From f50b4f0a7502518380a4ef7fb22705b00005679a Mon Sep 17 00:00:00 2001 From: anTONIos Date: Mon, 24 Feb 2020 22:59:23 +0100 Subject: [PATCH] Fix ios build (#31) * for release use nuget * fix nuget restore * fix replace * cs proj conditions * nuget restore * added config * Update azure-pipelines.yml for Azure Pipelines * update msbuild extras * added more frameworks --- azure-pipelines.yml | 84 ++++++++++++++++--- .../SampleApp.Android.csproj | 12 ++- .../SampleApp.iOS/SampleApp.iOS.csproj | 8 +- .../SampleApp/SampleApp.csproj | 3 +- src/Calendar.Plugin/CalendarPlugin.csproj | 6 +- 5 files changed, 90 insertions(+), 23 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f5768a1..9499ad7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,21 +25,23 @@ jobs: - task: NuGetCommand@2 displayName: 'Nuget restore solution' inputs: - restoreSolution: '**/*.sln' + restoreSolution: '**/CalendarPlugin.csproj' - task: MSBuild@1 inputs: solution: '**/CalendarPlugin.csproj' + msbuildArguments: '/p:Version=$(nugetVersion)' configuration: '$(BuildConfiguration)' - msbuildArguments: '/p:Version=$(nugetVersion) /p:OutputPath=$(Build.ArtifactStagingDirectory)/$(BuildPlatform)/$(BuildConfiguration)/' - task: PublishBuildArtifacts@1 displayName: 'Publish Artifact: nupkg' inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/$(BuildPlatform)/$(BuildConfiguration)' + PathtoPublish: 'src\Calendar.Plugin\bin\Release\' ArtifactName: nupkg - job: 'iOSSampleApp' + dependsOn: + - Nuget pool: vmImage: 'macOS-latest' steps: @@ -49,16 +51,41 @@ jobs: inputs: version: 3.x - - script: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 6_4_0 + - script: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 6_6_0 displayName: 'Selecting the Xamarin SDK version' - - task: NuGetCommand@2 - displayName: 'Nuget restore solution' + - task: DownloadBuildArtifacts@0 + displayName: "Download PackNugetPackage artifacts" inputs: - restoreSolution: '**/*.sln' + buildType: 'current' + downloadType: 'single' + downloadPath: '$(build.binariesDirectory)/nuget/' + artifactName: 'nupkg' + + - task: Bash@3 + inputs: + targetType: 'inline' + script: | + sed -E -i .bak -e 's/CalendarPlugin/d' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj + sed -E -i .bak -e '//{N;s/\n.*//;}' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj + sed -E -i .bak -e 's///g' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj + + sed -i .bak -e '/81e938f4-a11c-4726-a13f-0d7ecc84ca66/d' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj + sed -i .bak -e '/CalendarPlugin/d' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj + sed -E -i .bak -e '//{N;s/\n.*//;}' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj + sed -E -i .bak -e 's///g' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj + + cat src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj + cat src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj + + nuget restore src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj -NonInteractive -Source $(build.binariesDirectory)/nuget/nupkg/ -Source https://api.nuget.org/v3/index.json + nuget restore src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj -NonInteractive -Source $(build.binariesDirectory)/nuget/nupkg/ -Source https://api.nuget.org/v3/index.json - task: XamariniOS@2 - continueOnError: true + continueOnError: true inputs: solutionFile: '**/SampleApp.iOS.csproj' configuration: '$(buildConfiguration)' @@ -67,8 +94,10 @@ jobs: buildForSimulator: true - job: 'AndroidSampleApp' + dependsOn: + - Nuget pool: - vmImage: 'windows-latest' + vmImage: 'macOS-latest' steps: - task: NuGetToolInstaller@1 - task: UseDotNet@2 @@ -76,10 +105,39 @@ jobs: inputs: version: 3.x - - task: NuGetCommand@2 - displayName: 'Nuget restore solution' + - script: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 6_6_0 + displayName: 'Selecting the Xamarin SDK version' + + - task: DownloadBuildArtifacts@0 + displayName: "Download PackNugetPackage artifacts" inputs: - restoreSolution: '**/*.sln' + buildType: 'current' + downloadType: 'single' + downloadPath: '$(build.binariesDirectory)/nuget/' + artifactName: 'nupkg' + + - task: Bash@3 + inputs: + targetType: 'inline' + script: | + sed -E -i .bak -e 's/CalendarPlugin/d' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj + sed -E -i .bak -e '//{N;s/\n.*//;}' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj + sed -E -i .bak -e 's///g' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj + + sed -i .bak -e '/81e938f4-a11c-4726-a13f-0d7ecc84ca66/d' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj + sed -i .bak -e '/CalendarPlugin/d' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj + sed -E -i .bak -e '//{N;s/\n.*//;}' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj + sed -E -i .bak -e 's///g' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj + + cat src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj + cat src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj + + nuget restore src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj -NonInteractive -Source $(build.binariesDirectory)/nuget/nupkg/ -Source https://api.nuget.org/v3/index.json + nuget restore src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj -NonInteractive -Source $(build.binariesDirectory)/nuget/nupkg/ -Source https://api.nuget.org/v3/index.json + - task: XamarinAndroid@1 displayName: 'Build Xamarin.Android project SampleApp.Android.csproj' inputs: @@ -87,7 +145,7 @@ jobs: createAppPackage: true outputDirectory: '$(build.binariesdirectory)/$(BuildConfiguration)' jdkOption: 'JDKVersion' - clean: true + clean: false configuration: '$(BuildConfiguration)' msbuildVersionOption: latest diff --git a/src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj b/src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj index 4abeb8f..8a9c729 100644 --- a/src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj +++ b/src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj @@ -52,7 +52,7 @@ - + @@ -96,15 +96,19 @@ + + - {81e938f4-a11c-4726-a13f-0d7ecc84ca66} + {81e938f4-a11c-4726-a13f-0d7ecc84ca66} CalendarPlugin + + + {E4FB5119-AAD4-43E4-8741-1759FAF4083B} SampleApp - - \ No newline at end of file + diff --git a/src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj b/src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj index 0d30f6c..3dbb90f 100644 --- a/src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj +++ b/src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj @@ -124,17 +124,21 @@ - + + {81e938f4-a11c-4726-a13f-0d7ecc84ca66} CalendarPlugin + + + {E4FB5119-AAD4-43E4-8741-1759FAF4083B} SampleApp - \ No newline at end of file + diff --git a/src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj b/src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj index 25c8824..9afddcf 100644 --- a/src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj +++ b/src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj @@ -16,10 +16,11 @@ - + + \ No newline at end of file diff --git a/src/Calendar.Plugin/CalendarPlugin.csproj b/src/Calendar.Plugin/CalendarPlugin.csproj index a230921..14c1929 100644 --- a/src/Calendar.Plugin/CalendarPlugin.csproj +++ b/src/Calendar.Plugin/CalendarPlugin.csproj @@ -1,5 +1,5 @@  - + netstandard2.0;MonoAndroid81;Xamarin.iOS10 Josip Caleta @@ -48,7 +48,7 @@ - + @@ -100,5 +100,5 @@ - +