aspnetcore/build/RuntimeStoreInstaller.targets

528 lines
27 KiB
XML

<Project>
<PropertyGroup>
<_TemplatesDirectory>$(MSBuildThisFileDirectory)tools\templates\</_TemplatesDirectory>
<_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>
<_InstallerSource>$(RepositoryRoot).deps\Installers\</_InstallerSource>
<_WorkRoot>$(RepositoryRoot).w\</_WorkRoot>
<_WorkLayoutDir>$(_WorkRoot).l\</_WorkLayoutDir>
<_WorkOutputDir>$(_WorkRoot).o\</_WorkOutputDir>
<_DockerRootDirectory>/opt/code/</_DockerRootDirectory>
<_InstallersOutputDir>$(ArtifactsDir)installers\</_InstallersOutputDir>
<RSInstallerName>aspnetcore-store</RSInstallerName>
<HostingInstallerName>dotnet-hosting</HostingInstallerName>
<RSDebConfigFile>$(_PackagingDir)store_debian_config.json</RSDebConfigFile>
<HostingDebConfigFile>$(_PackagingDir)hosting_debian_config.json</HostingDebConfigFile>
<PublicCoreFeedPrefix>https://dotnetcli.blob.core.windows.net/dotnet</PublicCoreFeedPrefix>
<CoreFeedPrefix Condition="'$(KOREBUILD_DOTNET_FEED_UNCACHED)'!=''">$(KOREBUILD_DOTNET_FEED_UNCACHED)</CoreFeedPrefix>
<CoreFeedPrefix Condition="'$(CoreFeedPrefix)'==''">$(PublicCoreFeedPrefix)</CoreFeedPrefix>
<RuntimeStore20LinkPrefix>$(PublicCoreFeedPrefix)/aspnetcore/store/2.0.3-125/Build.RS.</RuntimeStore20LinkPrefix>
<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>
</PropertyGroup>
<Target Name="BuildInstallers" DependsOnTargets="GenerateTargzs;GenerateRpms;GenerateDebs;GenerateRelabledInstallers" />
<Target Name="_EnsureInstallerPrerequisites">
<MakeDir Directories="$(_InstallersOutputDir)" />
<!-- Check Docker server OS -->
<Exec Command="docker version -f &quot;{{.Server.Os}}&quot;" StandardOutputImportance="Normal" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="DockerHostOS" />
</Exec>
<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')" />
</Target>
<Target Name="_EnsureInstallerDirectory" >
<!-- Download dotnet installers -->
<MakeDir Directories="$(_InstallerSource)" />
</Target>
<Target Name="_DownloadInstallers" DependsOnTargets="_EnsureInstallerDirectory">
<!-- Download dotnet installers -->
<MakeDir Directories="$(_InstallerSource)" />
<!--
Note: KOREBUILD_DOTNET_FEED_CREDENTIAL is intentionally NOT an MSBuild variable.
MSBuild doesn't to the substitution correctly because the string contains %,
so we'll let bash do it instead.
-->
<Exec Command="curl --fail -sSL &quot;$(RuntimeTargzLink)$KOREBUILD_DOTNET_FEED_CREDENTIAL&quot; -o $(_InstallerSource)dotnet-runtime-$(MicrosoftNETCoreApp20PackageVersion)-linux-x64.tar.gz" />
<Exec Command="curl --fail -sSL &quot;$(RuntimeStore20LinkPrefix)linux.tar.gz&quot; -o $(_InstallerSource)Build.RS.linux.tar.gz" />
</Target>
<Target Name="_GenerateTargz">
<!-- Clear working directory -->
<RemoveDir Directories="$(_WorkRoot)" />
<MakeDir Directories="$(_WorkRoot)" />
<!-- Create layout: Aspnet Hosting Bundle -->
<Exec Command="tar -xzf $(RSArchive) -C $(_WorkRoot)" />
<ItemGroup>
<Archives Include="$(DependentArchives)" />
</ItemGroup>
<Exec Command="tar -xzf %(Archives.Identity) -C $(_WorkRoot)" />
<!-- Create Aspnet Hosting Bundle tar.gz -->
<Exec Command="tar -czvf $(_InstallersOutputDir)$(OutputArchiveName) ." WorkingDirectory="$(_WorkRoot)"/>
</Target>
<Target Name="_GenerateZip">
<!-- Clear working directory -->
<RemoveDir Directories="$(_WorkRoot)" />
<MakeDir Directories="$(_WorkRoot)" />
<!-- Create layout -->
<UnzipArchive File="$(RSArchive)" Destination="$(_WorkRoot)" />
<ItemGroup>
<Archives Include="$(DependentArchives)" />
</ItemGroup>
<UnzipArchive File="%(Archives.Identity)" Destination="$(_WorkRoot)" />
<ItemGroup>
<ArchiveFiles Include="$(_WorkRoot)**\*" />
</ItemGroup>
<!-- Create Zip -->
<ZipArchive File="$(_InstallersOutputDir)$(OutputArchiveName)" SourceFiles="@(ArchiveFiles)" WorkingDirectory="$(_WorkRoot)" Overwrite="true" />
</Target>
<Target Name="GenerateTargzs" DependsOnTargets="_EnsureInstallerPrerequisites;_DownloadInstallers">
<ItemGroup>
<_DependentArchives Include="$(_InstallerSource)dotnet-runtime-$(MicrosoftNETCoreApp20PackageVersion)-linux-x64.tar.gz" />
<_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)" />
</Target>
<Target Name="_DownloadAdditionalRSZips" DependsOnTargets="_EnsureInstallerDirectory;_DownloadInstallers">
<Exec Command="curl --fail -sSL &quot;$(RuntimeStore20LinkPrefix)osx.tar.gz&quot; -o $(_InstallerSource)Build.RS.osx.tar.gz" />
<Exec Command="curl --fail -sSL &quot;$(RuntimeStore20LinkPrefix)winx64.zip&quot; -o $(_InstallerSource)Build.RS.winx64.zip" />
<Exec Command="curl --fail -sSL &quot;$(RuntimeStore20LinkPrefix)winx86.zip&quot; -o $(_InstallerSource)Build.RS.winx86.zip" />
</Target>
<Target Name="GenerateCumulativeArchives" DependsOnTargets="_EnsureInstallerPrerequisites;_DownloadAdditionalRSZips">
<!-- Temporary: Generate time stamp free cumulative zips with old naming scheme -->
<ItemGroup>
<TargzArchives Include="Build.RS.linux.tar.gz">
<RSArchive>$(TimestampFreeRSArchivePrefix)linux-x64.tar.gz</RSArchive>
</TargzArchives>
<TargzArchives Include="Build.RS.osx.tar.gz">
<RSArchive>$(TimestampFreeRSArchivePrefix)osx-x64.tar.gz</RSArchive>
</TargzArchives>
<ZipArchives Include="Build.RS.winx64.zip">
<RSArchive>$(TimestampFreeRSArchivePrefix)win7-x64.zip</RSArchive>
</ZipArchives>
<ZipArchives Include="Build.RS.winx86.zip">
<RSArchive>$(TimestampFreeRSArchivePrefix)win7-x86.zip</RSArchive>
</ZipArchives>
</ItemGroup>
<!-- Targz -->
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="_GenerateTargz"
Properties="DependentArchives=$(_InstallerSource)%(TargzArchives.Identity);RSArchive=%(TargzArchives.RSArchive);OutputArchiveName=%(TargzArchives.Identity)" />
<!-- Targz -->
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="_GenerateZip"
Properties="DependentArchives=$(_InstallerSource)%(ZipArchives.Identity);RSArchive=%(ZipArchives.RSArchive);OutputArchiveName=%(ZipArchives.Identity)" />
</Target>
<Target Name="_BuildDockerImage">
<Exec
Command="docker build --build-arg USER_ID=%24(id -u) -t docker-image-$(Image) $(Image)"
WorkingDirectory="$(_DockerDir)" />
</Target>
<Target Name="_RemoveDockerImage">
<Exec Command="docker rmi docker-image-$(Image)" />
</Target>
<Target Name="_GenerateRpm">
<!-- Clear working directory -->
<RemoveDir Directories="$(_WorkRoot)" />
<MakeDir Directories="$(_WorkRoot)" />
<!-- Create layout: Extract archive if given -->
<MakeDir Directories="$(_WorkRoot)package_root\" />
<Exec Command="tar -xzf $(RSArchive) -C $(_WorkRoot)package_root\" Condition="'$(RSArchive)'!=''" />
<!-- Create layout: Place changelog -->
<Copy
SourceFiles="$(_PackagingDir)changelog"
DestinationFiles="$(_WorkRoot)templates/changelog"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False" />
<ItemGroup>
<ChangelogItems Include="DATE" Replacement="$([System.DateTime]::UtcNow.ToString(ddd MMM dd yyyy))" />
<ChangelogItems Include="MAINTAINER_NAME" Replacement="$(MaintainerName)" />
<ChangelogItems Include="MAINTAINER_EMAIL" Replacement="$(MaintainerEmail)" />
<ChangelogItems Include="PACKAGE_VERSION" Replacement="$(RPMVersion)" />
<ChangelogItems Include="PACKAGE_REVISION" Replacement="$(RPMRevision)" />
</ItemGroup>
<!-- Update Date, Maintainer, Version, Revision and Changelog Message -->
<RepoTasks.ReplaceInFile Filename="$(_WorkRoot)templates/changelog" Items="@(ChangelogItems)" />
<!-- Update Maintainer and Summary -->
<PropertyGroup>
<RPMMaintainer>$(MaintainerName) &lt;$(MaintainerEmail)&gt;</RPMMaintainer>
<RPMSummary>$(RPMSummary.Replace('DEB_VERSION','$(RPMVersion)'))</RPMSummary>
</PropertyGroup>
<!-- Run RPM -->
<Exec Command="docker run
--rm
-v $(RepositoryRoot):$(_DockerRootDirectory)
docker-image-$(Image)
fpm
--verbose
-s dir
-t rpm
-n $(RPMInstallerPrefix)-$(RPMVersion)
-p $(_DockerRootDirectory)artifacts/installers/$(RPMInstallerPrefix)-$(RPMVersion)-$(RPMFileSuffix)
-v $(RPMVersion)
--iteration $(RPMRevision)
-a amd64
$(RPMArguments)
--rpm-changelog $(_DockerRootDirectory).w/templates/changelog
--rpm-summary &quot;$(RPMSummary)&quot;
--description &quot;$(RPMDescription)&quot;
--maintainer &quot;$(RPMMaintainer)&quot;
--vendor &quot;$(RPMVendor)&quot;
--license &quot;$(RPMLicense)&quot;
--url &quot;$(RPMHomepage)&quot;
$(_DockerRootDirectory).w/package_root/=&quot;$(RPMInstallRoot)&quot;" />
</Target>
<Target Name="GenerateRpms" DependsOnTargets="_EnsureInstallerPrerequisites">
<PropertyGroup>
<Image>rhel.7</Image>
<RPMVendor>.NET Foundation</RPMVendor>
<RHInstallerInstallRoot>/opt/rh/rh-dotnet20/root/usr/lib64/dotnet/</RHInstallerInstallRoot>
<GenericInstallerInstallRoot>/usr/share/dotnet/</GenericInstallerInstallRoot>
</PropertyGroup>
<!-- Build Docker Image -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_BuildDockerImage" Properties="Image=$(Image)" />
<!-- Common installer parameters -->
<JsonPeek Query="$.short_description" JsonInputPath="$(RSDebConfigFile)">
<Output TaskParameter="Result" ItemName="_RSInstallerSummary" />
</JsonPeek>
<JsonPeek Query="$.long_description" JsonInputPath="$(RSDebConfigFile)">
<Output TaskParameter="Result" ItemName="_RSDescription" />
</JsonPeek>
<JsonPeek Query="$.license.type" JsonInputPath="$(RSDebConfigFile)">
<Output TaskParameter="Result" ItemName="_RSLicense" />
</JsonPeek>
<JsonPeek Query="$.release.package_revision" JsonInputPath="$(RSDebConfigFile)">
<Output TaskParameter="Result" ItemName="_RSPackageRevision" />
</JsonPeek>
<JsonPeek Query="$.homepage" JsonInputPath="$(RSDebConfigFile)">
<Output TaskParameter="Result" ItemName="_RSHomepage" />
</JsonPeek>
<JsonPeek Query="$.maintainer_name" JsonInputPath="$(RSDebConfigFile)">
<Output TaskParameter="Result" ItemName="_RSMaintainerName" />
</JsonPeek>
<JsonPeek Query="$.maintainer_email" JsonInputPath="$(RSDebConfigFile)">
<Output TaskParameter="Result" ItemName="_RSMaintainerEmail" />
</JsonPeek>
<JsonPeek Query="$.short_description" JsonInputPath="$(HostingDebConfigFile)">
<Output TaskParameter="Result" ItemName="_HostingSummary" />
</JsonPeek>
<JsonPeek Query="$.long_description" JsonInputPath="$(HostingDebConfigFile)">
<Output TaskParameter="Result" ItemName="_HostingDescription" />
</JsonPeek>
<JsonPeek Query="$.license.type" JsonInputPath="$(HostingDebConfigFile)">
<Output TaskParameter="Result" ItemName="_HostingLicense" />
</JsonPeek>
<JsonPeek Query="$.release.package_revision" JsonInputPath="$(HostingDebConfigFile)">
<Output TaskParameter="Result" ItemName="_HostingRevision" />
</JsonPeek>
<JsonPeek Query="$.homepage" JsonInputPath="$(HostingDebConfigFile)">
<Output TaskParameter="Result" ItemName="_HostingHomepage" />
</JsonPeek>
<JsonPeek Query="$.maintainer_name" JsonInputPath="$(HostingDebConfigFile)">
<Output TaskParameter="Result" ItemName="_HostingMaintainerName" />
</JsonPeek>
<JsonPeek Query="$.maintainer_email" JsonInputPath="$(HostingDebConfigFile)">
<Output TaskParameter="Result" ItemName="_HostingMaintainerEmail" />
</JsonPeek>
<ItemGroup>
<RHStoreDirectories Include="$(RHInstallerInstallRoot)additionalDeps" />
<RHStoreDirectories Include="$(RHInstallerInstallRoot)store" />
<GenericStoreDirectories Include="$(GenericInstallerInstallRoot)additionalDeps" />
<GenericStoreDirectories Include="$(GenericInstallerInstallRoot)store" />
<RSDependencies Include="$(RSInstallerName)-2.0.0">
<Version>2.0.0</Version>
</RSDependencies>
<HostingDependencies Include="$(RSInstallerName)-$(PackageVersion)">
<Version>$(PackageVersion)</Version>
</HostingDependencies>
<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>
<CommonArguments>Image=$(Image);RPMVendor=$(RPMVendor)</CommonArguments>
<CommonGenericArguments>RPMFileSuffix=rhel.7-x64.rpm;RPMInstallRoot=$(GenericInstallerInstallRoot)</CommonGenericArguments>
<CommonRHArguments>RPMFileSuffix=rh.rhel.7-x64.rpm;RPMInstallRoot=$(RHInstallerInstallRoot)</CommonRHArguments>
<CommonRSArguments>MaintainerName=@(_RSMaintainerName);MaintainerEmail=@(_RSMaintainerEmail)</CommonRSArguments>
<CommonRSArguments>$(CommonRSArguments);RPMInstallerPrefix=$(RSInstallerName);RPMRevision=@(_RSPackageRevision)</CommonRSArguments>
<CommonRSArguments>$(CommonRSArguments);RPMSummary=@(_RSInstallerSummary);RPMDescription=@(_RSDescription)</CommonRSArguments>
<CommonRSArguments>$(CommonRSArguments);RPMLicense=@(_RSLicense);RPMHomepage=@(_RSHomepage)</CommonRSArguments>
<CommonHostingArguments>$(CommonArguments);MaintainerName=@(_HostingMaintainerName);MaintainerEmail=@(_HostingMaintainerEmail)</CommonHostingArguments>
<CommonHostingArguments>$(CommonHostingArguments);RPMInstallerPrefix=$(HostingInstallerName);RPMRevision=@(_HostingRevision)</CommonHostingArguments>
<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>
<TimestampFreeRSArguments>$(CommonArguments);$(CommonGenericArguments);$(CommonRSArguments)</TimestampFreeRSArguments>
<TimestampFreeRSArguments>$(TimestampFreeRSArguments);RSArchive=$(TimestampFreeLinuxRSArchive);RPMVersion=$(PackageVersionNoTimestamp);RPMArguments=$(GenericRSArguments)</TimestampFreeRSArguments>
<TimestampHostingArguments>$(CommonArguments);$(CommonGenericArguments);$(CommonHostingArguments)</TimestampHostingArguments>
<TimestampHostingArguments>$(TimestampHostingArguments);RPMVersion=$(PackageVersion);RPMArguments=$(HostingFPMArguments)</TimestampHostingArguments>
<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>
</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)" />
<!-- 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)" />
<!-- Remove Docker Image to save disk space -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_RemoveDockerImage" Properties="Image=$(Image)" />
</Target>
<Target Name="_GenerateDeb">
<!-- Create layout: Clear work directory -->
<RemoveDir Directories="$(_WorkRoot)" />
<MakeDir Directories="$(_WorkRoot)" />
<!-- Create layout: Extract archive if given -->
<MakeDir Directories="$(_WorkLayoutDir)package_root\" />
<Exec Command="tar -xzf $(RSArchive) -C $(_WorkLayoutDir)package_root/" Condition="'$(RSArchive)'!=''" />
<!-- Create layout: Generate and Place debian_config.json -->
<Copy
SourceFiles="$(DebConfig)"
DestinationFiles="$(_WorkLayoutDir)debian_config.json"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False" />
<ItemGroup>
<DebConfigItems Include="DOTNET_VERSION" Replacement="$(DotnetVersion)" />
<DebConfigItems Include="DEB_VERSION" Replacement="$(DebVersion)" />
</ItemGroup>
<!-- Update versions -->
<RepoTasks.ReplaceInFile Filename="$(_WorkLayoutDir)debian_config.json" Items="@(DebConfigItems)" />
<!-- Build Runtime Store and Hosting Bundle Deb package -->
<!--
Note: KOREBUILD_DOTNET_FEED_CREDENTIAL is intentionally NOT an MSBuild variable.
MSBuild doesn't to the substitution correctly because the string contains %,
so we'll let bash do it instead.
-->
<Exec Command="docker run
--rm
-v $(RepositoryRoot):$(_DockerRootDirectory)
-e DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
-e INSTALLER_NAME=$(DebPrefix)-$(DebVersion)
-e INSTALLER_VERSION=$(DebVersion)
-e 'KOREBUILD_DOTNET_VERSION=$(KOREBUILD_DOTNET_VERSION)'
-e 'KOREBUILD_DOTNET_SHARED_RUNTIME_VERSION=$(KOREBUILD_DOTNET_SHARED_RUNTIME_VERSION)'
-e 'KOREBUILD_DOTNET_FEED_CDN=$(KOREBUILD_DOTNET_FEED_CDN)'
-e 'KOREBUILD_DOTNET_FEED_UNCACHED=$(KOREBUILD_DOTNET_FEED_UNCACHED)'
-e &quot;KOREBUILD_DOTNET_FEED_CREDENTIAL=$KOREBUILD_DOTNET_FEED_CREDENTIAL&quot;
docker-image-$(Image)
./build.sh /t:RunDebTool"
ContinueOnError="WarnAndContinue" />
<!-- Copy Runtime Store and Hosting Bundle packages to output -->
<ItemGroup>
<GeneratedDebFiles Include="$(_WorkOutputDir)/*.deb" />
</ItemGroup>
<Error Text="@(GeneratedDebFiles->Count()) deb installer files generated." Condition="'@(GeneratedDebFiles->Count())' != 1" />
<Copy
DestinationFiles="$(_InstallersOutputDir)$(DebPrefix)-$(DebVersion)-$(Image)-x64.deb"
SourceFiles="@(GeneratedDebFiles)"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False" />
</Target>
<Target Name="_GenerateDebOnPlatform">
<PropertyGroup>
<CommonRSArguments>Image=$(Image);DebConfig=$(RSDebConfigFile);DebPrefix=$(RSInstallerName)</CommonRSArguments>
<CommonHostingArguments>Image=$(Image);DebConfig=$(HostingDebConfigFile);DotnetVersion=$(MicrosoftNETCoreApp20PackageVersion);DebPrefix=$(HostingInstallerName)</CommonHostingArguments>
</PropertyGroup>
<!-- Build Docker Image -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_BuildDockerImage" Properties="Image=$(Image)" />
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="_GenerateDeb"
Properties="$(CommonRSArguments);RSArchive=$(TimestampRSArchive);DebVersion=$(Version)" />
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="_GenerateDeb"
Properties="$(CommonRSArguments);RSArchive=$(TimestampFreeLinuxRSArchive);DebVersion=$(PackageVersionNoTimestamp)" />
<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)" />
</Target>
<Target Name="GenerateDebs" DependsOnTargets="_EnsureInstallerPrerequisites">
<PropertyGroup>
<CommonArguments>Version=$(Version);TimestampFreeVersion=$(PackageVersionNoTimestamp)</CommonArguments>
</PropertyGroup>
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateDebOnPlatform" Properties="$(CommonArguments);Image=debian.8" />
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateDebOnPlatform" Properties="$(CommonArguments);Image=ubuntu.14.04" />
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateDebOnPlatform" Properties="$(CommonArguments);Image=ubuntu.16.04" />
</Target>
<Target Name="RunDebTool">
<!-- Install dotnet-deb tool -->
<MSBuild Projects="$(_DebToolDir)dotnet-deb-tool-consumer.csproj" Targets="Restore" />
<!-- Build deb package -->
<Exec
Command="dotnet deb-tool -i $(_WorkLayoutDir) -o $(_WorkOutputDir) -n $(INSTALLER_NAME) -v $(INSTALLER_VERSION)"
WorkingDirectory="$(_DebToolDir)" />
</Target>
<Target Name="GenerateRelabledInstallers">
<ItemGroup>
<Debian8Installers Include="$(_InstallersOutputDir)*debian.8*" />
<Ubuntu1604Installers Include="$(_InstallersOutputDir)*ubuntu.16.04*" />
</ItemGroup>
<!-- Create debian.9 installers by renaming debian.8 installers -->
<Copy
SourceFiles="%(Debian8Installers.FullPath)"
DestinationFiles="$([System.String]::Copy('%(Debian8Installers.FullPath)').Replace('debian.8','debian.9'))"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False" />
<!-- Create ubuntu.17.04 installers by renaming ubuntu.16.04 installers -->
<Copy
SourceFiles="%(Ubuntu1604Installers.FullPath)"
DestinationFiles="$([System.String]::Copy('%(Ubuntu1604Installers.FullPath)').Replace('ubuntu.16.04','ubuntu.17.04'))"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False" />
</Target>
</Project>