maui-linux/Version.targets

81 строка
3.8 KiB
XML

<Project>
<PropertyGroup>
<NightlyTag>nightly</NightlyTag>
</PropertyGroup>
<PropertyGroup>
<GitBranch Condition="'$(SYSTEM_PULLREQUEST_TARGETBRANCH)' != ''">$(SYSTEM_PULLREQUEST_TARGETBRANCH)</GitBranch>
<GitBranch Condition="'$(SYSTEM_PULLREQUEST_TARGETBRANCH)' == '' and '$(BUILD_SOURCEBRANCHNAME)' != ''">$(BUILD_SOURCEBRANCHNAME)</GitBranch>
</PropertyGroup>
<PropertyGroup>
<GitSemVerLabel Condition="$(CI) and '$(BUILD_REASON)' == 'Schedule'">$(NightlyTag)</GitSemVerLabel>
<GitSemVerDashLabel Condition="$(CI) and '$(BUILD_REASON)' == 'Schedule'">-$(GitSemVerLabel)</GitSemVerDashLabel>
</PropertyGroup>
<Target Name="SetVersions"
BeforeTargets="PrepareForBuild;GetAssemblyVersion;GetPackageVersion;Pack"
DependsOnTargets="GitVersion"
Returns="$(Version)"
>
<ItemGroup>
<VersionMetadata Include="$(GitCommits)" Condition="'$(GitSemVerDashLabel)' == ''" />
<VersionMetadata Condition="$(CI) and '$(BUILD_REASON)' == 'PullRequest'"
Include="pr.$(SYSTEM_PULLREQUEST_PULLREQUESTNUMBER)"/>
<VersionMetadata Include="sha.$(GitCommit)"/>
<VersionMetadata Condition="$(CI)"
Include="azdo.$(BUILD_BUILDID)"/>
</ItemGroup>
<PropertyGroup>
<VersionMetadataLabel>@(VersionMetadata -> '%(Identity)', '-')</VersionMetadataLabel>
<VersionMetadataPlusLabel Condition="'$(VersionMetadataLabel)' != ''">+$(VersionMetadataLabel)</VersionMetadataPlusLabel>
<Version>$(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)</Version>
<PackageVersion>$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)$(GitSemVerDashLabel)$(VersionMetadataPlusLabel)</PackageVersion>
<PackageVersion Condition="$(CI)">$(GitSemVerMajor).$(GitSemVerMinor).$(GitBaseVersionPatch).$(BUILDVERSION)$(GitSemVerDashLabel)$(VersionMetadataPlusLabel)</PackageVersion>
</PropertyGroup>
<PropertyGroup>
<InformationalVersion>$(PackageVersion)</InformationalVersion>
<FileVersion>$(Version).$(GitCommits)</FileVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion> <!-- THIS SHALL REMAIN 2.0.0.0 -->
</PropertyGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadata">
<_Parameter1>Version</_Parameter1>
<_Parameter2>2.0.0.0</_Parameter2> <!-- THIS SHALL REMAIN 2.0.0.0 -->
</AssemblyAttribute>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadata">
<_Parameter1>PackageVersion</_Parameter1>
<_Parameter2>$(PackageVersion)</_Parameter2>
</AssemblyAttribute>
</ItemGroup>
<Message Condition="$(CI) and '$(BUILD_REASON)' == 'Schedule'" Importance="high" Text="##vso[build.addbuildtag]$(NightlyTag)"/>
<ItemGroup>
<XamarinFormsVersionFile Include="../XamarinFormsVersionFile.txt"/>
<XamarinFormsVersionLine Include="$(PackageVersion)"/>
</ItemGroup>
<WriteLinesToFile File="@(XamarinFormsVersionFile)" Lines="@(XamarinFormsVersionLine)" Overwrite="true" />
<Message Condition="$(CI)" Importance="high" Text="##vso[build.updatebuildnumber]$(PackageVersion)"/>
<Message Condition="$(CI)" Importance="high" Text="##vso[task.setvariable variable=XamarinFormsPackageVersion;isOutput=true;]$(PackageVersion)"/>
</Target>
<Target Name="VersionInfoReport" DependsOnTargets="SetVersions" AfterTargets="GitInfoReport">
<ItemGroup>
<Message Importance="$(GitInfoReportImportance)" Text="Version Info:
AssemblyVersion: $(AssemblyVersion)
FileVersion: $(FileVersion)
InformationalVersion: $(InformationalVersion)
PackageVersion: $(PackageVersion)
Version: $(Version)
VersionPrefix: $(VersionPrefix)
VersionSuffix: $(VersionSuffix)
"/>
</ItemGroup>
</Target>
</Project>