Browse Source

Update the build workflow to select the latest Xcode version and allow building macOS/Mac Catalyst/iOS packages on macOS

pull/2122/head
Kévin Chalet 2 years ago
parent
commit
60eedd12bb
  1. 4
      .github/workflows/build.yml
  2. 34
      Directory.Build.props
  3. 3
      OpenIddict.sln
  4. 17
      eng/Build.props
  5. 6
      sandbox/OpenIddict.Sandbox.Maui.Client/OpenIddict.Sandbox.Maui.Client.csproj

4
.github/workflows/build.yml

@ -41,6 +41,10 @@ jobs:
os_name: windows
steps:
- name: Select Xcode version
if: ${{ runner.os == 'macOS' }}
run: sudo xcode-select -s "/Applications/Xcode_15.4.app"
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

34
Directory.Build.props

@ -38,39 +38,41 @@
built on machines that don't have the iOS workload installed, a directory check is used to
ensure the iOS reference assemblies pack is present on the machine before targeting iOS.
-->
<SupportsIOSPlatformTargeting
Condition=" '$(SupportsIOSPlatformTargeting)' == '' And $([System.OperatingSystem]::IsWindows()) And
<SupportsIOSTargeting
Condition=" '$(SupportsIOSTargeting)' == '' And
($([System.OperatingSystem]::IsMacOS()) Or $([System.OperatingSystem]::IsWindows())) And
('$(GITHUB_ACTIONS)' == 'true' Or ('$(DotNetRoot)' != '' And Exists('$(DotNetRoot)packs\Microsoft.iOS.Ref')) Or
('$(DOTNET_HOST_PATH)' != '' And Exists('$([System.IO.Path]::GetDirectoryName($(DOTNET_HOST_PATH)))\packs\Microsoft.iOS.Ref')) Or
('$(MSBuildRuntimeType)' != 'Core' And Exists('$(ProgramFiles)\dotnet\packs\Microsoft.iOS.Ref'))) ">true</SupportsIOSPlatformTargeting>
('$(MSBuildRuntimeType)' != 'Core' And Exists('$(ProgramFiles)\dotnet\packs\Microsoft.iOS.Ref'))) ">true</SupportsIOSTargeting>
<!--
Note: targeting Mac Catalyst requires installing the .NET Mac Catalyst workload. To ensure the solution
can be built on machines that don't have the Mac Catalyst workload installed, a directory check is used to
ensure the Mac Catalyst reference assemblies pack is present on the machine before targeting Mac Catalyst.
-->
<SupportsMacCatalystPlatformTargeting
Condition=" '$(SupportsMacCatalystPlatformTargeting)' == '' And $([System.OperatingSystem]::IsWindows()) And
<SupportsMacCatalystTargeting
Condition=" '$(SupportsMacCatalystTargeting)' == '' And
($([System.OperatingSystem]::IsMacOS()) Or $([System.OperatingSystem]::IsWindows())) And
('$(GITHUB_ACTIONS)' == 'true' Or ('$(DotNetRoot)' != '' And Exists('$(DotNetRoot)packs\Microsoft.MacCatalyst.Ref')) Or
('$(DOTNET_HOST_PATH)' != '' And Exists('$([System.IO.Path]::GetDirectoryName($(DOTNET_HOST_PATH)))\packs\Microsoft.MacCatalyst.Ref')) Or
('$(MSBuildRuntimeType)' != 'Core' And Exists('$(ProgramFiles)\dotnet\packs\Microsoft.MacCatalyst.Ref'))) ">true</SupportsMacCatalystPlatformTargeting>
('$(MSBuildRuntimeType)' != 'Core' And Exists('$(ProgramFiles)\dotnet\packs\Microsoft.MacCatalyst.Ref'))) ">true</SupportsMacCatalystTargeting>
<!--
Note: targeting macOS requires installing the .NET macOS workload. To ensure the solution can be
built on machines that don't have the macOS workload installed, a directory check is used to
ensure the macOS reference assemblies pack is present on the machine before targeting macOS.
-->
<SupportsMacOSPlatformTargeting
Condition=" '$(SupportsMacOSPlatformTargeting)' == '' And $([System.OperatingSystem]::IsWindows()) And
<SupportsMacOSTargeting
Condition=" '$(SupportsMacOSTargeting)' == '' And
($([System.OperatingSystem]::IsMacOS()) Or $([System.OperatingSystem]::IsWindows())) And
('$(GITHUB_ACTIONS)' == 'true' Or ('$(DotNetRoot)' != '' And Exists('$(DotNetRoot)packs\Microsoft.macOS.Ref')) Or
('$(DOTNET_HOST_PATH)' != '' And Exists('$([System.IO.Path]::GetDirectoryName($(DOTNET_HOST_PATH)))\packs\Microsoft.macOS.Ref')) Or
('$(MSBuildRuntimeType)' != 'Core' And Exists('$(ProgramFiles)\dotnet\packs\Microsoft.macOS.Ref'))) ">true</SupportsMacOSPlatformTargeting>
('$(MSBuildRuntimeType)' != 'Core' And Exists('$(ProgramFiles)\dotnet\packs\Microsoft.macOS.Ref'))) ">true</SupportsMacOSTargeting>
<!--
Note: while <EnableWindowsTargeting>true</EnableWindowsTargeting> can be used to allow targeting Windows,
Windows targets are only used when running on Windows to speed up the build on non-Windows platforms.
-->
<SupportsWindowsPlatformTargeting
Condition=" '$(SupportsWindowsPlatformTargeting)' == '' And $([System.OperatingSystem]::IsWindows()) ">true</SupportsWindowsPlatformTargeting>
<SupportsWindowsTargeting
Condition=" '$(SupportsWindowsTargeting)' == '' And $([System.OperatingSystem]::IsWindows()) ">true</SupportsWindowsTargeting>
<!--
Note: the .NET Core 5.0 reference assemblies or UWP contract assemblies may not be available if
@ -96,23 +98,23 @@
</NetCoreTargetFrameworks>
<NetCoreIOSTargetFrameworks
Condition=" '$(NetCoreIOSTargetFrameworks)' == '' And '$(SupportsIOSPlatformTargeting)' == 'true' ">
Condition=" '$(NetCoreIOSTargetFrameworks)' == '' And '$(SupportsIOSTargeting)' == 'true' ">
net8.0-ios12.0;
net8.0-ios13.0
</NetCoreIOSTargetFrameworks>
<NetCoreMacCatalystTargetFrameworks
Condition=" '$(NetCoreMacCatalystTargetFrameworks)' == '' And '$(SupportsMacCatalystPlatformTargeting)' == 'true' ">
Condition=" '$(NetCoreMacCatalystTargetFrameworks)' == '' And '$(SupportsMacCatalystTargeting)' == 'true' ">
net8.0-maccatalyst13.1
</NetCoreMacCatalystTargetFrameworks>
<NetCoreMacOSTargetFrameworks
Condition=" '$(NetCoreMacOSTargetFrameworks)' == '' And '$(SupportsMacOSPlatformTargeting)' == 'true' ">
Condition=" '$(NetCoreMacOSTargetFrameworks)' == '' And '$(SupportsMacOSTargeting)' == 'true' ">
net8.0-macos10.15
</NetCoreMacOSTargetFrameworks>
<NetCoreWindowsTargetFrameworks
Condition=" '$(NetCoreWindowsTargetFrameworks)' == '' And '$(SupportsWindowsPlatformTargeting)' == 'true' ">
Condition=" '$(NetCoreWindowsTargetFrameworks)' == '' And '$(SupportsWindowsTargeting)' == 'true' ">
net6.0-windows7.0;
net6.0-windows10.0.17763;
net7.0-windows7.0;

3
OpenIddict.sln

@ -60,6 +60,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "eng", "eng", "{6E8E862C-3F26-47D9-9C20-E3E87FD7CDFC}"
ProjectSection(SolutionItems) = preProject
eng\AfterTargetFrameworkInference.targets = eng\AfterTargetFrameworkInference.targets
eng\Build.props = eng\Build.props
eng\CodeAnalysis.ruleset = eng\CodeAnalysis.ruleset
eng\key.snk = eng\key.snk
eng\Signing.props = eng\Signing.props
@ -157,7 +158,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenIddict.Sandbox.WinForms
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenIddict.Sandbox.Console.Client", "sandbox\OpenIddict.Sandbox.Console.Client\OpenIddict.Sandbox.Console.Client.csproj", "{819CD7AA-01FD-4369-BABF-5DFCB7E94068}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenIddict.Sandbox.Maui.Client", "sandbox\OpenIddict.Sandbox.Maui.Client\OpenIddict.Sandbox.Maui.Client.csproj", "{CD5EE836-ED56-48E3-B3B6-8D74C7C859B9}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenIddict.Sandbox.Maui.Client", "sandbox\OpenIddict.Sandbox.Maui.Client\OpenIddict.Sandbox.Maui.Client.csproj", "{CD5EE836-ED56-48E3-B3B6-8D74C7C859B9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

17
eng/Build.props

@ -0,0 +1,17 @@
<Project>
<ItemGroup>
<ProjectToBuild Include="$(RepoRoot)sandbox\**\*.csproj" />
<ProjectToBuild Include="$(RepoRoot)src\**\*.csproj" />
<ProjectToBuild Include="$(RepoRoot)test\**\*.csproj" />
<!--
When using Xcode 15.4, the MAUI sample takes a very long time to build (more than 40 minutes in
most cases) due to the trimming process. To ensure the CI build completes within a reasonable
time frame, the sandbox projects are excluded on when running on macOS.
-->
<ProjectToBuild Remove="$(RepoRoot)sandbox\**\*.csproj"
Condition=" '$(GITHUB_ACTIONS)' == 'true' And $([System.OperatingSystem]::IsMacOS()) " />
</ItemGroup>
</Project>

6
sandbox/OpenIddict.Sandbox.Maui.Client/OpenIddict.Sandbox.Maui.Client.csproj

@ -2,9 +2,9 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks Condition=" '$(SupportsWindowsPlatformTargeting)' == 'true' ">net8.0-windows10.0.19041</TargetFrameworks>
<TargetFrameworks Condition=" '$(SupportsIOSPlatformTargeting)' == 'true' ">$(TargetFrameworks);net8.0-ios17.2</TargetFrameworks>
<TargetFrameworks Condition=" '$(SupportsMacCatalystPlatformTargeting)' == 'true' ">$(TargetFrameworks);net8.0-maccatalyst17.2</TargetFrameworks>
<TargetFrameworks Condition=" '$(SupportsWindowsTargeting)' == 'true' ">net8.0-windows10.0.19041</TargetFrameworks>
<TargetFrameworks Condition=" '$(SupportsIOSTargeting)' == 'true' ">$(TargetFrameworks);net8.0-ios17.2</TargetFrameworks>
<TargetFrameworks Condition=" '$(SupportsMacCatalystTargeting)' == 'true' ">$(TargetFrameworks);net8.0-maccatalyst17.2</TargetFrameworks>
<UseMaui Condition=" '$(TargetFrameworks)' != '' ">true</UseMaui>
<TargetFrameworks Condition=" '$(TargetFrameworks)' == '' ">net8.0</TargetFrameworks>
<SingleProject>true</SingleProject>

Loading…
Cancel
Save