Skip to content

Commit

Permalink
Build workflow: switch to dotnet and publish as self contained (#429)
Browse files Browse the repository at this point in the history
  • Loading branch information
fauxpark committed Oct 15, 2023
1 parent 0b84160 commit 8171da0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@ jobs:
runs-on: windows-latest

steps:
- uses: microsoft/setup-msbuild@v1.3

- uses: nuget/setup-nuget@v1
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.x'

- uses: actions/checkout@v4

- name: Build
working-directory: ./windows
run: |
nuget restore
msbuild "QMK Toolbox.sln" /verbosity:minimal /p:Configuration=Release
dotnet publish -c Release -r win-x64 --self-contained true
- name: Create installer
working-directory: ./windows
Expand All @@ -35,7 +34,7 @@ jobs:
- uses: actions/upload-artifact@v3
with:
name: qmk_toolbox.exe
path: windows/QMK Toolbox/bin/Release/qmk_toolbox.exe
path: windows/QMK Toolbox/bin/Release/win-x64/publish/qmk_toolbox.exe

- uses: actions/upload-artifact@v3
with:
Expand Down
16 changes: 13 additions & 3 deletions windows/QMK Toolbox/HidConsole/HidConsoleDevice.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using HidLibrary;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QMK_Toolbox.HidConsole
{
Expand Down Expand Up @@ -33,8 +34,7 @@ public HidConsoleDevice(IHidDevice device)
ProductId = (ushort)HidDevice.Attributes.ProductId;
RevisionBcd = (ushort)HidDevice.Attributes.Version;

HidDevice.MonitorDeviceEvents = true;
HidDevice.ReadReport(HidDeviceReportEvent);
RegisterReportTask();

HidDevice.CloseDevice();
}
Expand All @@ -44,6 +44,16 @@ public override string ToString()
return $"{ManufacturerString} {ProductString} ({VendorId:X4}:{ProductId:X4}:{RevisionBcd:X4})";
}

private void RegisterReportTask()
{
Task.Run(async () => await ReadReportAsync()).ContinueWith(t => HidDeviceReportEvent(t.Result));
}

private async Task<HidReport> ReadReportAsync()
{
return await Task.Run(() => HidDevice.ReadReport());
}

private string currentLine = "";

private void HidDeviceReportEvent(HidReport report)
Expand Down Expand Up @@ -71,7 +81,7 @@ private void HidDeviceReportEvent(HidReport report)
}

// Reregister this callback
HidDevice.ReadReport(HidDeviceReportEvent);
RegisterReportTask();
}
}

Expand Down
1 change: 1 addition & 0 deletions windows/QMK Toolbox/QMK Toolbox.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<PublishSingleFile>true</PublishSingleFile>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Resources\output.ico</ApplicationIcon>
Expand Down
2 changes: 1 addition & 1 deletion windows/install_compiler.iss
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"

[Files]
Source: "QMK Toolbox\bin\Release\qmk_toolbox.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "QMK Toolbox\bin\Release\win-x64\publish\qmk_toolbox.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Expand Down

0 comments on commit 8171da0

Please sign in to comment.