Skip to content

Commit

Permalink
Merge pull request #46
Browse files Browse the repository at this point in the history
ksidirop/MAN-335-ios-runtime-error-fix-about-you-should-not-call-this-method
  • Loading branch information
ksidirop-laerdal authored May 15, 2024
2 parents 22b4530 + a596d58 commit a837705
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:

- name: '🚀 Publish to the Laerdal Nuget Server on Github' # https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry
shell: 'bash'
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/ksidirop/MAN-335-ios-runtime-error-fix-about-you-should-not-call-this-method'
run: |
cd "${{env.BUILD_REPOSITORY_FOLDERPATH}}/Artifacts/" \
&& \
Expand Down
1 change: 1 addition & 0 deletions Laerdal.Dfu.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Misc", "_Misc", "{37EBD209
Laerdal.Scripts\Laerdal.SetupBuildEnvironment.sh = Laerdal.Scripts\Laerdal.SetupBuildEnvironment.sh
.github\workflows\github-actions.yml = .github\workflows\github-actions.yml
.gitignore = .gitignore
global.json = global.json
EndProjectSection
EndProject
Global
Expand Down
37 changes: 29 additions & 8 deletions Laerdal.Dfu/Laerdal.Dfu.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0-ios;net7.0-android</TargetFrameworks>
<!-- todo add support for maccatalyst -->
<TargetFrameworks>net7.0-ios;net7.0-android;netstandard2.1;</TargetFrameworks>

<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>

<LangVersion>11.0</LangVersion>

<TargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</TargetPlatformIdentifier>

<SupportedOSPlatformVersion Condition=" $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' ">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition=" $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android' ">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition=" '$(TargetPlatformIdentifier)' == 'ios' ">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition=" '$(TargetPlatformIdentifier)' == 'android' ">21.0</SupportedOSPlatformVersion>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -18,23 +23,39 @@
<Laerdal_Package_Description>Wrapper around Nordic.Dfu</Laerdal_Package_Description>
</PropertyGroup>

<!-- ==================== VERSION ==================== -->
<!-- ============================ VERSION ============================ -->
<PropertyGroup>
<Laerdal_Version_Major Condition=" '$(Laerdal_Version_Major)' == '' ">1</Laerdal_Version_Major>
<Laerdal_Version_Minor Condition=" '$(Laerdal_Version_Minor)' == '' ">27</Laerdal_Version_Minor>
<Laerdal_Version_Build Condition=" '$(Laerdal_Version_Build)' == '' ">0</Laerdal_Version_Build>

<Laerdal_Version Condition=" '$(Laerdal_Version)' == '' ">$(Laerdal_Version_Major).$(Laerdal_Version_Minor).$(Laerdal_Version_Build)</Laerdal_Version>
</PropertyGroup>
<!-- ============================ VERSION ============================ -->


<!-- ==================== NETSTANDARD PlACEHOLDER ==================== -->
<ItemGroup Condition=" '$(TargetFramework.StartsWith(netstandard))' == 'true' ">
<Compile Remove="Platforms\**\**">
</Compile>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework.StartsWith(netstandard))' != 'true' ">
<Compile Remove="Platforms.NetStandard\**">
</Compile>
</ItemGroup>
<!-- ==================== NETSTANDARD PlACEHOLDER ==================== -->

<Import Project="Laerdal.targets"/>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0-android'">
<PackageReference Include="Laerdal.Dfu.Bindings.Android" Version="2.3.0.43876" />
<!-- =========================== PACKAGES ============================ -->
<ItemGroup Condition=" '$(TargetPlatformIdentifier)' == 'android' ">
<PackageReference Include="Laerdal.Dfu.Bindings.Android" Version="2.3.0.43876"/>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0-ios'">
<PackageReference Include="Laerdal.Dfu.Bindings.iOS" Version="4.13.0.43907" />
<ItemGroup Condition=" '$(TargetPlatformIdentifier)' == 'ios' ">
<PackageReference Include="Laerdal.Dfu.Bindings.iOS" Version="4.13.0.43922"/>
</ItemGroup>
<!-- =========================== PACKAGES ============================ -->

</Project>
1 change: 1 addition & 0 deletions Laerdal.Dfu/Laerdal.targets
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<PackageLicenseFile Condition="Exists('$(PackageLicencePath)')">LICENSE</PackageLicenseFile>
<PackageReadmeFile Condition="Exists('$(PackageReadMePath)')">README.md</PackageReadmeFile>
</PropertyGroup>

<ItemGroup>
<None Include="$(PackageIconPath)" Pack="true" PackagePath="\" Condition="Exists('$(PackageIconPath)')" />
<None Include="$(PackageLicencePath)" Pack="true" PackagePath="\" Condition="Exists('$(PackageLicencePath)')" />
Expand Down
15 changes: 15 additions & 0 deletions Laerdal.Dfu/Platforms.NetStandard/DfuInstallation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace Laerdal.Dfu
{
public partial class DfuInstallation
{
public DfuInstallation(string deviceId, string fileUrl)
{
throw new NotImplementedException();
}

public override void Abort() => throw new NotImplementedException();
public override void Start() => throw new NotImplementedException();
public override void Pause() => throw new NotImplementedException();
public override void Resume() => throw new NotImplementedException();
}
}
1 change: 1 addition & 0 deletions Laerdal.Dfu/Platforms/Android/DfuInstallation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ private void SetInitiator()
public DfuInstallation(string deviceId, string fileUrl) : base(deviceId, fileUrl)
{
}

public DfuInstallation() : base()
{
}
Expand Down
1 change: 1 addition & 0 deletions Laerdal.Dfu/Platforms/iOS/DfuInstallation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ private void SetInitiator()
public DfuInstallation(string deviceId, string fileUrl) : base(deviceId, fileUrl)
{
}

public DfuInstallation() : base()
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ public override bool Select(CBPeripheral peripheral,
NSNumber rssi,
string name)
{
if (DfuInstallation.DeviceId != peripheral.Identifier.ToString())
{
return false;
}
return true;
return DfuInstallation.DeviceId == peripheral.Identifier.ToString();
}
}
}
30 changes: 21 additions & 9 deletions Laerdal.Scripts/Laerdal.Builder.targets
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>

<!-- -->
<!-- dotnet msbuild "Laerdal.Scripts/Laerdal.Builder.targets" -->
<!-- -->
<!-- to test stuff out on your localdev try these -->
<!-- -->
<!-- - to build with an explicit version specified in the cli: -->
<!-- -->
<!-- # on macos -->
<!-- dotnet msbuild \ -->
<!-- Laerdal.Scripts/Laerdal.Builder.targets \ -->
<!-- '"/m:1"' '"/p:Laerdal_Version=1.0.x.0"' -->
<!-- -->
<!-- # on windows powershell -->
<!-- dotnet msbuild ^ -->
<!-- Laerdal.Scripts\Laerdal.Builder.targets ^ -->
<!-- /m:1 /p:Laerdal_Version=1.0.x.0 -->
<!-- -->

<Project DefaultTargets="BuildProjects">

<PropertyGroup>
Expand All @@ -27,14 +39,14 @@
<Laerdal_Version_Build Condition=" '$(Laerdal_Version_Build)' == '' and '$(CI_PIPELINE_IID)' != '' ">$([MSBuild]::Add(8, $(CI_PIPELINE_IID)))</Laerdal_Version_Build> <!-- GitLab, auto-increment from 0 -->
<Laerdal_Version_Build Condition=" '$(Laerdal_Version_Build)' == '' ">0</Laerdal_Version_Build> <!-- Fallback value -->

<Laerdal_Version_Base Condition=" '$(Laerdal_Version_Base)' == '' ">$(Laerdal_Version_Major).$(Laerdal_Version_Minor).$(Laerdal_Version_Build)</Laerdal_Version_Base>
<Laerdal_Version Condition=" '$(Laerdal_Version)' == '' ">$(Laerdal_Version_Major).$(Laerdal_Version_Minor).$(Laerdal_Version_Build)</Laerdal_Version>
</PropertyGroup>

<Target Name="PrintConfiguration">
<Message Importance="High" Text="** Configuration = '$(Configuration)'"/>
<Message Importance="High" Text="** PackageOutputPath = '$(PackageOutputPath)'"/>

<Message Importance="High" Text="** Laerdal_Version_Base = '$(Laerdal_Version_Base)'"/>
<Message Importance="High" Text="** Laerdal_Version = '$(Laerdal_Version)'"/>
<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_Github_Access_Token ='$(Laerdal_Github_Access_Token)'"/> dont -->
Expand All @@ -44,13 +56,13 @@
<Target Name="BuildProjects">
<!-- REQUIRED PARAMETERS -->
<Error Condition=" '$(Configuration)' == '' " Text="'Configuration' has to be set. Please call this script again with the argument '/p:Configuration=...'" />
<Error Condition=" '$(Laerdal_Version)' == '' " Text="'Laerdal_Version' has to be set. Please call this script again with the argument '/p:Laerdal_Version=...'" />
<Error Condition=" '$(PackageOutputPath)' == '' " Text="'PackageOutputPath' has to be set. Please call this script again with the argument '/p:PackageOutputPath=...'" />
<Error Condition=" '$(Laerdal_Version_Base)' == '' " Text="'Laerdal_Version_Base' has to be set. Please call this script again with the argument '/p:Laerdal_Version_Base=...'" />

<!-- PARAMETERS -->
<PropertyGroup>
<_Laerdal_Build_Parameters>$(_Laerdal_Build_Parameters);Configuration=$(Configuration)</_Laerdal_Build_Parameters>
<_Laerdal_Build_Parameters>$(_Laerdal_Build_Parameters);Laerdal_Version=$(Laerdal_Version_Base)</_Laerdal_Build_Parameters>
<_Laerdal_Build_Parameters>$(_Laerdal_Build_Parameters);Laerdal_Version=$(Laerdal_Version)</_Laerdal_Build_Parameters>
<_Laerdal_Build_Parameters>$(_Laerdal_Build_Parameters);PackageOutputPath=$(PackageOutputPath)</_Laerdal_Build_Parameters>
</PropertyGroup>

Expand All @@ -63,7 +75,7 @@
Condition=" '$(Laerdal_Should_Tag_And_Release)' == 'True' "
AfterTargets="BuildProjects">

<Error Condition=" '$(Laerdal_Version_Base)' == '' " Text="'Laerdal_Version_Base' has to be set. Please call this script again with the argument '/p:Laerdal_Version_Base=...'" />
<Error Condition=" '$(Laerdal_Version)' == '' " Text="'Laerdal_Version' has to be set. Please call this script again with the argument '/p:Laerdal_Version=...'" />
<Error Condition=" '$(Laerdal_Source_Branch)' == '' " Text="'Laerdal_Source_Branch' has to be set. Please call this script again with the argument '/p:Laerdal_Source_Branch=...'" />
<Error Condition=" '$(Laerdal_Repository_Path)' == '' " Text="'Laerdal_Repository_Path' has to be set. Please call this script again with the argument '/p:Laerdal_Repository_Path=...'" />
<Error Condition=" '$(Laerdal_Github_Access_Token)' == '' " Text="'Laerdal_Github_Access_Token' has to be set. Please call this script again with the argument '/p:Laerdal_Github_Access_Token=...'" />
Expand All @@ -72,7 +84,7 @@
<Laerdal_Create_Github_Release_Script_Filepath Condition=" '$(Laerdal_Create_Github_Release_Script_Filepath)' == '' ">$([System.IO.Path]::Combine($(MSBuildThisFileDirectory), `Laerdal.CreateNewReleaseInGithub.sh`))</Laerdal_Create_Github_Release_Script_Filepath>

<_Laerdal_Create_Github_Release_Script_Parameters>$(_Laerdal_Create_Github_Release_Script_Parameters) --git-branch '$(Laerdal_Source_Branch)'</_Laerdal_Create_Github_Release_Script_Parameters>
<_Laerdal_Create_Github_Release_Script_Parameters>$(_Laerdal_Create_Github_Release_Script_Parameters) --tag-version '$(Laerdal_Version_Base)'</_Laerdal_Create_Github_Release_Script_Parameters>
<_Laerdal_Create_Github_Release_Script_Parameters>$(_Laerdal_Create_Github_Release_Script_Parameters) --tag-version '$(Laerdal_Version)'</_Laerdal_Create_Github_Release_Script_Parameters>
<_Laerdal_Create_Github_Release_Script_Parameters>$(_Laerdal_Create_Github_Release_Script_Parameters) --access-token '$(Laerdal_Github_Access_Token)'</_Laerdal_Create_Github_Release_Script_Parameters>
<_Laerdal_Create_Github_Release_Script_Parameters>$(_Laerdal_Create_Github_Release_Script_Parameters) --repository-path '$(Laerdal_Repository_Path)'</_Laerdal_Create_Github_Release_Script_Parameters>
</PropertyGroup>
Expand Down
7 changes: 7 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sdk": {
"version": "7.0.0",
"rollForward": "latestFeature",
"allowPrerelease": false
}
}

0 comments on commit a837705

Please sign in to comment.