aspnetcore/build/repo.targets

988 lines
59 KiB
XML

<Project>
<PropertyGroup>
<!-- Project for building the Runtime Store -->
<MetaPackagePath>$(RepositoryRoot)src\Microsoft.AspNetCore.RuntimeStore\</MetaPackagePath>
<MetaPackageFile>$(MetaPackagePath)Microsoft.AspNetCore.RuntimeStore.csproj</MetaPackageFile>
<HostingStartupTemplatePath>$(RepositoryRoot)tools\Microsoft.AspNetCore.HostingStartup.Template\</HostingStartupTemplatePath>
<HostingStartupTemplateFile>$(HostingStartupTemplatePath)Microsoft.AspNetCore.HostingStartup.Template.csproj</HostingStartupTemplateFile>
<!-- Project for building the NuGet Fallback Archive (LZMA for CLI) -->
<FallbackArchiveDir>$(RepositoryRoot)src\Archive.AspNetCore.All\</FallbackArchiveDir>
<FallbackArchiveProj>$(FallbackArchiveDir)Archive.AspNetCore.All.csproj</FallbackArchiveProj>
<!-- Determine ASP.NET Package Version -->
<NoTimestampSuffix Condition="'$(TIMESTAMP_FREE_VERSION)' != ''">$(TIMESTAMP_FREE_VERSION)</NoTimestampSuffix>
<NoTimestampSuffix Condition="'$(NoTimestampSuffix)' == ''">final</NoTimestampSuffix>
<NoTimestampVersion>$(VersionPrefix)-$(OriginalVersionSuffix)-$(NoTimestampSuffix)</NoTimestampVersion>
<NoTimestampVersion Condition="'$(OriginalVersionSuffix)' == 'rtm'">$(VersionPrefix)</NoTimestampVersion>
<TimestampVersion>$(VersionPrefix)-$(OriginalVersionSuffix)-$(BuildNumber)</TimestampVersion>
<RuntimeStoreTimestampInstallerPackageName>aspnetcore-store-$(TimestampVersion)</RuntimeStoreTimestampInstallerPackageName>
<RuntimeStoreNoTimestampInstallerPackageName>aspnetcore-store-$(NoTimestampVersion)</RuntimeStoreNoTimestampInstallerPackageName>
<HostingBundleTimestampInstallerPackageName>dotnet-hosting-$(TimestampVersion)</HostingBundleTimestampInstallerPackageName>
<HostingBundleNoTimestampInstallerPackageName>dotnet-hosting-$(NoTimestampVersion)</HostingBundleNoTimestampInstallerPackageName>
<RuntimeStoreWorkingDirectory>$(RepositoryRoot).rw\</RuntimeStoreWorkingDirectory>
<RuntimeStoreOutputPath>$(RepositoryRoot).ro\</RuntimeStoreOutputPath>
<ArtifactsDir>$(RepositoryRoot)artifacts\</ArtifactsDir>
<DotnetInstallersDir>$(ArtifactsDir)dotnetInstallers\</DotnetInstallersDir>
<ArtifactsZipDir>$(ArtifactsDir)zip\</ArtifactsZipDir>
<DepsOutputPath>$(ArtifactsDir)deps\</DepsOutputPath>
<RuntimeStoreZipTimestampDir>$(ArtifactsZipDir)t\</RuntimeStoreZipTimestampDir>
<RuntimeStoreZipNoTimestampDir>$(ArtifactsZipDir)n\</RuntimeStoreZipNoTimestampDir>
<RuntimeStoreSymbolsZipTimestampDir>$(ArtifactsZipDir)st\</RuntimeStoreSymbolsZipTimestampDir>
<RuntimeStoreSymbolsZipNoTimestampDir>$(ArtifactsZipDir)sn\</RuntimeStoreSymbolsZipNoTimestampDir>
<RuntimeStoreInstallerDirectory>$(ArtifactsDir)installers\</RuntimeStoreInstallerDirectory>
<RuntimeStoreArchiveDirectory>$(ArtifactsDir)rsArchive\</RuntimeStoreArchiveDirectory>
<RuntimeStoreInstallerLayoutTimestampDirectory>$(ArtifactsDir)StoreTimestampLayout\</RuntimeStoreInstallerLayoutTimestampDirectory>
<RuntimeStoreInstallerLayoutPackageRootTimestampDirectory>$(RuntimeStoreInstallerLayoutTimestampDirectory)package_root\</RuntimeStoreInstallerLayoutPackageRootTimestampDirectory>
<RuntimeStoreInstallerOutputTimeStampDirectory>$(ArtifactsDir)StoreTimestampOutput\</RuntimeStoreInstallerOutputTimeStampDirectory>
<RuntimeStoreInstallerLayoutNoTimestampDirectory>$(ArtifactsDir)StoreNoTimestampLayout\</RuntimeStoreInstallerLayoutNoTimestampDirectory>
<RuntimeStoreInstallerLayoutPackageRootNoTimestampDirectory>$(RuntimeStoreInstallerLayoutNoTimestampDirectory)package_root\</RuntimeStoreInstallerLayoutPackageRootNoTimestampDirectory>
<RuntimeStoreInstallerOutputNoTimeStampDirectory>$(ArtifactsDir)StoreNoTimestampOutput\</RuntimeStoreInstallerOutputNoTimeStampDirectory>
<HostingBundleInstallerLayoutTimestampDirectory>$(ArtifactsDir)HostingTimestampLayout\</HostingBundleInstallerLayoutTimestampDirectory>
<HostingBundleInstallerLayoutPackageRootTimestampDirectory>$(HostingBundleInstallerLayoutTimestampDirectory)package_root\</HostingBundleInstallerLayoutPackageRootTimestampDirectory>
<HostingBundleInstallerOutputTimeStampDirectory>$(ArtifactsDir)HostingTimestampOutput\</HostingBundleInstallerOutputTimeStampDirectory>
<HostingBundleInstallerLayoutNoTimestampDirectory>$(ArtifactsDir)HostingNoTimestampLayout\</HostingBundleInstallerLayoutNoTimestampDirectory>
<HostingBundleInstallerLayoutPackageRootNoTimestampDirectory>$(HostingBundleInstallerLayoutNoTimestampDirectory)package_root\</HostingBundleInstallerLayoutPackageRootNoTimestampDirectory>
<HostingBundleInstallerOutputNoTimeStampDirectory>$(ArtifactsDir)HostingNoTimestampOutput\</HostingBundleInstallerOutputNoTimeStampDirectory>
<TempDir>$(ArtifactsDir)temp\</TempDir>
<ToolsDir>$(RepositoryRoot)tools\</ToolsDir>
<PackagingDir>$(ToolsDir)packaging\</PackagingDir>
<ScriptsDir>$(ToolsDir)scripts\</ScriptsDir>
<DockerDir>$(ToolsDir)docker\</DockerDir>
<DependencyBuildDirectory>$(RepositoryRoot).deps\build\</DependencyBuildDirectory>
<RuntimeStoreReferenceDirectory>$(ToolsDir)Build.RuntimeStore.References\</RuntimeStoreReferenceDirectory>
<RuntimeStoreReferencePackageDirectory>$(RuntimeStoreReferenceDirectory)bin\Release\</RuntimeStoreReferencePackageDirectory>
<StoreDebianConfigTemplateFile>$(PackagingDir)store_debian_config.json</StoreDebianConfigTemplateFile>
<HostingDebianConfigTemplateFile>$(PackagingDir)hosting_debian_config.json</HostingDebianConfigTemplateFile>
<RPMChangelogTemplateFile>$(PackagingDir)changelog</RPMChangelogTemplateFile>
<DotnetDebToolDirectory>$(ToolsDir)dotnet-deb-tool-consumer\</DotnetDebToolDirectory>
<DockerRootDirectory>/opt/code/</DockerRootDirectory>
</PropertyGroup>
<Import Project="SiteExtension.targets" />
<Target Name="UpdateNuGetConfig">
<UpdatePackageSource
NuGetConfigPath="$(RepositoryRoot)NuGet.config"
SourceName="Dependencies"
SourceUri="$(DependencyBuildDirectory)"
Condition="Exists('$(DependencyBuildDirectory)')" />
</Target>
<Target Name="BuildPackageCache" DependsOnTargets="UpdateNuGetConfig;AddDiaSymReaderToPath;_ResolveCurrentSharedFrameworkVersion">
<GetOSPlatform>
<!-- Returns {Linux, macOS, Windows} -->
<Output TaskParameter="PlatformName" PropertyName="OSPlatform" />
</GetOSPlatform>
<Error Text="Please specify the platform for the runtime package store via PACKAGE_CACHE_PLATFORM: {x64|x86}." Condition="'$(PACKAGE_CACHE_PLATFORM)' == ''"/>
<!-- Display dotnet info -->
<Exec Command="dotnet --info" />
<PropertyGroup>
<RID Condition="'$(OSPlatform)' == 'Windows'">win7-$(PACKAGE_CACHE_PLATFORM)</RID>
<RID Condition="'$(OSPlatform)' == 'Linux'">linux-$(PACKAGE_CACHE_PLATFORM)</RID>
<RID Condition="'$(OSPlatform)' == 'macOS'">osx-$(PACKAGE_CACHE_PLATFORM)</RID>
<OutputZip>$(ArtifactsDir)aspnetcore-store-$(TimestampVersion)-$(RID).zip</OutputZip>
<OutputZipNoTimestamp>$(ArtifactsDir)aspnetcore-store-$(NoTimestampVersion)-$(RID).zip</OutputZipNoTimestamp>
<OutputSymbolZip>$(ArtifactsDir)aspnetcore-symbols-$(TimestampVersion)-$(RID).zip</OutputSymbolZip>
<OutputSymbolZipNoTimestamp>$(ArtifactsDir)aspnetcore-symbols-$(NoTimestampVersion)-$(RID).zip</OutputSymbolZipNoTimestamp>
<OutputSymbolTGZ>$(ArtifactsDir)aspnetcore-symbols-$(TimestampVersion)-$(RID).tar.gz</OutputSymbolTGZ>
<OutputSymbolTGZNoTimeStamp>$(ArtifactsDir)aspnetcore-symbols-$(NoTimestampVersion)-$(RID).tar.gz</OutputSymbolTGZNoTimeStamp>
</PropertyGroup>
<!-- Build reference package -->
<Exec Command="dotnet restore" WorkingDirectory="$(RuntimeStoreReferenceDirectory)" />
<MSBuild Projects="$(RuntimeStoreReferenceDirectory)\Build.RuntimeStore.References.csproj"
Targets="Pack"
Properties="Configuration=Release" />
<UpdatePackageSource
NuGetConfigPath="$(RepositoryRoot)NuGet.config"
SourceName="RuntimeStoreReference"
SourceUri="$(RuntimeStoreReferencePackageDirectory)"
Condition="Exists('$(RuntimeStoreReferencePackageDirectory)')" />
<!-- Build runtime store -->
<RemoveDir Directories="$(RuntimeStoreOutputPath)" />
<RemoveDir Directories="$(RuntimeStoreWorkingDirectory)" />
<Exec Command="dotnet store -m $(MetaPackageFile) -f netcoreapp2.0 -r $(RID) -o $(RuntimeStoreOutputPath) --framework-version 2.0.0-* -w $(RuntimeStoreWorkingDirectory) $(RUNTIME_STORE_ADDITIONAL_ARGUMENTS)" />
<!-- Create deps files for hosting startup -->
<Exec Command="dotnet restore" WorkingDirectory="$(RepositoryRoot)tools\TrimDeps" />
<Exec Command="dotnet restore" WorkingDirectory="$(HostingStartupTemplatePath)" />
<!--- MSBuild caches things if you run inproc so have to use Exec -->
<Exec Command="dotnet msbuild /t:&quot;Restore;Rebuild;CollectDeps&quot; $(HostingStartupTemplateFile) /p:&quot;DepsOutputPath=$(DepsOutputPath);HostingStartupPackageName=%(HostingStartupPackageReference.Identity);HostingStartupPackageVersion=%(Version);RuntimeFrameworkVersion=$(SharedFrameworkVersion)&quot;"/>
<ItemGroup>
<PackageStoreManifestFiles Include="$(RuntimeStoreOutputPath)**\artifact.xml">
<TimestampDestinationFile>aspnetcore-store-$(TimestampVersion)-$(RID).xml</TimestampDestinationFile>
</PackageStoreManifestFiles>
<_RuntimeStoreFiles Include="$(RuntimeStoreOutputPath)**\*" Exclude="$(RuntimeStoreOutputPath)**\artifact.xml;$(RuntimeStoreOutputPath)symbols\**\*" />
<RuntimeStoreFiles Include="@(_RuntimeStoreFiles)" >
<NoTimestampRecursiveDir>$([System.String]::new('%(RecursiveDir)').Replace('$(TimestampVersion)', '$(NoTimestampVersion)'))</NoTimestampRecursiveDir>
</RuntimeStoreFiles>
<_RuntimeStoreSymbolFiles Include="$(RuntimeStoreOutputPath)symbols\**\*" />
<RuntimeStoreSymbolFiles Include="@(_RuntimeStoreSymbolFiles )" >
<NoTimestampRecursiveDir>$([System.String]::new('%(RecursiveDir)').Replace('$(TimestampVersion)', '$(NoTimestampVersion)'))</NoTimestampRecursiveDir>
</RuntimeStoreSymbolFiles>
<DepsFiles Include="$(DepsOutputPath)**\*" />
</ItemGroup>
<Move SourceFiles="%(PackageStoreManifestFiles.FullPath)" DestinationFiles="$(ArtifactsDir)%(PackageStoreManifestFiles.TimestampDestinationFile)" />
<Copy SourceFiles="@(DepsFiles)" DestinationFolder="$(RuntimeStoreZipTimestampDir)additionalDeps\%(RecursiveDir)" />
<Copy SourceFiles="@(DepsFiles)" DestinationFolder="$(RuntimeStoreZipNoTimestampDir)additionalDeps\%(RecursiveDir)" />
<Copy SourceFiles="@(RuntimeStoreFiles)" DestinationFolder="$(RuntimeStoreZipTimestampDir)store\%(RecursiveDir)" />
<Copy SourceFiles="@(RuntimeStoreFiles)" DestinationFiles="$(RuntimeStoreZipNoTimestampDir)store\%(RuntimeStoreFiles.NoTimestampRecursiveDir)%(RuntimeStoreFiles.FileName)%(RuntimeStoreFiles.Extension)" />
<Copy SourceFiles="@(RuntimeStoreSymbolFiles)" DestinationFolder="$(RuntimeStoreSymbolsZipTimestampDir)%(RecursiveDir)" />
<Copy SourceFiles="@(RuntimeStoreSymbolFiles)" DestinationFiles="$(RuntimeStoreSymbolsZipNoTimestampDir)%(RuntimeStoreSymbolFiles.NoTimestampRecursiveDir)%(RuntimeStoreSymbolFiles.FileName)%(RuntimeStoreSymbolFiles.Extension)" />
<ItemGroup>
<NoTimestampDepsFiles Include="$(RuntimeStoreZipNoTimestampDir)additionalDeps\**\*"/>
</ItemGroup>
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_RemoveTimestampFromDepsFile" Properties="DepsFile=%(NoTimestampDepsFiles.FullPath)" />
<ItemGroup>
<OutputZipFiles Include="$(RuntimeStoreZipTimestampDir)**\*" />
<OutputZipFilesNoTimestamp Include="$(RuntimeStoreZipNoTimestampDir)**\*" />
<OutputSymbolZipFiles Include="$(RuntimeStoreSymbolsZipTimestampDir)**\*" />
<OutputSymbolZipFilesNoTimestamp Include="$(RuntimeStoreSymbolsZipNoTimestampDir)**\*" />
</ItemGroup>
<ZipArchive File="$(OutputZip)" SourceFiles="@(OutputZipFiles)" WorkingDirectory="$(RuntimeStoreZipTimestampDir)" Overwrite="true"/>
<ZipArchive File="$(OutputZipNoTimeStamp)" SourceFiles="@(OutputZipFilesNoTimestamp)" WorkingDirectory="$(RuntimeStoreZipNoTimestampDir)" Overwrite="true"/>
<ZipArchive File="$(OutputSymbolZip)" SourceFiles="@(OutputSymbolZipFiles)" WorkingDirectory="$(RuntimeStoreSymbolsZipTimestampDir)" Overwrite="true" Condition="'@(OutputSymbolZipFiles)' != ''"/>
<ZipArchive File="$(OutputSymbolZipNoTimeStamp)" SourceFiles="@(OutputSymbolZipFilesNoTimestamp)" WorkingDirectory="$(RuntimeStoreSymbolsZipNoTimestampDir)" Overwrite="true" Condition="'@(OutputSymbolZipFilesNoTimestamp)' != ''"/>
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="ConvertZipToTGZ" Properties="ZipFileName=$(OutputSymbolZip);TGZFileName=$(OutputSymbolTGZ)" Condition="'$(OSPlatform)' == 'Linux'"/>
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="ConvertZipToTGZ" Properties="ZipFileName=$(OutputSymbolZipNoTimeStamp);TGZFileName=$(OutputSymbolTGZNoTimeStamp)" Condition="'$(OSPlatform)' == 'Linux'"/>
<!-- Add a common manifest for package trimming -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="CreateCommonManifest" Condition="'$(OSPlatform)' == 'Windows' AND '$(PACKAGE_CACHE_PLATFORM)' == 'x64'"/>
</Target>
<Target Name="CreateCommonManifest">
<PropertyGroup>
<CommonManifestFileName>aspnetcore-store-$(TimestampVersion)-common.xml</CommonManifestFileName>
</PropertyGroup>
<ItemGroup>
<PackageToTrim Include="runtime.win-arm64.runtime.native.system.data.sqlclient.sni" />
</ItemGroup>
<MSBuild Projects="$(RuntimeStoreReferenceDirectory)\Build.RuntimeStore.References.csproj" Targets="GetPackageDefinitions" >
<Output TaskParameter="TargetOutputs" ItemName="_PackageDefinitions" />
</MSBuild>
<RepoTasks.CreateCommonManifest DestinationFilePath="$(ArtifactsDir)$(CommonManifestFileName)" PackageDefinitions="@(_PackageDefinitions)" Packages="@(PackageToTrim)"/>
</Target>
<Target Name="ConvertZipToTGZ">
<Exec Command="&quot;$(ScriptsDir)zip2tgz.sh&quot; &quot;$(ZipFileName)&quot; &quot;$(TGZFileName)&quot;" />
<Delete Files="$(ZipFileName)" />
</Target>
<Target Name="_ResolveCurrentSharedFrameworkVersion">
<!-- Parse framework version -->
<Exec Command="powershell.exe $(ScriptsDir)GetSharedFrameworkVersion.ps1" ConsoleToMSBuild="true" Condition="'$(OS)' == 'Windows_NT'">
<Output TaskParameter="ConsoleOutput" PropertyName="SharedFrameworkVersion" />
</Exec>
<Exec Command="bash $(ScriptsDir)GetSharedFrameworkVersion.sh" ConsoleToMSBuild="true" Condition="'$(OS)' != 'Windows_NT'">
<Output TaskParameter="ConsoleOutput" PropertyName="SharedFrameworkVersion" />
</Exec>
</Target>
<Target Name="AddDiaSymReaderToPath" Condition="'$(OS)' == 'Windows_NT'" DependsOnTargets="_ResolveCurrentSharedFrameworkVersion">
<GetDotNetHost>
<Output TaskParameter="DotNetDirectory" PropertyName="DotnetHomeDirectory" />
</GetDotNetHost>
<PropertyGroup>
<DiaSymReaderDirectory>$(DotnetHomeDirectory)shared\Microsoft.NETCore.App\$(SharedFrameworkVersion)</DiaSymReaderDirectory>
</PropertyGroup>
<Message Text="Adding DiaSymReader to PATH by appending: $(DiaSymReaderDirectory)" Importance="high" />
<SetEnvironmentVariable Variable="PATH" Value="$(PATH);$(DiaSymReaderDirectory)" />
</Target>
<Target Name="_RemoveTimestampFromDepsFile">
<Exec Command="powershell.exe -command &quot;(Get-Content $(DepsFile)).replace('$(TimestampVersion)', '$(NoTimestampVersion)') | Set-Content $(DepsFile)&quot;" Condition="'$(OS)' == 'Windows_NT'"/>
<Exec Command="sed -i -e &quot;s/$(TimestampVersion)/$(NoTimestampVersion)/g&quot; $(DepsFile)" Condition="'$(OS)' != 'Windows_NT'"/>
</Target>
<Target Name="_BuildFallbackArchive">
<Error Text="AspNetPackageVersion must be specified" Condition=" '$(AspNetPackageVersion)' == '' " />
<Error Text="PackageSource must be specified" Condition=" '$(PackageSource)' == '' " />
<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)')" />
<!-- Clear the directories -->
<RemoveDir Directories="$(FallbackArchiveDir)bin" />
<RemoveDir Directories="$(FallbackArchiveDir)obj" />
<PropertyGroup>
<FallbackStagingDir>$(FallbackArchiveDir)obj/$(OutputPackageName)</FallbackStagingDir>
<FallbackOutputArchive>$(RepositoryRoot)artifacts\$(OutputPackageName).lzma</FallbackOutputArchive>
<FallbackOutputArchiveZip>$(RepositoryRoot)artifacts\$(OutputPackageName).zip</FallbackOutputArchiveZip>
<FallbackRestoreConfigFile>$(FallbackArchiveDir)\obj\$(OutputPackageName).NuGet.config</FallbackRestoreConfigFile>
</PropertyGroup>
<!-- Create the Staging Dir -->
<MakeDir Directories="$(FallbackStagingDir)" />
<!-- Copy the NuGet.config from this repo and update it with the Package Source -->
<Copy SourceFiles="$(RepositoryRoot)NuGet.config" DestinationFiles="$(FallbackRestoreConfigFile)" />
<UpdatePackageSource
NuGetConfigPath="$(FallbackRestoreConfigFile)"
SourceName="Dependencies"
SourceUri="$(PackageSource)" />
<!-- Restore the target project -->
<MSBuild Projects="$(FallbackArchiveProj)" Targets="Restore" Properties="RestorePackagesPath=$(FallbackStagingDir);AspNetPackageVersion=$(AspNetPackageVersion);RestoreConfigFile=$(FallbackRestoreConfigFile)" />
<!-- Create the archive -->
<Message Text="Producing LZMA and ZIP Archives, this may take a while..." Importance="high" />
<ItemGroup>
<FallbackOutputFiles Include="$(FallbackStagingDir)\**\*.*" />
</ItemGroup>
<ZipArchive File="$(FallbackOutputArchiveZip)" SourceFiles="@(FallbackOutputFiles)" WorkingDirectory="$(FallbackStagingDir)" Overwrite="true"/>
<Exec Command="$(ArchiverPath) -a $(FallbackOutputArchive) $(FallbackStagingDir)" />
</Target>
<Target Name="BuildFallbackArchive">
<!-- Validate Arguments -->
<Error Text="COHERENCE_SIGNED_DROP_LOCATION is not specified. This requires a path like \\aspnetci\drops\Coherence-Signed\{branch}\{build-number}"
Condition=" '$(COHERENCE_SIGNED_DROP_LOCATION)' == '' " />
<Error Text="Required Property 'BuildNumber' not provided" Condition="'$(BuildNumber)' == ''" />
<!-- Determine ASP.NET Package Version -->
<PropertyGroup>
<NoTimestampSource>$(COHERENCE_SIGNED_DROP_LOCATION)\Signed\Packages-NoTimeStamp</NoTimestampSource>
<TimestampSource>$(COHERENCE_SIGNED_DROP_LOCATION)\Signed\Packages</TimestampSource>
<NoTimestampOutputPackageName>nuGetPackagesArchive-$(NoTimestampVersion)</NoTimestampOutputPackageName>
<TimestampOutputPackageName>nuGetPackagesArchive-$(TimestampVersion)</TimestampOutputPackageName>
</PropertyGroup>
<!-- 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="AspNetPackageVersion=$(TimestampVersion);PackageSource=$(TimestampSource);OutputPackageName=$(TimestampOutputPackageName);ArchiverPath=$(ArchiverPath)" />
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_BuildFallbackArchive" Properties="AspNetPackageVersion=$(NoTimestampVersion);PackageSource=$(NoTimestampSource);OutputPackageName=$(NoTimestampOutputPackageName);ArchiverPath=$(ArchiverPath)" />
<!-- Copy LZMA archives to Coherence-Signed drop location -->
<PropertyGroup>
<PublishDir Condition="'$(PublishShare)' != ''">$(PublishShare)\fallbackArchives</PublishDir>
</PropertyGroup>
<Copy
SourceFiles="
$(RepositoryRoot)artifacts\$(TimestampOutputPackageName).lzma;
$(RepositoryRoot)artifacts\$(NoTimestampOutputPackageName).lzma;
$(RepositoryRoot)artifacts\$(TimestampOutputPackageName).zip;
$(RepositoryRoot)artifacts\$(NoTimestampOutputPackageName).zip"
DestinationFolder="$(PublishDir)"
Condition="'$(PublishDir)' != ''" />
</Target>
<Target Name="AddManifestsToNupkg">
<Error Text="COHERENCE_DROP_LOCATION is not specified. This requires a path like \\aspnetci\drops\Coherence\{branch}\{build-number}"
Condition=" '$(COHERENCE_DROP_LOCATION)' == '' " />
<ItemGroup>
<MetaPackageNupkg Include="$(COHERENCE_DROP_LOCATION)\ship\Microsoft.AspNetCore.All.*.nupkg" />
<ManifestFiles Include="$(ArtifactsDir)*.xml"/>
</ItemGroup>
<RemoveDir Directories="@(MetaPackageNupkg->'$(TempDir)%(Filename)')" />
<Copy SourceFiles="@(MetaPackageNupkg)" DestinationFolder="$(ArtifactsDir)" />
<UnzipArchive File="$(ArtifactsDir)%(MetaPackageNupkg.FileName)%(MetaPackageNupkg.Extension)" Destination="@(MetaPackageNupkg->'$(TempDir)%(Filename)')" />
<Copy SourceFiles="@(ManifestFiles)" DestinationFolder="@(MetaPackageNupkg->'$(TempDir)%(Filename)\build\')" />
<ItemGroup>
<ArchiveFiles Include="$(TempDir)%(MetaPackageNupkg.Filename)\**\*" />
</ItemGroup>
<ZipArchive File="%(MetaPackageNupkg.FullPath)" SourceFiles="@(ArchiveFiles)" WorkingDirectory="@(MetaPackageNupkg->'$(TempDir)%(Filename)')" Overwrite="true" />
</Target>
<Target Name="BuildInstallers" DependsOnTargets="GenerateDebs;GenerateRpms;GenerateTargzs" />
<Target Name="EnsureInstallerPrerequisites" DependsOnTargets="_ResolveCurrentSharedFrameworkVersion">
<!-- Check Docker server OS -->
<Exec Command="docker version -f &quot;{{.Server.Os}}&quot;" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="DockerHostOS" />
</Exec>
<Error Text="Docker host must be using Linux containers." Condition="'$(DockerHostOS)' != 'linux'"/>
<Error Text="RUNTIMESTORE_SIGNED_ARTIFACTS_PATH is not specified. The path containing the linux archives files must be must not be empty." Condition="'$(RUNTIMESTORE_SIGNED_ARTIFACTS_PATH)' == ''" />
<ItemGroup>
<RuntimeStoreTimestampArchive Include="$(RUNTIMESTORE_SIGNED_ARTIFACTS_PATH)**\aspnetcore-store-$(TimestampVersion)-linux-x64.tar.gz"/>
<RuntimeStoreNoTimestampArchive Include="$(RUNTIMESTORE_SIGNED_ARTIFACTS_PATH)**\aspnetcore-store-$(NoTimestampVersion)-linux-x64.tar.gz"/>
</ItemGroup>
<Error Text="@(RuntimeStoreTimestampArchive->Count()) timestamp linux archives found at $(RUNTIMESTORE_SIGNED_ARTIFACTS_PATH)." Condition="'@(RuntimeStoreTimestampArchive->Count())' != 1" />
<Error Text="@(RuntimeStoreNoTimestampArchive->Count()) no timestamp linux archives found at $(RUNTIMESTORE_SIGNED_ARTIFACTS_PATH)." Condition="'@(RuntimeStoreNoTimestampArchive->Count())' != 1" />
<!-- Download dotnet installers -->
<PropertyGroup>
<HostLink>http://dotnetcli.azureedge.net/dotnet/Runtime/$(SharedFrameworkVersion)/dotnet-host-$(SharedFrameworkVersion)</HostLink>
<HostfxrLink>http://dotnetcli.azureedge.net/dotnet/Runtime/$(SharedFrameworkVersion)/dotnet-hostfxr-$(SharedFrameworkVersion)</HostfxrLink>
<RuntimeLink>http://dotnetcli.azureedge.net/dotnet/Runtime/$(SharedFrameworkVersion)/dotnet-runtime-$(SharedFrameworkVersion)</RuntimeLink>
<RuntimeTargzLink>http://dotnetcli.azureedge.net/dotnet/Runtime/$(SharedFrameworkVersion)/dotnet-runtime-$(SharedFrameworkVersion)-linux-x64.tar.gz</RuntimeTargzLink>
</PropertyGroup>
<ItemGroup>
<DotnetInstallerSuffixes Include="rhel.7-x64.rpm;debian.8-x64.deb;ubuntu.14.04-x64.deb;ubuntu.16.04-x64.deb;ubuntu.16.10-x64.deb"/>
</ItemGroup>
<RemoveDir Directories="$(DotnetInstallersDir)" />
<MakeDir Directories="$(DotnetInstallersDir)" />
<Exec Command="curl $(HostLink)-%(DotnetInstallerSuffixes.Identity) -o $(DotnetInstallersDir)dotnet-host-$(SharedFrameworkVersion)-%(DotnetInstallerSuffixes.Identity)" />
<Exec Command="curl $(HostfxrLink)-%(DotnetInstallerSuffixes.Identity) -o $(DotnetInstallersDir)dotnet-hostfxr-$(SharedFrameworkVersion)-%(DotnetInstallerSuffixes.Identity)" />
<Exec Command="curl $(RuntimeLink)-%(DotnetInstallerSuffixes.Identity) -o $(DotnetInstallersDir)dotnet-runtime-$(SharedFrameworkVersion)-%(DotnetInstallerSuffixes.Identity)" />
<Exec Command="curl $(RuntimeTargzLink) -o $(DotnetInstallersDir)dotnet-runtime-$(SharedFrameworkVersion)-linux-x64.tar.gz" />
</Target>
<Target Name="GenerateTargzs" DependsOnTargets="EnsureInstallerPrerequisites">
<!-- Create layout: Clear layout directories -->
<RemoveDir Directories="$(HostingBundleInstallerLayoutTimestampDirectory);$(HostingBundleInstallerLayoutNoTimestampDirectory)" />
<MakeDir Directories="$(HostingBundleInstallerLayoutTimestampDirectory);$(HostingBundleInstallerLayoutNoTimestampDirectory)" />
<MakeDir Directories="$(RuntimeStoreInstallerDirectory)" Condition="!Exists($(RuntimeStoreInstallerDirectory))" />
<!-- Create layout: Download dotnet runtime -->
<PropertyGroup>
<HostingBundleTimestampTARGZFileName>$(HostingBundleTimestampInstallerPackageName)-linux-$(PACKAGE_CACHE_PLATFORM).tar.gz</HostingBundleTimestampTARGZFileName>
<HostingBundleNoTimestampTARGZFileName>$(HostingBundleNoTimestampInstallerPackageName)-linux-$(PACKAGE_CACHE_PLATFORM).tar.gz</HostingBundleNoTimestampTARGZFileName>
</PropertyGroup>
<!-- Create layout: Aspnet Hosting Bundle -->
<Exec Command="tar -xzf @(RuntimeStoreTimestampArchive) -C $(HostingBundleInstallerLayoutTimestampDirectory)" />
<Exec Command="tar -xzf @(RuntimeStoreNoTimestampArchive) -C $(HostingBundleInstallerLayoutNoTimestampDirectory)" />
<Exec Command="tar -xzf $(DotnetInstallersDir)dotnet-runtime-$(SharedFrameworkVersion)-linux-x64.tar.gz -C $(HostingBundleInstallerLayoutTimestampDirectory)" />
<Exec Command="tar -xzf $(DotnetInstallersDir)dotnet-runtime-$(SharedFrameworkVersion)-linux-x64.tar.gz -C $(HostingBundleInstallerLayoutNoTimestampDirectory)" />
<!-- Create Aspnet Hosting Bundle tar.gz -->
<Exec Command="tar -czf $(RuntimeStoreInstallerDirectory)$(HostingBundleTimestampTARGZFileName) $(HostingBundleInstallerLayoutTimestampDirectory)" />
<Exec Command="tar -czf $(RuntimeStoreInstallerDirectory)$(HostingBundleNoTimestampTARGZFileName) $(HostingBundleInstallerLayoutNoTimestampDirectory)" />
</Target>
<Target Name="GenerateRpms" DependsOnTargets="EnsureInstallerPrerequisites">
<!-- Create layout: Aspnet runtime store -->
<RemoveDir Directories="$(RuntimeStoreInstallerLayoutTimestampDirectory);$(RuntimeStoreInstallerLayoutNoTimestampDirectory);$(HostingBundleInstallerLayoutTimestampDirectory);$(HostingBundleInstallerLayoutNoTimestampDirectory)" />
<MakeDir Directories="$(RuntimeStoreInstallerLayoutPackageRootTimestampDirectory);$(RuntimeStoreInstallerLayoutPackageRootNoTimestampDirectory);$(HostingBundleInstallerLayoutPackageRootTimestampDirectory);$(HostingBundleInstallerLayoutPackageRootNoTimestampDirectory)" />
<Exec Command="tar -xzf @(RuntimeStoreTimestampArchive) -C $(RuntimeStoreInstallerLayoutPackageRootTimestampDirectory)" />
<Exec Command="tar -xzf @(RuntimeStoreNoTimestampArchive) -C $(RuntimeStoreInstallerLayoutPackageRootNoTimestampDirectory)" />
<!-- Create layout: Place changelog -->
<Copy
SourceFiles="$(RPMChangelogTemplateFile)"
DestinationFiles="$(RuntimeStoreInstallerLayoutTimestampDirectory)templates/changelog"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False" />
<Copy
SourceFiles="$(RPMChangelogTemplateFile)"
DestinationFiles="$(RuntimeStoreInstallerLayoutNoTimestampDirectory)templates/changelog"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False" />
<Copy
SourceFiles="$(RPMChangelogTemplateFile)"
DestinationFiles="$(HostingBundleInstallerLayoutTimestampDirectory)templates/changelog"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False" />
<Copy
SourceFiles="$(RPMChangelogTemplateFile)"
DestinationFiles="$(HostingBundleInstallerLayoutNoTimestampDirectory)templates/changelog"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False" />
<!-- Common installer parameters -->
<JsonPeek Query="$.short_description" JsonInputPath="$(StoreDebianConfigTemplateFile)">
<Output TaskParameter="Result" ItemName="_StoreInstallerSummary" />
</JsonPeek>
<JsonPeek Query="$.long_description" JsonInputPath="$(StoreDebianConfigTemplateFile)">
<Output TaskParameter="Result" ItemName="_StoreInstallerDescription" />
</JsonPeek>
<JsonPeek Query="$.license.type" JsonInputPath="$(StoreDebianConfigTemplateFile)">
<Output TaskParameter="Result" ItemName="_StoreInstallerLicense" />
</JsonPeek>
<JsonPeek Query="$.release.package_revision" JsonInputPath="$(StoreDebianConfigTemplateFile)">
<Output TaskParameter="Result" ItemName="_StoreInstallerPackageRevision" />
</JsonPeek>
<JsonPeek Query="$.homepage" JsonInputPath="$(StoreDebianConfigTemplateFile)">
<Output TaskParameter="Result" ItemName="_StoreInstallerHomepage" />
</JsonPeek>
<JsonPeek Query="$.maintainer_name" JsonInputPath="$(StoreDebianConfigTemplateFile)">
<Output TaskParameter="Result" ItemName="_StoreInstallerMaintainerName" />
</JsonPeek>
<JsonPeek Query="$.maintainer_email" JsonInputPath="$(StoreDebianConfigTemplateFile)">
<Output TaskParameter="Result" ItemName="_StoreInstallerMaintainerEmail" />
</JsonPeek>
<JsonPeek Query="$.short_description" JsonInputPath="$(HostingDebianConfigTemplateFile)">
<Output TaskParameter="Result" ItemName="_HostingInstallerSummary" />
</JsonPeek>
<JsonPeek Query="$.long_description" JsonInputPath="$(HostingDebianConfigTemplateFile)">
<Output TaskParameter="Result" ItemName="_HostingInstallerDescription" />
</JsonPeek>
<JsonPeek Query="$.license.type" JsonInputPath="$(HostingDebianConfigTemplateFile)">
<Output TaskParameter="Result" ItemName="_HostingInstallerLicense" />
</JsonPeek>
<JsonPeek Query="$.release.package_revision" JsonInputPath="$(HostingDebianConfigTemplateFile)">
<Output TaskParameter="Result" ItemName="_HostingInstallerPackageRevision" />
</JsonPeek>
<JsonPeek Query="$.homepage" JsonInputPath="$(HostingDebianConfigTemplateFile)">
<Output TaskParameter="Result" ItemName="_HostingInstallerHomepage" />
</JsonPeek>
<JsonPeek Query="$.maintainer_name" JsonInputPath="$(HostingDebianConfigTemplateFile)">
<Output TaskParameter="Result" ItemName="_HostingInstallerMaintainerName" />
</JsonPeek>
<JsonPeek Query="$.maintainer_email" JsonInputPath="$(HostingDebianConfigTemplateFile)">
<Output TaskParameter="Result" ItemName="_HostingInstallerMaintainerEmail" />
</JsonPeek>
<ItemGroup>
<RHStoreDirectories Include="/opt/rh/rh-dotnet20/root/usr/lib64/dotnet/additionalDeps" />
<RHStoreDirectories Include="/opt/rh/rh-dotnet20/root/usr/lib64/dotnet/store" />
<GeneralStoreDirectories Include="/usr/share/dotnet/additionalDeps" />
<GeneralStoreDirectories Include="/usr/share/dotnet/store" />
</ItemGroup>
<PropertyGroup>
<StoreInstallerSummary>@(_StoreInstallerSummary)</StoreInstallerSummary>
<StoreInstallerDescription>@(_StoreInstallerDescription)</StoreInstallerDescription>
<StoreInstallerLicense>@(_StoreInstallerLicense)</StoreInstallerLicense>
<StoreInstallerPackageRevision>@(_StoreInstallerPackageRevision)</StoreInstallerPackageRevision>
<StoreInstallerHomepage>@(_StoreInstallerHomepage)</StoreInstallerHomepage>
<StoreInstallerMaintainerName>@(_StoreInstallerMaintainerName)</StoreInstallerMaintainerName>
<StoreInstallerMaintainerEmail>@(_StoreInstallerMaintainerEmail)</StoreInstallerMaintainerEmail>
<HostingInstallerSummary>@(_HostingInstallerSummary)</HostingInstallerSummary>
<HostingInstallerDescription>@(_HostingInstallerDescription)</HostingInstallerDescription>
<HostingInstallerLicense>@(_HostingInstallerLicense)</HostingInstallerLicense>
<HostingInstallerPackageRevision>@(_HostingInstallerPackageRevision)</HostingInstallerPackageRevision>
<HostingInstallerHomepage>@(_HostingInstallerHomepage)</HostingInstallerHomepage>
<HostingInstallerMaintainerName>@(_HostingInstallerMaintainerName)</HostingInstallerMaintainerName>
<HostingInstallerMaintainerEmail>@(_HostingInstallerMaintainerEmail)</HostingInstallerMaintainerEmail>
<RHInstallerInstallRoot>/opt/rh/rh-dotnet20/root/usr/lib64/dotnet/</RHInstallerInstallRoot>
<RHStoreDirectoriesArguments>@(RHStoreDirectories->' --directories &quot;%(FullPath)&quot;', ' ')</RHStoreDirectoriesArguments>
<GeneralInstallerInstallRoot>/usr/share/dotnet/</GeneralInstallerInstallRoot>
<GeneralStoreDirectoriesArguments>@(GeneralStoreDirectories->' --directories &quot;%(FullPath)&quot;', ' ')</GeneralStoreDirectoriesArguments>
</PropertyGroup>
<!-- Update Date, Maintainer, Version, Revision and Changelog Message -->
<Exec Command="sed -i
-e 's/DATE/$([System.DateTime]::UtcNow.ToString(ddd MMM dd yyyy))/'
-e 's/MAINTAINER_NAME/$(StoreInstallerMaintainerName)/'
-e 's/MAINTAINER_EMAIL/$(StoreInstallerMaintainerEmail)/'
-e 's/PACKAGE_VERSION/$(TimestampVersion)/'
-e 's/PACKAGE_REVISION/$(StoreInstallerPackageRevision)/'
$(RuntimeStoreInstallerLayoutTimestampDirectory)templates/changelog" />
<Exec Command="sed -i
-e 's/DATE/$([System.DateTime]::UtcNow.ToString(ddd MMM dd yyyy))/'
-e 's/MAINTAINER_NAME/$(StoreInstallerMaintainerName)/'
-e 's/MAINTAINER_EMAIL/$(StoreInstallerMaintainerEmail)/'
-e 's/PACKAGE_VERSION/$(NoTimestampVersion)/'
-e 's/PACKAGE_REVISION/$(StoreInstallerPackageRevision)/'
$(RuntimeStoreInstallerLayoutNoTimestampDirectory)templates/changelog" />
<Exec Command="sed -i
-e 's/DATE/$([System.DateTime]::UtcNow.ToString(ddd MMM dd yyyy))/'
-e 's/MAINTAINER_NAME/$(HostingInstallerMaintainerName)/'
-e 's/MAINTAINER_EMAIL/$(HostingInstallerMaintainerEmail)/'
-e 's/PACKAGE_VERSION/$(TimestampVersion)/'
-e 's/PACKAGE_REVISION/$(HostingInstallerPackageRevision)/'
$(HostingBundleInstallerLayoutTimestampDirectory)templates/changelog" />
<Exec Command="sed -i
-e 's/DATE/$([System.DateTime]::UtcNow.ToString(ddd MMM dd yyyy))/'
-e 's/MAINTAINER_NAME/$(HostingInstallerMaintainerName)/'
-e 's/MAINTAINER_EMAIL/$(HostingInstallerMaintainerEmail)/'
-e 's/PACKAGE_VERSION/$(NoTimestampVersion)/'
-e 's/PACKAGE_REVISION/$(HostingInstallerPackageRevision)/'
$(HostingBundleInstallerLayoutNoTimestampDirectory)templates/changelog" />
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="BuildStoreAndHostingRPM"
Properties="DockerImage=rhel.7;
InstallerPlatform=rh.rhel.7;
InstallerInstallRoot=$(RHInstallerInstallRoot);
BuildNumber=$(BuildNumber);
SharedFrameworkVersion=$(SharedFrameworkVersion);
StoreDirectoriesArguments=$(RHStoreDirectoriesArguments);
StoreInstallerSummary=$(StoreInstallerSummary);
StoreInstallerDescription=$(StoreInstallerDescription);
StoreInstallerLicense=$(StoreInstallerLicense);
StoreInstallerPackageRevision=$(StoreInstallerPackageRevision);
StoreInstallerHomepage=$(StoreInstallerHomepage);
StoreInstallerMaintainerName=$(StoreInstallerMaintainerName);
StoreInstallerMaintainerEmail=$(StoreInstallerMaintainerEmail);
HostingInstallerSummary=$(HostingInstallerSummary);
HostingInstallerDescription=$(HostingInstallerDescription);
HostingInstallerLicense=$(HostingInstallerLicense);
HostingInstallerPackageRevision=$(HostingInstallerPackageRevision);
HostingInstallerHomepage=$(HostingInstallerHomepage);
HostingInstallerMaintainerName=$(HostingInstallerMaintainerName);
HostingInstallerMaintainerEmail=$(HostingInstallerMaintainerEmail);
SkipInstallerTests=true" />
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="BuildStoreAndHostingRPM"
Properties="DockerImage=rhel.7;
InstallerPlatform=rhel.7;
InstallerInstallRoot=$(GeneralInstallerInstallRoot);
BuildNumber=$(BuildNumber);
SharedFrameworkVersion=$(SharedFrameworkVersion);
StoreDirectoriesArguments=$(GeneralStoreDirectoriesArguments);
StoreInstallerSummary=$(StoreInstallerSummary);
StoreInstallerDescription=$(StoreInstallerDescription);
StoreInstallerLicense=$(StoreInstallerLicense);
StoreInstallerPackageRevision=$(StoreInstallerPackageRevision);
StoreInstallerHomepage=$(StoreInstallerHomepage);
StoreInstallerMaintainerName=$(StoreInstallerMaintainerName);
StoreInstallerMaintainerEmail=$(StoreInstallerMaintainerEmail);
HostingInstallerSummary=$(HostingInstallerSummary);
HostingInstallerDescription=$(HostingInstallerDescription);
HostingInstallerLicense=$(HostingInstallerLicense);
HostingInstallerPackageRevision=$(HostingInstallerPackageRevision);
HostingInstallerHomepage=$(HostingInstallerHomepage);
HostingInstallerMaintainerName=$(HostingInstallerMaintainerName);
HostingInstallerMaintainerEmail=$(HostingInstallerMaintainerEmail)" />
</Target>
<Target Name="BuildStoreAndHostingRPM">
<PropertyGroup>
<!-- rpm unique installer parameters -->
<RuntimeStoreTimestampRPMFileName>$(RuntimeStoreTimestampInstallerPackageName)-$(InstallerPlatform)-$(PACKAGE_CACHE_PLATFORM).rpm</RuntimeStoreTimestampRPMFileName>
<RuntimeStoreNoTimestampRPMFileName>$(RuntimeStoreNoTimestampInstallerPackageName)-$(InstallerPlatform)-$(PACKAGE_CACHE_PLATFORM).rpm</RuntimeStoreNoTimestampRPMFileName>
<HostingBundleTimestampRPMFileName>$(HostingBundleTimestampInstallerPackageName)-$(InstallerPlatform)-$(PACKAGE_CACHE_PLATFORM).rpm</HostingBundleTimestampRPMFileName>
<HostingBundleNoTimestampRPMFileName>$(HostingBundleNoTimestampInstallerPackageName)-$(InstallerPlatform)-$(PACKAGE_CACHE_PLATFORM).rpm</HostingBundleNoTimestampRPMFileName>
<StoreInstallerMaintainer>$(StoreInstallerMaintainerName) &lt;$(StoreInstallerMaintainerEmail)&gt;</StoreInstallerMaintainer>
<HostingInstallerMaintainer>$(HostingInstallerMaintainerName) &lt;$(HostingInstallerMaintainerEmail)&gt;</HostingInstallerMaintainer>
<InstallerVendor>.NET Foundation</InstallerVendor>
</PropertyGroup>
<!-- Clear the output dir -->
<RemoveDir Directories="$(RuntimeStoreInstallerOutputTimeStampDirectory);$(RuntimeStoreInstallerOutputNoTimeStampDirectory);$(HostingBundleInstallerOutputTimeStampDirectory);$(HostingBundleInstallerOutputNoTimeStampDirectory)" />
<MakeDir Directories="$(RuntimeStoreInstallerOutputTimeStampDirectory);$(RuntimeStoreInstallerOutputNoTimeStampDirectory);$(HostingBundleInstallerOutputTimeStampDirectory);$(HostingBundleInstallerOutputNoTimeStampDirectory)" />
<!-- Build Docker Image -->
<Exec
Command="docker build --build-arg USER_ID=%24(id -u) -t docker-image-$(DockerImage) $(DockerImage)"
WorkingDirectory="$(DockerDir)" />
<!-- Build Runtime Store RPM package -->
<Exec Command="docker run
--rm
-v $(RepositoryRoot):$(DockerRootDirectory)
docker-image-$(DockerImage)
fpm
--verbose
-s dir
-t rpm
-n $(RuntimeStoreTimestampInstallerPackageName)
-v $(TimestampVersion)
-a amd64
$(StoreDirectoriesArguments)
--rpm-changelog $(DockerRootDirectory)artifacts/StoreTimestampLayout/templates/changelog
--rpm-summary &quot;$(StoreInstallerSummary)&quot;
--description &quot;$(StoreInstallerDescription)&quot;
--maintainer &quot;$(StoreInstallerMaintainer)&quot;
--vendor &quot;$(InstallerVendor)&quot;
-p $(DockerRootDirectory)artifacts/StoreTimestampOutput/$(RuntimeStoreTimestampRPMFileName)
--license &quot;$(StoreInstallerLicense)&quot;
--iteration $(StoreInstallerPackageRevision)
--url &quot;$(StoreInstallerHomepage)&quot;
$(DockerRootDirectory)artifacts/StoreTimestampLayout/package_root/=&quot;$(InstallerInstallRoot)&quot;" />
<Exec Command="docker run
--rm
-v $(RepositoryRoot):$(DockerRootDirectory)
docker-image-$(DockerImage)
fpm
--verbose
-s dir
-t rpm
-n $(RuntimeStoreNoTimestampInstallerPackageName)
-v $(NoTimestampVersion)
-a amd64
$(StoreDirectoriesArguments)
--rpm-changelog $(DockerRootDirectory)artifacts/StoreNoTimestampLayout/templates/changelog
--rpm-summary &quot;$(StoreInstallerSummary)&quot;
--description &quot;$(StoreInstallerDescription)&quot;
--maintainer &quot;$(StoreInstallerMaintainer)&quot;
--vendor &quot;$(InstallerVendor)&quot;
-p $(DockerRootDirectory)artifacts/StoreNoTimestampOutput/$(RuntimeStoreNoTimestampRPMFileName)
--license &quot;$(StoreInstallerLicense)&quot;
--iteration $(StoreInstallerPackageRevision)
--url &quot;$(StoreInstallerHomepage)&quot;
$(DockerRootDirectory)artifacts/StoreNoTimestampLayout/package_root/=&quot;$(InstallerInstallRoot)&quot;" />
<!-- Build Hosting Bundle RPM package -->
<ItemGroup>
<HostingBundleTimestampDependencies Include="$(RuntimeStoreTimestampInstallerPackageName)">
<Version>$(TimestampVersion)</Version>
</HostingBundleTimestampDependencies>
<HostingBundleTimestampDependencies Include="dotnet-runtime-$(SharedFrameworkVersion)">
<Version>$(SharedFrameworkVersion)</Version>
</HostingBundleTimestampDependencies>
<HostingBundleNoTimestampDependencies Include="$(RuntimeStoreNoTimestampInstallerPackageName)">
<Version>$(NoTimestampVersion)</Version>
</HostingBundleNoTimestampDependencies>
<HostingBundleNoTimestampDependencies Include="dotnet-runtime-$(SharedFrameworkVersion)">
<Version>$(SharedFrameworkVersion)</Version>
</HostingBundleNoTimestampDependencies>
</ItemGroup>
<PropertyGroup>
<HostingBundleTimestampDependenciesArguments>@(HostingBundleTimestampDependencies->' -d &quot;%(Identity) &gt;= %(Version)&quot;', ' ')</HostingBundleTimestampDependenciesArguments>
<HostingBundleNoTimestampDependenciesArguments>@(HostingBundleNoTimestampDependencies->' -d &quot;%(Identity) &gt;= %(Version)&quot;', ' ')</HostingBundleNoTimestampDependenciesArguments>
</PropertyGroup>
<Exec Command="docker run
--rm
-v $(RepositoryRoot):$(DockerRootDirectory)
docker-image-$(DockerImage)
fpm
--verbose
-s dir
-t rpm
-n $(HostingBundleTimestampInstallerPackageName)
-v $(TimestampVersion)
-a amd64
$(HostingBundleTimestampDependenciesArguments)
--rpm-changelog $(DockerRootDirectory)artifacts/HostingTimestampLayout/templates/changelog
--rpm-summary &quot;$(HostingInstallerSummary)&quot;
--description &quot;$(HostingInstallerDescription)&quot;
--maintainer &quot;$(HostingInstallerMaintainer)&quot;
--vendor &quot;$(InstallerVendor)&quot;
-p $(DockerRootDirectory)artifacts/HostingTimestampOutput/$(HostingBundleTimestampRPMFileName)
--license &quot;$(HostingInstallerLicense)&quot;
--iteration $(HostingInstallerPackageRevision)
--url &quot;$(HostingInstallerHomepage)&quot;
$(DockerRootDirectory)artifacts/HostingTimestampLayout/package_root/=&quot;$(InstallerInstallRoot)&quot;" />
<Exec Command="docker run
--rm
-v $(RepositoryRoot):$(DockerRootDirectory)
docker-image-$(DockerImage)
fpm
--verbose
-s dir
-t rpm
-n $(HostingBundleNoTimestampInstallerPackageName)
-v $(NoTimestampVersion)
-a amd64
$(HostingBundleNoTimestampDependenciesArguments)
--rpm-changelog $(DockerRootDirectory)artifacts/HostingNoTimestampLayout/templates/changelog
--rpm-summary &quot;$(HostingInstallerSummary)&quot;
--description &quot;$(HostingInstallerDescription)&quot;
--maintainer &quot;$(HostingInstallerMaintainer)&quot;
--vendor &quot;$(InstallerVendor)&quot;
-p $(DockerRootDirectory)artifacts/HostingNoTimestampOutput/$(HostingBundleNoTimestampRPMFileName)
--license &quot;$(HostingInstallerLicense)&quot;
--iteration $(HostingInstallerPackageRevision)
--url &quot;$(HostingInstallerHomepage)&quot;
$(DockerRootDirectory)artifacts/HostingNoTimestampLayout/package_root/=&quot;$(InstallerInstallRoot)&quot;" />
<!-- Copy Runtime Store package to output -->
<ItemGroup>
<GeneratedStoreTimestampRPMFiles Include="$(RuntimeStoreInstallerOutputTimeStampDirectory)/*.rpm" />
<GeneratedStoreNoTimestampRPMFiles Include="$(RuntimeStoreInstallerOutputNoTimeStampDirectory)/*.rpm" />
<GeneratedHostingTimestampRPMFiles Include="$(HostingBundleInstallerOutputTimeStampDirectory)/*.rpm" />
<GeneratedHostingNoTimestampRPMFiles Include="$(HostingBundleInstallerOutputNoTimeStampDirectory)/*.rpm" />
</ItemGroup>
<Error Text="@(GeneratedStoreTimestampRPMFiles->Count()) timestamp store rpm installer files generated." Condition="'@(GeneratedStoreTimestampRPMFiles->Count())' != 1" />
<Error Text="@(GeneratedStoreNoTimestampRPMFiles->Count()) no timestamp store rpm installer files generated." Condition="'@(GeneratedStoreNoTimestampRPMFiles->Count())' != 1" />
<Error Text="@(GeneratedHostingTimestampRPMFiles->Count()) timestamp hosting rpm instaler files generated." Condition="'@(GeneratedHostingTimestampRPMFiles->Count())' != 1" />
<Error Text="@(GeneratedHostingNoTimestampRPMFiles->Count()) no timestamp hosting rpm installer files generated." Condition="'@(GeneratedHostingNoTimestampRPMFiles->Count())' != 1" />
<Copy
DestinationFiles="$(RuntimeStoreInstallerDirectory)$(RuntimeStoreTimestampRPMFileName)"
SourceFiles="@(GeneratedStoreTimestampRPMFiles)"
OverwriteReadOnlyFiles="true"
SkipUnchangedFiles="false" />
<Copy
DestinationFiles="$(RuntimeStoreInstallerDirectory)$(RuntimeStoreNoTimestampRPMFileName)"
SourceFiles="@(GeneratedStoreNoTimestampRPMFiles)"
OverwriteReadOnlyFiles="true"
SkipUnchangedFiles="false" />
<Copy
DestinationFiles="$(RuntimeStoreInstallerDirectory)$(HostingBundleTimestampRPMFileName)"
SourceFiles="@(GeneratedHostingTimestampRPMFiles)"
OverwriteReadOnlyFiles="true"
SkipUnchangedFiles="false" />
<Copy
DestinationFiles="$(RuntimeStoreInstallerDirectory)$(HostingBundleNoTimestampRPMFileName)"
SourceFiles="@(GeneratedHostingNoTimestampRPMFiles)"
OverwriteReadOnlyFiles="true"
SkipUnchangedFiles="false" />
<!-- Run installer tests -->
<Exec Command="docker run
--rm
-v $(RepositoryRoot):$(DockerRootDirectory)
-e DotnetInstallerSuffix=-$(SharedFrameworkVersion)-$(DockerImage)-x64.rpm
-e InstallerExtension=.rpm
-e StoreInstallerFile=@(GeneratedStoreTimestampRPMFiles->'%(Filename)%(Extension)')
-e StoreInstallerPackageName=$(RuntimeStoreTimestampInstallerPackageName)
-e HostingInstallerFile=@(GeneratedHostingTimestampRPMFiles->'%(Filename)%(Extension)')
-e HostingInstallerPackageName=$(HostingBundleTimestampInstallerPackageName)
-e InstallRoot=$(InstallerInstallRoot)
-e InstallCommand=&quot;sudo rpm -i&quot;
-e UninstallCommand=&quot;sudo rpm -e&quot;
docker-image-$(DockerImage)
./tools/scripts/TestInstallers.sh"
Condition="'$(SkipInstallerTests)' != 'true'"/>
<Exec Command="docker run
--rm
-v $(RepositoryRoot):$(DockerRootDirectory)
-e DotnetInstallerSuffix=-$(SharedFrameworkVersion)-$(DockerImage)-x64.rpm
-e InstallerExtension=.rpm
-e StoreInstallerFile=@(GeneratedStoreNoTimestampRPMFiles->'%(Filename)%(Extension)')
-e StoreInstallerPackageName=$(RuntimeStoreNoTimestampInstallerPackageName)
-e HostingInstallerFile=@(GeneratedHostingNoTimestampRPMFiles->'%(Filename)%(Extension)')
-e HostingInstallerPackageName=$(HostingBundleNoTimestampInstallerPackageName)
-e InstallRoot=$(InstallerInstallRoot)
-e InstallCommand=&quot;sudo rpm -i&quot;
-e UninstallCommand=&quot;sudo rpm -e&quot;
docker-image-$(DockerImage)
./tools/scripts/TestInstallers.sh"
Condition="'$(SkipInstallerTests)' != 'true'"/>
<!-- Remove Docker Image to save disk space -->
<Exec Command="docker rmi docker-image-$(DockerImage)" />
</Target>
<Target Name="GenerateDebs" DependsOnTargets="EnsureInstallerPrerequisites">
<!-- Create layout: Aspnet runtime store -->
<RemoveDir Directories="$(RuntimeStoreInstallerLayoutTimestampDirectory);$(RuntimeStoreInstallerLayoutNoTimestampDirectory);$(HostingBundleInstallerLayoutTimestampDirectory);$(HostingBundleInstallerLayoutNoTimestampDirectory)" />
<MakeDir Directories="$(RuntimeStoreInstallerLayoutPackageRootTimestampDirectory);$(RuntimeStoreInstallerLayoutPackageRootNoTimestampDirectory);$(HostingBundleInstallerLayoutPackageRootTimestampDirectory);$(HostingBundleInstallerLayoutPackageRootNoTimestampDirectory)" />
<Exec Command="tar -xzf @(RuntimeStoreTimestampArchive) -C $(RuntimeStoreInstallerLayoutPackageRootTimestampDirectory)" />
<Exec Command="tar -xzf @(RuntimeStoreNoTimestampArchive) -C $(RuntimeStoreInstallerLayoutPackageRootNoTimestampDirectory)" />
<!-- Create layout: Generate and Place debian_config.json -->
<Copy
SourceFiles="$(StoreDebianConfigTemplateFile)"
DestinationFiles="$(RuntimeStoreInstallerLayoutTimestampDirectory)debian_config.json"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False" />
<Copy
SourceFiles="$(StoreDebianConfigTemplateFile)"
DestinationFiles="$(RuntimeStoreInstallerLayoutNoTimestampDirectory)debian_config.json"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False" />
<Copy
SourceFiles="$(HostingDebianConfigTemplateFile)"
DestinationFiles="$(HostingBundleInstallerLayoutTimestampDirectory)debian_config.json"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False" />
<Copy
SourceFiles="$(HostingDebianConfigTemplateFile)"
DestinationFiles="$(HostingBundleInstallerLayoutNoTimestampDirectory)debian_config.json"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False" />
<!-- Create layout: Update debian_config.json -->
<Exec Command="sed -i
-e 's/DOTNET_RUNTIME_VERSION/$(SharedFrameworkVersion)/'
-e 's/ASPNETCORE_STORE_VERSION/$(TimestampVersion)/'
$(HostingBundleInstallerLayoutTimestampDirectory)debian_config.json" />
<Exec Command="sed -i
-e 's/DOTNET_RUNTIME_VERSION/$(SharedFrameworkVersion)/'
-e 's/ASPNETCORE_STORE_VERSION/$(NoTimestampVersion)/'
$(HostingBundleInstallerLayoutNoTimestampDirectory)debian_config.json" />
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="BuildStoreAndHostingDeb"
Properties="InstallerPlatform=debian.8;
SharedFrameworkVersion=$(SharedFrameworkVersion);
BuildNumber=$(BuildNumber)" />
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="BuildStoreAndHostingDeb"
Properties="InstallerPlatform=ubuntu.14.04;
SharedFrameworkVersion=$(SharedFrameworkVersion);
BuildNumber=$(BuildNumber)" />
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="BuildStoreAndHostingDeb"
Properties="InstallerPlatform=ubuntu.16.04;
SharedFrameworkVersion=$(SharedFrameworkVersion);
BuildNumber=$(BuildNumber)" />
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="BuildStoreAndHostingDeb"
Properties="InstallerPlatform=ubuntu.16.10;
SharedFrameworkVersion=$(SharedFrameworkVersion);
BuildNumber=$(BuildNumber)" />
</Target>
<Target Name="BuildStoreAndHostingDeb">
<PropertyGroup>
<RuntimeStoreTimestampDebianFileName>$(RuntimeStoreTimestampInstallerPackageName)-$(InstallerPlatform)-$(PACKAGE_CACHE_PLATFORM).deb</RuntimeStoreTimestampDebianFileName>
<RuntimeStoreNoTimestampDebianFileName>$(RuntimeStoreNoTimestampInstallerPackageName)-$(InstallerPlatform)-$(PACKAGE_CACHE_PLATFORM).deb</RuntimeStoreNoTimestampDebianFileName>
<HostingBundleTimestampDebianFileName>$(HostingBundleTimestampInstallerPackageName)-$(InstallerPlatform)-$(PACKAGE_CACHE_PLATFORM).deb</HostingBundleTimestampDebianFileName>
<HostingBundleNoTimestampDebianFileName>$(HostingBundleNoTimestampInstallerPackageName)-$(InstallerPlatform)-$(PACKAGE_CACHE_PLATFORM).deb</HostingBundleNoTimestampDebianFileName>
</PropertyGroup>
<!-- Clear the output dir -->
<RemoveDir Directories="$(RuntimeStoreInstallerOutputTimeStampDirectory);$(RuntimeStoreInstallerOutputNoTimeStampDirectory);$(HostingBundleInstallerOutputTimeStampDirectory);$(HostingBundleInstallerOutputNoTimeStampDirectory)" />
<MakeDir Directories="$(RuntimeStoreInstallerOutputTimeStampDirectory);$(RuntimeStoreInstallerOutputNoTimeStampDirectory);$(HostingBundleInstallerOutputTimeStampDirectory);$(HostingBundleInstallerOutputNoTimeStampDirectory)" />
<!-- Build Docker Image -->
<Exec
Command="docker build --build-arg USER_ID=%24(id -u) -t docker-image-$(InstallerPlatform) $(InstallerPlatform)"
WorkingDirectory="$(DockerDir)" />
<!-- Build Runtime Store and Hosting Bundle Deb package -->
<Exec Command="docker run
--rm
-v $(RepositoryRoot):$(DockerRootDirectory)
-e DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
-e KOREBUILD_SKIP_OLD_RUNTIME_INSTALL=true
-e BuildNumber=$(BuildNumber)
-e RUNTIMESTORE_TIMESTAMP_INSTALLERNAME=$(RuntimeStoreTimestampInstallerPackageName)
-e RUNTIMESTORE_NOTIMESTAMP_INSTALLERNAME=$(RuntimeStoreNoTimestampInstallerPackageName)
-e HOSTINGBUNDLE_TIMESTAMP_INSTALLERNAME=$(HostingBundleTimestampInstallerPackageName)
-e HOSTINGBUNDLE_NOTIMESTAMP_INSTALLERNAME=$(HostingBundleNoTimestampInstallerPackageName)
docker-image-$(InstallerPlatform)
./build.sh /t:RunDebTool"
ContinueOnError="WarnAndContinue" />
<!-- Copy Runtime Store and Hosting Bundle packages to output -->
<ItemGroup>
<GeneratedStoreTimestampDebFiles Include="$(RuntimeStoreInstallerOutputTimeStampDirectory)/*.deb" />
<GeneratedStoreNoTimestampDebFiles Include="$(RuntimeStoreInstallerOutputNoTimeStampDirectory)/*.deb" />
<GeneratedHostingTimestampDebFiles Include="$(HostingBundleInstallerOutputTimeStampDirectory)/*.deb" />
<GeneratedHostingNoTimestampDebFiles Include="$(HostingBundleInstallerOutputNoTimeStampDirectory)/*.deb" />
</ItemGroup>
<Error Text="@(GeneratedTimestampDebFiles->Count()) timestamp store deb installer files generated." Condition="'@(GeneratedStoreTimestampDebFiles->Count())' != 1" />
<Error Text="@(GeneratedNoTimestampDebFiles->Count()) no timestamp store deb installer files generated." Condition="'@(GeneratedStoreNoTimestampDebFiles->Count())' != 1" />
<Error Text="@(GeneratedHostingTimestampDebFiles->Count()) timestamp hosting deb installer files generated." Condition="'@(GeneratedHostingTimestampDebFiles->Count())' != 1" />
<Error Text="@(GeneratedHostingNoTimestampDebFiles->Count()) no timestamp hosting deb installer files generated." Condition="'@(GeneratedHostingNoTimestampDebFiles->Count())' != 1" />
<Copy
DestinationFiles="$(RuntimeStoreInstallerDirectory)$(RuntimeStoreTimestampDebianFileName)"
SourceFiles="@(GeneratedStoreTimestampDebFiles)"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False" />
<Copy
DestinationFiles="$(RuntimeStoreInstallerDirectory)$(RuntimeStoreNoTimestampDebianFileName)"
SourceFiles="@(GeneratedStoreNoTimestampDebFiles)"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False" />
<Copy
DestinationFiles="$(RuntimeStoreInstallerDirectory)$(HostingBundleTimestampDebianFileName)"
SourceFiles="@(GeneratedHostingTimestampDebFiles)"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False" />
<Copy
DestinationFiles="$(RuntimeStoreInstallerDirectory)$(HostingBundleNoTimestampDebianFileName)"
SourceFiles="@(GeneratedHostingNoTimestampDebFiles)"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False" />
<!-- Run installer tests -->
<Exec Command="docker run
--rm
-v $(RepositoryRoot):$(DockerRootDirectory)
-e DotnetInstallerSuffix=-$(SharedFrameworkVersion)-$(InstallerPlatform)-x64.deb
-e InstallerExtension=.deb
-e StoreInstallerFile=$(RuntimeStoreTimestampDebianFileName)
-e StoreInstallerPackageName=$(RuntimeStoreTimestampInstallerPackageName)
-e HostingInstallerFile=$(HostingBundleTimestampDebianFileName)
-e HostingInstallerPackageName=$(HostingBundleTimestampInstallerPackageName)
-e InstallRoot=/usr/share/dotnet/
-e InstallCommand=&quot;sudo dpkg -i&quot;
-e UninstallCommand=&quot;sudo dpkg -r&quot;
docker-image-$(InstallerPlatform)
./tools/scripts/TestInstallers.sh" />
<Exec Command="docker run
--rm
-v $(RepositoryRoot):$(DockerRootDirectory)
-e DotnetInstallerSuffix=-$(SharedFrameworkVersion)-$(InstallerPlatform)-x64.deb
-e InstallerExtension=.deb
-e StoreInstallerFile=$(RuntimeStoreNoTimestampDebianFileName)
-e StoreInstallerPackageName=$(RuntimeStoreNoTimestampInstallerPackageName)
-e HostingInstallerFile=$(HostingBundleNoTimestampDebianFileName)
-e HostingInstallerPackageName=$(HostingBundleNoTimestampInstallerPackageName)
-e InstallRoot=/usr/share/dotnet/
-e InstallCommand=&quot;sudo dpkg -i&quot;
-e UninstallCommand=&quot;sudo dpkg -r&quot;
docker-image-$(InstallerPlatform)
./tools/scripts/TestInstallers.sh" />
<!-- Remove Docker Image to save disk space -->
<Exec Command="docker rmi docker-image-$(InstallerPlatform)" />
</Target>
<Target Name="RunDebTool">
<!-- Install dotnet-deb tool -->
<Exec Command="dotnet restore" WorkingDirectory="$(DotnetDebToolDirectory)" />
<!-- Build Runtime Store Timestamp Deb package -->
<Exec Command="
dotnet deb-tool
-i $(RuntimeStoreInstallerLayoutTimestampDirectory)
-o $(RuntimeStoreInstallerOutputTimeStampDirectory)
-n $(RUNTIMESTORE_TIMESTAMP_INSTALLERNAME)
-v $(TimestampVersion)"
WorkingDirectory="$(DotnetDebToolDirectory)" />
<!-- Build Runtime Store NoTimestamp Deb package -->
<Exec Command="
dotnet deb-tool
-i $(RuntimeStoreInstallerLayoutNoTimestampDirectory)
-o $(RuntimeStoreInstallerOutputNoTimeStampDirectory)
-n $(RUNTIMESTORE_NOTIMESTAMP_INSTALLERNAME)
-v $(NoTimestampVersion)"
WorkingDirectory="$(DotnetDebToolDirectory)" />
<!-- Build Hosting Bundle Timestamp Deb package -->
<Exec Command="
dotnet deb-tool
-i $(HostingBundleInstallerLayoutTimestampDirectory)
-o $(HostingBundleInstallerOutputTimeStampDirectory)
-n $(HOSTINGBUNDLE_TIMESTAMP_INSTALLERNAME)
-v $(TimestampVersion)"
WorkingDirectory="$(DotnetDebToolDirectory)" />
<!-- Build Hosting Bundle NoTimestamp Deb package -->
<Exec Command="
dotnet deb-tool
-i $(HostingBundleInstallerLayoutNoTimestampDirectory)
-o $(HostingBundleInstallerOutputNoTimeStampDirectory)
-n $(HOSTINGBUNDLE_NOTIMESTAMP_INSTALLERNAME)
-v $(NoTimestampVersion)"
WorkingDirectory="$(DotnetDebToolDirectory)" />
</Target>
</Project>