Skip to content

Commit

Permalink
Merge pull request #72 from Laerdal/ksidirop/MAN-456-resupport-iossim…
Browse files Browse the repository at this point in the history
…ulator-side-builds

[MAN-456] Resupport iossimulator side builds
  • Loading branch information
ksidirop-laerdal authored Jan 20, 2025
2 parents 3b9981b + 90df899 commit c3d6940
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 5 deletions.
13 changes: 10 additions & 3 deletions Laerdal.Dfu/Laerdal.Dfu.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,17 @@

<!-- ==================== TARGET FRAMEWORKS GROUP ===================== -->
<PropertyGroup>

<!-- - note that we build against net8.0 merely as a dud-placeholder for windows in which we are bound to get not-implemented exceptions all over the place -->
<!-- - the dud build for net8 also comes in handy when we want to launch an application inside an ios-simulator in the macos desktop (for UI testing purposes) -->

<PackageVersionPostfix Condition=" '$(BuildOnlyDudNet8)' == 'true' ">-force-dud</PackageVersionPostfix>

<TargetFrameworks>$(TargetFrameworks)net8.0;</TargetFrameworks>
<TargetFrameworks>$(TargetFrameworks)net8.0-ios;</TargetFrameworks>
<TargetFrameworks>$(TargetFrameworks)net8.0-android;</TargetFrameworks>
<TargetFrameworks>$(TargetFrameworks)net8.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition=" '$(BuildOnlyDudNet8)' != 'true' ">$(TargetFrameworks)net8.0-ios;</TargetFrameworks>
<TargetFrameworks Condition=" '$(BuildOnlyDudNet8)' != 'true' ">$(TargetFrameworks)net8.0-android;</TargetFrameworks>
<TargetFrameworks Condition=" '$(BuildOnlyDudNet8)' != 'true' ">$(TargetFrameworks)net8.0-maccatalyst</TargetFrameworks>

</PropertyGroup>

<!-- =================== TARGET FRAMEWORK DETECTION ===================== -->
Expand Down
3 changes: 2 additions & 1 deletion Laerdal.Dfu/Laerdal.targets
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@

<!-- Apply Version parts according to packaging standards -->
<Version>$(Laerdal_Version_Full)</Version>
<PackageVersion>$(Laerdal_Version_Full)</PackageVersion>
<!-- keep this because it is needed to generate the *-force-dud nuget packages! -->
<PackageVersion>$(Laerdal_Version_Full)$(PackageVersionPostfix)</PackageVersion>

<AssemblyVersion>$(Laerdal_Version_Full)</AssemblyVersion>
<AssemblyFileVersion>$(Laerdal_Version_Full)</AssemblyFileVersion>
Expand Down
10 changes: 9 additions & 1 deletion Laerdal.Scripts/Laerdal.Builder.targets
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
<PackageOutputPath Condition=" '$(PackageOutputPath)' == '' ">$(BUILD_ARTIFACTSTAGINGDIRECTORY)</PackageOutputPath>
<PackageOutputPath Condition=" '$(PackageOutputPath)' == '' ">$([System.IO.Path]::Combine($(MSBuildThisFileDirectory), `..`, `Artifacts/`))</PackageOutputPath>

<Laerdal_Script_FolderPath>$(MSBuildThisFileDirectory)</Laerdal_Script_FolderPath>

<Laerdal_RootDirectory_Folderpath>$([System.IO.Path]::Combine( '$(Laerdal_Script_FolderPath)', '..' ))</Laerdal_RootDirectory_Folderpath>
<Laerdal_RootDirectory_Folderpath>$([System.IO.Path]::GetFullPath( '$(Laerdal_RootDirectory_Folderpath)' ))</Laerdal_RootDirectory_Folderpath>

<Laerdal_Source_Branch Condition=" '$(Laerdal_Source_Branch)' == '' ">$(BUILD_SOURCEBRANCH)</Laerdal_Source_Branch>
<Laerdal_Repository_Path Condition=" '$(Laerdal_Repository_Path)' == '' ">$(BUILD_REPOSITORY_NAME)</Laerdal_Repository_Path>
<Laerdal_Dependency_Tracker_Server_Url Condition=" '$(Laerdal_Dependency_Tracker_Server_Url)' == '' ">https://dep-tracker.laerdal.com/api/api/v1/bom</Laerdal_Dependency_Tracker_Server_Url>
Expand Down Expand Up @@ -85,7 +90,10 @@
</PropertyGroup>

<!-- RUN -->
<MSBuild Projects="$(Laerdal_Project)" Properties="$(_Laerdal_Build_Parameters)" Targets="Restore;Build"/>
<MSBuild Projects="$(Laerdal_Project)" Targets="Restore;Build" Properties="$(_Laerdal_Build_Parameters)" />

<!-- -force-dud build aiming just pure net8 without bindings this is meant for desktop simulators of android and ios for ui testing purposes of apps -->
<MSBuild Projects="$(Laerdal_Project)" Targets="Restore;Rebuild" Properties="$(_Laerdal_Build_Parameters);BuildOnlyDudNet8=true;SourceRoot=$(Laerdal_RootDirectory_Folderpath)/Laerdal.Dfu/;" />
</Target>

<!-- GITHUB RELEASE -->
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,23 @@ git clone https://github.com/Laerdal/Laerdal.Dfu.git
```bash
dotnet msbuild Laerdal.Scripts/Laerdal.Builder.targets /m:1 /p:Laerdal_Version=9.0.x.0 /p:Laerdal_Github_Access_Token=<place your github access token here - its needed by carthage>
```

## Known issues

- Trying to use the iOS/Android flavours of this library in desktop-simulators for iOS/Android will probably result in compilation errors. If you want to perform general purpose
UI-testing on your desktop using such simulators you need to tweak your nuget references to use the `-force-dud` nuget of `Laerdal.Dfu` like so:

```xml
<PackageReference Include="Laerdal.Dfu" Version="x.y.z-force-dud">
<NoWarn>$(NoWarn);NU1605</NoWarn>
</PackageReference>
```

Alternatively you can achieve the same result by overriding the reference to `Laerdal.Dfu.Bindings.iOS` like so (note: this solution is only applicable for iOS and will work only
for iOS sdk 18.x or below!):

```xml
<PackageReference Include="Laerdal.Dfu.Bindings.iOS" Version="x.y.z-ios-sim-arm64">
<NoWarn>$(NoWarn);NU1605</NoWarn>
</PackageReference>
```

0 comments on commit c3d6940

Please sign in to comment.