forked from cjlotz/Xamarin.Plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.proj
95 lines (82 loc) · 5.09 KB
/
build.proj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="BuildComponent" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildProjectDirectory)\Build.tasks" />
<PropertyGroup>
<XamarinPluginsRoot>$(MSBuildProjectDirectory)</XamarinPluginsRoot>
<XamarinPluginName Condition="'$(XamarinPluginName)' == ''">Messaging</XamarinPluginName>
<XamarinPluginPath>$(XamarinPluginsRoot)\$(XamarinPluginName)</XamarinPluginPath>
<NugetExe>$(XamarinPluginsRoot)\.nuget\NuGet.exe</NugetExe>
<XamarinComponentExe>$(XamarinPluginsRoot)\.xamarin-component\xamarin-component.exe</XamarinComponentExe>
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
</PropertyGroup>
<PropertyGroup>
<MajorVersion Condition="'$(MajorVersion)' == ''">3</MajorVersion>
<MinorVersion Condition="'$(MinorVersion)' == ''">2</MinorVersion>
<Revision Condition="'$(Revision)' == ''">0</Revision>
<Build Condition="'$(Build)' == ''">0</Build>
<GlobalAssemblyInfoPath>$(XamarinPluginPath)\Plugin.$(XamarinPluginName).Shared\GlobalAssemblyInfo.cs</GlobalAssemblyInfoPath>
<AssemblyVersion>$(MajorVersion).$(MinorVersion).$(Revision).$(Build)</AssemblyVersion>
<AssemblyFileVersion>$(MajorVersion).$(MinorVersion).$(Revision).$(Build)</AssemblyFileVersion>
<AssemblyInformationalVersion Condition="'$(Prerelease)' == ''">$(MajorVersion).$(MinorVersion).$(Revision)</AssemblyInformationalVersion>
<AssemblyInformationalVersion Condition="'$(Prerelease)' != ''">$(MajorVersion).$(MinorVersion).$(Revision)-$(Prerelease)</AssemblyInformationalVersion>
<PackageVersion Condition="'$(Prerelease)' == ''">$(MajorVersion).$(MinorVersion).$(Revision)</PackageVersion>
<PackageVersion Condition="'$(Prerelease)' != ''">$(MajorVersion).$(MinorVersion).$(Revision)-$(Prerelease)</PackageVersion>
</PropertyGroup>
<ItemGroup>
<RegexTransform Include="$(GlobalAssemblyInfoPath)">
<Find>AssemblyVersion\("\d+\.\d+\.\d+\.\d+"\)</Find>
<ReplaceWith>AssemblyVersion("$(AssemblyVersion)")</ReplaceWith>
</RegexTransform>
<RegexTransform Include="$(GlobalAssemblyInfoPath)">
<Find>AssemblyFileVersion\("\d+\.\d+\.\d+\.\d+"\)</Find>
<ReplaceWith>AssemblyFileVersion("$(AssemblyFileVersion)")</ReplaceWith>
</RegexTransform>
<RegexTransform Include="$(GlobalAssemblyInfoPath)">
<Find>AssemblyInformationalVersion\("\d+\.\d+\.\d+(?:-\w+)*"\)</Find>
<ReplaceWith>AssemblyInformationalVersion("$(AssemblyInformationalVersion)")</ReplaceWith>
</RegexTransform>
<RegexTransform Include="$(XamarinPluginPath)\Plugin.$(XamarinPluginName).nuspec">
<Find><version>\d+\.\d+\.\d+</Find>
<ReplaceWith><version>$(MajorVersion).$(MinorVersion).$(Revision)</ReplaceWith>
</RegexTransform>
<RegexTransform Include="$(XamarinPluginPath)\Component\component.yaml">
<Find>version: \d+\.\d+\.\d+\.\d+</Find>
<ReplaceWith>version: $(AssemblyFileVersion)</ReplaceWith>
</RegexTransform>
<RegexTransform Include="$(XamarinPluginPath)\Component\component.yaml">
<Find>Xam.Plugins.$(XamarinPluginName), Version=\d+\.\d+\.\d+\.\d+</Find>
<ReplaceWith>Xam.Plugins.$(XamarinPluginName), Version=$(AssemblyFileVersion)</ReplaceWith>
</RegexTransform>
</ItemGroup>
<PropertyGroup>
<BuildDependsOn>RestorePackages;UpdateVersion</BuildDependsOn>
<SolutionName Condition="'$(SolutionName)' == ''">$(XamarinPluginPath)\Plugin.$(XamarinPluginName).sln</SolutionName>
</PropertyGroup>
<Target Name="Build" DependsOnTargets="$(BuildDependsOn)">
<MSBuild Projects="$(SolutionName)" Targets="Build"
Properties="Configuration=$(Configuration)"/>
</Target>
<Target Name="Rebuild" DependsOnTargets="$(BuildDependsOn)">
<MSBuild Projects="$(SolutionName)" Targets="Rebuild"
Properties="Configuration=$(Configuration)"/>
</Target>
<Target Name="Clean">
<MSBuild Projects="$(SolutionName)" Targets="Clean"
Properties="Configuration=$(Configuration)"/>
</Target>
<Target Name="RestorePackages">
<Exec Command=""$(NuGetExe)" restore "$(SolutionName)"" />
</Target>
<Target Name="UpdateVersion">
<RegexTransform Items="@(RegexTransform)" />
</Target>
<Target Name="BuildPackage" DependsOnTargets="Build">
<MakeDir Directories="$(XamarinPluginPath)\Output" Condition="!Exists('$(XamarinPluginPath)\Output')" />
<Exec Command=""$(NuGetExe)" pack $(XamarinPluginPath)\Plugin.$(XamarinPluginName).nuspec -NoPackageAnalysis -o "$(XamarinPluginPath)\Output" -Version $(PackageVersion)" />
</Target>
<Target Name="BuildComponent" DependsOnTargets="BuildPackage">
<MakeDir Directories="$(XamarinPluginPath)\Output" Condition="!Exists('$(XamarinPluginPath)\Output')" />
<Exec Command=""$(XamarinComponentExe)" package $(XamarinPluginPath)\Component\ " />
<Move SourceFiles="$(XamarinPluginPath)\Component\Xam.Plugins.$(XamarinPluginName)-$(AssemblyFileVersion).xam" DestinationFolder="$(XamarinPluginPath)\Output" />
</Target>
</Project>