Skip to content

Commit

Permalink
Merge pull request #47
Browse files Browse the repository at this point in the history
develop
  • Loading branch information
ksidirop-laerdal authored May 16, 2024
2 parents d555b8c + c3b938c commit 088d931
Show file tree
Hide file tree
Showing 12 changed files with 97 additions and 31 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ env:
LAERDAL_SOURCE_BRANCH: ${{ github.ref }}
LAERDAL_REPOSITORY_PATH: ${{ github.repository }}

# note that its vital that we use our own token here instead of GITHUB_TOKEN that is because access the
# nuget repos of Laerdal.Dfu.Bindings.iOS and Laerdal.Dfu.Bindings.Android which are inaccessible to the GITHUB_TOKEN
SCL_GITHUB_ACCESS_TOKEN: ${{ secrets.SCL_GITHUB_ACCESS_TOKEN }}
SCL_NUGET_ORG_FEED_API_KEY: ${{ secrets.NUGET_ORG_FEED_API_KEY }}
SCL_AZURE_ARTIFACTS_API_KEY: ${{ secrets.SCL_AZURE_ARTIFACTS_API_KEY }}
SCL_GITHUB_NUGET_FEED_USERNAME: ${{ secrets.SCL_GITHUB_NUGET_FEED_USERNAME }}


on:
workflow_call: # so that other workflows can trigger this
workflow_dispatch: # allows to run this workflow manually from the actions tab
Expand All @@ -38,7 +40,7 @@ jobs:
build:

runs-on: 'windows-2022'
timeout-minutes: 5
timeout-minutes: 20

steps:

Expand Down Expand Up @@ -91,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 All @@ -117,4 +119,4 @@ jobs:
push \
--source "https://api.nuget.org/v3/index.json" \
--api-key "${{env.SCL_NUGET_ORG_FEED_API_KEY}}" \
*nupkg
*.nupkg
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -354,3 +354,10 @@ Output/

.DS_Store

**/Jars/*.[JjAa]ar

**/Carthage/Cartfile

# we dont want to allow any local nuget.configs to be checked in as they can cause issues with the build and/or contain hardcoded API keys with write access to the
# nuget feed and this is something we definitely want to avoid at all costs for obvious reasons such nuget.config files should be remain local to each dev machine
[Nn][Uu][Gg][Ee][Tt].[Cc][Oo][Nn][Ff][Ii][Gg]
2 changes: 2 additions & 0 deletions Laerdal.Dfu.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Misc", "_Misc", "{37EBD209
Laerdal.Scripts\Laerdal.CreateNewReleaseInGithub.sh = Laerdal.Scripts\Laerdal.CreateNewReleaseInGithub.sh
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
42 changes: 33 additions & 9 deletions Laerdal.Dfu/Laerdal.Dfu.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +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 @@ -17,21 +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.43685"/>
<!-- =========================== 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.43870"/>

<ItemGroup Condition=" '$(TargetPlatformIdentifier)' == 'ios' ">
<PackageReference Include="Laerdal.Dfu.Bindings.iOS" Version="4.13.0.43926"/>
</ItemGroup>
</Project>
<!-- =========================== 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
2 changes: 2 additions & 0 deletions Laerdal.Dfu/Platforms/Android/Specific/DfuLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ public class DfuLogger : Java.Lang.Object, Laerdal.Dfu.Bindings.Android.IDfuLogL
public DfuLogger(string deviceAddress)
{
DeviceAddress = deviceAddress;

Laerdal.Dfu.Bindings.Android.DfuServiceListenerHelper.RegisterLogListener(Android.App.Application.Context, this);
}

protected override void Dispose(bool disposing)
{
Laerdal.Dfu.Bindings.Android.DfuServiceListenerHelper.UnregisterLogListener(Android.App.Application.Context, this);

base.Dispose(disposing);
}

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();
}
}
}
34 changes: 21 additions & 13 deletions Laerdal.Scripts/Laerdal.Builder.targets
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>

<!-- -->
<!-- # on macos -->
<!-- dotnet msbuild "Laerdal.Scripts/Laerdal.Builder.targets" -->
<!-- -->
<!-- # on windows powershell -->
<!-- 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 @@ -31,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 @@ -48,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 @@ -67,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 @@ -76,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 088d931

Please sign in to comment.