Skip to content

Commit 19e8009

Browse files
anTONIosAntonioSeric
anTONIos
and
AntonioSeric
authored
Update azure-pipelines.yml for Azure Pipelines (lilcodelab#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 <[email protected]>
1 parent 542c5d2 commit 19e8009

File tree

10 files changed

+87
-51
lines changed

10 files changed

+87
-51
lines changed

Diff for: .azure-devops/msbuild.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
echo $MONO_OPTIONS
3+
echo $@
4+
mono '/Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/msbuild.dll' "$@"

Diff for: .azure-devops/use-nuget.ps1

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
$nugetVersion = $Env:NUGETVERSION
2+
echo "Nuget Version = "$nugetVersion
3+
4+
((Get-Content src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj) -replace '<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj"', "<PackageReference Include=""Xamarin.Plugin.Calendar"" Version=""$($nugetVersion)""") | Out-File -encoding ASCII src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj
5+
6+
# (Get-Content src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj) | Where-Object {$_ -notmatch '81e938f4-a11c-4726-a13f-0d7ecc84ca66'} | Out-File -encoding ASCII src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
7+
# (Get-Content src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj) | Where-Object {$_ -notmatch '<Name>CalendarPlugin'} | Out-File -encoding ASCII src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
8+
(Get-Content src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj -Raw) -replace "(?sm)<ProjectReference Include=""..\\..\\Calendar.Plugin\\CalendarPlugin.csproj"">.*?</ProjectReference>", "<PackageReference Include=""Xamarin.Plugin.Calendar"" Version=""$($nugetVersion)"" />" | Out-File -encoding ASCII src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
9+
10+
# (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
11+
# (Get-Content src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj) | Where-Object {$_ -notmatch '<Name>CalendarPlugin'} | Out-File -encoding ASCII src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
12+
(Get-Content src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj -Raw) -replace "(?sm)<ProjectReference Include=""..\\..\\Calendar.Plugin\\CalendarPlugin.csproj"">.*?</ProjectReference>", "<PackageReference Include=""Xamarin.Plugin.Calendar"" Version=""$($nugetVersion)"" />" | Out-File -encoding ASCII src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj

Diff for: .azure-devops/use-nuget.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
3+
echo "Nuget Version = "$NUGETVERSION
4+
5+
sed -E -i .bak -e 's/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj"/<PackageReference Include="Xamarin.Plugin.Calendar" Version="'$NUGETVERSION'"/g' src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj
6+
7+
sed -i .bak -e '/81e938f4-a11c-4726-a13f-0d7ecc84ca66/d' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
8+
sed -i .bak -e '/<Name>CalendarPlugin/d' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
9+
sed -E -i .bak -e '/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj">/{N;s/\n.*//;}' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
10+
sed -E -i .bak -e 's/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj">/<PackageReference Include="Xamarin.Plugin.Calendar" Version="'$NUGETVERSION'" \/>/g' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
11+
12+
sed -i .bak -e '/81e938f4-a11c-4726-a13f-0d7ecc84ca66/d' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
13+
sed -i .bak -e '/<Name>CalendarPlugin/d' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
14+
sed -E -i .bak -e '/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj">/{N;s/\n.*//;}' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
15+
sed -E -i .bak -e 's/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj">/<PackageReference Include="Xamarin.Plugin.Calendar" Version="'$NUGETVERSION'" \/>/g' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
16+
17+
## Debug
18+
#cat src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
19+
#cat src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj

Diff for: azure-pipelines.yml

+36-45
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,20 @@ variables:
1010
buildPlatform: 'AnyCPU'
1111
buildConfiguration: 'Release'
1212
nugetVersion: '1.4.$(Build.BuildId)'
13-
MonoVersion: 6_12_0
13+
monoVersion: 6_12_7
14+
dotentVersion: 5.x
1415

1516
jobs:
1617
- job: 'Nuget'
18+
displayName: 'Build Nuget'
1719
pool:
1820
vmImage: 'windows-latest'
1921
steps:
2022
- task: NuGetToolInstaller@1
2123
- task: UseDotNet@2
22-
displayName: 'Use dotnet sdk 3.x'
24+
displayName: 'Use dotnet sdk $(dotentVersion)'
2325
inputs:
24-
version: 3.x
26+
version: $(dotentVersion)
2527

2628
- task: NuGetCommand@2
2729
displayName: 'Nuget restore solution'
@@ -49,14 +51,22 @@ jobs:
4951
ArtifactName: nupkg
5052

5153
- job: 'iOSSampleApp'
54+
displayName: 'Build iOS Sample App'
5255
dependsOn:
5356
- Nuget
5457
pool:
5558
vmImage: 'macOS-latest'
59+
demands:
60+
- msbuild
61+
- visualstudio
5662
steps:
5763
- task: NuGetToolInstaller@1
64+
- task: UseDotNet@2
65+
displayName: 'Use dotnet sdk $(dotentVersion)'
66+
inputs:
67+
version: $(dotentVersion)
5868

59-
- script: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh $MonoVersion
69+
- script: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh $monoVersion
6070
displayName: 'Selecting the Xamarin SDK version'
6171

6272
- task: DownloadBuildArtifacts@0
@@ -68,50 +78,41 @@ jobs:
6878
artifactName: 'nupkg'
6979

7080
- task: Bash@3
81+
displayName: "Replace project ref with nuget reference"
82+
inputs:
83+
filePath: '.azure-devops/use-nuget.sh'
84+
85+
- task: Bash@3
86+
displayName: "Restore nuget packages"
7187
inputs:
7288
targetType: 'inline'
7389
script: |
74-
sed -E -i .bak -e 's/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj"/<PackageReference Include="Xamarin.Plugin.Calendar" Version="'$(nugetVersion)'"/g' src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj
75-
76-
sed -i .bak -e '/81e938f4-a11c-4726-a13f-0d7ecc84ca66/d' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
77-
sed -i .bak -e '/<Name>CalendarPlugin/d' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
78-
sed -E -i .bak -e '/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj">/{N;s/\n.*//;}' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
79-
sed -E -i .bak -e 's/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj">/<PackageReference Include="Xamarin.Plugin.Calendar" Version="'$(nugetVersion)'" \/>/g' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
80-
81-
sed -i .bak -e '/81e938f4-a11c-4726-a13f-0d7ecc84ca66/d' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
82-
sed -i .bak -e '/<Name>CalendarPlugin/d' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
83-
sed -E -i .bak -e '/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj">/{N;s/\n.*//;}' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
84-
sed -E -i .bak -e 's/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj">/<PackageReference Include="Xamarin.Plugin.Calendar" Version="'$(nugetVersion)'" \/>/g' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
85-
86-
cat src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
87-
cat src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
88-
8990
nuget restore src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj -NonInteractive -Source $(build.binariesDirectory)/nuget/nupkg/ -Source https://api.nuget.org/v3/index.json
9091
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
9192
93+
chmod 755 $(Build.Repository.LocalPath)/.azure-devops/msbuild.sh
94+
9295
- task: XamariniOS@2
93-
continueOnError: true
9496
inputs:
97+
buildToolLocation: '$(Build.Repository.LocalPath)/.azure-devops/msbuild.sh'
9598
solutionFile: '**/SampleApp.iOS.csproj'
9699
configuration: '$(buildConfiguration)'
97100
packageApp: false
98101
runNugetRestore: false
99102
buildForSimulator: true
100103

101104
- job: 'AndroidSampleApp'
105+
displayName: 'Build Android Sample App'
102106
dependsOn:
103107
- Nuget
104108
pool:
105-
vmImage: 'macOS-latest'
109+
vmImage: 'windows-latest'
106110
steps:
107111
- task: NuGetToolInstaller@1
108112
- task: UseDotNet@2
109-
displayName: 'Use dotnet sdk 3.x'
113+
displayName: 'Use dotnet sdk $(dotentVersion)'
110114
inputs:
111-
version: 3.x
112-
113-
- script: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh $MonoVersion
114-
displayName: 'Selecting the Xamarin SDK version'
115+
version: $(dotentVersion)
115116

116117
- task: DownloadBuildArtifacts@0
117118
displayName: "Download PackNugetPackage artifacts"
@@ -121,27 +122,17 @@ jobs:
121122
downloadPath: '$(build.binariesDirectory)/nuget/'
122123
artifactName: 'nupkg'
123124

124-
- task: Bash@3
125+
- task: PowerShell@2
126+
displayName: "Replace project ref with nuget reference"
127+
inputs:
128+
filePath: '.azure-devops\use-nuget.ps1'
129+
130+
- task: CmdLine@2
131+
displayName: "Restore nuget packages"
125132
inputs:
126-
targetType: 'inline'
127133
script: |
128-
sed -E -i .bak -e 's/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj"/<PackageReference Include="Xamarin.Plugin.Calendar" Version="'$(nugetVersion)'"/g' src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj
129-
130-
sed -i .bak -e '/81e938f4-a11c-4726-a13f-0d7ecc84ca66/d' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
131-
sed -i .bak -e '/<Name>CalendarPlugin/d' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
132-
sed -E -i .bak -e '/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj">/{N;s/\n.*//;}' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
133-
sed -E -i .bak -e 's/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj">/<PackageReference Include="Xamarin.Plugin.Calendar" Version="'$(nugetVersion)'" \/>/g' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
134-
135-
sed -i .bak -e '/81e938f4-a11c-4726-a13f-0d7ecc84ca66/d' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
136-
sed -i .bak -e '/<Name>CalendarPlugin/d' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
137-
sed -E -i .bak -e '/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj">/{N;s/\n.*//;}' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
138-
sed -E -i .bak -e 's/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj">/<PackageReference Include="Xamarin.Plugin.Calendar" Version="'$(nugetVersion)'" \/>/g' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
139-
140-
cat src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
141-
cat src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
142-
143-
nuget restore src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj -NonInteractive -Source $(build.binariesDirectory)/nuget/nupkg/ -Source https://api.nuget.org/v3/index.json
144-
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
134+
nuget restore src\Calendar.Plugin.Sample\SampleApp\SampleApp.csproj -NonInteractive -Source $(build.binariesDirectory)\nuget\nupkg\ -Source https://api.nuget.org/v3/index.json
135+
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
145136
146137
- task: XamarinAndroid@1
147138
displayName: 'Build Xamarin.Android project SampleApp.Android.csproj'

Diff for: src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.3.0" />
5959
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.7" />
6060
<PackageReference Include="Xamarin.AndroidX.CardView" Version="1.0.0.8" />
61-
<PackageReference Include="Xamarin.AndroidX.MediaRouter" Version="1.2.3" />
61+
<PackageReference Include="Xamarin.AndroidX.MediaRouter" Version="1.2.4" />
6262
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.Core.Utils" Version="1.0.0.7" />
6363
<PackageReference Include="Xamarin.AndroidX.Browser" Version="1.3.0.5" />
6464
<PackageReference Include="Xamarin.Forms">

Diff for: src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj

+3
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@
6363
<CodesignKey>iPhone Developer</CodesignKey>
6464
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
6565
</PropertyGroup>
66+
<PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' ">
67+
<AppExtensionDebugBundleId />
68+
</PropertyGroup>
6669
<ItemGroup>
6770
<Compile Include="Main.cs" />
6871
<Compile Include="AppDelegate.cs" />

Diff for: src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFramework>netstandard2.1</TargetFramework>
55
<ProduceAssemblyReference>true</ProduceAssemblyReference>
66
<LangVersion>latest</LangVersion>
77
</PropertyGroup>
88

99
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
10-
<DebugType>pdbonly</DebugType>
10+
<DebugType>portable</DebugType>
1111
<DebugSymbols>true</DebugSymbols>
12+
<DefineConstants>DEBUG;TRACE</DefineConstants>
1213
</PropertyGroup>
1314

1415
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">

Diff for: src/Calendar.Plugin/CalendarPlugin.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="MSBuild.Sdk.Extras/3.0.23">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;MonoAndroid10.0;Xamarin.iOS10</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.1;MonoAndroid10.0;Xamarin.iOS10</TargetFrameworks>
55
<Product>$(AssemblyName) ($(TargetFramework))</Product>
66
<PackageId>Xamarin.Plugin.Calendar</PackageId>
77
<PackageTags>events calendar, calendar, xamarin forms, custom calendar</PackageTags>

Diff for: src/Calendar.Plugin/Shared/Controls/Calendar.xaml.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ public bool AnimateCalendar
851851
public static readonly BindableProperty SelectedDateProperty =
852852
BindableProperty.Create(nameof(SelectedDate), typeof(DateTime?), typeof(Calendar), null, BindingMode.TwoWay, propertyChanged: OnSelectedDateChanged);
853853

854-
protected internal static void OnSelectedDateChanged(BindableObject bindable, object oldValue, object newValue)
854+
private static void OnSelectedDateChanged(BindableObject bindable, object oldValue, object newValue)
855855
{
856856
var control = (Calendar)bindable;
857857
var dateToSet = (DateTime?)newValue;
@@ -1022,7 +1022,9 @@ private static void OnMonthYearChanged(BindableObject bindable, object oldValue,
10221022
}
10231023
}
10241024

1025-
/// <summary> Method that is called when a bound property is changed. </summary>
1025+
/// <summary>
1026+
/// Method that is called when a bound property is changed.
1027+
/// </summary>
10261028
/// <param name="propertyName">The name of the bound property that changed.</param>
10271029
protected override void OnPropertyChanged([CallerMemberName] string propertyName = null)
10281030
{

Diff for: src/Calendar.Plugin/Shared/Controls/RangeSelectionCalendar.cs

+4
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ public RangeSelectionCalendar() : base()
4949
_selectionEngine = monthDaysView.CurrentSelectionEngine as RangedSelectionEngine;
5050
}
5151

52+
/// <summary>
53+
/// Method that is called when a bound property is changed.
54+
/// </summary>
55+
/// <param name="propertyName">The name of the bound property that changed.</param>
5256
protected override void OnPropertyChanged([CallerMemberName] string propertyName = null)
5357
{
5458
base.OnPropertyChanged(propertyName);

0 commit comments

Comments
 (0)