From 19e8009ec5f483f3991d40ef5f7c241193304336 Mon Sep 17 00:00:00 2001 From: anTONIos Date: Sun, 4 Jul 2021 21:00:15 +0200 Subject: [PATCH] Update azure-pipelines.yml for Azure Pipelines (#102) * Update azure-pipelines.yml for Azure Pipelines * fix warings, update pipeline * added scripts to change to use nuget * fix variables * fix sh version * fix sh script * fix csproj Co-authored-by: AntonioSeric --- .azure-devops/msbuild.sh | 4 + .azure-devops/use-nuget.ps1 | 12 +++ .azure-devops/use-nuget.sh | 19 +++++ azure-pipelines.yml | 81 +++++++++---------- .../SampleApp.Android.csproj | 2 +- .../SampleApp.iOS/SampleApp.iOS.csproj | 3 + .../SampleApp/SampleApp.csproj | 5 +- src/Calendar.Plugin/CalendarPlugin.csproj | 2 +- .../Shared/Controls/Calendar.xaml.cs | 6 +- .../Shared/Controls/RangeSelectionCalendar.cs | 4 + 10 files changed, 87 insertions(+), 51 deletions(-) create mode 100644 .azure-devops/msbuild.sh create mode 100644 .azure-devops/use-nuget.ps1 create mode 100644 .azure-devops/use-nuget.sh diff --git a/.azure-devops/msbuild.sh b/.azure-devops/msbuild.sh new file mode 100644 index 0000000..e45af34 --- /dev/null +++ b/.azure-devops/msbuild.sh @@ -0,0 +1,4 @@ +#!/bin/sh +echo $MONO_OPTIONS +echo $@ +mono '/Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/msbuild.dll' "$@" \ No newline at end of file diff --git a/.azure-devops/use-nuget.ps1 b/.azure-devops/use-nuget.ps1 new file mode 100644 index 0000000..16f9ab6 --- /dev/null +++ b/.azure-devops/use-nuget.ps1 @@ -0,0 +1,12 @@ +$nugetVersion = $Env:NUGETVERSION +echo "Nuget Version = "$nugetVersion + +((Get-Content src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj) -replace 'CalendarPlugin'} | Out-File -encoding ASCII src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj +(Get-Content src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj -Raw) -replace "(?sm).*?", "" | Out-File -encoding ASCII src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj + +# (Get-Content src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj) | Where-Object {$_ -notmatch '81e938f4-a11c-4726-a13f-0d7ecc84ca66'} | Out-File -encoding ASCII src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj +# (Get-Content src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj) | Where-Object {$_ -notmatch 'CalendarPlugin'} | Out-File -encoding ASCII src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj +(Get-Content src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj -Raw) -replace "(?sm).*?", "" | Out-File -encoding ASCII src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj diff --git a/.azure-devops/use-nuget.sh b/.azure-devops/use-nuget.sh new file mode 100644 index 0000000..b8c14c5 --- /dev/null +++ b/.azure-devops/use-nuget.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +echo "Nuget Version = "$NUGETVERSION + +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 + +## Debug +#cat src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj +#cat src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index fcb5709..ab366d0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -10,18 +10,20 @@ variables: buildPlatform: 'AnyCPU' buildConfiguration: 'Release' nugetVersion: '1.4.$(Build.BuildId)' - MonoVersion: 6_12_0 + monoVersion: 6_12_7 + dotentVersion: 5.x jobs: - job: 'Nuget' + displayName: 'Build Nuget' pool: vmImage: 'windows-latest' steps: - task: NuGetToolInstaller@1 - task: UseDotNet@2 - displayName: 'Use dotnet sdk 3.x' + displayName: 'Use dotnet sdk $(dotentVersion)' inputs: - version: 3.x + version: $(dotentVersion) - task: NuGetCommand@2 displayName: 'Nuget restore solution' @@ -49,14 +51,22 @@ jobs: ArtifactName: nupkg - job: 'iOSSampleApp' + displayName: 'Build iOS Sample App' dependsOn: - Nuget pool: vmImage: 'macOS-latest' + demands: + - msbuild + - visualstudio steps: - task: NuGetToolInstaller@1 + - task: UseDotNet@2 + displayName: 'Use dotnet sdk $(dotentVersion)' + inputs: + version: $(dotentVersion) - - script: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh $MonoVersion + - script: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh $monoVersion displayName: 'Selecting the Xamarin SDK version' - task: DownloadBuildArtifacts@0 @@ -68,30 +78,23 @@ jobs: artifactName: 'nupkg' - task: Bash@3 + displayName: "Replace project ref with nuget reference" + inputs: + filePath: '.azure-devops/use-nuget.sh' + + - task: Bash@3 + displayName: "Restore nuget packages" 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 + chmod 755 $(Build.Repository.LocalPath)/.azure-devops/msbuild.sh + - task: XamariniOS@2 - continueOnError: true inputs: + buildToolLocation: '$(Build.Repository.LocalPath)/.azure-devops/msbuild.sh' solutionFile: '**/SampleApp.iOS.csproj' configuration: '$(buildConfiguration)' packageApp: false @@ -99,19 +102,17 @@ jobs: buildForSimulator: true - job: 'AndroidSampleApp' + displayName: 'Build Android Sample App' dependsOn: - Nuget pool: - vmImage: 'macOS-latest' + vmImage: 'windows-latest' steps: - task: NuGetToolInstaller@1 - task: UseDotNet@2 - displayName: 'Use dotnet sdk 3.x' + displayName: 'Use dotnet sdk $(dotentVersion)' inputs: - version: 3.x - - - script: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh $MonoVersion - displayName: 'Selecting the Xamarin SDK version' + version: $(dotentVersion) - task: DownloadBuildArtifacts@0 displayName: "Download PackNugetPackage artifacts" @@ -121,27 +122,17 @@ jobs: downloadPath: '$(build.binariesDirectory)/nuget/' artifactName: 'nupkg' - - task: Bash@3 + - task: PowerShell@2 + displayName: "Replace project ref with nuget reference" + inputs: + filePath: '.azure-devops\use-nuget.ps1' + + - task: CmdLine@2 + displayName: "Restore nuget packages" 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 + 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' diff --git a/src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj b/src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj index ab75d5c..cec5d86 100644 --- a/src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj +++ b/src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj @@ -58,7 +58,7 @@ - + diff --git a/src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj b/src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj index 84539b8..ac99362 100644 --- a/src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj +++ b/src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj @@ -63,6 +63,9 @@ iPhone Developer Entitlements.plist + + + diff --git a/src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj b/src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj index 0d111ce..ebed999 100644 --- a/src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj +++ b/src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj @@ -1,14 +1,15 @@  - netstandard2.0 + netstandard2.1 true latest - pdbonly + portable true + DEBUG;TRACE diff --git a/src/Calendar.Plugin/CalendarPlugin.csproj b/src/Calendar.Plugin/CalendarPlugin.csproj index e487408..1e6aaf5 100644 --- a/src/Calendar.Plugin/CalendarPlugin.csproj +++ b/src/Calendar.Plugin/CalendarPlugin.csproj @@ -1,7 +1,7 @@  - netstandard2.0;MonoAndroid10.0;Xamarin.iOS10 + netstandard2.1;MonoAndroid10.0;Xamarin.iOS10 $(AssemblyName) ($(TargetFramework)) Xamarin.Plugin.Calendar events calendar, calendar, xamarin forms, custom calendar diff --git a/src/Calendar.Plugin/Shared/Controls/Calendar.xaml.cs b/src/Calendar.Plugin/Shared/Controls/Calendar.xaml.cs index efdd450..7fcdeb4 100644 --- a/src/Calendar.Plugin/Shared/Controls/Calendar.xaml.cs +++ b/src/Calendar.Plugin/Shared/Controls/Calendar.xaml.cs @@ -851,7 +851,7 @@ public bool AnimateCalendar public static readonly BindableProperty SelectedDateProperty = BindableProperty.Create(nameof(SelectedDate), typeof(DateTime?), typeof(Calendar), null, BindingMode.TwoWay, propertyChanged: OnSelectedDateChanged); - protected internal static void OnSelectedDateChanged(BindableObject bindable, object oldValue, object newValue) + private static void OnSelectedDateChanged(BindableObject bindable, object oldValue, object newValue) { var control = (Calendar)bindable; var dateToSet = (DateTime?)newValue; @@ -1022,7 +1022,9 @@ private static void OnMonthYearChanged(BindableObject bindable, object oldValue, } } - /// Method that is called when a bound property is changed. + /// + /// Method that is called when a bound property is changed. + /// /// The name of the bound property that changed. protected override void OnPropertyChanged([CallerMemberName] string propertyName = null) { diff --git a/src/Calendar.Plugin/Shared/Controls/RangeSelectionCalendar.cs b/src/Calendar.Plugin/Shared/Controls/RangeSelectionCalendar.cs index 9fae52e..4ec27a1 100644 --- a/src/Calendar.Plugin/Shared/Controls/RangeSelectionCalendar.cs +++ b/src/Calendar.Plugin/Shared/Controls/RangeSelectionCalendar.cs @@ -49,6 +49,10 @@ public RangeSelectionCalendar() : base() _selectionEngine = monthDaysView.CurrentSelectionEngine as RangedSelectionEngine; } + /// + /// Method that is called when a bound property is changed. + /// + /// The name of the bound property that changed. protected override void OnPropertyChanged([CallerMemberName] string propertyName = null) { base.OnPropertyChanged(propertyName);