Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build workflow: switch to dotnet and publish as self contained #429

Merged
merged 3 commits into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-[email protected]

- 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