dotnet-installer/build/package/Microsoft.DotNet.Cli.Installer.DEB.targets

217 lines
10 KiB
Text
Raw Normal View History

2016-06-28 01:26:57 +00:00
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2016-08-18 17:11:20 +00:00
<Import Project="Microsoft.DotNet.Cli.Installer.DEB.props" />
2016-08-19 21:52:06 +00:00
<Target Name="GenerateDebs"
DependsOnTargets="Init;
GenerateSdkDeb;
TestSdkDeb;"
Condition=" '$(OSName)' == 'ubuntu' " />
2016-08-18 17:11:20 +00:00
<Target Name="SetupGenerateDebInputsOutputs">
<Exec Command="/usr/bin/env debuild -h" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="DebuildExitCode" />
</Exec>
<!-- Workaround for Ubuntu16 Jenkins https://github.com/dotnet/core-setup/issues/167 -->
<Message Condition=" '$(DebuildPresent)' != 'true' "
Text="Debuild Not found, Debian packages will not be built."
Importance="High" />
<PropertyGroup>
2016-08-19 21:52:06 +00:00
<DebuildPresent>false</DebuildPresent>
<DebuildPresent Condition=" '$(DebuildExitCode)' == '0' ">true</DebuildPresent>
2016-08-18 17:11:20 +00:00
2016-08-19 21:52:06 +00:00
<DotnetDebToolDir></DotnetDebToolDir>
<DotnetDebToolVersion></DotnetDebToolVersion>
<DotnetDebToolPackageSource></DotnetDebToolPackageSource>
2016-08-18 17:11:20 +00:00
2016-08-19 21:52:06 +00:00
<DebianPackagingScript>$(RepoRoot)/scripts/package/package-debian.sh</DebianPackagingScript>
<ManpagesDirectory>$(RepoRoot)/Documentation/manpages</ManpagesDirectory>
2016-08-18 17:11:20 +00:00
2016-08-19 21:52:06 +00:00
<InstallerOutputDirectory>$(PackagesDirectory)</InstallerOutputDirectory>
<SdkInstallerFile>$(InstallerOutputDirectory)/$(ArtifactNameWithVersionSdk)$(InstallerExtension)</SdkInstallerFile>
2016-08-18 17:11:20 +00:00
2016-08-19 21:52:06 +00:00
<SdkDebianPackageName>dotnet-dev-$(SdkVersion)</SdkDebianPackageName>
<SharedFrameworkDebianPackageName>dotnet-sharedframework-$(SharedFrameworkName)-$(SharedFrameworkVersion)</SharedFrameworkDebianPackageName>
<SharedFrameworkDebianPackageName>$(SharedFrameworkDebianPackageName.ToLower())</SharedFrameworkDebianPackageName>
<HostFxrDebianPackageName>dotnet-hostfxr-$(HostFxrVersion)</HostFxrDebianPackageName>
<HostFxrDebianPackageName>$(HostFxrDebianPackageName.ToLower())</HostFxrDebianPackageName>
<SharedHostDebianPackageName>dotnet-host</SharedHostDebianPackageName>
2016-08-18 17:11:20 +00:00
2016-08-19 21:52:06 +00:00
<SdkDebianIntermediateDirectory>$(IntermediateDirectory)/debian/sdk</SdkDebianIntermediateDirectory>
2016-08-18 17:11:20 +00:00
2016-08-19 21:52:06 +00:00
<DebianTestResultsXmlFile>$(SdkDebianIntermediateDirectory)/debian-testResults.xml</DebianTestResultsXmlFile>
<DebianInstalledDirectory>/usr/share/dotnet</DebianInstalledDirectory>
<EndToEndTestDirectory>$(RepoRoot)/test/EndToEnd</EndToEndTestDirectory>
<DotnetDebToolConfigJsonFilePath>$(SdkDebianLayoutOutputDirectory)/$(DotnetDebToolConfigJsonFileName)</DotnetDebToolConfigJsonFilePath>
2016-08-18 17:11:20 +00:00
</PropertyGroup>
<ItemGroup>
<TestSdkDebTaskEnvironmentVariables Include="PATH=$(DebianInstalledDirectory)$(PathListSeparator)$(PATH)" />
2016-08-19 21:52:06 +00:00
<SdkDebianPackageTemplateReplacement Include="SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME">
<ReplacementString>$(SharedFrameworkDebianPackageName)</ReplacementString>
</SdkDebianPackageTemplateReplacement>
<SdkDebianPackageTemplateReplacement Include="SHARED_FRAMEWORK_NUGET_NAME">
<ReplacementString>$(SharedFrameworkName)</ReplacementString>
</SdkDebianPackageTemplateReplacement>
<SdkDebianPackageTemplateReplacement Include="SHARED_FRAMEWORK_NUGET_VERSION">
<ReplacementString>$(SharedFrameworkVersion)</ReplacementString>
</SdkDebianPackageTemplateReplacement>
<SdkDebianPackageTemplateReplacement Include="SHARED_FRAMEWORK_BRAND_NAME">
<ReplacementString>$(SharedFrameworkBrandName)</ReplacementString>
</SdkDebianPackageTemplateReplacement>
<SdkDebianPackageTemplateReplacement Include="SDK_NUGET_VERSION">
<ReplacementString>$(SdkVersion)</ReplacementString>
</SdkDebianPackageTemplateReplacement>
<SdkDebianPackageTemplateReplacement Include="CLI_SDK_BRAND_NAME">
<ReplacementString>$(SdkBrandName)</ReplacementString>
</SdkDebianPackageTemplateReplacement>
<!-- Consumed By Publish -->
2016-08-18 17:11:20 +00:00
<GeneratedInstallers Include="$(SdkInstallerFile)" />
2016-08-19 21:52:06 +00:00
<SdkDebInputFiles Include="$(SdkLayoutOutputDirectory)/**/*" />
<SdkDebManPageFiles Include="$(ManpagesDirectory)/**/*" />
2016-08-18 17:11:20 +00:00
</ItemGroup>
</Target>
<Target Name="GenerateSdkDeb"
Condition=" '$(OSName)' == 'ubuntu' and '$(DebuildPresent)' == 'true' "
2016-08-19 21:52:06 +00:00
DependsOnTargets="SetupGenerateDebInputsOutputs;
PrepareDotnetDebDirectories;
PrepareDotnetDebTool;"
Inputs="@(SdkDebInputFiles)"
2016-08-18 17:11:20 +00:00
Outputs="$(SdkInstallerFile)" >
<!-- Install Packages -->
<Exec Command="sudo dpkg -i $(DownloadedSharedHostInstallerFile)" />
<Exec Command="sudo dpkg -i $(DownloadedHostFxrInstallerFile)" />
<Exec Command="sudo dpkg -i $(DownloadedSharedFrameworkInstallerFile)" />
<!-- Create layout -->
2016-08-19 21:52:06 +00:00
<Copy
DestinationFiles="@(SourceFile->'$(DebLayoutPackageRootDirName)/%(RecursiveDir)%(Filename)%(Extension)')"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
SourceFiles="@(SdkLayoutOutputDirectory)"
UseHardlinksIfPossible="False">
</Copy>
<Copy
DestinationFiles="@(SourceFile->'$(DebLayoutDocsDir)/%(RecursiveDir)%(Filename)-$(SdkVersion)%(Extension)')"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
SourceFiles="@(SdkDebManPageFiles)"
UseHardlinksIfPossible="False">
</Copy>
2016-08-19 21:52:06 +00:00
<Copy
DestinationFiles="$(DotnetDebToolConfigJsonFilePath)"
2016-08-19 21:52:06 +00:00
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
SourceFiles="$(DotnetDebToolConfigJsonFilePath)"
2016-08-19 21:52:06 +00:00
UseHardlinksIfPossible="False">
</Copy>
<DotNetDebTool ToolPath="$(Stage2Directory)"
InputDir="$(SdkLayoutDirectory)"
OutputFile="$(SdkInstallerFile)"
PackageName="$(SdkDebianPackageName)"
PackageVersion="$(SdkVersion)"
WorkingDirectory="$(DotnetDebToolDir)" />
2016-08-18 17:11:20 +00:00
<!-- Remove Packages -->
<Exec Command="sudo dpkg -r $(SdkDebianPackageName)" />
<Exec Command="sudo dpkg -r $(SharedFrameworkDebianPackageName)" />
<Exec Command="sudo dpkg -r $(HostFxrDebianPackageName)" />
<Exec Command="sudo dpkg -r $(SharedHostDebianPackageName)" />
</Target>
<Target Name="TestSdkDeb"
Condition=" '$(OSName)' == 'ubuntu' and '$(DebuildPresent)' == 'true' "
Inputs="$(DownloadedSharedHostInstallerFile);
$(DownloadedHostFxrInstallerFile);
$(DownloadedSharedFrameworkInstallerFile);
$(SdkInstallerFile);"
Outputs="$(DebianTestResultsXmlFile)" >
2016-08-19 21:52:06 +00:00
<!-- Install v(N-1) Packages -->
2016-08-18 17:11:20 +00:00
<Exec Command="sudo dpkg -i $(DownloadedSharedHostInstallerFile)" />
<Exec Command="sudo dpkg -i $(DownloadedHostFxrInstallerFile)" />
<Exec Command="sudo dpkg -i $(DownloadedSharedFrameworkInstallerFile)" />
<Exec Command="sudo dpkg -i $(SdkInstallerFile)" />
<!-- Run E2E -->
<DotNetTest WorkingDirectory="$(EndToEndTestDirectory)"
EnvironmentVariables="@(TestSdkDebTaskEnvironmentVariables)"
ToolPath="$(DebianInstalledDirectory)"
Xml="$(DebianTestResultsXmlFile)" />
<!-- Remove Packages -->
<Exec Command="sudo dpkg -r $(SdkDebianPackageName)" />
<Exec Command="sudo dpkg -r $(SharedFrameworkDebianPackageName)" />
<Exec Command="sudo dpkg -r $(HostFxrDebianPackageName)" />
<Exec Command="sudo dpkg -r $(SharedHostDebianPackageName)" />
</Target>
2016-08-19 21:52:06 +00:00
<Target Name="PrepareDotnetDebDirectories">
<PropertyGroup>
<DebLayoutPackageRootDir>$(SdkDebianLayoutOutputDirectory)/$(DebLayoutPackageRootDirName)</DebLayoutPackageRootDirName>
<DebLayoutAbsolutePlacementDir>$(SdkDebianLayoutOutputDirectory)/$(DebLayoutAbsolutePlacementDirName)</DebLayoutAbsolutePlacementDir>
<DebLayoutSamplesDir>$(SdkDebianLayoutOutputDirectory)/$(DebLayoutSamplesDirName)</DebLayoutSamplesDir>
<DebLayoutDocsDir>$(SdkDebianLayoutOutputDirectory)/$(DebLayoutDocsDirName)</DebLayoutDocsDir>
<DebLayoutDebianFilesDir>$(SdkDebianLayoutOutputDirectory)/$(DebLayoutDebianFilesDirName)</DebLayoutDebianFilesDir>
</PropertyGroup>
<!-- Clean the workspace -->
<ItemGroup>
<SdkDebianFilesToClean Remove="*" />
<SdkDebianFilesToClean Include="$(SdkInstallerFile)" />
<SdkDebianDirectoriesToClean Remove="*" />
<SdkDebianDirectoriesToClean Include="$(SdkDebianIntermediateDirectory);
$(SdkDebianLayoutOutputDirectory)" />
<SdkDebianLayoutSubDirectories Remove="*" />
<SdkDebianLayoutSubDirectories Include="$(DebLayoutPackageRootDir);
$(DebLayoutAbsolutePlacementDir);
$(DebLayoutSamplesDir);
$(DebLayoutDocsDir);
$(DebLayoutDebianFilesDir)" />
</ItemGroup>
<Delete Condition=" 'Exists(%(SdkDebianFilesToClean))' " Files="@(SdkDebianFilesToClean)" />
<RemoveDir Condition=" 'Exists(%(SdkDebianDirectoriesToClean))' " Directories="@(SdkDebianDirectoriesToClean)" />
<MakeDir Directories="@(SdkDebianDirectoriesToClean)" />
<MakeDir Directories="@(SdkDebianLayoutSubDirectories)" />
</Target>
2016-08-18 17:11:20 +00:00
<Target Name="PrepareDotnetDebTool"
DependsOnTargets="WriteDotnetDebToolProjectJson;">
2016-08-19 21:52:06 +00:00
<DotNetRestore FallbackSource="$(DotnetDebToolPackageSource)"
ToolPath="$(Stage2Directory)"
WorkingDirectory="$(DotnetDebToolDir)" />
2016-08-18 17:11:20 +00:00
</Target>
2016-08-19 21:52:06 +00:00
<Target Name="WriteDotnetDebToolProjectJson"
Inputs="$(MSBuildThisFile);$(MSBuildThisFileDirectory)/Microsoft.DotNet.Cli.Installer.DEB.props"
Outputs="$(DotnetDebToolDir)/project.json">
<WriteLinesToFile File="$(DotnetDebToolDir)/project.json" Lines="@(DotnetDebToolProjectJsonLines)" />
2016-08-18 17:11:20 +00:00
</Target>
<Target Name="UpdateDotnetDebConfigFile">
<ReplaceFileContents
InputFile="$(DotnetDebToolConfigJsonFilePath)"
DestinationFile="$(DotnetDebToolConfigJsonFilePath)"
ReplacementPatterns="@(SdkDebianPackageTemplateReplacement -> '%(Identity)')"
ReplacementStrings="@(SdkDebianPackageTemplateReplacement -> '%(ReplacementString)')" />
</Target>
2016-06-28 01:26:57 +00:00
</Project>