Only produce one version of the runtime store, templates packages, and installers (#665)

This commit is contained in:
Nate McMaster 2017-11-21 17:05:52 -08:00 committed by GitHub
parent 728627e918
commit dfd15c8679
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 42 additions and 220 deletions

View File

@ -2,29 +2,12 @@
<PropertyGroup>
<_TemplatesDirectory>$(MSBuildThisFileDirectory)tools\templates\</_TemplatesDirectory>
<_WorkRoot>$(RepositoryRoot).w\</_WorkRoot>
<TimestampSource>$(RepositoryRoot).deps\Signed\Packages\</TimestampSource>
<TimestampFreeSource>$(RepositoryRoot).deps\Signed\Packages-NoTimeStamp\</TimestampFreeSource>
<TimestampOutputPackageName>nuGetPackagesArchive.timestamped</TimestampOutputPackageName>
<TimestampFreeOutputPackageName>nuGetPackagesArchive.notimestamp</TimestampFreeOutputPackageName>
<SignedPackagesSource>$(RepositoryRoot).deps\Signed\Packages\</SignedPackagesSource>
<LzmaOutputPackageName>nuGetPackagesArchive-$(PackageVersion)</LzmaOutputPackageName>
</PropertyGroup>
<Target Name="BuildFallbackArchive">
<!-- Run the actual target twice, once for timestamped packages, once for non-timestamped packages -->
<!-- Here, we're re-invoking KoreBuild, but limiting it to a specific target. -->
<!-- This won't rerun the whole build, but it ensures that the necessary MSBuild Tasks and Properties are initialized -->
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="_BuildFallbackArchive"
Properties="MetapackageRestoreSource=$(TimestampSource);OutputPackageName=$(TimestampOutputPackageName);RemoveTimestamp=false;MetapackageVersion=$(PackageVersion)" />
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="_BuildFallbackArchive"
Properties="MetapackageRestoreSource=$(TimestampFreeSource);OutputPackageName=$(TimestampFreeOutputPackageName);RemoveTimestamp=true;MetapackageVersion=$(PackageVersionNoTimestamp)" />
</Target>
<Target Name="_BuildFallbackArchive" DependsOnTargets="ResolveRepoInfo">
<Target Name="BuildFallbackArchive" DependsOnTargets="ResolveRepoInfo">
<Error Text="MetapackageRestoreSource must be specified" Condition=" '$(MetapackageRestoreSource)' == '' " />
<Error Text="OutputPackageName must be specified" Condition=" '$(OutputPackageName)' == '' " />
<Error Text="ArchiverPath must be specified" Condition=" '$(ArchiverPath)' == '' " />
<Error Text="Archiver not found at $(ArchiverPath)" Condition="!Exists('$(ArchiverPath)')" />
@ -40,14 +23,13 @@
BuildArtifacts="@(ArtifactInfo)"
PackageArtifacts="@(PackageArtifact)"
ExternalDependencies="@(ExternalDependency)"
RemoveTimestamp="$(RemoveTimestamp)"
MetapackageVersion="$(MetapackageVersion)" />
<PropertyGroup>
<FallbackStagingDir>$(_WorkRoot)obj\$(OutputPackageName)</FallbackStagingDir>
<FallbackStagingDir>$(_WorkRoot)obj\$(LzmaOutputPackageName)</FallbackStagingDir>
<FallbackOutputDir>$(ArtifactsDir)lzma\</FallbackOutputDir>
<FallbackOutputPath>$(FallbackOutputDir)$(OutputPackageName).lzma</FallbackOutputPath>
<GeneratedFallbackRestoreSourcesPropsPath>$(_WorkRoot)restoresources.$(OutputPackageName).props</GeneratedFallbackRestoreSourcesPropsPath>
<FallbackOutputPath>$(FallbackOutputDir)$(LzmaOutputPackageName).lzma</FallbackOutputPath>
<GeneratedFallbackRestoreSourcesPropsPath>$(_WorkRoot)restoresources.$(LzmaOutputPackageName).props</GeneratedFallbackRestoreSourcesPropsPath>
</PropertyGroup>
<ItemGroup>

View File

@ -43,7 +43,9 @@
<!-- If there are duplicate properties, the properties which are defined later in the order would override the earlier ones -->
<RepositoryBuildArguments>$(RepositoryBuildArguments) /p:DotNetRestoreSourcePropsPath=$(GeneratedRestoreSourcesPropsPath)</RepositoryBuildArguments>
<RepositoryBuildArguments>$(RepositoryBuildArguments) /p:DotNetPackageVersionPropsPath=$(GeneratedPackageVersionPropsPath)</RepositoryBuildArguments>
<RepositoryBuildArguments>$(RepositoryBuildArguments) /p:BuildNumber=$(BuildNumber) /p:Configuration=$(Configuration)</RepositoryBuildArguments>
<RepositoryBuildArguments>$(RepositoryBuildArguments) /p:BuildNumber=$(BuildNumber)</RepositoryBuildArguments>
<RepositoryBuildArguments>$(RepositoryBuildArguments) /p:Configuration=$(Configuration)</RepositoryBuildArguments>
<RepositoryBuildArguments>$(RepositoryBuildArguments) /p:IsFinalBuild=$(IsFinalBuild)</RepositoryBuildArguments>
<RepositoryBuildArguments>$(RepositoryBuildArguments) /noconsolelogger '/l:RepoTasks.FlowLogger,$(MSBuildThisFileDirectory)tasks\bin\publish\RepoTasks.dll;Summary;FlowId=$(RepositoryToBuild)'</RepositoryBuildArguments>
<BuildArguments>$(_RepositoryBuildTargets) $(RepositoryBuildArguments)</BuildArguments>

View File

@ -4,8 +4,7 @@
<_DockerDir>$(MSBuildThisFileDirectory)tools\docker\</_DockerDir>
<_PackagingDir>$(MSBuildThisFileDirectory)tools\packaging\</_PackagingDir>
<_DebToolDir>$(MSBuildThisFileDirectory)tools\dotnet-deb-tool-consumer\</_DebToolDir>
<_TimestampRSSource>$(RepositoryRoot).deps\Signed\Store\</_TimestampRSSource>
<_TimestampFreeRSSource>$(RepositoryRoot).deps\Signed\Store-TimestampFree\</_TimestampFreeRSSource>
<_RuntimeStoreSource>$(RepositoryRoot).deps\Signed\Store\</_RuntimeStoreSource>
<_InstallerSource>$(RepositoryRoot).deps\Installers\</_InstallerSource>
<_WorkRoot>$(RepositoryRoot).w\</_WorkRoot>
<_WorkLayoutDir>$(_WorkRoot).l\</_WorkLayoutDir>
@ -15,6 +14,7 @@
<RSInstallerName>aspnetcore-store</RSInstallerName>
<HostingInstallerName>dotnet-hosting</HostingInstallerName>
<HostingArchiveName>$(HostingInstallerName)-$(PackageVersion)-linux-x64.tar.gz</HostingArchiveName>
<RSDebConfigFile>$(_PackagingDir)store_debian_config.json</RSDebConfigFile>
<HostingDebConfigFile>$(_PackagingDir)hosting_debian_config.json</HostingDebConfigFile>
@ -24,9 +24,8 @@
<RuntimeStore200LinkPrefix>$(PublicCoreFeedPrefix)/aspnetcore/store/2.0.0-26452/Build.RS.</RuntimeStore200LinkPrefix>
<RuntimeTargzLink>$(CoreFeedPrefix)/Runtime/$(MicrosoftNETCoreApp20PackageVersion)/dotnet-runtime-$(MicrosoftNETCoreApp20PackageVersion)-linux-x64.tar.gz</RuntimeTargzLink>
<TimestampRSArchive>$(_TimestampRSSource)aspnetcore-store-$(PackageVersion)-linux-x64.tar.gz</TimestampRSArchive>
<TimestampFreeRSArchivePrefix>$(_TimestampFreeRSSource)aspnetcore-store-$(PackageVersionNoTimestamp)-</TimestampFreeRSArchivePrefix>
<TimestampFreeLinuxRSArchive>$(TimestampFreeRSArchivePrefix)linux-x64.tar.gz</TimestampFreeLinuxRSArchive>
<RuntimeStoreArchivePrefix>$(_RuntimeStoreSource)aspnetcore-store-$(PackageVersion)-</RuntimeStoreArchivePrefix>
<RuntimeStoreLinuxArchiveFilePath>$(RuntimeStoreArchivePrefix)linux-x64.tar.gz</RuntimeStoreLinuxArchiveFilePath>
</PropertyGroup>
<Target Name="BuildInstallers" DependsOnTargets="GenerateTargzs;GenerateRpms;GenerateDebs;GenerateRelabledInstallers" />
@ -42,20 +41,8 @@
<Error Text="Docker host must be using Linux containers." Condition="'$(DockerHostOS)' != 'linux'"/>
<Error
Text="Timestamp linux archive not found. Expected it to exist in $(TimestampRSArchive)."
Condition="!Exists('$(TimestampRSArchive)')" />
<Error
Text="Non-timestamp linux archive not found. Expected it to exist in $(TimestampFreeLinuxRSArchive)."
Condition="!Exists('$(TimestampFreeLinuxRSArchive)')" />
<Error
Text="Non-timestamp osx archive not found. Expected it to exist in $(TimestampFreeRSArchivePrefix)osx-x64.tar.gz."
Condition="!Exists('$(TimestampFreeRSArchivePrefix)osx-x64.tar.gz')" />
<Error
Text="Non-timestamp winx64 archive not found. Expected it to exist in $(TimestampFreeRSArchivePrefix)win7-x64.zip."
Condition="!Exists('$(TimestampFreeRSArchivePrefix)win7-x64.zip')" />
<Error
Text="Non-timestamp winx86 archive not found. Expected it to exist in $(TimestampFreeRSArchivePrefix)win7-x86.zip."
Condition="!Exists('$(TimestampFreeRSArchivePrefix)win7-x86.zip')" />
Text="Linux archive not found. Expected it to exist in $(RuntimeStoreLinuxArchiveFilePath)."
Condition="!Exists('$(RuntimeStoreLinuxArchiveFilePath)')" />
</Target>
<Target Name="_EnsureInstallerDirectory" >
@ -121,22 +108,10 @@
<_DependentArchives Include="$(_InstallerSource)Build.RS.linux.tar.gz" />
</ItemGroup>
<PropertyGroup>
<DependentArchives>@(_DependentArchives)</DependentArchives>
<HostingArchiveName>$(HostingInstallerName)-$(Version)-linux-x64.tar.gz</HostingArchiveName>
<TimestampFreeHostingArchiveName>$(HostingInstallerName)-$(PackageVersionNoTimestamp)-linux-x64.tar.gz</TimestampFreeHostingArchiveName>
</PropertyGroup>
<!-- Timestamp hosting bundle -->
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="_GenerateTargz"
Properties="DependentArchives=$(DependentArchives);RSArchive=$(TimestampRSArchive);OutputArchiveName=$(HostingArchiveName)" />
<!-- Timestamp free hosting bundle -->
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="_GenerateTargz"
Properties="DependentArchives=$(DependentArchives);RSArchive=$(TimestampFreeLinuxRSArchive);OutputArchiveName=$(TimestampFreeHostingArchiveName)" />
Properties="DependentArchives=@(_DependentArchives);RSArchive=$(RuntimeStoreLinuxArchiveFilePath);OutputArchiveName=$(HostingArchiveName)" />
</Target>
<Target Name="_DownloadAdditionalRSZips" DependsOnTargets="_EnsureInstallerDirectory;_DownloadInstallers">
@ -150,16 +125,16 @@
<ItemGroup>
<TargzArchives Include="Build.RS.linux.tar.gz">
<RSArchive>$(TimestampFreeRSArchivePrefix)linux-x64.tar.gz</RSArchive>
<RSArchive>$(RuntimeStoreArchivePrefix)linux-x64.tar.gz</RSArchive>
</TargzArchives>
<TargzArchives Include="Build.RS.osx.tar.gz">
<RSArchive>$(TimestampFreeRSArchivePrefix)osx-x64.tar.gz</RSArchive>
<RSArchive>$(RuntimeStoreArchivePrefix)osx-x64.tar.gz</RSArchive>
</TargzArchives>
<ZipArchives Include="Build.RS.winx64.zip">
<RSArchive>$(TimestampFreeRSArchivePrefix)win7-x64.zip</RSArchive>
<RSArchive>$(RuntimeStoreArchivePrefix)win7-x64.zip</RSArchive>
</ZipArchives>
<ZipArchives Include="Build.RS.winx86.zip">
<RSArchive>$(TimestampFreeRSArchivePrefix)win7-x86.zip</RSArchive>
<RSArchive>$(RuntimeStoreArchivePrefix)win7-x86.zip</RSArchive>
</ZipArchives>
</ItemGroup>
@ -313,17 +288,10 @@
<HostingDependencies Include="dotnet-runtime-$(MicrosoftNETCoreApp20PackageVersion)">
<Version>$(MicrosoftNETCoreApp20PackageVersion)</Version>
</HostingDependencies>
<TimestampFreeHostingDependencies Include="$(RSInstallerName)-$(PackageVersionNoTimestamp)">
<Version>$(PackageVersionNoTimestamp)</Version>
</TimestampFreeHostingDependencies>
<TimestampFreeHostingDependencies Include="dotnet-runtime-$(MicrosoftNETCoreApp20PackageVersion)">
<Version>$(MicrosoftNETCoreApp20PackageVersion)</Version>
</TimestampFreeHostingDependencies>
</ItemGroup>
<PropertyGroup>
<HostingFPMArguments>@(HostingDependencies->' -d &quot;%(Identity) &gt;= %(Version)&quot;', ' ')</HostingFPMArguments>
<TimestampFreeHostingFPMArguments>@(TimestampFreeHostingDependencies->' -d &quot;%(Identity) &gt;= %(Version)&quot;', ' ')</TimestampFreeHostingFPMArguments>
<RSDependencyArguments>@(RSDependencies->' -d &quot;%(Identity) &gt;= %(Version)&quot;', ' ')</RSDependencyArguments>
<RHRSArguments>$(RSDependencyArguments) @(RHStoreDirectories->' --directories &quot;%(FullPath)&quot;', ' ')</RHRSArguments>
<GenericRSArguments>$(RSDependencyArguments) @(GenericStoreDirectories->' --directories &quot;%(FullPath)&quot;', ' ')</GenericRSArguments>
@ -342,48 +310,28 @@
<CommonHostingArguments>$(CommonHostingArguments);RPMSummary=@(_HostingSummary);RPMDescription=@(_HostingDescription)</CommonHostingArguments>
<CommonHostingArguments>$(CommonHostingArguments);RPMLicense=@(_HostingLicense);RPMHomepage=@(_HostingHomepage)</CommonHostingArguments>
<TimestampRSArguments>$(CommonArguments);$(CommonGenericArguments);$(CommonRSArguments)</TimestampRSArguments>
<TimestampRSArguments>$(TimestampRSArguments);RSArchive=$(TimestampRSArchive);RPMVersion=$(PackageVersion);RPMArguments=$(GenericRSArguments)</TimestampRSArguments>
<RS_RPM_Arguments>$(CommonArguments);$(CommonGenericArguments);$(CommonRSArguments)</RS_RPM_Arguments>
<RS_RPM_Arguments>$(RS_RPM_Arguments);RSArchive=$(RuntimeStoreLinuxArchiveFilePath);RPMVersion=$(PackageVersion);RPMArguments=$(GenericRSArguments)</RS_RPM_Arguments>
<TimestampFreeRSArguments>$(CommonArguments);$(CommonGenericArguments);$(CommonRSArguments)</TimestampFreeRSArguments>
<TimestampFreeRSArguments>$(TimestampFreeRSArguments);RSArchive=$(TimestampFreeLinuxRSArchive);RPMVersion=$(PackageVersionNoTimestamp);RPMArguments=$(GenericRSArguments)</TimestampFreeRSArguments>
<Hosting_RPM_RedHat_Arguments>$(CommonArguments);$(CommonGenericArguments);$(CommonHostingArguments)</Hosting_RPM_RedHat_Arguments>
<Hosting_RPM_RedHat_Arguments>$(Hosting_RPM_RedHat_Arguments);RPMVersion=$(PackageVersion);RPMArguments=$(HostingFPMArguments)</Hosting_RPM_RedHat_Arguments>
<TimestampHostingArguments>$(CommonArguments);$(CommonGenericArguments);$(CommonHostingArguments)</TimestampHostingArguments>
<TimestampHostingArguments>$(TimestampHostingArguments);RPMVersion=$(PackageVersion);RPMArguments=$(HostingFPMArguments)</TimestampHostingArguments>
<RS_RPM_RedHat_Arguments>$(CommonArguments);$(CommonRHArguments);$(CommonRSArguments)</RS_RPM_RedHat_Arguments>
<RS_RPM_RedHat_Arguments>$(RS_RPM_RedHat_Arguments);RSArchive=$(RuntimeStoreLinuxArchiveFilePath);RPMVersion=$(PackageVersion);RPMArguments=$(RHRSArguments)</RS_RPM_RedHat_Arguments>
<TimestampFreeHostingArguments>$(CommonArguments);$(CommonGenericArguments);$(CommonHostingArguments)</TimestampFreeHostingArguments>
<TimestampFreeHostingArguments>$(TimestampFreeHostingArguments);RPMVersion=$(PackageVersionNoTimestamp);RPMArguments=$(TimestampFreeHostingFPMArguments)</TimestampFreeHostingArguments>
<RHTimestampRSArguments>$(CommonArguments);$(CommonRHArguments);$(CommonRSArguments)</RHTimestampRSArguments>
<RHTimestampRSArguments>$(RHTimestampRSArguments);RSArchive=$(TimestampRSArchive);RPMVersion=$(PackageVersion);RPMArguments=$(RHRSArguments)</RHTimestampRSArguments>
<RHTimestampFreeRSArguments>$(CommonArguments);$(CommonRHArguments);$(CommonRSArguments)</RHTimestampFreeRSArguments>
<RHTimestampFreeRSArguments>$(RHTimestampFreeRSArguments);RSArchive=$(TimestampFreeLinuxRSArchive);RPMVersion=$(PackageVersionNoTimestamp);RPMArguments=$(RHRSArguments)</RHTimestampFreeRSArguments>
<RHTimestampHostingArguments>$(CommonArguments);$(CommonRHArguments);$(CommonHostingArguments)</RHTimestampHostingArguments>
<RHTimestampHostingArguments>$(RHTimestampHostingArguments);RPMVersion=$(PackageVersion);RPMArguments=$(HostingFPMArguments)</RHTimestampHostingArguments>
<RHTimestampFreeHostingArguments>$(CommonArguments);$(CommonRHArguments);$(CommonHostingArguments)</RHTimestampFreeHostingArguments>
<RHTimestampFreeHostingArguments>$(RHTimestampFreeHostingArguments);RPMVersion=$(PackageVersionNoTimestamp);RPMArguments=$(TimestampFreeHostingFPMArguments)</RHTimestampFreeHostingArguments>
<Hosting_RPM_Arguments>$(CommonArguments);$(CommonRHArguments);$(CommonHostingArguments)</Hosting_RPM_Arguments>
<Hosting_RPM_Arguments>$(Hosting_RPM_Arguments);RPMVersion=$(PackageVersion);RPMArguments=$(HostingFPMArguments)</Hosting_RPM_Arguments>
</PropertyGroup>
<!-- General Timestamp runtime store -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(TimestampRSArguments)" />
<!-- General Timestamp free runtime store -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(TimestampFreeRSArguments)" />
<!-- General Timestamp hosting bundle -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(TimestampHostingArguments)" />
<!-- General Timestamp free hosting bundle -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(TimestampFreeHostingArguments)" />
<!-- General runtime store -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(RS_RPM_Arguments)" />
<!-- General hosting bundle -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(Hosting_RPM_RedHat_Arguments)" />
<!-- RH Timestamp runtime store -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(RHTimestampRSArguments)" />
<!-- RH Timestamp free runtime store -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(RHTimestampFreeRSArguments)" />
<!-- RH Timestamp hosting bundle -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(RHTimestampHostingArguments)" />
<!-- RH Timestamp free hosting bundle -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(RHTimestampFreeHostingArguments)" />
<!-- RH runtime store -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(RS_RPM_RedHat_Arguments)" />
<!-- RH hosting bundle -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(Hosting_RPM_Arguments)" />
<!-- Remove Docker Image to save disk space -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_RemoveDockerImage" Properties="Image=$(Image)" />
@ -464,19 +412,11 @@
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="_GenerateDeb"
Properties="$(CommonRSArguments);RSArchive=$(TimestampRSArchive);DebVersion=$(Version)" />
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="_GenerateDeb"
Properties="$(CommonRSArguments);RSArchive=$(TimestampFreeLinuxRSArchive);DebVersion=$(PackageVersionNoTimestamp)" />
Properties="$(CommonRSArguments);RSArchive=$(RuntimeStoreLinuxArchiveFilePath);DebVersion=$(Version)" />
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="_GenerateDeb"
Properties="$(CommonHostingArguments);DebVersion=$(Version)" />
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="_GenerateDeb"
Properties="$(CommonHostingArguments);DebVersion=$(PackageVersionNoTimestamp)" />
<!-- Remove Docker Image to save disk space -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_RemoveDockerImage" Properties="Image=$(Image)" />
@ -484,7 +424,7 @@
<Target Name="GenerateDebs" DependsOnTargets="_EnsureInstallerPrerequisites">
<PropertyGroup>
<CommonArguments>Version=$(Version);TimestampFreeVersion=$(PackageVersionNoTimestamp)</CommonArguments>
<CommonArguments>Version=$(Version)</CommonArguments>
</PropertyGroup>
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateDebOnPlatform" Properties="$(CommonArguments);Image=debian.8" />

View File

@ -5,26 +5,16 @@
<Target Name="BuildTemplates" DependsOnTargets="GeneratePropsFiles">
<PropertyGroup>
<GeneratedNoTimestampPackageVersionPropsPath>$(IntermediateDir)dependencies.notimestamp.props</GeneratedNoTimestampPackageVersionPropsPath>
<TemplateProjCommmonProperties>
<TemplateProjProperties>
RepositoryRoot=$(TemplatingProjectRoot);
DotNetRestoreSourcesPropsPath=$(GeneratedRestoreSourcesPropsPath);
DotNetPackageVersionPropsPath=$(GeneratedPackageVersionPropsPath);
BuildNumber=$(BuildNumber);
Configuration=$(Configuration);
</TemplateProjCommmonProperties>
<TemplateProjProperties>
$(TemplateProjCommmonProperties);
DotNetPackageVersionPropsPath=$(GeneratedPackageVersionPropsPath);
VersionMetadata=timestamped;
IsFinalBuild=$(IsFinalBuild);
</TemplateProjProperties>
<TemplateProjNoTimestampProperties>
$(TemplateProjCommmonProperties);
DotNetPackageVersionPropsPath=$(GeneratedNoTimestampPackageVersionPropsPath);
IsFinalBuild=true;
</TemplateProjNoTimestampProperties>
</PropertyGroup>
<!-- Produce regular, timestamped templates for pre-release builds -->
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="Restore;Compile;Package"
Properties="$(TemplateProjProperties)" />
@ -34,35 +24,6 @@
</ItemGroup>
<Copy SourceFiles="@(TemplateArtifacts)" DestinationFolder="$(BuildDir)" />
<!-- Gather artifact info as if this were a final build -->
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="GetArtifactInfo"
Properties="RepositoryRoot=%(Repository.RootPath);Configuration=$(Configuration);BuildNumber=$(BuildNumber);IsFinalBuild=true"
ContinueOnError="WarnAndContinue">
<Output TaskParameter="TargetOutputs" ItemName="FinalBuildArtifactInfo" />
</MSBuild>
<ItemGroup>
<_NoTimestampPackages Include="@(ExternalDependency)" />
<_NoTimestampPackages Include="%(FinalBuildArtifactInfo.PackageId)" Version="%(FinalBuildArtifactInfo.Version)" Condition=" '%(FinalBuildArtifactInfo.ArtifactType)' == 'NuGetPackage' " />
<_NoTimestampPackages Include="Microsoft.AspNetCore.All" Version="$(PackageVersionNoTimestamp)" />
</ItemGroup>
<GeneratePackageVersionPropsFile
Packages="@(_NoTimestampPackages)"
OutputPath="$(GeneratedNoTimestampPackageVersionPropsPath)" />
<!-- Rebuild the templates without restoring. (The non-timestamped packages don't exist yet.) -->
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="Prepare;Compile;Package"
Properties="$(TemplateProjNoTimestampProperties);NoRestore=true" />
<ItemGroup>
<TemplateNoTimestampArtifacts Include="$(TemplatingProjectRoot)artifacts\build\*" />
</ItemGroup>
<Copy SourceFiles="@(TemplateNoTimestampArtifacts)" DestinationFolder="$(ArtifactsDir)notimestamp\" />
</Target>
</Project>

View File

@ -7,6 +7,7 @@
<SkipTests>false</SkipTests>
<SkipTests Condition="'$(CompileOnly)' == 'true'">true</SkipTests>
<IsFinalBuild Condition="'$(IsFinalBuild)' == ''">false</IsFinalBuild>
</PropertyGroup>
<Import Project="artifacts.props" />

View File

@ -19,9 +19,6 @@ namespace RepoTasks
[Required]
public string MetaPackageVersion { get; set; }
[Required]
public bool RemoveTimestamp { get; set; }
[Required]
public ITaskItem[] BuildArtifacts { get; set; }
@ -61,11 +58,6 @@ namespace RepoTasks
.Single(p => string.Equals(p.PackageInfo.Id, packageName, StringComparison.OrdinalIgnoreCase))
.PackageInfo.Version.ToString();
if (RemoveTimestamp)
{
packageVersion = VersionUtilities.GetTimestampFreeVersion(packageVersion);
}
Log.LogMessage(MessageImportance.High, $" - Package: {packageName} Version: {packageVersion}");
var packageReferenceElement = xmlDoc.CreateElement("PackageReference");
@ -95,11 +87,6 @@ namespace RepoTasks
.Single(p => string.Equals(p.PackageInfo.Id, packageName, StringComparison.OrdinalIgnoreCase))
.PackageInfo.Version.ToString();
if (RemoveTimestamp)
{
packageVersion = VersionUtilities.GetTimestampFreeVersion(packageVersion);
}
Log.LogMessage(MessageImportance.High, $" - Tool: {packageName} Version: {packageVersion}");
var packageReferenceElement = xmlDoc.CreateElement("DotNetCliToolReference");

View File

@ -1,49 +0,0 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using NuGet.Versioning;
namespace RepoTasks.Utilities
{
public class VersionUtilities
{
public static string GetTimestampFreeVersion(string packageVersion)
{
var version = new NuGetVersion(packageVersion);
var updatedVersion = new NuGetVersion(version.Version, GetTimestampFreeReleaseLabel(version.Release));
return updatedVersion.ToNormalizedString();
}
public static string GetTimestampFreeReleaseLabel(string releaseLabel)
{
if (releaseLabel.StartsWith("rtm-", StringComparison.OrdinalIgnoreCase))
{
// E.g. change version 2.5.0-rtm-123123 to 2.5.0.
releaseLabel = string.Empty;
}
else
{
var timeStampFreeVersion = Environment.GetEnvironmentVariable("TIMESTAMP_FREE_VERSION");
if (string.IsNullOrEmpty(timeStampFreeVersion))
{
timeStampFreeVersion = "final";
}
if (!timeStampFreeVersion.StartsWith("-"))
{
timeStampFreeVersion = "-" + timeStampFreeVersion;
}
// E.g. change version 2.5.0-rc2-123123 to 2.5.0-rc2-final.
var index = releaseLabel.LastIndexOf('-');
if (index != -1)
{
releaseLabel = releaseLabel.Substring(0, index) + timeStampFreeVersion;
}
}
return releaseLabel;
}
}
}

View File

@ -3,9 +3,7 @@
<VersionPrefix>2.1.0</VersionPrefix>
<VersionSuffix>preview1</VersionSuffix>
<PackageVersion Condition="'$(IsFinalBuild)' == 'true' AND '$(VersionSuffix)' == 'rtm' ">$(VersionPrefix)</PackageVersion>
<PackageVersionNoTimestamp Condition="'$(VersionSuffix)' == 'rtm' ">$(VersionPrefix)</PackageVersionNoTimestamp>
<PackageVersion Condition="'$(IsFinalBuild)' == 'true' AND '$(VersionSuffix)' != 'rtm' ">$(VersionPrefix)-$(VersionSuffix)-final</PackageVersion>
<PackageVersionNoTimestamp Condition="'$(VersionSuffix)' != 'rtm' ">$(VersionPrefix)-$(VersionSuffix)-final</PackageVersionNoTimestamp>
<VersionSuffix Condition="'$(VersionSuffix)' != '' And '$(BuildNumber)' != ''">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
</PropertyGroup>
</Project>