Skip to content

Commit

Permalink
refa (Laerdal.McuMgr.csproj): we now set the dotnet property <TargetP…
Browse files Browse the repository at this point in the history
…latformVersion> separately from the target sdk that was used to build each binding project

   For iOS and MacCatalyst we use TargetPlatformVersion=17.0 because this is what the macos-14 vm-image of our CI pipelines actually support

   (if we use values less than 17.0 we get a warning which says that in the future this will be considered an error)
  • Loading branch information
ksidirop-laerdal committed Oct 2, 2024
1 parent d89717a commit 0d079d0
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 28 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ env:
SCL_DEPENDENCY_TRACKER_SERVER_URL: ${{ secrets.SCL_DEPENDENCY_TRACKER_SERVER_URL }}
SCL_DEPENDENCY_TRACKER_SIGNING_PRIVATE_KEY: ${{ secrets.SCL_DEPENDENCY_TRACKER_SIGNING_PRIVATE_KEY }}

BINDINGS_ANDROID___DOTNET_TARGET_PLATFORM_VERSION: "34"

BINDINGS_IOS___SDK_VERSION: "17.5"
BINDINGS_IOS___XCODE_IDE_DEV_PATH: "/Applications/Xcode_15.4.app/Contents/Developer"

BINDINGS_ANDROID___SDK_VERSION: "34"
BINDINGS_IOS___DOTNET_TARGET_PLATFORM_VERSION: "17.0"

BINDINGS_MACCATALYST___SDK_VERSION: "14.5"
BINDINGS_MACCATALYST___XCODE_IDE_DEV_PATH: "/Applications/Xcode_15.4.app/Contents/Developer"
BINDINGS_MACCATALYST___DOTNET_TARGET_PLATFORM_VERSION: "17.0"

on:
workflow_call: # so that other workflows can trigger this
Expand Down Expand Up @@ -94,15 +96,15 @@ jobs:
-p:Laerdal_Github_Access_Token="${{env.SCL_GITHUB_ACCESS_TOKEN}}" \
-p:Laerdal_Test_Results_Folderpath="${{env.BUILD_REPOSITORY_FOLDERPATH}}/TestResults" \
\
-p:Laerdal_TargetPlatformVersion_IOS="${{env.BINDINGS_IOS___SDK_VERSION}}" \
-p:Laerdal_TargetPlatformVersion_Android="${{env.BINDINGS_ANDROID___SDK_VERSION}}" \
-p:Laerdal_TargetPlatformVersion_MacCatalyst="${{env.BINDINGS_MACCATALYST___SDK_VERSION}}" \
-p:Laerdal_Bindings_Android___DotnetTargetPlatformVersion="${{env.BINDINGS_ANDROID___DOTNET_TARGET_PLATFORM_VERSION}}" \
\
-p:Laerdal_Bindings_iOS___Sdk_Version="${{env.BINDINGS_IOS___SDK_VERSION}}" \
-p:Laerdal_Bindings_iOS___Xcode_Ide_Dev_Path="${{env.BINDINGS_IOS___XCODE_IDE_DEV_PATH}}" \
-p:Laerdal_Bindings_iOS___DotnetTargetPlatformVersion="${{env.BINDINGS_IOS___DOTNET_TARGET_PLATFORM_VERSION}}" \
\
-p:Laerdal_Bindings_MacCatalyst___Sdk_Version="${{env.BINDINGS_MACCATALYST___SDK_VERSION}}" \
-p:Laerdal_Bindings_MacCatalyst___Xcode_Ide_Dev_Path="${{env.BINDINGS_MACCATALYST___XCODE_IDE_DEV_PATH}}" \
-p:Laerdal_Bindings_MacCatalyst___DotnetTargetPlatformVersion="${{env.BINDINGS_MACCATALYST___DOTNET_TARGET_PLATFORM_VERSION}}" \
\
-p:Laerdal_Dependency_Tracker_Server_Url="${{env.SCL_DEPENDENCY_TRACKER_SERVER_URL}}" \
-p:Laerdal_Dependency_Tracker_Api_Key_File_Path="${{env.BUILD_REPOSITORY_FOLDERPATH}}/Laerdal.Scripts/dependency_tracker_api_key.ppk" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<ShouldBuildNativeLibraries Condition=" '$(IsNetX)' == 'true' ">true</ShouldBuildNativeLibraries>

<!-- net8 supports android13 and it corresponds to android-api level 34.0 -->
<TargetPlatformVersion Condition=" '$(IsNetX)' == 'true' and '$(TargetPlatformVersion)' == '' ">34.0</TargetPlatformVersion>
<TargetPlatformVersion Condition=" '$(IsNetX)' == 'true' and '$(TargetPlatformVersion)' == '' ">34</TargetPlatformVersion>
<SupportedOSPlatformVersion Condition=" '$(IsNetX)' == 'true' ">21</SupportedOSPlatformVersion>

<DebugType>pdbonly</DebugType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<ShouldBuildNativeLibraries Condition=" '$(IsNetXMacCatalyst)' == 'true' ">true</ShouldBuildNativeLibraries>

<!-- this should must be kept in sync between this file and laerdal.mcumgr.csproj -->
<TargetPlatformVersion Condition=" '$(IsNetXMacCatalyst)' == 'true' and '$(TargetPlatformVersion)' == '' ">14.5</TargetPlatformVersion>
<TargetPlatformVersion Condition=" '$(IsNetXMacCatalyst)' == 'true' and '$(TargetPlatformVersion)' == '' ">17.0</TargetPlatformVersion>
<SupportedOSPlatformVersion Condition=" '$(IsNetXMacCatalyst)' == 'true' ">13.1</SupportedOSPlatformVersion>

<OutputPath>bin\</OutputPath>
Expand All @@ -38,7 +38,7 @@
<NativeFrameworkActualTargetFolderpath>$(NativeFrameworkParentFolderpath)/McuMgrBindingsiOS.framework</NativeFrameworkActualTargetFolderpath>

<!-- set these explicitly here only for experimentation as far as cicd is concerned these values should be set in the .yml file of the pipeline -->
<!-- <Laerdal_Bindings_MacCatalyst___Sdk_Version Condition=" '$(Laerdal_Bindings_MacCatalyst___Sdk_Version)' == '' ">14.5</Laerdal_Bindings_MacCatalyst___Sdk_Version> -->
<!-- <Laerdal_Bindings_MacCatalyst___Sdk_Version Condition=" '$(Laerdal_Bindings_MacCatalyst___Sdk_Version)' == '' ">17.0</Laerdal_Bindings_MacCatalyst___Sdk_Version> -->
<!-- <Laerdal_Bindings_MacCatalyst___Xcode_Ide_Dev_Path Condition=" '$(Laerdal_Bindings_MacCatalyst___Xcode_Ide_Dev_Path)' == '' ">/Applications/Xcode_15.4.app/Contents/Developer</Laerdal_Bindings_MacCatalyst___Xcode_Ide_Dev_Path> -->
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
<ShouldBuildNativeLibraries Condition=" '$(IsNetXIos)' == 'true' ">true</ShouldBuildNativeLibraries>

<!-- this should must be kept in sync between this file and laerdal.mcumgr.csproj -->
<TargetPlatformVersion Condition=" '$(IsNetXIos)' == 'true' and '$(TargetPlatformVersion)' == '' ">17.5</TargetPlatformVersion>
<SupportedOSPlatformVersion Condition=" '$(IsNetXIos)' == 'true' ">11</SupportedOSPlatformVersion>
<TargetPlatformVersion Condition=" '$(IsNetXIos)' == 'true' and '$(TargetPlatformVersion)' == '' ">17.0</TargetPlatformVersion>
<SupportedOSPlatformVersion Condition=" '$(IsNetXIos)' == 'true' ">11.0</SupportedOSPlatformVersion>

<OutputPath>bin\</OutputPath>
<OutputType>Library</OutputType>
Expand All @@ -38,7 +38,7 @@
<NativeFrameworkActualTargetFolderpath>$(NativeFrameworkParentFolderpath)/McuMgrBindingsiOS.framework</NativeFrameworkActualTargetFolderpath>

<!-- set these explicitly here only for experimentation as far as cicd is concerned these values should be set in the .yml file of the pipeline -->
<!-- <Laerdal_Bindings_iOS___Sdk_Version Condition=" '$(Laerdal_Bindings_iOS___Sdk_Version)' == '' ">17.5</Laerdal_Bindings_iOS___Sdk_Version> -->
<!-- <Laerdal_Bindings_iOS___Sdk_Version Condition=" '$(Laerdal_Bindings_iOS___Sdk_Version)' == '' ">17.0</Laerdal_Bindings_iOS___Sdk_Version> -->
<!-- <Laerdal_Bindings_iOS___Xcode_Ide_Dev_Path Condition=" '$(Laerdal_Bindings_iOS___Xcode_Ide_Dev_Path)' == '' ">/Applications/Xcode_15.4.app/Contents/Developer/</Laerdal_Bindings_iOS___Xcode_Ide_Dev_Path> -->
</PropertyGroup>

Expand Down
14 changes: 7 additions & 7 deletions Laerdal.McuMgr/Laerdal.McuMgr.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@

<!-- #1 these properties must be kept in sync between this file and laerdal.mcumgr.bindings.[android|ios|maccatalyst].csproj -->
<!-- #2 even though this is library is pure csharp we still have to specify the target-plaform-version for each target because if we dont dont the build system throws a tantrum from oct 2024 onwards -->
<TargetPlatformVersion Condition=" '$(IsIOS)' == 'true' and '$(Laerdal_TargetPlatformVersion_IOS)' != '' ">$(Laerdal_TargetPlatformVersion_IOS)</TargetPlatformVersion>
<TargetPlatformVersion Condition=" '$(IsIOS)' == 'true' and '$(TargetPlatformVersion)' == '' ">17.5</TargetPlatformVersion>
<TargetPlatformVersion Condition=" '$(IsAndroid)' == 'true' and '$(Laerdal_TargetPlatformVersion_Android)' != '' ">$(Laerdal_TargetPlatformVersion_Android)</TargetPlatformVersion>
<TargetPlatformVersion Condition=" '$(IsAndroid)' == 'true' and '$(TargetPlatformVersion)' == '' ">34.0</TargetPlatformVersion>
<TargetPlatformVersion Condition=" '$(IsMacCatalyst)' == 'true' and '$(Laerdal_TargetPlatformVersion_MacCatalyst)' != '' ">$(Laerdal_TargetPlatformVersion_MacCatalyst)</TargetPlatformVersion>
<TargetPlatformVersion Condition=" '$(IsMacCatalyst)' == 'true' and '$(TargetPlatformVersion)' == '' ">14.5</TargetPlatformVersion>
<TargetPlatformVersion Condition=" '$(IsIOS)' == 'true' and '$(Laerdal_Bindings_iOS___DotnetTargetPlatformVersion)' != '' ">$(Laerdal_Bindings_iOS___DotnetTargetPlatformVersion)</TargetPlatformVersion>
<TargetPlatformVersion Condition=" '$(IsIOS)' == 'true' and '$(TargetPlatformVersion)' == '' ">17.0</TargetPlatformVersion>
<TargetPlatformVersion Condition=" '$(IsAndroid)' == 'true' and '$(Laerdal_Bindings_Android___DotnetTargetPlatformVersion)' != '' ">$(Laerdal_Bindings_Android___DotnetTargetPlatformVersion)</TargetPlatformVersion>
<TargetPlatformVersion Condition=" '$(IsAndroid)' == 'true' and '$(TargetPlatformVersion)' == '' ">34</TargetPlatformVersion>
<TargetPlatformVersion Condition=" '$(IsMacCatalyst)' == 'true' and '$(Laerdal_Bindings_MacCatalyst___DotnetTargetPlatformVersion)' != '' ">$(Laerdal_Bindings_MacCatalyst___DotnetTargetPlatformVersion)</TargetPlatformVersion>
<TargetPlatformVersion Condition=" '$(IsMacCatalyst)' == 'true' and '$(TargetPlatformVersion)' == '' ">17.0</TargetPlatformVersion>
<!-- minimum ios/android/maccatalyst os versions that we support -->
<SupportedOSPlatformVersion Condition=" '$(IsIOS)' == 'true' ">11</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition=" '$(IsIOS)' == 'true' ">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition=" '$(IsAndroid)' == 'true' ">21</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition=" '$(IsMacCatalyst)' == 'true' ">13.1</SupportedOSPlatformVersion>

Expand Down
22 changes: 12 additions & 10 deletions Laerdal.Scripts/Laerdal.Builder.targets
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@
<Message Importance="High" Text="** Laerdal_Source_Branch = '$(Laerdal_Source_Branch)'"/>
<Message Importance="High" Text="** Laerdal_Repository_Path = '$(Laerdal_Repository_Path)'"/>

<Message Importance="High" Text="** Laerdal_TargetPlatformVersion_IOS = '$(Laerdal_TargetPlatformVersion_IOS)'"/>
<Message Importance="High" Text="** Laerdal_TargetPlatformVersion_Android = '$(Laerdal_TargetPlatformVersion_Android)'"/>
<Message Importance="High" Text="** Laerdal_TargetPlatformVersion_MacCatalyst = '$(Laerdal_TargetPlatformVersion_MacCatalyst)'"/>
<Message Importance="High" Text="** Laerdal_Bindings_iOS___DotnetTargetPlatformVersion = '$(Laerdal_Bindings_iOS___DotnetTargetPlatformVersion)'"/>
<Message Importance="High" Text="** Laerdal_Bindings_Android___DotnetTargetPlatformVersion = '$(Laerdal_Bindings_Android___DotnetTargetPlatformVersion)'"/>
<Message Importance="High" Text="** Laerdal_Bindings_MacCatalyst___DotnetTargetPlatformVersion = '$(Laerdal_Bindings_MacCatalyst___DotnetTargetPlatformVersion)'"/>

<!-- <Message Importance="High" Text="** Laerdal_Github_Access_Token ='$(Laerdal_Github_Access_Token)'"/> dont -->
</Target>
Expand Down Expand Up @@ -237,24 +237,24 @@
<MSBuild Projects="$(Laerdal_McuMgrBindings_ProjectFile_Android)" Properties="$(_Laerdal_Build_Parameters)" Targets="Restore"/>
<MSBuild Projects="$(Laerdal_McuMgrBindings_ProjectFile_Android)" Properties="$(_Laerdal_Build_Parameters);BuildingProject=true;" Targets="TackleJarDependencies"/>
<MSBuild Projects="$(Laerdal_McuMgrBindings_ProjectFile_Android)"
Properties="$(_Laerdal_Build_Parameters);TargetPlatformVersion=$(Laerdal_TargetPlatformVersion_Android);BuildingProject=true;SourceRoot=$(Laerdal_RootDirectory_Folderpath)/Laerdal.McuMgr.Bindings.Android/;" Targets="Build"/>
Properties="$(_Laerdal_Build_Parameters);TargetPlatformVersion=$(Laerdal_Bindings_Android___DotnetTargetPlatformVersion);BuildingProject=true;SourceRoot=$(Laerdal_RootDirectory_Folderpath)/Laerdal.McuMgr.Bindings.Android/;" Targets="Build"/>

<!-- its absolute vital to call this targets first explicitly and separately from the main build otherwise the -->
<!-- resulting nugets will be poisoned and will not work in maui apps at all due to missing native symbols -->
<MSBuild Projects="$(Laerdal_McuMgrBindings_ProjectFile_iOS)" Targets="EnsureFrameworkFolderIsCreated"/>
<MSBuild Projects="$(Laerdal_McuMgrBindings_ProjectFile_iOS)"
Properties="$(_Laerdal_Build_Parameters);TargetPlatformVersion=$(Laerdal_TargetPlatformVersion_IOS);Laerdal_Bindings_iOS___Xcode_Ide_Dev_Path=$(Laerdal_Bindings_iOS___Xcode_Ide_Dev_Path);Laerdal_Bindings_iOS___Sdk_Version=$(Laerdal_Bindings_iOS___Sdk_Version);SourceRoot=$(Laerdal_RootDirectory_Folderpath)/Laerdal.McuMgr.Bindings.iOS/;" Targets="Restore;Rebuild"/>
Properties="$(_Laerdal_Build_Parameters);TargetPlatformVersion=$(Laerdal_Bindings_iOS___DotnetTargetPlatformVersion);Laerdal_Bindings_iOS___Xcode_Ide_Dev_Path=$(Laerdal_Bindings_iOS___Xcode_Ide_Dev_Path);Laerdal_Bindings_iOS___Sdk_Version=$(Laerdal_Bindings_iOS___Sdk_Version);SourceRoot=$(Laerdal_RootDirectory_Folderpath)/Laerdal.McuMgr.Bindings.iOS/;" Targets="Restore;Rebuild"/>

<!-- its absolute vital to call this targets first explicitly and separately from the main build otherwise the -->
<!-- resulting nugets will be poisoned and will not work in maui apps at all due to missing native symbols -->
<MSBuild Projects="$(Laerdal_McuMgrBindings_ProjectFile_MacCatalyst)" Targets="EnsureFrameworkFolderIsCreated" Condition=" '$(Should_Skip_MacCatalyst)' != 'true' "/>
<MSBuild Targets="Restore;Rebuild" Condition=" '$(Should_Skip_MacCatalyst)' != 'true' "
Projects="$(Laerdal_McuMgrBindings_ProjectFile_MacCatalyst)"
Properties="$(_Laerdal_Build_Parameters);TargetPlatformVersion=$(Laerdal_TargetPlatformVersion_MacCatalyst);Laerdal_Bindings_MacCatalyst___Xcode_Ide_Dev_Path=$(Laerdal_Bindings_MacCatalyst___Xcode_Ide_Dev_Path);Laerdal_Bindings_MacCatalyst___Sdk_Version=$(Laerdal_Bindings_MacCatalyst___Sdk_Version);SourceRoot=$(Laerdal_RootDirectory_Folderpath)/Laerdal.McuMgr.Bindings.MacCatalyst/;" />
Properties="$(_Laerdal_Build_Parameters);TargetPlatformVersion=$(Laerdal_Bindings_MacCatalyst___DotnetTargetPlatformVersion);Laerdal_Bindings_MacCatalyst___Xcode_Ide_Dev_Path=$(Laerdal_Bindings_MacCatalyst___Xcode_Ide_Dev_Path);Laerdal_Bindings_MacCatalyst___Sdk_Version=$(Laerdal_Bindings_MacCatalyst___Sdk_Version);SourceRoot=$(Laerdal_RootDirectory_Folderpath)/Laerdal.McuMgr.Bindings.MacCatalyst/;" />

<!-- notice that we are actually rebuilding mcumgr merely building the project doesnt really cut it -->
<MSBuild Projects="$(Laerdal_McuMgr_ProjectFile)"
Properties="$(_Laerdal_Build_Parameters);Laerdal_TargetPlatformVersion_Android=$(Laerdal_TargetPlatformVersion_Android);Laerdal_TargetPlatformVersion_IOS=$(Laerdal_TargetPlatformVersion_IOS);Laerdal_TargetPlatformVersion_MacCatalyst=$(Laerdal_TargetPlatformVersion_MacCatalyst);SourceRoot=$(Laerdal_RootDirectory_Folderpath)/Laerdal.McuMgr/;" Targets="Restore;Rebuild"/>
Properties="$(_Laerdal_Build_Parameters);Laerdal_Bindings_Android___DotnetTargetPlatformVersion=$(Laerdal_Bindings_Android___DotnetTargetPlatformVersion);Laerdal_Bindings_iOS___DotnetTargetPlatformVersion=$(Laerdal_Bindings_iOS___DotnetTargetPlatformVersion);Laerdal_Bindings_MacCatalyst___DotnetTargetPlatformVersion=$(Laerdal_Bindings_MacCatalyst___DotnetTargetPlatformVersion);SourceRoot=$(Laerdal_RootDirectory_Folderpath)/Laerdal.McuMgr/;" Targets="Restore;Rebuild"/>
</Target>

<!-- TESTS -->
Expand All @@ -264,16 +264,18 @@

<MSBuild Targets="Restore"
Projects="$(Laerdal_McuMgrBindings_ProjectFile_Tests)"
Properties="Configuration=$(Configuration);Should_Skip_MacCatalyst=$(Should_Skip_MacCatalyst);"/>
Properties="Configuration=$(Configuration);Should_Skip_MacCatalyst=$(Should_Skip_MacCatalyst);Laerdal_Bindings_iOS___DotnetTargetPlatformVersion=$(Laerdal_Bindings_iOS___DotnetTargetPlatformVersion);Laerdal_Bindings_Android___DotnetTargetPlatformVersion=$(Laerdal_Bindings_Android___DotnetTargetPlatformVersion);Laerdal_Bindings_MacCatalyst___DotnetTargetPlatformVersion=$(Laerdal_Bindings_MacCatalyst___DotnetTargetPlatformVersion);"/>

<PropertyGroup>
<TestParameters>$(TestParameters) test 'Laerdal.McuMgr.Tests/Laerdal.McuMgr.Tests.csproj'</TestParameters>
<TestParameters>$(TestParameters) --logger 'trx;LogFileName=TEST-Laerdal.McuMgr.Tests.xml'</TestParameters>

<TestParameters>$(TestParameters) --no-restore</TestParameters>
<TestParameters>$(TestParameters) --verbosity '4'</TestParameters>
<TestParameters>$(TestParameters) --configuration '$(Configuration)'</TestParameters>
<TestParameters>$(TestParameters) --results-directory '$(Laerdal_Test_Results_Folderpath)'</TestParameters>

<TestParameters>$(TestParameters) -p:Laerdal_Bindings_iOS___DotnetTargetPlatformVersion=$(Laerdal_Bindings_iOS___DotnetTargetPlatformVersion)</TestParameters>
<TestParameters>$(TestParameters) -p:Laerdal_Bindings_Android___DotnetTargetPlatformVersion=$(Laerdal_Bindings_Android___DotnetTargetPlatformVersion)</TestParameters>
<TestParameters>$(TestParameters) -p:Laerdal_Bindings_MacCatalyst___DotnetTargetPlatformVersion=$(Laerdal_Bindings_MacCatalyst___DotnetTargetPlatformVersion)</TestParameters>
</PropertyGroup>

<Exec Command=" bash -c &quot; dotnet $(TestParameters) &quot; "
Expand Down

0 comments on commit 0d079d0

Please sign in to comment.