Skip to content

Commit 3781961

Browse files
committed
chore(demo): conditionally add iOS target on macOS only
1 parent 3d3e9e8 commit 3781961

3 files changed

Lines changed: 33 additions & 4 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ jobs:
4545
with:
4646
dotnet-version: '10.0.x'
4747

48+
# Only maui-android is installable on Linux; maui-ios fails with
49+
# "Workload ID maui-ios isn't supported on this platform". The iOS TFM
50+
# is gated on macOS in OneSignalSDK.DotNet.csproj and demo.csproj, so
51+
# restore won't try to walk it here.
4852
- name: Install MAUI Android workload
4953
run: dotnet workload install maui-android
5054

@@ -103,8 +107,13 @@ jobs:
103107
with:
104108
dotnet-version: '10.0.x'
105109

106-
- name: Install MAUI iOS workload
107-
run: dotnet workload install maui-ios
110+
# Both workloads are required even though only the iOS TFM is built,
111+
# because NuGet restore walks every declared TargetFramework of the
112+
# multi-targeted OneSignalSDK.DotNet.csproj, and its android TFM
113+
# follows references into the android-only OneSignalSDK.DotNet.Android*
114+
# projects which need the android workload.
115+
- name: Install MAUI workloads
116+
run: dotnet workload install maui-android maui-ios
108117

109118
- name: Create demo .env
110119
working-directory: examples/demo

OneSignalSDK.DotNet/OneSignalSDK.DotNet.csproj

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net10.0;net10.0-android;net10.0-ios;netstandard2.0</TargetFrameworks>
3+
<!--
4+
iOS TFM only on macOS hosts. NuGet restore walks every declared
5+
TargetFramework of every transitively referenced project, and the iOS
6+
TFM pulls in OneSignalSDK.DotNet.iOS{,.Binding}.csproj which require
7+
the iOS workload. The iOS workload (`maui-ios`) cannot be installed on
8+
Linux ("Workload ID maui-ios isn't supported on this platform"), so
9+
consumers on Linux/Windows that only build the android TFM would
10+
otherwise fail at restore with NETSDK1178 looking for Microsoft.iOS.Sdk.
11+
NuGet packing for release runs on macOS, so the published package still
12+
ships all four TFMs.
13+
-->
14+
<TargetFrameworks>net10.0;net10.0-android;netstandard2.0</TargetFrameworks>
15+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net10.0-ios</TargetFrameworks>
416
<ImplicitUsings>enable</ImplicitUsings>
517
<Nullable>enable</Nullable>
618
<LangVersion>10.0</LangVersion>

examples/demo/demo.csproj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net10.0-android;net10.0-ios</TargetFrameworks>
3+
<!--
4+
iOS targets only on macOS hosts. Linux/Windows CI runners (e.g. the
5+
Android build job) don't have the iOS workload installed, and NuGet
6+
restore evaluates every declared TargetFramework, which would otherwise
7+
pull in NotificationServiceExtension.csproj (net10.0-ios) and fail with
8+
NETSDK1178 looking for Microsoft.iOS.Sdk.
9+
-->
10+
<TargetFrameworks>net10.0-android</TargetFrameworks>
11+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('OSX'))">$(TargetFrameworks);net10.0-ios</TargetFrameworks>
412
<OutputType>Exe</OutputType>
513
<RootNamespace>OneSignalDemo</RootNamespace>
614
<UseMaui>true</UseMaui>

0 commit comments

Comments
 (0)