Skip to content

Commit f50b4f0

Browse files
author
anTONIos
authored
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
1 parent b12fb58 commit f50b4f0

File tree

5 files changed

+90
-23
lines changed

5 files changed

+90
-23
lines changed

azure-pipelines.yml

Lines changed: 71 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,23 @@ jobs:
2525
- task: NuGetCommand@2
2626
displayName: 'Nuget restore solution'
2727
inputs:
28-
restoreSolution: '**/*.sln'
28+
restoreSolution: '**/CalendarPlugin.csproj'
2929

3030
- task: MSBuild@1
3131
inputs:
3232
solution: '**/CalendarPlugin.csproj'
33+
msbuildArguments: '/p:Version=$(nugetVersion)'
3334
configuration: '$(BuildConfiguration)'
34-
msbuildArguments: '/p:Version=$(nugetVersion) /p:OutputPath=$(Build.ArtifactStagingDirectory)/$(BuildPlatform)/$(BuildConfiguration)/'
3535

3636
- task: PublishBuildArtifacts@1
3737
displayName: 'Publish Artifact: nupkg'
3838
inputs:
39-
PathtoPublish: '$(Build.ArtifactStagingDirectory)/$(BuildPlatform)/$(BuildConfiguration)'
39+
PathtoPublish: 'src\Calendar.Plugin\bin\Release\'
4040
ArtifactName: nupkg
4141

4242
- job: 'iOSSampleApp'
43+
dependsOn:
44+
- Nuget
4345
pool:
4446
vmImage: 'macOS-latest'
4547
steps:
@@ -49,16 +51,41 @@ jobs:
4951
inputs:
5052
version: 3.x
5153

52-
- script: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 6_4_0
54+
- script: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 6_6_0
5355
displayName: 'Selecting the Xamarin SDK version'
5456

55-
- task: NuGetCommand@2
56-
displayName: 'Nuget restore solution'
57+
- task: DownloadBuildArtifacts@0
58+
displayName: "Download PackNugetPackage artifacts"
5759
inputs:
58-
restoreSolution: '**/*.sln'
60+
buildType: 'current'
61+
downloadType: 'single'
62+
downloadPath: '$(build.binariesDirectory)/nuget/'
63+
artifactName: 'nupkg'
64+
65+
- task: Bash@3
66+
inputs:
67+
targetType: 'inline'
68+
script: |
69+
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
70+
71+
sed -i .bak -e '/81e938f4-a11c-4726-a13f-0d7ecc84ca66/d' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
72+
sed -i .bak -e '/<Name>CalendarPlugin/d' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
73+
sed -E -i .bak -e '/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj">/{N;s/\n.*//;}' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
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.Android/SampleApp.Android.csproj
75+
76+
sed -i .bak -e '/81e938f4-a11c-4726-a13f-0d7ecc84ca66/d' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
77+
sed -i .bak -e '/<Name>CalendarPlugin/d' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
78+
sed -E -i .bak -e '/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj">/{N;s/\n.*//;}' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.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.iOS/SampleApp.iOS.csproj
80+
81+
cat src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
82+
cat src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
83+
84+
nuget restore src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj -NonInteractive -Source $(build.binariesDirectory)/nuget/nupkg/ -Source https://api.nuget.org/v3/index.json
85+
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
5986
6087
- task: XamariniOS@2
61-
continueOnError: true
88+
continueOnError: true
6289
inputs:
6390
solutionFile: '**/SampleApp.iOS.csproj'
6491
configuration: '$(buildConfiguration)'
@@ -67,27 +94,58 @@ jobs:
6794
buildForSimulator: true
6895

6996
- job: 'AndroidSampleApp'
97+
dependsOn:
98+
- Nuget
7099
pool:
71-
vmImage: 'windows-latest'
100+
vmImage: 'macOS-latest'
72101
steps:
73102
- task: NuGetToolInstaller@1
74103
- task: UseDotNet@2
75104
displayName: 'Use dotnet sdk 3.x'
76105
inputs:
77106
version: 3.x
78107

79-
- task: NuGetCommand@2
80-
displayName: 'Nuget restore solution'
108+
- script: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 6_6_0
109+
displayName: 'Selecting the Xamarin SDK version'
110+
111+
- task: DownloadBuildArtifacts@0
112+
displayName: "Download PackNugetPackage artifacts"
81113
inputs:
82-
restoreSolution: '**/*.sln'
114+
buildType: 'current'
115+
downloadType: 'single'
116+
downloadPath: '$(build.binariesDirectory)/nuget/'
117+
artifactName: 'nupkg'
118+
119+
- task: Bash@3
120+
inputs:
121+
targetType: 'inline'
122+
script: |
123+
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
124+
125+
sed -i .bak -e '/81e938f4-a11c-4726-a13f-0d7ecc84ca66/d' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
126+
sed -i .bak -e '/<Name>CalendarPlugin/d' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
127+
sed -E -i .bak -e '/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj">/{N;s/\n.*//;}' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
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.Android/SampleApp.Android.csproj
129+
130+
sed -i .bak -e '/81e938f4-a11c-4726-a13f-0d7ecc84ca66/d' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
131+
sed -i .bak -e '/<Name>CalendarPlugin/d' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
132+
sed -E -i .bak -e '/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj">/{N;s/\n.*//;}' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.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.iOS/SampleApp.iOS.csproj
134+
135+
cat src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
136+
cat src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
137+
138+
nuget restore src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj -NonInteractive -Source $(build.binariesDirectory)/nuget/nupkg/ -Source https://api.nuget.org/v3/index.json
139+
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
140+
83141
- task: XamarinAndroid@1
84142
displayName: 'Build Xamarin.Android project SampleApp.Android.csproj'
85143
inputs:
86144
projectFile: '**/SampleApp.Android.csproj'
87145
createAppPackage: true
88146
outputDirectory: '$(build.binariesdirectory)/$(BuildConfiguration)'
89147
jdkOption: 'JDKVersion'
90-
clean: true
148+
clean: false
91149
configuration: '$(BuildConfiguration)'
92150
msbuildVersionOption: latest
93151

src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<Reference Include="System.Numerics.Vectors" />
5353
</ItemGroup>
5454
<ItemGroup>
55-
<PackageReference Include="Xamarin.Forms" Version="4.4.0.991477" />
55+
<PackageReference Include="Xamarin.Forms" Version="4.4.0.991640" />
5656
<PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.3" />
5757
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="28.0.0.3" />
5858
<PackageReference Include="Xamarin.Android.Support.v4" Version="28.0.0.3" />
@@ -96,15 +96,19 @@
9696
<Folder Include="Resources\drawable-xxxhdpi\" />
9797
<Folder Include="Resources\drawable\" />
9898
</ItemGroup>
99+
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
100+
99101
<ItemGroup>
100102
<ProjectReference Include="..\..\Calendar.Plugin\CalendarPlugin.csproj">
101-
<Project>{81e938f4-a11c-4726-a13f-0d7ecc84ca66}</Project>
103+
<Project>{81e938f4-a11c-4726-a13f-0d7ecc84ca66}</Project>
102104
<Name>CalendarPlugin</Name>
103105
</ProjectReference>
106+
</ItemGroup>
107+
108+
<ItemGroup>
104109
<ProjectReference Include="..\SampleApp\SampleApp.csproj">
105110
<Project>{E4FB5119-AAD4-43E4-8741-1759FAF4083B}</Project>
106111
<Name>SampleApp</Name>
107112
</ProjectReference>
108113
</ItemGroup>
109-
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
110-
</Project>
114+
</Project>

src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,21 @@
124124
<Reference Include="System.Numerics.Vectors" />
125125
</ItemGroup>
126126
<ItemGroup>
127-
<PackageReference Include="Xamarin.Forms" Version="4.4.0.991477" />
127+
<PackageReference Include="Xamarin.Forms" Version="4.4.0.991640" />
128128
</ItemGroup>
129129
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
130+
130131
<ItemGroup>
131132
<ProjectReference Include="..\..\Calendar.Plugin\CalendarPlugin.csproj">
132133
<Project>{81e938f4-a11c-4726-a13f-0d7ecc84ca66}</Project>
133134
<Name>CalendarPlugin</Name>
134135
</ProjectReference>
136+
</ItemGroup>
137+
138+
<ItemGroup>
135139
<ProjectReference Include="..\SampleApp\SampleApp.csproj">
136140
<Project>{E4FB5119-AAD4-43E4-8741-1759FAF4083B}</Project>
137141
<Name>SampleApp</Name>
138142
</ProjectReference>
139143
</ItemGroup>
140-
</Project>
144+
</Project>

src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
</PropertyGroup>
1717

1818
<ItemGroup>
19-
<PackageReference Include="Xamarin.Forms" Version="4.4.0.991477" />
19+
<PackageReference Include="Xamarin.Forms" Version="4.4.0.991640" />
2020
</ItemGroup>
2121

2222
<ItemGroup>
2323
<ProjectReference Include="..\..\Calendar.Plugin\CalendarPlugin.csproj" />
2424
</ItemGroup>
25+
2526
</Project>

src/Calendar.Plugin/CalendarPlugin.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Project Sdk="MSBuild.Sdk.Extras/2.0.54">
2-
2+
33
<PropertyGroup>
44
<TargetFrameworks>netstandard2.0;MonoAndroid81;Xamarin.iOS10</TargetFrameworks>
55
<Authors>Josip Caleta</Authors>
@@ -48,7 +48,7 @@
4848
</PropertyGroup>
4949

5050
<ItemGroup>
51-
<PackageReference Include="Xamarin.Forms" Version="3.2.0.839982" />
51+
<PackageReference Include="Xamarin.Forms" Version="3.3.0.912540" />
5252
<Compile Include="Shared\**\*.cs" />
5353
</ItemGroup>
5454

@@ -100,5 +100,5 @@
100100
<Compile Include="iOS\*.cs" />
101101
</ItemGroup>
102102

103-
103+
<Import Project="$(MSBuildSDKExtrasTargets)" Condition="Exists('$(MSBuildSDKExtrasTargets)')" />
104104
</Project>

0 commit comments

Comments
 (0)