2017-06-11 22:27:48 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
|
|
<Import Project='Installer.RPM.props'/>
|
|
|
|
|
|
|
|
<UsingTask TaskName="ReplaceFileContents" AssemblyFile="$(CLIBuildDll)"/>
|
|
|
|
<UsingTask TaskName="BuildFPMToolPreReqs" AssemblyFile="$(CLIBuildDll)"/>
|
|
|
|
|
|
|
|
<PropertyGroup>
|
|
|
|
<BuildRpmPackage Condition=" '$(IsRPMBasedDistro)' == 'True' ">True</BuildRpmPackage>
|
|
|
|
</PropertyGroup>
|
|
|
|
|
|
|
|
<Target Name="GenerateRpms"
|
|
|
|
DependsOnTargets="TestFPMTool;BuildRpms;TestSdkRpm"
|
|
|
|
Condition=" '$(BuildRpmPackage)' == 'True' "
|
|
|
|
Outputs="@(GeneratedInstallers)"/>
|
|
|
|
|
|
|
|
<Target Name="BuildRpms"
|
|
|
|
DependsOnTargets="GenerateSdkRpm"
|
|
|
|
Condition=" '$(BuildRpmPackage)' == 'True' and '$(FPMPresent)' == 'True' "/>
|
|
|
|
|
2017-07-31 18:19:15 +00:00
|
|
|
<Target Name="GenerateSdkRpm"
|
|
|
|
DependsOnTargets="SetupRpmProps">
|
2017-06-11 22:27:48 +00:00
|
|
|
|
|
|
|
<RemoveDir Condition="Exists('$(RpmIntermediatesDir)')" Directories="$(RpmIntermediatesDir)"/>
|
|
|
|
<MakeDir Directories="$(RpmIntermediatesDir)"/>
|
|
|
|
|
|
|
|
<!-- Create empty rpm layout -->
|
|
|
|
<RemoveDir Condition="Exists('$(RpmLayoutDirectory)')" Directories="$(RpmLayoutDirectory)"/>
|
|
|
|
<MakeDir Directories="$(RpmLayoutDirectory)"/>
|
|
|
|
<MakeDir Directories="$(RpmLayoutPackageRoot)"/>
|
|
|
|
<MakeDir Directories="$(RpmLayoutSDK)"/>
|
|
|
|
<MakeDir Directories="$(RpmLayoutDocs)"/>
|
|
|
|
<MakeDir Directories="$(RpmLayoutTemplates)"/>
|
|
|
|
<MakeDir Directories="$(RpmLayoutScripts)"/>
|
|
|
|
|
|
|
|
<!-- Copy files to rpm layout -->
|
|
|
|
<ItemGroup>
|
|
|
|
<SDKFiles Include="$(InputRoot)/**/*"/>
|
|
|
|
<SDKManpages Include="$(ManPagesDir)/**/*"/>
|
|
|
|
<SDKTemplatesFiles Include="$(TemplatesDir)/**/*"/>
|
2017-07-27 06:10:48 +00:00
|
|
|
<SDKScriptsFiles Include="$(ScriptsDir)/after_remove_host.sh"/>
|
2017-06-11 22:27:48 +00:00
|
|
|
</ItemGroup>
|
|
|
|
|
|
|
|
<Copy SourceFiles="@(SDKFiles)"
|
|
|
|
DestinationFiles="@(SDKFiles->'$(RpmLayoutSDK)/%(RecursiveDir)%(Filename)%(Extension)')"
|
|
|
|
OverwriteReadOnlyFiles="True"
|
|
|
|
SkipUnchangedFiles="False"
|
|
|
|
UseHardlinksIfPossible="False"/>
|
|
|
|
|
|
|
|
<Copy SourceFiles="@(SDKManpages)"
|
|
|
|
DestinationFiles="@(SDKManpages->'$(RpmLayoutDocs)/%(RecursiveDir)%(Filename)%(Extension)')"
|
|
|
|
OverwriteReadOnlyFiles="True"
|
|
|
|
SkipUnchangedFiles="False"
|
|
|
|
UseHardlinksIfPossible="False"/>
|
|
|
|
|
|
|
|
<Copy SourceFiles="@(SDKTemplatesFiles)"
|
|
|
|
DestinationFiles="@(SDKTemplatesFiles->'$(RpmLayoutTemplates)/%(RecursiveDir)%(Filename)%(Extension)')"
|
|
|
|
OverwriteReadOnlyFiles="True"
|
|
|
|
SkipUnchangedFiles="False"
|
|
|
|
UseHardlinksIfPossible="False"/>
|
|
|
|
|
|
|
|
<Copy SourceFiles="@(SDKScriptsFiles)"
|
|
|
|
DestinationFiles="@(SDKScriptsFiles->'$(RpmLayoutScripts)/%(RecursiveDir)%(Filename)%(Extension)')"
|
|
|
|
OverwriteReadOnlyFiles="True"
|
|
|
|
SkipUnchangedFiles="False"
|
|
|
|
UseHardlinksIfPossible="False"/>
|
|
|
|
|
|
|
|
<!-- Replace config json variables -->
|
|
|
|
<ItemGroup>
|
|
|
|
<SDKTokenValue Include="%SHARED_HOST_RPM_VERSION%">
|
|
|
|
<ReplacementString>$(SharedFrameworkVersion)</ReplacementString>
|
|
|
|
</SDKTokenValue>
|
2017-07-13 19:08:35 +00:00
|
|
|
<SDKTokenValue Include="%ASPNETCOREPACKAGESTORE_RPM_PACKAGE_NAME%">
|
|
|
|
<ReplacementString>$(AspNetCoreRuntimePackageName)</ReplacementString>
|
|
|
|
</SDKTokenValue>
|
|
|
|
<SDKTokenValue Include="%ASPNETCOREPACKAGESTORE_RPM_PACKAGE_VERSION%">
|
|
|
|
<ReplacementString>$(AspNetCoreRuntimePackageVersion)</ReplacementString>
|
|
|
|
</SDKTokenValue>
|
2017-06-11 22:27:48 +00:00
|
|
|
<SDKTokenValue Include="%SHARED_HOST_RPM_NAME%">
|
|
|
|
<ReplacementString>$(SharedFxRpmPackageName)</ReplacementString>
|
|
|
|
</SDKTokenValue>
|
|
|
|
<SDKTokenValue Include="%SDK_NUGET_VERSION%">
|
|
|
|
<ReplacementString>$(SdkVersion)</ReplacementString>
|
|
|
|
</SDKTokenValue>
|
|
|
|
<SDKTokenValue Include="%CLI_SDK_BRAND_NAME%">
|
|
|
|
<ReplacementString>$(SdkBrandName)</ReplacementString>
|
|
|
|
</SDKTokenValue>
|
|
|
|
<SDKTokenValue Include="%SDK_RPM_PACKAGE_NAME%">
|
|
|
|
<ReplacementString>$(SdkRpmPackageName)</ReplacementString>
|
|
|
|
</SDKTokenValue>
|
2017-07-27 06:10:48 +00:00
|
|
|
|
|
|
|
<AfterInstallHostTokenValue Include="%SDK_VERSION%">
|
|
|
|
<ReplacementString>$(SdkVersion)</ReplacementString>
|
|
|
|
</AfterInstallHostTokenValue>
|
2017-06-11 22:27:48 +00:00
|
|
|
</ItemGroup>
|
|
|
|
|
|
|
|
<ItemGroup>
|
|
|
|
<TestSdkRpmTaskEnvironmentVariables Include="PATH=$(RpmInstalledDirectory)$(PathListSeparator)$(PATH)" />
|
2017-09-05 22:08:42 +00:00
|
|
|
<TestSdkRpmTaskEnvironmentVariables Include="TEST_ARTIFACTS=$(TestArtifactsDir)" />
|
|
|
|
<TestSdkRpmTaskEnvironmentVariables Include="TEST_PACKAGES=$(TestPackagesDir)" />
|
|
|
|
<TestSdkRpmTaskEnvironmentVariables Include="PreviousStageProps=$(NextStagePropsPath)" />
|
|
|
|
|
|
|
|
<!-- Consumed By Publish -->
|
2017-06-11 22:27:48 +00:00
|
|
|
<GeneratedInstallers Include="$(SdkInstallerFile)" />
|
|
|
|
</ItemGroup>
|
|
|
|
|
2017-07-27 06:10:48 +00:00
|
|
|
<ReplaceFileContents InputFile="$(AfterInstallHostScriptTemplateFile)"
|
|
|
|
DestinationFile="$(AfterInstallHostScriptDestinationFile)"
|
|
|
|
ReplacementItems="@(AfterInstallHostTokenValue)"/>
|
|
|
|
|
|
|
|
<Chmod
|
|
|
|
Glob="$(AfterInstallHostScriptDestinationFile)"
|
|
|
|
Mode="ugo+x" />
|
|
|
|
|
2017-06-11 22:27:48 +00:00
|
|
|
<ReplaceFileContents InputFile="$(ConfigJsonFile)"
|
|
|
|
DestinationFile="$(RpmLayoutDirectory)$(RpmConfigJsonName)"
|
|
|
|
ReplacementItems="@(SDKTokenValue)"/>
|
|
|
|
|
|
|
|
<!-- Call the task to build the pre-reqs (parameters, copyright, changelog) for calling the FPM tool -->
|
|
|
|
<BuildFPMToolPreReqs InputDir="$(RpmLayoutDirectory)"
|
|
|
|
OutputDir="$(RpmIntermediatesDir)"
|
|
|
|
PackageVersion="$(RpmPackageVersion)"
|
|
|
|
ConfigJsonFile="$(RpmLayoutDirectory)$(RpmConfigJsonName)">
|
|
|
|
<Output TaskParameter="FPMParameters" PropertyName="FPMCmdParameters"/>
|
|
|
|
</BuildFPMToolPreReqs>
|
|
|
|
|
|
|
|
<!-- Build the RPM package by calling the FPM tool and passing the parameter list -->
|
|
|
|
<Exec Command="fpm $(FPMCmdParameters)" WorkingDirectory="$(RpmIntermediatesDir)"/>
|
|
|
|
|
|
|
|
<!-- Copy package to output -->
|
|
|
|
<ItemGroup>
|
|
|
|
<GeneratedRpmFiles Remove="@(GeneratedRpmFiles)"/>
|
|
|
|
<GeneratedRpmFiles Include="$(RpmIntermediatesDir)/*.rpm"/>
|
|
|
|
</ItemGroup>
|
|
|
|
|
|
|
|
<Error Text="@(GeneratedRpmFiles->Count()) .rpm files generated." Condition="'@(GeneratedRpmFiles->Count())' != 1"/>
|
|
|
|
|
|
|
|
<Copy SourceFiles="@(GeneratedRpmFiles)"
|
|
|
|
DestinationFiles="$(RpmFile)"
|
|
|
|
OverwriteReadOnlyFiles="True"
|
|
|
|
SkipUnchangedFiles="False"
|
|
|
|
UseHardlinksIfPossible="False"/>
|
|
|
|
|
|
|
|
</Target>
|
|
|
|
|
2017-07-31 18:19:15 +00:00
|
|
|
<Target Name="SetupRpmProps">
|
|
|
|
<PropertyGroup>
|
|
|
|
<RpmPackageVersion>$(SdkVersion)</RpmPackageVersion>
|
|
|
|
<InputRoot>$(OutputDirectory)/sdk</InputRoot>
|
|
|
|
<SdkInstallerFile>$(InstallerOutputDirectory)/$(DistroSpecificArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk)$(InstallerExtension)</SdkInstallerFile>
|
|
|
|
<RpmFile>$(SdkInstallerFile)</RpmFile>
|
|
|
|
<ManPagesDir>$(RepoRoot)/Documentation/manpages</ManPagesDir>
|
|
|
|
<ConfigJsonFile>$(RepoRoot)/packaging/rpm/dotnet-config.json</ConfigJsonFile>
|
|
|
|
<RpmIntermediatesDir>$(IntermediateDirectory)/$(RpmPackageName)/$(RpmPackageVersion)</RpmIntermediatesDir>
|
|
|
|
<RpmTestResultsXmlFile>$(RpmIntermediatesDir)/debian-testResults.xml</RpmTestResultsXmlFile>
|
|
|
|
<RpmInstalledDirectory>/usr/share/dotnet</RpmInstalledDirectory>
|
|
|
|
</PropertyGroup>
|
|
|
|
|
|
|
|
<PropertyGroup>
|
|
|
|
<RpmLayoutDirectory>$(RpmIntermediatesDir)/RpmLayoutDirectory/</RpmLayoutDirectory>
|
|
|
|
<RpmLayoutPackageRoot>$(RpmLayoutDirectory)package_root</RpmLayoutPackageRoot>
|
|
|
|
<RpmLayoutSDK>$(RpmLayoutPackageRoot)/sdk</RpmLayoutSDK>
|
|
|
|
<RpmLayoutDocs>$(RpmLayoutDirectory)docs</RpmLayoutDocs> <!-- Man Pages -->
|
|
|
|
<RpmLayoutTemplates>$(RpmLayoutDirectory)templates</RpmLayoutTemplates> <!-- Copyright, Changelog -->
|
|
|
|
<RpmLayoutScripts>$(RpmLayoutDirectory)scripts</RpmLayoutScripts>
|
|
|
|
</PropertyGroup>
|
|
|
|
|
|
|
|
<PropertyGroup>
|
|
|
|
<SdkRpmPackageVersion>$(SdkVersion)</SdkRpmPackageVersion>
|
|
|
|
<SdkRpmPackageName>$(ArtifactNameCombinedHostHostFxrFrameworkSdk)-$(SdkRpmPackageVersion)</SdkRpmPackageName>
|
|
|
|
<SharedFxRpmPackageVersion>$(SharedFrameworkVersion)</SharedFxRpmPackageVersion>
|
|
|
|
<SharedFxRpmPackageName>dotnet-runtime-$(SharedFxRpmPackageVersion)</SharedFxRpmPackageName>
|
|
|
|
<SharedFxRpmPackageName>$(SharedFxRpmPackageName.ToLower())</SharedFxRpmPackageName>
|
|
|
|
<HostFxrRpmPackageVersion>$(HostFxrVersion)</HostFxrRpmPackageVersion>
|
|
|
|
<HostFxrRpmPackageName>dotnet-hostfxr-$(HostFxrRpmPackageVersion)</HostFxrRpmPackageName>
|
|
|
|
<HostFxrRpmPackageName>$(HostFxrRpmPackageName.ToLower())</HostFxrRpmPackageName>
|
|
|
|
<HostRpmPackageName>dotnet-host</HostRpmPackageName>
|
2017-11-30 22:15:38 +00:00
|
|
|
<AspNetCoreRuntimePackageName>$(AspNetCoreRuntimePackageBrandName)-$(AspNetCoreRuntimePackageVersion)</AspNetCoreRuntimePackageName>
|
|
|
|
<AspNetCoreRuntimeRpmInstallerFileName>$(AspNetCoreRuntimePackageBrandName)-$(AspNetCoreRuntimePackageVersion)-$(HostRid).rpm</AspNetCoreRuntimeRpmInstallerFileName>
|
2017-07-31 18:19:15 +00:00
|
|
|
<AfterInstallHostScriptTemplateFile>$(ScriptsDir)/$(AfterInstallHostScriptName)</AfterInstallHostScriptTemplateFile>
|
|
|
|
<AfterInstallHostScriptDestinationFile>$(RpmLayoutScripts)/$(AfterInstallHostScriptName)</AfterInstallHostScriptDestinationFile>
|
|
|
|
</PropertyGroup>
|
|
|
|
|
|
|
|
<PropertyGroup>
|
|
|
|
<EndToEndTestProject>$(RepoRoot)/test/EndToEnd/EndToEnd.csproj</EndToEndTestProject>
|
|
|
|
</PropertyGroup>
|
|
|
|
</Target>
|
|
|
|
|
2017-07-13 19:08:35 +00:00
|
|
|
<Target Name="DownloadAspNetCoreRuntimeRpmInstaller"
|
2017-07-31 18:19:15 +00:00
|
|
|
DependsOnTargets="SetupRpmProps">
|
2017-07-13 19:08:35 +00:00
|
|
|
<PropertyGroup>
|
|
|
|
<DownloadedSharedAspNetCoreRuntime>$(PackagesDirectory)/$(AspNetCoreRuntimeRpmInstallerFileName)</DownloadedSharedAspNetCoreRuntime>
|
|
|
|
</PropertyGroup>
|
|
|
|
<DownloadFile
|
2017-10-09 21:09:48 +00:00
|
|
|
Uri="$(AspNetCoreRuntimeInstallerBlobRootUrl)/$(AspNetCoreRuntimeRpmInstallerFileName)$(CoreSetupBlobAccessTokenParam)"
|
2017-07-13 19:08:35 +00:00
|
|
|
DestinationPath="$(DownloadedSharedAspNetCoreRuntime)"/>
|
|
|
|
</Target>
|
|
|
|
|
2017-06-11 22:27:48 +00:00
|
|
|
<Target Name="TestFPMTool">
|
|
|
|
|
|
|
|
<!-- run FPM -->
|
|
|
|
<Exec Command="fpm --help > /dev/null" ContinueOnError="True">
|
|
|
|
<Output TaskParameter="ExitCode" PropertyName="FPMExitCode"/>
|
|
|
|
</Exec>
|
|
|
|
|
|
|
|
<!-- Check if it returned 0 -->
|
|
|
|
<PropertyGroup>
|
|
|
|
<FPMPresent>false</FPMPresent>
|
|
|
|
<FPMPresent Condition=" '$(FPMExitCode)' == '0' ">True</FPMPresent>
|
|
|
|
</PropertyGroup>
|
|
|
|
|
|
|
|
<!-- Workaround for Jenkins machines that don't have the necessary packages https://github.com/dotnet/core-setup/issues/2260 -->
|
|
|
|
<Message Condition=" '$(FPMPresent)' != 'True' "
|
|
|
|
Text="FPM tool Not found, RPM packages will not be built."
|
|
|
|
Importance="High"/>
|
|
|
|
</Target>
|
|
|
|
|
|
|
|
<Target Name="TestSdkRpm"
|
2017-07-13 19:08:35 +00:00
|
|
|
DependsOnTargets="RestoreTests;DownloadAspNetCoreRuntimeRpmInstaller"
|
2017-11-30 19:19:17 +00:00
|
|
|
Condition=" '$(IsRPMBasedDistro)' == 'True' and '$(FPMPresent)' == 'True' "
|
2017-06-11 22:27:48 +00:00
|
|
|
Inputs="$(DownloadedSharedHostInstallerFile);
|
|
|
|
$(DownloadedHostFxrInstallerFile);
|
|
|
|
$(DownloadedSharedFrameworkInstallerFile);
|
2017-07-13 19:08:35 +00:00
|
|
|
$(DownloadedSharedAspNetCoreRuntime);
|
2017-06-11 22:27:48 +00:00
|
|
|
$(RpmTestResultsXmlFile);"
|
|
|
|
Outputs="$(RpmTestResultsXmlFile)" >
|
|
|
|
|
|
|
|
<!-- Install Dependencies and SDK Packages -->
|
|
|
|
<Exec Command="sudo yum -y install $(DownloadedSharedHostInstallerFile)" />
|
|
|
|
<Exec Command="sudo yum -y install $(DownloadedHostFxrInstallerFile)" />
|
|
|
|
<Exec Command="sudo yum -y install $(DownloadedSharedFrameworkInstallerFile)" />
|
2017-07-13 19:08:35 +00:00
|
|
|
<Exec Command="sudo yum -y install $(DownloadedSharedAspNetCoreRuntime)" />
|
2017-06-11 22:27:48 +00:00
|
|
|
|
|
|
|
<Exec Command="sudo yum -y install $(SdkInstallerFile)" />
|
|
|
|
|
|
|
|
<!-- Run Tests -->
|
|
|
|
<DotNetRestore ProjectPath="$(EndToEndTestProject)"
|
|
|
|
ToolPath="$(RpmInstalledDirectory)" />
|
|
|
|
|
|
|
|
<DotNetTest ProjectPath="$(EndToEndTestProject)"
|
2017-09-06 15:53:01 +00:00
|
|
|
EnvironmentVariables="@(TestSdkRpmTaskEnvironmentVariables)"
|
2017-06-11 22:27:48 +00:00
|
|
|
ToolPath="$(RpmInstalledDirectory)" />
|
|
|
|
|
|
|
|
<!-- Clean up Packages -->
|
|
|
|
<Exec Command="sudo yum remove -y $(SdkRpmPackageName)" />
|
2017-07-13 19:08:35 +00:00
|
|
|
|
|
|
|
<Exec Command="sudo yum remove -y $(AspNetCoreRuntimePackageName)" />
|
2017-06-11 22:27:48 +00:00
|
|
|
<Exec Command="sudo yum remove -y $(SharedFxRpmPackageName)" />
|
|
|
|
<Exec Command="sudo yum remove -y $(HostFxrRpmPackageName)" />
|
|
|
|
<Exec Command="sudo yum remove -y $(HostRpmPackageName)" />
|
|
|
|
</Target>
|
2017-07-29 03:34:57 +00:00
|
|
|
</Project>
|