Skip to content

Commit 8960337

Browse files
committed
Only windows can build all
1 parent 76445ba commit 8960337

File tree

10 files changed

+24
-40
lines changed

10 files changed

+24
-40
lines changed

.github/workflows/Build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ name: Build
33
on: [push, pull_request]
44
jobs:
55
Everything:
6-
runs-on: windows-latest
6+
runs-on: [windows-latest, ubuntu-latest, macos-latest]
77
steps:
88
- uses: actions/checkout@v6
99
with:
1010
submodules: 'recursive'
1111
- name: Setup .NET
1212
uses: actions/setup-dotnet@v5
1313
with:
14-
dotnet-version: '10.0.x'
14+
dotnet-version: '10.x'
1515
- name: .NET Workload restore
1616
run: dotnet workload restore
1717
- name: Restore NuGet Packages

.github/workflows/Release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@ jobs:
2222
${{ github.event.release.body }}
2323
run: |
2424
# .NET Core MSBuild cannot parse , and ; correctly so we replace them with substitutions: https://github.com/dotnet/msbuild/issues/471#issuecomment-366268743
25-
# https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameter-Expansion
26-
# ${parameter/pattern/string} If pattern begins with ‘/’, all matches of pattern are replaced with string. Normally only the first match is replaced.
27-
RELEASE_NOTES=${RELEASE_NOTES//,/%2C}
28-
RELEASE_NOTES=${RELEASE_NOTES//;/%3B}
25+
# PowerShell string replacement
26+
$env:RELEASE_NOTES = $env:RELEASE_NOTES -replace ',','%2C' -replace ';','%3B'
2927
3028
dotnet workload restore
3129
# -r for restore
32-
dotnet msbuild -r -p:Configuration=Release -p:PackageVersion="${{ github.event.release.tag_name }}" -p:PackageReleaseNotes="$RELEASE_NOTES" CSharpMath.sln
30+
dotnet msbuild -r -p:Configuration=Release -p:PackageVersion="${{ github.event.release.tag_name }}" -p:PackageReleaseNotes="$env:RELEASE_NOTES" CSharpMath.sln
31+
shell: pwsh
3332
- name: Upload to GitHub Releases
3433
uses: svenstaro/upload-release-action@v2
3534
with:
@@ -42,3 +41,4 @@ jobs:
4241
run: | # We use double quotes to avoid shell globbing: https://github.com/NuGet/Home/issues/4393#issuecomment-667618120
4342
# Use --skip-duplicate since we want re-runs of this workflow to succeed in case of network issues
4443
dotnet nuget push ".nupkgs/*.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
44+
shell: pwsh

CSharpMath.Maui.Example/CSharpMath.Maui.Example.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net10.0-android;net10.0-ios;net10.0-maccatalyst</TargetFrameworks>
4+
<TargetFrameworks>net10.0;net10.0-android</TargetFrameworks>
5+
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('linux'))">$(TargetFrameworks);net10.0-ios;net10.0-maccatalyst</TargetFrameworks>
56
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net10.0-windows10.0.19041.0</TargetFrameworks>
67

78
<!-- Note for MacCatalyst:
@@ -64,7 +65,7 @@
6465
<ItemGroup>
6566
<PackageReference Include="Microsoft.Maui.Controls" Version="10.0.20" />
6667
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.0" />
67-
<PackageReference Include="SharpHook" Version="7.1.1" />
68+
<PackageReference Include="SharpHook" Version="7.1.1" Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'ios' AND $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'android'" />
6869
<PackageReference Include="CommunityToolkit.Maui" Version="13.0.0" />
6970
<ProjectReference Include="..\CSharpMath.Maui\CSharpMath.Maui.csproj" />
7071
<ProjectReference Include="..\CSharpMath.Evaluation\CSharpMath.Evaluation.csproj" />

CSharpMath.Maui.Example/EditorPage.xaml.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ public EditorView() {
2424
var viewModel = keyboard.Keyboard;
2525
viewModel.BindDisplay(OutputGraphicsView, OutputMathPainter, new Color(0, 0, 0, 153));
2626

27-
// Input from physical keyboard
28-
var hook = new SimpleGlobalHook(GlobalHookType.Keyboard);
27+
// Input from physical keyboard (doesn't work on mobile because SharpHook depends on libuiohook which only works on desktop)
28+
#if !IOS && !ANDROID
2929
var popupShown = false;
30+
var hook = new SimpleGlobalHook(GlobalHookType.Keyboard);
3031
void activatedListener(object? sender, EventArgs e) { if (!hook.IsRunning && IsLoaded && !popupShown) hook.RunAsync(); }
3132
void deactivatedListener(object? sender, EventArgs e) { if (hook.IsRunning) hook.Stop(); }
3233
Window? owningWindow = null;
@@ -54,13 +55,16 @@ void unloadedListener(object? sender, EventArgs e) {
5455
case KeyCode.VcDown: viewModel.KeyPress(Editor.MathKeyboardInput.Down); break;
5556
}
5657
};
58+
#endif
5759

5860
// Evaluation
5961
keyboard.Keyboard.ReturnPressed += delegate {
6062
Dispatcher.Dispatch(async () => { // We may not be on the main thread since SharpHook event handlers are called from its own threads.
6163
if (Parent is Page p) {
64+
#if !IOS && !ANDROID
6265
popupShown = true;
6366
if (hook.IsRunning) hook.Stop();
67+
#endif
6468
var view = new MathView { FontSize = 32, EnablePanning = true, TextAlignment = Rendering.FrontEnd.TextAlignment.TopLeft,
6569
LaTeX = Evaluation.Interpret(keyboard.Keyboard.MathList)
6670
};
@@ -71,8 +75,10 @@ await p.ShowPopupAsync(new VerticalStackLayout {
7175
GridItem(0, 0, new Button { Text = "Reset pan", Command = new Command(() => view.DisplacementX = view.DisplacementY = 0) }),
7276
GridItem(0, 1, new Button { Text = "Close", Command = new Command(() => p.ClosePopupAsync()) }) }
7377
}, view });
78+
#if !IOS && !ANDROID
7479
popupShown = false;
7580
if (IsLoaded && owningWindow is { IsActivated: true } && !hook.IsRunning) await hook.RunAsync();
81+
#endif
7682
}
7783
});
7884
};

CSharpMath.Maui/CSharpMath.Maui.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net10.0;net10.0-android;net10.0-ios;net10.0-maccatalyst</TargetFrameworks>
4+
<TargetFrameworks>net10.0;net10.0-android</TargetFrameworks>
5+
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('linux'))">$(TargetFrameworks);net10.0-ios;net10.0-maccatalyst</TargetFrameworks>
56
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net10.0-windows10.0.19041.0</TargetFrameworks>
67

78
<UseMaui>true</UseMaui>

CSharpMath.Playground/AlgorithmsTest/ExecutionEngineException.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

CSharpMath.Playground/CSharpMath.Playground.csproj

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
<!-- Suppress nullable reference type warnings from Typography submodule -->
88
<NoWarn>$(NoWarn);CS8618;CS8603;CS8625;CS8600;CS8601;CS8602;CS8604</NoWarn>
99
</PropertyGroup>
10-
11-
<Import Project="..\Typography\Typography.OpenFont\Typography.OpenFont.projitems" Label="Shared" />
12-
<Import Project="..\Typography\Typography.GlyphLayout\Typography.GlyphLayout.projitems" Label="Shared" />
13-
<Import Project="..\Typography\Typography.TextBreak\Typography.TextBreak\Typography.TextBreak.projitems" Label="Shared" />
1410
<ItemGroup>
15-
<Compile Include="..\CSharpMath.Rendering\_IgnoreTypographyWarnings.cs" Link="_IgnoreTypographyWarnings.cs" />
11+
<ProjectReference Include="..\CSharpMath.SkiaSharp\CSharpMath.SkiaSharp.csproj" />
1612
</ItemGroup>
1713
</Project>

CSharpMath.Playground/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using CSharpMath.SkiaSharp;
23

34
namespace CSharpMath.Playground {
45
class Program {

CSharpMath.Rendering.Tests/TestRendering_SkiaSharp.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class TestRendering_SkiaSharp : TestRendering<SKCanvas, SKColor, MathPain
1010
protected override double FileSizeTolerance => 0; // SkiaSharp is the baseline, no deviations allowed
1111
protected override void DrawToStream<TContent>(Painter<SKCanvas, TContent, SKColor> painter,
1212
System.IO.Stream stream, float textPainterCanvasWidth, TextAlignment alignment) =>
13-
painter.DrawAsStream(textPainterCanvasWidth, alignment)?.CopyTo(stream);
13+
painter.DrawAsStream(textPainterCanvasWidth, alignmentForTests: alignment)?.CopyTo(stream);
1414
public static TheoryData<string, MathPainter> MathPainterSettingsDataExtra =>
1515
new TheoryData<string, MathPainter> {
1616
{ "NoAntiAlias", new MathPainter { AntiAlias = false } }

CSharpMath.Rendering/_IgnoreTypographyWarnings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@
2424
static class IgnoreTypographyWarnings {
2525
public const string Justification = "These messages are from the Typography library. Its code is not very clean.";
2626
public const string Scope = "namespaceanddescendants";
27-
public const string _Typography = nameof(Typography);
27+
public const string _Typography = "~N:Typography";
2828
}

0 commit comments

Comments
 (0)