Skip to content

Commit

Permalink
Fix ios build (#31)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
anTONIos authored Feb 24, 2020
1 parent b12fb58 commit f50b4f0
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 23 deletions.
84 changes: 71 additions & 13 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj"/<PackageReference Include="Xamarin.Plugin.Calendar" Version="'$(nugetVersion)'"/g' src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj
sed -i .bak -e '/81e938f4-a11c-4726-a13f-0d7ecc84ca66/d' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
sed -i .bak -e '/<Name>CalendarPlugin/d' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
sed -E -i .bak -e '/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj">/{N;s/\n.*//;}' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
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
sed -i .bak -e '/81e938f4-a11c-4726-a13f-0d7ecc84ca66/d' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
sed -i .bak -e '/<Name>CalendarPlugin/d' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
sed -E -i .bak -e '/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj">/{N;s/\n.*//;}' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
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
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)'
Expand All @@ -67,27 +94,58 @@ jobs:
buildForSimulator: true

- job: 'AndroidSampleApp'
dependsOn:
- Nuget
pool:
vmImage: 'windows-latest'
vmImage: 'macOS-latest'
steps:
- task: NuGetToolInstaller@1
- task: UseDotNet@2
displayName: 'Use dotnet sdk 3.x'
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/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj"/<PackageReference Include="Xamarin.Plugin.Calendar" Version="'$(nugetVersion)'"/g' src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj
sed -i .bak -e '/81e938f4-a11c-4726-a13f-0d7ecc84ca66/d' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
sed -i .bak -e '/<Name>CalendarPlugin/d' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
sed -E -i .bak -e '/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj">/{N;s/\n.*//;}' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj
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
sed -i .bak -e '/81e938f4-a11c-4726-a13f-0d7ecc84ca66/d' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
sed -i .bak -e '/<Name>CalendarPlugin/d' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
sed -E -i .bak -e '/<ProjectReference Include="..\\..\\Calendar.Plugin\\CalendarPlugin.csproj">/{N;s/\n.*//;}' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
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
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:
projectFile: '**/SampleApp.Android.csproj'
createAppPackage: true
outputDirectory: '$(build.binariesdirectory)/$(BuildConfiguration)'
jdkOption: 'JDKVersion'
clean: true
clean: false
configuration: '$(BuildConfiguration)'
msbuildVersionOption: latest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<Reference Include="System.Numerics.Vectors" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.4.0.991477" />
<PackageReference Include="Xamarin.Forms" Version="4.4.0.991640" />
<PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.v4" Version="28.0.0.3" />
Expand Down Expand Up @@ -96,15 +96,19 @@
<Folder Include="Resources\drawable-xxxhdpi\" />
<Folder Include="Resources\drawable\" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />

<ItemGroup>
<ProjectReference Include="..\..\Calendar.Plugin\CalendarPlugin.csproj">
<Project>{81e938f4-a11c-4726-a13f-0d7ecc84ca66}</Project>
<Project>{81e938f4-a11c-4726-a13f-0d7ecc84ca66}</Project>
<Name>CalendarPlugin</Name>
</ProjectReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\SampleApp\SampleApp.csproj">
<Project>{E4FB5119-AAD4-43E4-8741-1759FAF4083B}</Project>
<Name>SampleApp</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
</Project>
</Project>
8 changes: 6 additions & 2 deletions src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,21 @@
<Reference Include="System.Numerics.Vectors" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.4.0.991477" />
<PackageReference Include="Xamarin.Forms" Version="4.4.0.991640" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />

<ItemGroup>
<ProjectReference Include="..\..\Calendar.Plugin\CalendarPlugin.csproj">
<Project>{81e938f4-a11c-4726-a13f-0d7ecc84ca66}</Project>
<Name>CalendarPlugin</Name>
</ProjectReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\SampleApp\SampleApp.csproj">
<Project>{E4FB5119-AAD4-43E4-8741-1759FAF4083B}</Project>
<Name>SampleApp</Name>
</ProjectReference>
</ItemGroup>
</Project>
</Project>
3 changes: 2 additions & 1 deletion src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.4.0.991477" />
<PackageReference Include="Xamarin.Forms" Version="4.4.0.991640" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Calendar.Plugin\CalendarPlugin.csproj" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions src/Calendar.Plugin/CalendarPlugin.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project Sdk="MSBuild.Sdk.Extras/2.0.54">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;MonoAndroid81;Xamarin.iOS10</TargetFrameworks>
<Authors>Josip Caleta</Authors>
Expand Down Expand Up @@ -48,7 +48,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="3.2.0.839982" />
<PackageReference Include="Xamarin.Forms" Version="3.3.0.912540" />
<Compile Include="Shared\**\*.cs" />
</ItemGroup>

Expand Down Expand Up @@ -100,5 +100,5 @@
<Compile Include="iOS\*.cs" />
</ItemGroup>


<Import Project="$(MSBuildSDKExtrasTargets)" Condition="Exists('$(MSBuildSDKExtrasTargets)')" />
</Project>

0 comments on commit f50b4f0

Please sign in to comment.