This commit is contained in:
Jérôme Laban 2019-05-22 15:22:54 -04:00
Родитель f93281dc78
Коммит 4f8d2b602b
23 изменённых файлов: 399 добавлений и 107 удалений

3
.gitignore поставляемый
Просмотреть файл

@ -292,4 +292,5 @@ Generated Files/
src/GraphControl/GraphingImplOverrides.props
!/build/config/TRexDefs/**
!src/Calculator/TemporaryKey.pfx
!src/CalculatorUnitTests/CalculatorUnitTests_TemporaryKey.pfx
!src/CalculatorUnitTests/CalculatorUnitTests_TemporaryKey.pfx
*.binlog

Просмотреть файл

@ -13,9 +13,9 @@ jobs:
clean: true
- bash: |
sudo chmod -R 777 /emsdk
cd /emsdk
sudo ./emsdk activate sdk-1.38.28-64bit
sudo ./emsdk activate sdk-1.38.31-64bit
sudo chmod -R 777 /emsdk
displayName: 'Setup Emscripten'
@ -37,7 +37,8 @@ jobs:
- script: |
source /emsdk/emsdk_env.sh
cd $(build.sourcesdirectory)
msbuild /r /p:Configuration=Release "/p:PackageVersion=$(GITVERSION_FullSemVer)" /p:MixedModeBuild=$(MixedModeBuild) $(build.sourcesdirectory)/src/Calculator.Wasm/Calculator.Wasm.csproj
msbuild /r /p:BuildPlatformTarget=Wasm $(build.sourcesdirectory)/src/build/build.csproj
msbuild /r /p:Configuration=Release $(build.sourcesdirectory)/src/Calculator.Wasm/Calculator.Wasm.csproj
env:
GITVERSION_FullSemVer: $(GITVERSION_FullSemVer)

Просмотреть файл

@ -14,13 +14,26 @@ jobs:
versionSpec: 4.9.1
checkLatest: false
- task: MSBuild@1
inputs:
solution: src/build/build.csproj
msbuildLocationMethod: version
msbuildVersion: latest
msbuildArchitecture: x86
msbuildArguments: /r /p:Configuration=Release /detailedsummary
clean: false
maximumCpuCount: true
restoreNugetPackages: false
logProjectEvents: false
createLogFile: false
- task: MSBuild@1
inputs:
solution: src/Calculator.sln
msbuildLocationMethod: version
msbuildVersion: latest
msbuildArchitecture: x86
msbuildArguments: /r /p:Configuration=Release "/p:PackageVersion=%GITVERSION_FullSemVer%" "/p:InformationalVersion=%GITVERSION_InformationalVersion%" /detailedsummary
msbuildArguments: /r /p:Configuration=Release /detailedsummary
clean: false
maximumCpuCount: true
restoreNugetPackages: false

Просмотреть файл

@ -45,13 +45,26 @@ jobs:
displayName: Build native CalcManager
- task: MSBuild@1
inputs:
solution: '$(build.sourcesdirectory)/src/build/build.csproj'
msbuildLocationMethod: version
msbuildVersion: latest
msbuildArchitecture: x86
msbuildArguments: /r /p:BuildPlatformTarget=iOS /bl:$(build.artifactstagingdirectory)/build.binlog
clean: false
maximumCpuCount: true
restoreNugetPackages: false
logProjectEvents: true
createLogFile: true
- task: MSBuild@1
inputs:
solution: '$(build.sourcesdirectory)/src/Calculator.iOS/Calculator.iOS.csproj'
msbuildLocationMethod: version
msbuildVersion: latest
msbuildArchitecture: x86
msbuildArguments: /r /p:Configuration=Release /p:Platform=iPhone /detailedsummary /m:16 /nr:false "/p:InformationalVersion=%GITVERSION_InformationalVersion%"
msbuildArguments: /r /p:Configuration=Release /p:Platform=iPhone /bl:$(build.artifactstagingdirectory)/build.binlog
clean: false
maximumCpuCount: true
restoreNugetPackages: false
@ -69,6 +82,7 @@ jobs:
flattenFolders: false
- task: PublishBuildArtifacts@1
condition: always()
inputs:
PathtoPublish: $(build.artifactstagingdirectory)
ArtifactName: Uno-Calculator-iOS

Просмотреть файл

@ -1,7 +1,7 @@
resources:
containers:
- container: nv-bionic-wasm
image: nventive/wasm-build:1.2
image: nventive/wasm-build:1.3
jobs:
- template: .vsts-ci.Windows.yml

Просмотреть файл

@ -0,0 +1,17 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: System.Reflection.AssemblyVersion("1.0.0.0")]
[assembly: System.Reflection.AssemblyFileVersion("270")]
[assembly: System.Reflection.AssemblyProduct("AppVersion for Android")]
[assembly: System.Reflection.AssemblyInformationalVersion("1.0.0.0")]
[assembly: System.Reflection.AssemblyCopyright("Copyright (C) 2019")]

Просмотреть файл

@ -0,0 +1,17 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: System.Reflection.AssemblyVersion("1.0.0.0")]
[assembly: System.Reflection.AssemblyFileVersion("270")]
[assembly: System.Reflection.AssemblyProduct("AppVersion for Windows")]
[assembly: System.Reflection.AssemblyInformationalVersion("1.0.0.0")]
[assembly: System.Reflection.AssemblyCopyright("Copyright (C) 2019")]

Просмотреть файл

@ -0,0 +1,17 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: System.Reflection.AssemblyVersion("1.0.0.0")]
[assembly: System.Reflection.AssemblyFileVersion("270")]
[assembly: System.Reflection.AssemblyProduct("AppVersion for Windows Phone")]
[assembly: System.Reflection.AssemblyInformationalVersion("1.0.0.0")]
[assembly: System.Reflection.AssemblyCopyright("Copyright (C) 2019")]

Просмотреть файл

@ -0,0 +1,17 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: System.Reflection.AssemblyVersion("1.0.0.0")]
[assembly: System.Reflection.AssemblyFileVersion("270")]
[assembly: System.Reflection.AssemblyProduct("AppVersion for iOS")]
[assembly: System.Reflection.AssemblyInformationalVersion("1.0.0.0")]
[assembly: System.Reflection.AssemblyCopyright("Copyright (C) 2019")]

Просмотреть файл

@ -15,7 +15,7 @@ mkdir bin/arm64
libtool \
-static \
*.o \
-o bin/arm64/libCalcManager.a
-o ../Calculator.iOS/NativeReferences/arm64/libCalcManager.a
rm *.o
@ -32,7 +32,7 @@ mkdir bin/x86_64
libtool \
-static \
*.o \
-o bin/x86_64/libCalcManager.a
-o ../Calculator.iOS/NativeReferences/x86_64/libCalcManager.a
rm *.o

Просмотреть файл

@ -58,6 +58,9 @@
<PackageReference Include="Uno.UniversalImageLoader" Version="1.9.32" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\AssemblyVersion.Android.cs">
<Link>Properties\AssemblyVersion.Android.cs</Link>
</Compile>
<Compile Include="MainActivity.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Main.cs" />
@ -88,4 +91,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>

Просмотреть файл

@ -10,21 +10,6 @@ using Android.App;
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UnoQuickStart.Droid")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Просмотреть файл

@ -9,7 +9,7 @@
<Version>4.3.1</Version>
</PackageReference>
<PackageReference Include="Uno.UI">
<Version>1.45.0-dev.1457</Version>
<Version>1.45.0-dev.1503</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup>
@ -103,6 +103,9 @@
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
</ItemGroup>
<ItemGroup>
<Compile Include="..\AssemblyVersion.Uwp.cs">
<Link>Properties\AssemblyVersion.Uwp.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
@ -127,4 +130,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>

Просмотреть файл

@ -9,21 +9,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UnoQuickStart")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]
[assembly: ComVisible(false)]

Просмотреть файл

@ -1,50 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netstandard2.0</TargetFramework>
<WasmHead>true</WasmHead>
<DefineConstants>$(DefineConstants);__WASM__</DefineConstants>
<NoWarn>NU1701</NoWarn>
<WasmShellGenerateCompressedFiles Condition="'$(Configuration)'=='Debug'">false</WasmShellGenerateCompressedFiles>
<!--<BuildingInsideUnoSourceGenerator>true</BuildingInsideUnoSourceGenerator>-->
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netstandard2.0</TargetFramework>
<WasmHead>true</WasmHead>
<DefineConstants>$(DefineConstants);__WASM__</DefineConstants>
<NoWarn>NU1701</NoWarn>
<WasmShellGenerateCompressedFiles Condition="'$(Configuration)'=='Debug'">false</WasmShellGenerateCompressedFiles>
<MonoRuntimeDebuggerEnabled Condition="'$(Configuration)'=='Debug'">true</MonoRuntimeDebuggerEnabled>
<WasmShellMonoRuntimeExecutionMode Condition="$([MSBuild]::IsOsPlatform('Linux'))">FullAOT</WasmShellMonoRuntimeExecutionMode>
<MonoWasmRuntimeConfiguration>release-dynamic</MonoWasmRuntimeConfiguration>
<!-- This build a custom one pending a PR in mono -->
<MonoWasmSDKUri Condition="'$(Configuration)'=='Debug'">C:\Users\jerome.laban\Downloads\mono-wasm-527abcd1152.zip</MonoWasmSDKUri>
</PropertyGroup>
<ItemGroup>
<Content Include="..\Calculator.UWP\Assets\*.png" Link="Assets\%(FileName)%(Extension)" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="WasmCSS\Fonts.css" />
<EmbeddedResource Include="WasmScripts\*.js" />
</ItemGroup>
<ItemGroup>
<LinkerDescriptor Include="LinkerConfig.xml" />
</ItemGroup>
<ItemGroup>
<!--
<ItemGroup>
<Content Include="..\Calculator.UWP\Assets\*.png" Link="Assets\%(FileName)%(Extension)" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="WasmCSS\Fonts.css" />
<EmbeddedResource Include="WasmScripts\*.js" />
</ItemGroup>
<ItemGroup>
<LinkerDescriptor Include="LinkerConfig.xml" />
</ItemGroup>
<ItemGroup>
<!--
This item group is required by the project templace because of the
new SDK-Style project, otherwise some files are not aded automatically.
You can safely remove this ItemGroup completely.
-->
<Compile Remove="Program.cs" />
<None Remove="WasmScripts\CalcManager.js" />
<Compile Include="Program.cs" />
<Content Include="LinkerConfig.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
<PackageReference Include="Uno.UI" Version="1.45.0-dev.1457" />
<PackageReference Include="Uno.Wasm.Bootstrap" Version="1.0.0-dev.271" />
<DotNetCliToolReference Include="Uno.Wasm.Bootstrap.Cli" Version="1.0.0-dev.269" />
</ItemGroup>
<ItemGroup>
<Content Include="..\CalcManager\CalcManager.wasm" Link="CalcManager.wasm" />
</ItemGroup>
<Import Project="..\Calculator.Shared\Calculator.Shared.projitems" Label="Shared" Condition="Exists('..\Calculator.Shared\Calculator.Shared.projitems')" />
<Compile Remove="Program.cs" />
<None Remove="WasmScripts\CalcManager.js" />
<Compile Include="Program.cs" />
<Content Include="LinkerConfig.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
<PackageReference Include="Uno.UI" Version="1.45.0-dev.1503" />
<PackageReference Include="Uno.Wasm.Bootstrap" Version="1.0.0-dev.278" />
<DotNetCliToolReference Include="Uno.Wasm.Bootstrap.Cli" Version="1.0.0-dev.276" />
</ItemGroup>
<ItemGroup>
<Content Include="..\CalcManager\CalcManager.wasm" Link="CalcManager.wasm" />
</ItemGroup>
<Import Project="..\Calculator.Shared\Calculator.Shared.projitems" Label="Shared" Condition="Exists('..\Calculator.Shared\Calculator.Shared.projitems')" />
</Project>

Просмотреть файл

@ -1,9 +1,3 @@
<linker>
<assembly fullname="Calculator.Wasm" />
<assembly fullname="Uno.UI" />
<assembly fullname="System.Core">
<!-- This is required by JSon.NET and any expression.Compile caller -->
<type fullname="System.Linq.Expressions*" />
</assembly>
</linker>

Просмотреть файл

@ -114,6 +114,9 @@
<AppExtensionDebugBundleId />
</PropertyGroup>
<ItemGroup>
<Compile Include="..\AssemblyVersion.iOS.cs">
<Link>Properties\AssemblyVersion.iOS.cs</Link>
</Compile>
<Compile Include="Main.cs" />
<ImageAsset Include="Media.xcassets\AppIcons.appiconset\Icon-83.5%402x.png">
<Visible>false</Visible>
@ -172,6 +175,8 @@
<ImageAsset Include="Media.xcassets\LaunchImages.launchimage\Contents.json">
<Visible>false</Visible>
</ImageAsset>
<None Include="NativeReferences\arm64\libCalcManager.a" />
<None Include="NativeReferences\x86_64\libCalcManager.a" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
@ -183,18 +188,18 @@
<BundleResource Include="Resources\Fonts\winjs-symbols.ttf" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Uno.UI" Version="1.45.0-dev.1457" />
<PackageReference Include="Uno.UI" Version="1.45.0-dev.1503" />
</ItemGroup>
<ItemGroup Condition=" '$(Platform)' == 'iPhoneSimulator' ">
<NativeReference Include="Native References/x86_64/libCalcManager.a">
<NativeReference Include="NativeReferences/x86_64/libCalcManager.a">
<Kind>Static</Kind>
</NativeReference>
</ItemGroup>
<ItemGroup Condition=" '$(Platform)' == 'iPhone' ">
<NativeReference Include="Native References/arm64/libCalcManager.a">
<NativeReference Include="NativeReferences/arm64/libCalcManager.a">
<Kind>Static</Kind>
</NativeReference>
</ItemGroup>
<Import Project="..\Calculator.Shared\Calculator.Shared.projitems" Label="Shared" Condition="Exists('..\Calculator.Shared\Calculator.Shared.projitems')" />
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
</Project>
</Project>

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичные данные
src/Calculator.iOS/NativeReferences/arm64/libCalcManager.a Normal file

Двоичный файл не отображается.

Двоичные данные
src/Calculator.iOS/NativeReferences/x86_64/libCalcManager.a Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -5,12 +5,10 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UnoQuickStart.iOS")]
[assembly: AssemblyTitle("Uno Calculator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UnoQuickStart.iOS")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@ -21,16 +19,3 @@ using System.Runtime.InteropServices;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("166de4ca-8f11-4ef9-bcf8-3e7834988e7d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

237
src/build/build.csproj Normal file
Просмотреть файл

@ -0,0 +1,237 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<IsTool>true</IsTool>
<IncludeBuildOutput>false</IncludeBuildOutput>
<AppName>Calculator</AppName>
<IncludeBuildInVersion>true</IncludeBuildInVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MSBuildTasks" Version="1.5.0.235" />
</ItemGroup>
<Target Name="RunBuild" AfterTargets="Build">
<CallTarget Targets="BuildVersion">
<Output TaskParameter="TargetOutputs" PropertyName="_VersionOutput"/>
</CallTarget>
<ItemGroup>
<PackageVersion Include="$(_VersionOutput.Split(';')[0])" />
<PackageBuildNumber Include="$(_VersionOutput.Split(';')[1])" />
</ItemGroup>
</Target>
<Target Name="BuildVersion"
Outputs="$(_AppVersion);$(_BuildNumber)"
Condition="'$(GITVERSION_InformationalVersion)'!=''">
<!-- Build Number -->
<PropertyGroup>
<_BuildNumber>$(PackageBuildNumber)</_BuildNumber>
<_BuildNumber Condition="'$(BUILD_REPOSITORY_PROVIDER)' == 'TfsVersionControl'">$(BUILD_SOURCEVERSION.Substring(1))</_BuildNumber>
</PropertyGroup>
<Message Text="%0A#### Running BuildVersion"
Importance="$(_MessageImportance)" />
<Exec Command="git rev-list --count HEAD"
Condition="'$(_BuildNumber)' == ''"
ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput"
PropertyName="_BuildNumber" />
</Exec>
<PropertyGroup>
<_BuildNumber Condition="$(BuildNumberOffset) != ''">$([MSBuild]::Add($(_BuildNumber), $(BuildNumberOffset)))</_BuildNumber>
<_InformationalVersion>$(PackageInformationalVersion)</_InformationalVersion>
<_InformationalVersion Condition="'$(_InformationalVersion)' == ''">$(GITVERSION_InformationalVersion)</_InformationalVersion>
<_AppVersion>$(PackageVersion)</_AppVersion>
<_AppVersion Condition="'$(_AppVersion)'==''">$(GitVersion_MajorMinorPatch)</_AppVersion>
</PropertyGroup>
<Error Condition="'$(_InformationalVersion)'=='' Or '$(_AppVersion)'==''"
Text="Failed to calculate version. You must either run GitVersion before building the application or set both AppVersion and InformationalVersion variables."/>
<!-- App version without revision -->
<PropertyGroup Condition="'$(IncludeBuildInVersion)' == 'True'">
<_AppVersion>$(GitVersion_Major).$(GitVersion_Minor).$(_BuildNumber)</_AppVersion>
</PropertyGroup>
<!-- Pad the version in case it's too short -->
<PropertyGroup Condition="'$(IncludeBuildInVersion)' != 'True'">
<_AppVersion Condition="$(_AppVersion.Split('.').length) == 1">$(_AppVersion).0.0</_AppVersion>
<_AppVersion Condition="$(_AppVersion.Split('.').length) == 2">$(_AppVersion).0</_AppVersion>
</PropertyGroup>
<!-- App revision -->
<PropertyGroup>
<AppRevision Condition="'$(AppRevision)'==''">0</AppRevision>
<_AppVersion>$(_AppVersion).$(AppRevision)</_AppVersion>
</PropertyGroup>
<Message Text="App version : $(_AppVersion)"
Importance="$(_MessageImportance)" />
<Message Text="Build number : $(_BuildNumber)"
Importance="$(_MessageImportance)" />
<Message Text="Informational version : $(_InformationalVersion)"
Importance="$(_MessageImportance)" />
<!-- Create official assembly version files with right version number -->
<AssemblyInfo
CodeLanguage="CS"
OutputFile="../AssemblyVersion.Uwp.cs"
AssemblyVersion="$(_AppVersion)"
AssemblyFileVersion="$(GitVersion_MajorMinorPatch)"
AssemblyProduct="$(ProjectName) for Windows"
AssemblyCompany="$(CompanyName)"
AssemblyInformationalVersion="$(_InformationalVersion)"
AssemblyCopyright="Copyright (C) $(CompanyName) $([System.DateTime]::Now.Year)" />
<AssemblyInfo
CodeLanguage="CS"
OutputFile="../AssemblyVersion.Wasm.cs"
AssemblyVersion="$(_AppVersion)"
AssemblyFileVersion="$(_BuildNumber)"
AssemblyProduct="$(ProjectName) for WebAssembly"
AssemblyCompany="$(CompanyName)"
AssemblyInformationalVersion="$(_InformationalVersion)"
AssemblyCopyright="Copyright (C) $(CompanyName) $([System.DateTime]::Now.Year)" />
<AssemblyInfo
CodeLanguage="CS"
OutputFile="../AssemblyVersion.iOS.cs"
AssemblyVersion="$(_AppVersion)"
AssemblyFileVersion="$(_BuildNumber)"
AssemblyProduct="$(ProjectName) for iOS"
AssemblyCompany="$(CompanyName)"
AssemblyInformationalVersion="$(_InformationalVersion)"
AssemblyCopyright="Copyright (C) $(CompanyName) $([System.DateTime]::Now.Year)" />
<AssemblyInfo
CodeLanguage="CS"
OutputFile="../AssemblyVersion.Android.cs"
AssemblyVersion="$(_AppVersion)"
AssemblyFileVersion="$(_BuildNumber)"
AssemblyProduct="$(ProjectName) for Android"
AssemblyCompany="$(CompanyName)"
AssemblyInformationalVersion="$(_InformationalVersion)"
AssemblyCopyright="Copyright (C) $(CompanyName) $([System.DateTime]::Now.Year)" />
<Message Text="#### Done running BuildVersion"
Importance="$(_MessageImportance)" />
<Message Text="%0A"
Importance="$(_MessageImportance)" />
</Target>
<UsingTask TaskName="_XmlUpdate"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)/Microsoft.Build.Tasks.v12.0.dll" >
<ParameterGroup>
<XmlFileName Required="True" />
<XPath Required="True" />
<Value Required="True" />
</ParameterGroup>
<Task>
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Using Namespace="System"/>
<Using Namespace="System.Xml.XPath"/>
<!-- The following code is from the MSBuildTasks library (https://github.com/loresoft/msbuildtasks/blob/6196d43e7eb6807f306e9861b286fe61c8bb0993/Source/MSBuild.Community.Tasks/XmlUpdate.cs) -->
<!-- MSBuildTasks is not used as it brings a Zip tasks that conflicts with Xamarin's -->
<Code Type="Fragment" Language="cs">
<![CDATA[
System.Xml.Linq.XDocument xdoc = System.Xml.Linq.XDocument.Load(XmlFileName);
System.Xml.XmlNamespaceManager manager = new System.Xml.XmlNamespaceManager(new System.Xml.NameTable());
var items = xdoc.XPathEvaluate(XPath, manager) as System.Collections.Generic.IEnumerable<object>;
Console.WriteLine("Updating " + items.Count() + " nodes");
foreach (var item in items.ToArray())
{
var attr = item as System.Xml.Linq.XAttribute;
if (attr != null)
{
attr.SetValue(Value);
}
var ele = item as System.Xml.Linq.XElement;
if (ele != null)
{
ele.SetValue(Value);
}
}
xdoc.Save(XmlFileName);
]]>
</Code>
</Task>
</UsingTask>
<Target Name="_SetPackageVersion"
AfterTargets="RunBuild"
Condition="'$(PackageVersion)'!='' And '$(PackageBuildNumber)'!=''">
<PropertyGroup>
<_SourceBasePath>../$(AppName)</_SourceBasePath>
<_ManifestPath>$(_SourceBasePath).Android/Properties/AndroidManifest.xml</_ManifestPath>
<_PlistFilePath>$(_SourceBasePath).Android/Info.plist</_PlistFilePath>
<_AppxManifestPath>$(_SourceBasePath).Android/Package.appxmanifest</_AppxManifestPath>
<_AndroidNamespace>
<Namespace Prefix="android" Uri="http://schemas.android.com/apk/res/android" />
</_AndroidNamespace>
<_WindowsNamespace>
<Namespace Prefix="x" Uri="http://schemas.microsoft.com/appx/manifest/foundation/windows10" />
</_WindowsNamespace>
</PropertyGroup>
<!-- Android -->
<XmlPoke Condition="Exists('$(_ManifestPath)')"
XmlInputPath="$(_ManifestPath)"
Query="/manifest/@android:versionName"
Value="$(PackageVersion)"
Namespaces="$(_AndroidNamespace)" />
<XmlPoke Condition="Exists('$(_ManifestPath)')"
XmlInputPath="$(_ManifestPath)"
Query="/manifest/@android:versionCode"
Value="$(PackageBuildNumber)"
Namespaces="$(_AndroidNamespace)" />
<!-- iOS -->
<!-- Using our own _XmlUpdate instead of XmlPoke to avoid unecessary (and possibly breaking) changes in the plist -->
<_XmlUpdate Condition="Exists('$(_PlistFilePath)')"
XmlFileName="$(_PlistFilePath)"
XPath="//plist/dict/key[text() = 'CFBundleShortVersionString']/following-sibling::string[1]"
Value="$(PackageVersion)" />
<_XmlUpdate Condition="Exists('$(_PlistFilePath)')"
XmlFileName="$(_PlistFilePath)"
XPath="//plist/dict/key[text() = 'CFBundleVersion']/following-sibling::string[1]"
Value="$(PackageBuildNumber)" />
<!-- UWP -->
<ItemGroup>
<_Major Include="$(PackageVersion.Split('.')[0])" />
<_Minor Include="$(PackageVersion.Split('.')[1])" />
<_Revision Include="$(PackageVersion.Split('.')[3])" />
</ItemGroup>
<!-- Forcing the inclusion of the build number in UWP as the standard format is Major.Minor.Build.Revision -->
<!-- Not doing this makes it impossible to update a package unless the version is updated -->
<PropertyGroup>
<_UWPVersion>@(_Major).@(_Minor).$(PackageBuildNumber).@(_Revision)</_UWPVersion>
</PropertyGroup>
<XmlPoke Condition="Exists('$(_AppxManifestPath)')"
XmlInputPath="$(_AppxManifestPath)"
Query="/x:Package/x:Identity/@Version"
Value="$(_UWPVersion)"
Namespaces="$(_WindowsNamespace)" />
</Target>
</Project>