RuntimeStoreInstaller.targets 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. <Project>
  2. <PropertyGroup>
  3. <_TemplatesDirectory>$(MSBuildThisFileDirectory)tools\templates\</_TemplatesDirectory>
  4. <_DockerDir>$(MSBuildThisFileDirectory)tools\docker\</_DockerDir>
  5. <_PackagingDir>$(MSBuildThisFileDirectory)tools\packaging\</_PackagingDir>
  6. <_DebToolDir>$(MSBuildThisFileDirectory)tools\dotnet-deb-tool-consumer\</_DebToolDir>
  7. <_TimestampRSSource>$(RepositoryRoot).deps\Signed\Store\</_TimestampRSSource>
  8. <_TimestampFreeRSSource>$(RepositoryRoot).deps\Signed\Store-TimestampFree\</_TimestampFreeRSSource>
  9. <_InstallerSource>$(RepositoryRoot).deps\Installers\</_InstallerSource>
  10. <_WorkRoot>$(RepositoryRoot).w\</_WorkRoot>
  11. <_WorkLayoutDir>$(_WorkRoot).l\</_WorkLayoutDir>
  12. <_WorkOutputDir>$(_WorkRoot).o\</_WorkOutputDir>
  13. <_DockerRootDirectory>/opt/code/</_DockerRootDirectory>
  14. <_InstallersOutputDir>$(ArtifactsDir)installers\</_InstallersOutputDir>
  15. <RSInstallerName>aspnetcore-store</RSInstallerName>
  16. <HostingInstallerName>dotnet-hosting</HostingInstallerName>
  17. <RSDebConfigFile>$(_PackagingDir)store_debian_config.json</RSDebConfigFile>
  18. <HostingDebConfigFile>$(_PackagingDir)hosting_debian_config.json</HostingDebConfigFile>
  19. <PublicCoreFeedPrefix>https://dotnetcli.blob.core.windows.net/dotnet</PublicCoreFeedPrefix>
  20. <CoreFeedPrefix Condition="'$(KOREBUILD_DOTNET_FEED_UNCACHED)'!=''">$(KOREBUILD_DOTNET_FEED_UNCACHED)</CoreFeedPrefix>
  21. <CoreFeedPrefix Condition="'$(CoreFeedPrefix)'==''">$(PublicCoreFeedPrefix)</CoreFeedPrefix>
  22. <RuntimeStore200LinkPrefix>$(PublicCoreFeedPrefix)/aspnetcore/store/2.0.0-26452/Build.RS.</RuntimeStore200LinkPrefix>
  23. <RuntimeTargzLink>$(CoreFeedPrefix)/Runtime/$(MicrosoftNETCoreApp20PackageVersion)/dotnet-runtime-$(MicrosoftNETCoreApp20PackageVersion)-linux-x64.tar.gz</RuntimeTargzLink>
  24. <TimestampRSArchive>$(_TimestampRSSource)aspnetcore-store-$(PackageVersion)-linux-x64.tar.gz</TimestampRSArchive>
  25. <TimestampFreeRSArchivePrefix>$(_TimestampFreeRSSource)aspnetcore-store-$(PackageVersionNoTimestamp)-</TimestampFreeRSArchivePrefix>
  26. <TimestampFreeLinuxRSArchive>$(TimestampFreeRSArchivePrefix)linux-x64.tar.gz</TimestampFreeLinuxRSArchive>
  27. </PropertyGroup>
  28. <Target Name="BuildInstallers" DependsOnTargets="GenerateTargzs;GenerateRpms;GenerateDebs;GenerateRelabledInstallers" />
  29. <Target Name="_EnsureInstallerPrerequisites">
  30. <MakeDir Directories="$(_InstallersOutputDir)" />
  31. <!-- Check Docker server OS -->
  32. <Exec Command="docker version -f &quot;{{.Server.Os}}&quot;" StandardOutputImportance="Normal" ConsoleToMSBuild="true">
  33. <Output TaskParameter="ConsoleOutput" PropertyName="DockerHostOS" />
  34. </Exec>
  35. <Error Text="Docker host must be using Linux containers." Condition="'$(DockerHostOS)' != 'linux'"/>
  36. <Error
  37. Text="Timestamp linux archive not found. Expected it to exist in $(TimestampRSArchive)."
  38. Condition="!Exists('$(TimestampRSArchive)')" />
  39. <Error
  40. Text="Non-timestamp linux archive not found. Expected it to exist in $(TimestampFreeLinuxRSArchive)."
  41. Condition="!Exists('$(TimestampFreeLinuxRSArchive)')" />
  42. <Error
  43. Text="Non-timestamp osx archive not found. Expected it to exist in $(TimestampFreeRSArchivePrefix)osx-x64.tar.gz."
  44. Condition="!Exists('$(TimestampFreeRSArchivePrefix)osx-x64.tar.gz')" />
  45. <Error
  46. Text="Non-timestamp winx64 archive not found. Expected it to exist in $(TimestampFreeRSArchivePrefix)win7-x64.zip."
  47. Condition="!Exists('$(TimestampFreeRSArchivePrefix)win7-x64.zip')" />
  48. <Error
  49. Text="Non-timestamp winx86 archive not found. Expected it to exist in $(TimestampFreeRSArchivePrefix)win7-x86.zip."
  50. Condition="!Exists('$(TimestampFreeRSArchivePrefix)win7-x86.zip')" />
  51. </Target>
  52. <Target Name="_EnsureInstallerDirectory" >
  53. <!-- Download dotnet installers -->
  54. <MakeDir Directories="$(_InstallerSource)" />
  55. </Target>
  56. <Target Name="_DownloadInstallers" DependsOnTargets="_EnsureInstallerDirectory">
  57. <!-- Download dotnet installers -->
  58. <MakeDir Directories="$(_InstallerSource)" />
  59. <!--
  60. Note: KOREBUILD_DOTNET_FEED_CREDENTIAL is intentionally NOT an MSBuild variable.
  61. MSBuild doesn't to the substitution correctly because the string contains %,
  62. so we'll let bash do it instead.
  63. -->
  64. <Exec Command="curl --fail -sSL &quot;$(RuntimeTargzLink)$KOREBUILD_DOTNET_FEED_CREDENTIAL&quot; -o $(_InstallerSource)dotnet-runtime-$(MicrosoftNETCoreApp20PackageVersion)-linux-x64.tar.gz" />
  65. <Exec Command="curl --fail -sSL &quot;$(RuntimeStore200LinkPrefix)linux.tar.gz&quot; -o $(_InstallerSource)Build.RS.linux.tar.gz" />
  66. </Target>
  67. <Target Name="_GenerateTargz">
  68. <!-- Clear working directory -->
  69. <RemoveDir Directories="$(_WorkRoot)" />
  70. <MakeDir Directories="$(_WorkRoot)" />
  71. <!-- Create layout: Aspnet Hosting Bundle -->
  72. <Exec Command="tar -xzf $(RSArchive) -C $(_WorkRoot)" />
  73. <ItemGroup>
  74. <Archives Include="$(DependentArchives)" />
  75. </ItemGroup>
  76. <Exec Command="tar -xzf %(Archives.Identity) -C $(_WorkRoot)" />
  77. <!-- Create Aspnet Hosting Bundle tar.gz -->
  78. <Exec Command="tar -czvf $(_InstallersOutputDir)$(OutputArchiveName) ." WorkingDirectory="$(_WorkRoot)"/>
  79. </Target>
  80. <Target Name="_GenerateZip">
  81. <!-- Clear working directory -->
  82. <RemoveDir Directories="$(_WorkRoot)" />
  83. <MakeDir Directories="$(_WorkRoot)" />
  84. <!-- Create layout -->
  85. <UnzipArchive File="$(RSArchive)" Destination="$(_WorkRoot)" />
  86. <ItemGroup>
  87. <Archives Include="$(DependentArchives)" />
  88. </ItemGroup>
  89. <UnzipArchive File="%(Archives.Identity)" Destination="$(_WorkRoot)" />
  90. <ItemGroup>
  91. <ArchiveFiles Include="$(_WorkRoot)**\*" />
  92. </ItemGroup>
  93. <!-- Create Zip -->
  94. <ZipArchive File="$(_InstallersOutputDir)$(OutputArchiveName)" SourceFiles="@(ArchiveFiles)" WorkingDirectory="$(_WorkRoot)" Overwrite="true" />
  95. </Target>
  96. <Target Name="GenerateTargzs" DependsOnTargets="_EnsureInstallerPrerequisites;_DownloadInstallers">
  97. <ItemGroup>
  98. <_DependentArchives Include="$(_InstallerSource)dotnet-runtime-$(MicrosoftNETCoreApp20PackageVersion)-linux-x64.tar.gz" />
  99. <_DependentArchives Include="$(_InstallerSource)Build.RS.linux.tar.gz" />
  100. </ItemGroup>
  101. <PropertyGroup>
  102. <DependentArchives>@(_DependentArchives)</DependentArchives>
  103. <HostingArchiveName>$(HostingInstallerName)-$(Version)-linux-x64.tar.gz</HostingArchiveName>
  104. <TimestampFreeHostingArchiveName>$(HostingInstallerName)-$(PackageVersionNoTimestamp)-linux-x64.tar.gz</TimestampFreeHostingArchiveName>
  105. </PropertyGroup>
  106. <!-- Timestamp hosting bundle -->
  107. <MSBuild
  108. Projects="$(MSBuildProjectFullPath)"
  109. Targets="_GenerateTargz"
  110. Properties="DependentArchives=$(DependentArchives);RSArchive=$(TimestampRSArchive);OutputArchiveName=$(HostingArchiveName)" />
  111. <!-- Timestamp free hosting bundle -->
  112. <MSBuild
  113. Projects="$(MSBuildProjectFullPath)"
  114. Targets="_GenerateTargz"
  115. Properties="DependentArchives=$(DependentArchives);RSArchive=$(TimestampFreeLinuxRSArchive);OutputArchiveName=$(TimestampFreeHostingArchiveName)" />
  116. </Target>
  117. <Target Name="_DownloadAdditionalRSZips" DependsOnTargets="_EnsureInstallerDirectory;_DownloadInstallers">
  118. <Exec Command="curl --fail -sSL &quot;$(RuntimeStore200LinkPrefix)osx.tar.gz&quot; -o $(_InstallerSource)Build.RS.osx.tar.gz" />
  119. <Exec Command="curl --fail -sSL &quot;$(RuntimeStore200LinkPrefix)winx64.zip&quot; -o $(_InstallerSource)Build.RS.winx64.zip" />
  120. <Exec Command="curl --fail -sSL &quot;$(RuntimeStore200LinkPrefix)winx86.zip&quot; -o $(_InstallerSource)Build.RS.winx86.zip" />
  121. </Target>
  122. <Target Name="GenerateCumulativeArchives" DependsOnTargets="_EnsureInstallerPrerequisites;_DownloadAdditionalRSZips">
  123. <!-- Temporary: Generate time stamp free cumulative zips with old naming scheme -->
  124. <ItemGroup>
  125. <TargzArchives Include="Build.RS.linux.tar.gz">
  126. <RSArchive>$(TimestampFreeRSArchivePrefix)linux-x64.tar.gz</RSArchive>
  127. </TargzArchives>
  128. <TargzArchives Include="Build.RS.osx.tar.gz">
  129. <RSArchive>$(TimestampFreeRSArchivePrefix)osx-x64.tar.gz</RSArchive>
  130. </TargzArchives>
  131. <ZipArchives Include="Build.RS.winx64.zip">
  132. <RSArchive>$(TimestampFreeRSArchivePrefix)win7-x64.zip</RSArchive>
  133. </ZipArchives>
  134. <ZipArchives Include="Build.RS.winx86.zip">
  135. <RSArchive>$(TimestampFreeRSArchivePrefix)win7-x86.zip</RSArchive>
  136. </ZipArchives>
  137. </ItemGroup>
  138. <!-- Targz -->
  139. <MSBuild
  140. Projects="$(MSBuildProjectFullPath)"
  141. Targets="_GenerateTargz"
  142. Properties="DependentArchives=$(_InstallerSource)%(TargzArchives.Identity);RSArchive=%(TargzArchives.RSArchive);OutputArchiveName=%(TargzArchives.Identity)" />
  143. <!-- Targz -->
  144. <MSBuild
  145. Projects="$(MSBuildProjectFullPath)"
  146. Targets="_GenerateZip"
  147. Properties="DependentArchives=$(_InstallerSource)%(ZipArchives.Identity);RSArchive=%(ZipArchives.RSArchive);OutputArchiveName=%(ZipArchives.Identity)" />
  148. </Target>
  149. <Target Name="_BuildDockerImage">
  150. <Exec
  151. Command="docker build --build-arg USER_ID=%24(id -u) -t docker-image-$(Image) $(Image)"
  152. WorkingDirectory="$(_DockerDir)" />
  153. </Target>
  154. <Target Name="_RemoveDockerImage">
  155. <Exec Command="docker rmi docker-image-$(Image)" />
  156. </Target>
  157. <Target Name="_GenerateRpm">
  158. <!-- Clear working directory -->
  159. <RemoveDir Directories="$(_WorkRoot)" />
  160. <MakeDir Directories="$(_WorkRoot)" />
  161. <!-- Create layout: Extract archive if given -->
  162. <MakeDir Directories="$(_WorkRoot)package_root\" />
  163. <Exec Command="tar -xzf $(RSArchive) -C $(_WorkRoot)package_root\" Condition="'$(RSArchive)'!=''" />
  164. <!-- Create layout: Place changelog -->
  165. <Copy
  166. SourceFiles="$(_PackagingDir)changelog"
  167. DestinationFiles="$(_WorkRoot)templates/changelog"
  168. OverwriteReadOnlyFiles="True"
  169. SkipUnchangedFiles="False"
  170. UseHardlinksIfPossible="False" />
  171. <ItemGroup>
  172. <ChangelogItems Include="DATE" Replacement="$([System.DateTime]::UtcNow.ToString(ddd MMM dd yyyy))" />
  173. <ChangelogItems Include="MAINTAINER_NAME" Replacement="$(MaintainerName)" />
  174. <ChangelogItems Include="MAINTAINER_EMAIL" Replacement="$(MaintainerEmail)" />
  175. <ChangelogItems Include="PACKAGE_VERSION" Replacement="$(RPMVersion)" />
  176. <ChangelogItems Include="PACKAGE_REVISION" Replacement="$(RPMRevision)" />
  177. </ItemGroup>
  178. <!-- Update Date, Maintainer, Version, Revision and Changelog Message -->
  179. <RepoTasks.ReplaceInFile Filename="$(_WorkRoot)templates/changelog" Items="@(ChangelogItems)" />
  180. <!-- Update Maintainer and Summary -->
  181. <PropertyGroup>
  182. <RPMMaintainer>$(MaintainerName) &lt;$(MaintainerEmail)&gt;</RPMMaintainer>
  183. <RPMSummary>$(RPMSummary.Replace('DEB_VERSION','$(RPMVersion)'))</RPMSummary>
  184. </PropertyGroup>
  185. <!-- Run RPM -->
  186. <Exec Command="docker run
  187. --rm
  188. -v $(RepositoryRoot):$(_DockerRootDirectory)
  189. docker-image-$(Image)
  190. fpm
  191. --verbose
  192. -s dir
  193. -t rpm
  194. -n $(RPMInstallerPrefix)-$(RPMVersion)
  195. -p $(_DockerRootDirectory)artifacts/installers/$(RPMInstallerPrefix)-$(RPMVersion)-$(RPMFileSuffix)
  196. -v $(RPMVersion)
  197. --iteration $(RPMRevision)
  198. -a amd64
  199. $(RPMArguments)
  200. --rpm-changelog $(_DockerRootDirectory).w/templates/changelog
  201. --rpm-summary &quot;$(RPMSummary)&quot;
  202. --description &quot;$(RPMDescription)&quot;
  203. --maintainer &quot;$(RPMMaintainer)&quot;
  204. --vendor &quot;$(RPMVendor)&quot;
  205. --license &quot;$(RPMLicense)&quot;
  206. --url &quot;$(RPMHomepage)&quot;
  207. $(_DockerRootDirectory).w/package_root/=&quot;$(RPMInstallRoot)&quot;" />
  208. </Target>
  209. <Target Name="GenerateRpms" DependsOnTargets="_EnsureInstallerPrerequisites">
  210. <PropertyGroup>
  211. <Image>rhel.7</Image>
  212. <RPMVendor>.NET Foundation</RPMVendor>
  213. <RHInstallerInstallRoot>/opt/rh/rh-dotnet20/root/usr/lib64/dotnet/</RHInstallerInstallRoot>
  214. <GenericInstallerInstallRoot>/usr/share/dotnet/</GenericInstallerInstallRoot>
  215. </PropertyGroup>
  216. <!-- Build Docker Image -->
  217. <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_BuildDockerImage" Properties="Image=$(Image)" />
  218. <!-- Common installer parameters -->
  219. <JsonPeek Query="$.short_description" JsonInputPath="$(RSDebConfigFile)">
  220. <Output TaskParameter="Result" ItemName="_RSInstallerSummary" />
  221. </JsonPeek>
  222. <JsonPeek Query="$.long_description" JsonInputPath="$(RSDebConfigFile)">
  223. <Output TaskParameter="Result" ItemName="_RSDescription" />
  224. </JsonPeek>
  225. <JsonPeek Query="$.license.type" JsonInputPath="$(RSDebConfigFile)">
  226. <Output TaskParameter="Result" ItemName="_RSLicense" />
  227. </JsonPeek>
  228. <JsonPeek Query="$.release.package_revision" JsonInputPath="$(RSDebConfigFile)">
  229. <Output TaskParameter="Result" ItemName="_RSPackageRevision" />
  230. </JsonPeek>
  231. <JsonPeek Query="$.homepage" JsonInputPath="$(RSDebConfigFile)">
  232. <Output TaskParameter="Result" ItemName="_RSHomepage" />
  233. </JsonPeek>
  234. <JsonPeek Query="$.maintainer_name" JsonInputPath="$(RSDebConfigFile)">
  235. <Output TaskParameter="Result" ItemName="_RSMaintainerName" />
  236. </JsonPeek>
  237. <JsonPeek Query="$.maintainer_email" JsonInputPath="$(RSDebConfigFile)">
  238. <Output TaskParameter="Result" ItemName="_RSMaintainerEmail" />
  239. </JsonPeek>
  240. <JsonPeek Query="$.short_description" JsonInputPath="$(HostingDebConfigFile)">
  241. <Output TaskParameter="Result" ItemName="_HostingSummary" />
  242. </JsonPeek>
  243. <JsonPeek Query="$.long_description" JsonInputPath="$(HostingDebConfigFile)">
  244. <Output TaskParameter="Result" ItemName="_HostingDescription" />
  245. </JsonPeek>
  246. <JsonPeek Query="$.license.type" JsonInputPath="$(HostingDebConfigFile)">
  247. <Output TaskParameter="Result" ItemName="_HostingLicense" />
  248. </JsonPeek>
  249. <JsonPeek Query="$.release.package_revision" JsonInputPath="$(HostingDebConfigFile)">
  250. <Output TaskParameter="Result" ItemName="_HostingRevision" />
  251. </JsonPeek>
  252. <JsonPeek Query="$.homepage" JsonInputPath="$(HostingDebConfigFile)">
  253. <Output TaskParameter="Result" ItemName="_HostingHomepage" />
  254. </JsonPeek>
  255. <JsonPeek Query="$.maintainer_name" JsonInputPath="$(HostingDebConfigFile)">
  256. <Output TaskParameter="Result" ItemName="_HostingMaintainerName" />
  257. </JsonPeek>
  258. <JsonPeek Query="$.maintainer_email" JsonInputPath="$(HostingDebConfigFile)">
  259. <Output TaskParameter="Result" ItemName="_HostingMaintainerEmail" />
  260. </JsonPeek>
  261. <ItemGroup>
  262. <RHStoreDirectories Include="$(RHInstallerInstallRoot)additionalDeps" />
  263. <RHStoreDirectories Include="$(RHInstallerInstallRoot)store" />
  264. <GenericStoreDirectories Include="$(GenericInstallerInstallRoot)additionalDeps" />
  265. <GenericStoreDirectories Include="$(GenericInstallerInstallRoot)store" />
  266. <RSDependencies Include="$(RSInstallerName)-2.0.0">
  267. <Version>2.0.0</Version>
  268. </RSDependencies>
  269. <HostingDependencies Include="$(RSInstallerName)-$(PackageVersion)">
  270. <Version>$(PackageVersion)</Version>
  271. </HostingDependencies>
  272. <HostingDependencies Include="dotnet-runtime-$(MicrosoftNETCoreApp20PackageVersion)">
  273. <Version>$(MicrosoftNETCoreApp20PackageVersion)</Version>
  274. </HostingDependencies>
  275. <TimestampFreeHostingDependencies Include="$(RSInstallerName)-$(PackageVersionNoTimestamp)">
  276. <Version>$(PackageVersionNoTimestamp)</Version>
  277. </TimestampFreeHostingDependencies>
  278. <TimestampFreeHostingDependencies Include="dotnet-runtime-$(MicrosoftNETCoreApp20PackageVersion)">
  279. <Version>$(MicrosoftNETCoreApp20PackageVersion)</Version>
  280. </TimestampFreeHostingDependencies>
  281. </ItemGroup>
  282. <PropertyGroup>
  283. <HostingFPMArguments>@(HostingDependencies->' -d &quot;%(Identity) &gt;= %(Version)&quot;', ' ')</HostingFPMArguments>
  284. <TimestampFreeHostingFPMArguments>@(TimestampFreeHostingDependencies->' -d &quot;%(Identity) &gt;= %(Version)&quot;', ' ')</TimestampFreeHostingFPMArguments>
  285. <RSDependencyArguments>@(RSDependencies->' -d &quot;%(Identity) &gt;= %(Version)&quot;', ' ')</RSDependencyArguments>
  286. <RHRSArguments>$(RSDependencyArguments) @(RHStoreDirectories->' --directories &quot;%(FullPath)&quot;', ' ')</RHRSArguments>
  287. <GenericRSArguments>$(RSDependencyArguments) @(GenericStoreDirectories->' --directories &quot;%(FullPath)&quot;', ' ')</GenericRSArguments>
  288. <CommonArguments>Image=$(Image);RPMVendor=$(RPMVendor)</CommonArguments>
  289. <CommonGenericArguments>RPMFileSuffix=rhel.7-x64.rpm;RPMInstallRoot=$(GenericInstallerInstallRoot)</CommonGenericArguments>
  290. <CommonRHArguments>RPMFileSuffix=rh.rhel.7-x64.rpm;RPMInstallRoot=$(RHInstallerInstallRoot)</CommonRHArguments>
  291. <CommonRSArguments>MaintainerName=@(_RSMaintainerName);MaintainerEmail=@(_RSMaintainerEmail)</CommonRSArguments>
  292. <CommonRSArguments>$(CommonRSArguments);RPMInstallerPrefix=$(RSInstallerName);RPMRevision=@(_RSPackageRevision)</CommonRSArguments>
  293. <CommonRSArguments>$(CommonRSArguments);RPMSummary=@(_RSInstallerSummary);RPMDescription=@(_RSDescription)</CommonRSArguments>
  294. <CommonRSArguments>$(CommonRSArguments);RPMLicense=@(_RSLicense);RPMHomepage=@(_RSHomepage)</CommonRSArguments>
  295. <CommonHostingArguments>$(CommonArguments);MaintainerName=@(_HostingMaintainerName);MaintainerEmail=@(_HostingMaintainerEmail)</CommonHostingArguments>
  296. <CommonHostingArguments>$(CommonHostingArguments);RPMInstallerPrefix=$(HostingInstallerName);RPMRevision=@(_HostingRevision)</CommonHostingArguments>
  297. <CommonHostingArguments>$(CommonHostingArguments);RPMSummary=@(_HostingSummary);RPMDescription=@(_HostingDescription)</CommonHostingArguments>
  298. <CommonHostingArguments>$(CommonHostingArguments);RPMLicense=@(_HostingLicense);RPMHomepage=@(_HostingHomepage)</CommonHostingArguments>
  299. <TimestampRSArguments>$(CommonArguments);$(CommonGenericArguments);$(CommonRSArguments)</TimestampRSArguments>
  300. <TimestampRSArguments>$(TimestampRSArguments);RSArchive=$(TimestampRSArchive);RPMVersion=$(PackageVersion);RPMArguments=$(GenericRSArguments)</TimestampRSArguments>
  301. <TimestampFreeRSArguments>$(CommonArguments);$(CommonGenericArguments);$(CommonRSArguments)</TimestampFreeRSArguments>
  302. <TimestampFreeRSArguments>$(TimestampFreeRSArguments);RSArchive=$(TimestampFreeLinuxRSArchive);RPMVersion=$(PackageVersionNoTimestamp);RPMArguments=$(GenericRSArguments)</TimestampFreeRSArguments>
  303. <TimestampHostingArguments>$(CommonArguments);$(CommonGenericArguments);$(CommonHostingArguments)</TimestampHostingArguments>
  304. <TimestampHostingArguments>$(TimestampHostingArguments);RPMVersion=$(PackageVersion);RPMArguments=$(HostingFPMArguments)</TimestampHostingArguments>
  305. <TimestampFreeHostingArguments>$(CommonArguments);$(CommonGenericArguments);$(CommonHostingArguments)</TimestampFreeHostingArguments>
  306. <TimestampFreeHostingArguments>$(TimestampFreeHostingArguments);RPMVersion=$(PackageVersionNoTimestamp);RPMArguments=$(TimestampFreeHostingFPMArguments)</TimestampFreeHostingArguments>
  307. <RHTimestampRSArguments>$(CommonArguments);$(CommonRHArguments);$(CommonRSArguments)</RHTimestampRSArguments>
  308. <RHTimestampRSArguments>$(RHTimestampRSArguments);RSArchive=$(TimestampRSArchive);RPMVersion=$(PackageVersion);RPMArguments=$(RHRSArguments)</RHTimestampRSArguments>
  309. <RHTimestampFreeRSArguments>$(CommonArguments);$(CommonRHArguments);$(CommonRSArguments)</RHTimestampFreeRSArguments>
  310. <RHTimestampFreeRSArguments>$(RHTimestampFreeRSArguments);RSArchive=$(TimestampFreeLinuxRSArchive);RPMVersion=$(PackageVersionNoTimestamp);RPMArguments=$(RHRSArguments)</RHTimestampFreeRSArguments>
  311. <RHTimestampHostingArguments>$(CommonArguments);$(CommonRHArguments);$(CommonHostingArguments)</RHTimestampHostingArguments>
  312. <RHTimestampHostingArguments>$(RHTimestampHostingArguments);RPMVersion=$(PackageVersion);RPMArguments=$(HostingFPMArguments)</RHTimestampHostingArguments>
  313. <RHTimestampFreeHostingArguments>$(CommonArguments);$(CommonRHArguments);$(CommonHostingArguments)</RHTimestampFreeHostingArguments>
  314. <RHTimestampFreeHostingArguments>$(RHTimestampFreeHostingArguments);RPMVersion=$(PackageVersionNoTimestamp);RPMArguments=$(TimestampFreeHostingFPMArguments)</RHTimestampFreeHostingArguments>
  315. </PropertyGroup>
  316. <!-- General Timestamp runtime store -->
  317. <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(TimestampRSArguments)" />
  318. <!-- General Timestamp free runtime store -->
  319. <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(TimestampFreeRSArguments)" />
  320. <!-- General Timestamp hosting bundle -->
  321. <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(TimestampHostingArguments)" />
  322. <!-- General Timestamp free hosting bundle -->
  323. <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(TimestampFreeHostingArguments)" />
  324. <!-- RH Timestamp runtime store -->
  325. <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(RHTimestampRSArguments)" />
  326. <!-- RH Timestamp free runtime store -->
  327. <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(RHTimestampFreeRSArguments)" />
  328. <!-- RH Timestamp hosting bundle -->
  329. <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(RHTimestampHostingArguments)" />
  330. <!-- RH Timestamp free hosting bundle -->
  331. <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateRpm" Properties="$(RHTimestampFreeHostingArguments)" />
  332. <!-- Remove Docker Image to save disk space -->
  333. <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_RemoveDockerImage" Properties="Image=$(Image)" />
  334. </Target>
  335. <Target Name="_GenerateDeb">
  336. <!-- Create layout: Clear work directory -->
  337. <RemoveDir Directories="$(_WorkRoot)" />
  338. <MakeDir Directories="$(_WorkRoot)" />
  339. <!-- Create layout: Extract archive if given -->
  340. <MakeDir Directories="$(_WorkLayoutDir)package_root\" />
  341. <Exec Command="tar -xzf $(RSArchive) -C $(_WorkLayoutDir)package_root/" Condition="'$(RSArchive)'!=''" />
  342. <!-- Create layout: Generate and Place debian_config.json -->
  343. <Copy
  344. SourceFiles="$(DebConfig)"
  345. DestinationFiles="$(_WorkLayoutDir)debian_config.json"
  346. OverwriteReadOnlyFiles="True"
  347. SkipUnchangedFiles="False"
  348. UseHardlinksIfPossible="False" />
  349. <ItemGroup>
  350. <DebConfigItems Include="DOTNET_VERSION" Replacement="$(DotnetVersion)" />
  351. <DebConfigItems Include="DEB_VERSION" Replacement="$(DebVersion)" />
  352. </ItemGroup>
  353. <!-- Update versions -->
  354. <RepoTasks.ReplaceInFile Filename="$(_WorkLayoutDir)debian_config.json" Items="@(DebConfigItems)" />
  355. <!-- Build Runtime Store and Hosting Bundle Deb package -->
  356. <!--
  357. Note: KOREBUILD_DOTNET_FEED_CREDENTIAL is intentionally NOT an MSBuild variable.
  358. MSBuild doesn't to the substitution correctly because the string contains %,
  359. so we'll let bash do it instead.
  360. -->
  361. <Exec Command="docker run
  362. --rm
  363. -v $(RepositoryRoot):$(_DockerRootDirectory)
  364. -e DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
  365. -e INSTALLER_NAME=$(DebPrefix)-$(DebVersion)
  366. -e INSTALLER_VERSION=$(DebVersion)
  367. -e 'KOREBUILD_DOTNET_VERSION=$(KOREBUILD_DOTNET_VERSION)'
  368. -e 'KOREBUILD_DOTNET_SHARED_RUNTIME_VERSION=$(KOREBUILD_DOTNET_SHARED_RUNTIME_VERSION)'
  369. -e 'KOREBUILD_DOTNET_FEED_CDN=$(KOREBUILD_DOTNET_FEED_CDN)'
  370. -e 'KOREBUILD_DOTNET_FEED_UNCACHED=$(KOREBUILD_DOTNET_FEED_UNCACHED)'
  371. -e &quot;KOREBUILD_DOTNET_FEED_CREDENTIAL=$KOREBUILD_DOTNET_FEED_CREDENTIAL&quot;
  372. docker-image-$(Image)
  373. ./build.sh /t:RunDebTool"
  374. ContinueOnError="WarnAndContinue" />
  375. <!-- Copy Runtime Store and Hosting Bundle packages to output -->
  376. <ItemGroup>
  377. <GeneratedDebFiles Include="$(_WorkOutputDir)/*.deb" />
  378. </ItemGroup>
  379. <Error Text="@(GeneratedDebFiles->Count()) deb installer files generated." Condition="'@(GeneratedDebFiles->Count())' != 1" />
  380. <Copy
  381. DestinationFiles="$(_InstallersOutputDir)$(DebPrefix)-$(DebVersion)-$(Image)-x64.deb"
  382. SourceFiles="@(GeneratedDebFiles)"
  383. OverwriteReadOnlyFiles="True"
  384. SkipUnchangedFiles="False"
  385. UseHardlinksIfPossible="False" />
  386. </Target>
  387. <Target Name="_GenerateDebOnPlatform">
  388. <PropertyGroup>
  389. <CommonRSArguments>Image=$(Image);DebConfig=$(RSDebConfigFile);DebPrefix=$(RSInstallerName)</CommonRSArguments>
  390. <CommonHostingArguments>Image=$(Image);DebConfig=$(HostingDebConfigFile);DotnetVersion=$(MicrosoftNETCoreApp20PackageVersion);DebPrefix=$(HostingInstallerName)</CommonHostingArguments>
  391. </PropertyGroup>
  392. <!-- Build Docker Image -->
  393. <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_BuildDockerImage" Properties="Image=$(Image)" />
  394. <MSBuild
  395. Projects="$(MSBuildProjectFullPath)"
  396. Targets="_GenerateDeb"
  397. Properties="$(CommonRSArguments);RSArchive=$(TimestampRSArchive);DebVersion=$(Version)" />
  398. <MSBuild
  399. Projects="$(MSBuildProjectFullPath)"
  400. Targets="_GenerateDeb"
  401. Properties="$(CommonRSArguments);RSArchive=$(TimestampFreeLinuxRSArchive);DebVersion=$(PackageVersionNoTimestamp)" />
  402. <MSBuild
  403. Projects="$(MSBuildProjectFullPath)"
  404. Targets="_GenerateDeb"
  405. Properties="$(CommonHostingArguments);DebVersion=$(Version)" />
  406. <MSBuild
  407. Projects="$(MSBuildProjectFullPath)"
  408. Targets="_GenerateDeb"
  409. Properties="$(CommonHostingArguments);DebVersion=$(PackageVersionNoTimestamp)" />
  410. <!-- Remove Docker Image to save disk space -->
  411. <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_RemoveDockerImage" Properties="Image=$(Image)" />
  412. </Target>
  413. <Target Name="GenerateDebs" DependsOnTargets="_EnsureInstallerPrerequisites">
  414. <PropertyGroup>
  415. <CommonArguments>Version=$(Version);TimestampFreeVersion=$(PackageVersionNoTimestamp)</CommonArguments>
  416. </PropertyGroup>
  417. <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateDebOnPlatform" Properties="$(CommonArguments);Image=debian.8" />
  418. <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateDebOnPlatform" Properties="$(CommonArguments);Image=ubuntu.14.04" />
  419. <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateDebOnPlatform" Properties="$(CommonArguments);Image=ubuntu.16.04" />
  420. <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GenerateDebOnPlatform" Properties="$(CommonArguments);Image=ubuntu.16.10" />
  421. </Target>
  422. <Target Name="RunDebTool">
  423. <!-- Install dotnet-deb tool -->
  424. <MSBuild Projects="$(_DebToolDir)dotnet-deb-tool-consumer.csproj" Targets="Restore" />
  425. <!-- Build deb package -->
  426. <Exec
  427. Command="dotnet deb-tool -i $(_WorkLayoutDir) -o $(_WorkOutputDir) -n $(INSTALLER_NAME) -v $(INSTALLER_VERSION)"
  428. WorkingDirectory="$(_DebToolDir)" />
  429. </Target>
  430. <Target Name="GenerateRelabledInstallers">
  431. <ItemGroup>
  432. <Debian8Installers Include="$(_InstallersOutputDir)*debian.8*" />
  433. <Ubuntu1604Installers Include="$(_InstallersOutputDir)*ubuntu.16.04*" />
  434. </ItemGroup>
  435. <!-- Create debian.9 installers by renaming debian.8 installers -->
  436. <Copy
  437. SourceFiles="%(Debian8Installers.FullPath)"
  438. DestinationFiles="$([System.String]::Copy('%(Debian8Installers.FullPath)').Replace('debian.8','debian.9'))"
  439. OverwriteReadOnlyFiles="True"
  440. SkipUnchangedFiles="False"
  441. UseHardlinksIfPossible="False" />
  442. <!-- Create ubuntu.17.04 installers by renaming ubuntu.16.04 installers -->
  443. <Copy
  444. SourceFiles="%(Ubuntu1604Installers.FullPath)"
  445. DestinationFiles="$([System.String]::Copy('%(Ubuntu1604Installers.FullPath)').Replace('ubuntu.16.04','ubuntu.17.04'))"
  446. OverwriteReadOnlyFiles="True"
  447. SkipUnchangedFiles="False"
  448. UseHardlinksIfPossible="False" />
  449. </Target>
  450. </Project>