diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index f167f12..5205ea7 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -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 @@ -38,7 +40,7 @@ jobs: build: runs-on: 'windows-2022' - timeout-minutes: 5 + timeout-minutes: 20 steps: @@ -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/" \ && \ @@ -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 diff --git a/.gitignore b/.gitignore index 6527e19..195b533 100644 --- a/.gitignore +++ b/.gitignore @@ -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] diff --git a/Laerdal.Dfu.sln b/Laerdal.Dfu.sln index fd306ec..2264f7b 100644 --- a/Laerdal.Dfu.sln +++ b/Laerdal.Dfu.sln @@ -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 diff --git a/Laerdal.Dfu/Laerdal.Dfu.csproj b/Laerdal.Dfu/Laerdal.Dfu.csproj index b7876b5..f92c72d 100644 --- a/Laerdal.Dfu/Laerdal.Dfu.csproj +++ b/Laerdal.Dfu/Laerdal.Dfu.csproj @@ -1,13 +1,19 @@ - net7.0-ios;net7.0-android + + net7.0-ios;net7.0-android;netstandard2.1; + true true enable + + 11.0 + + $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) - 14.2 - 21.0 + 14.2 + 21.0 @@ -17,7 +23,7 @@ Wrapper around Nordic.Dfu - + 1 27 @@ -25,13 +31,31 @@ $(Laerdal_Version_Major).$(Laerdal_Version_Minor).$(Laerdal_Version_Build) + + + + + + + + + + + + + + - - + + + - - + + + - \ No newline at end of file + + + diff --git a/Laerdal.Dfu/Laerdal.targets b/Laerdal.Dfu/Laerdal.targets index bea5937..0f524dc 100644 --- a/Laerdal.Dfu/Laerdal.targets +++ b/Laerdal.Dfu/Laerdal.targets @@ -53,6 +53,7 @@ LICENSE README.md + diff --git a/Laerdal.Dfu/Platforms.NetStandard/DfuInstallation.cs b/Laerdal.Dfu/Platforms.NetStandard/DfuInstallation.cs new file mode 100644 index 0000000..b4cefaa --- /dev/null +++ b/Laerdal.Dfu/Platforms.NetStandard/DfuInstallation.cs @@ -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(); + } +} diff --git a/Laerdal.Dfu/Platforms/Android/DfuInstallation.cs b/Laerdal.Dfu/Platforms/Android/DfuInstallation.cs index 1b83d38..7f165ee 100644 --- a/Laerdal.Dfu/Platforms/Android/DfuInstallation.cs +++ b/Laerdal.Dfu/Platforms/Android/DfuInstallation.cs @@ -137,6 +137,7 @@ private void SetInitiator() public DfuInstallation(string deviceId, string fileUrl) : base(deviceId, fileUrl) { } + public DfuInstallation() : base() { } diff --git a/Laerdal.Dfu/Platforms/Android/Specific/DfuLogger.cs b/Laerdal.Dfu/Platforms/Android/Specific/DfuLogger.cs index 8bc9eb2..3f4a58b 100644 --- a/Laerdal.Dfu/Platforms/Android/Specific/DfuLogger.cs +++ b/Laerdal.Dfu/Platforms/Android/Specific/DfuLogger.cs @@ -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); } diff --git a/Laerdal.Dfu/Platforms/iOS/DfuInstallation.cs b/Laerdal.Dfu/Platforms/iOS/DfuInstallation.cs index 28fbbea..1c00c0a 100644 --- a/Laerdal.Dfu/Platforms/iOS/DfuInstallation.cs +++ b/Laerdal.Dfu/Platforms/iOS/DfuInstallation.cs @@ -87,6 +87,7 @@ private void SetInitiator() public DfuInstallation(string deviceId, string fileUrl) : base(deviceId, fileUrl) { } + public DfuInstallation() : base() { } diff --git a/Laerdal.Dfu/Platforms/iOS/Specific/DfuPeripheralSelectorDelegate.cs b/Laerdal.Dfu/Platforms/iOS/Specific/DfuPeripheralSelectorDelegate.cs index 6822105..20041ea 100644 --- a/Laerdal.Dfu/Platforms/iOS/Specific/DfuPeripheralSelectorDelegate.cs +++ b/Laerdal.Dfu/Platforms/iOS/Specific/DfuPeripheralSelectorDelegate.cs @@ -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(); } } } \ No newline at end of file diff --git a/Laerdal.Scripts/Laerdal.Builder.targets b/Laerdal.Scripts/Laerdal.Builder.targets index 59ebbb0..a172cb2 100644 --- a/Laerdal.Scripts/Laerdal.Builder.targets +++ b/Laerdal.Scripts/Laerdal.Builder.targets @@ -1,12 +1,20 @@ - - - - - - - + + + + + + + + + + + + + + + @@ -31,14 +39,14 @@ $([MSBuild]::Add(8, $(CI_PIPELINE_IID))) 0 - $(Laerdal_Version_Major).$(Laerdal_Version_Minor).$(Laerdal_Version_Build) + $(Laerdal_Version_Major).$(Laerdal_Version_Minor).$(Laerdal_Version_Build) - + @@ -48,13 +56,13 @@ + - <_Laerdal_Build_Parameters>$(_Laerdal_Build_Parameters);Configuration=$(Configuration) - <_Laerdal_Build_Parameters>$(_Laerdal_Build_Parameters);Laerdal_Version=$(Laerdal_Version_Base) + <_Laerdal_Build_Parameters>$(_Laerdal_Build_Parameters);Laerdal_Version=$(Laerdal_Version) <_Laerdal_Build_Parameters>$(_Laerdal_Build_Parameters);PackageOutputPath=$(PackageOutputPath) @@ -67,7 +75,7 @@ Condition=" '$(Laerdal_Should_Tag_And_Release)' == 'True' " AfterTargets="BuildProjects"> - + @@ -76,7 +84,7 @@ $([System.IO.Path]::Combine($(MSBuildThisFileDirectory), `Laerdal.CreateNewReleaseInGithub.sh`)) <_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) --tag-version '$(Laerdal_Version_Base)' + <_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) --access-token '$(Laerdal_Github_Access_Token)' <_Laerdal_Create_Github_Release_Script_Parameters>$(_Laerdal_Create_Github_Release_Script_Parameters) --repository-path '$(Laerdal_Repository_Path)' diff --git a/global.json b/global.json new file mode 100644 index 0000000..237f5ce --- /dev/null +++ b/global.json @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "7.0.0", + "rollForward": "latestFeature", + "allowPrerelease": false + } +}