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

190 lines
7.7 KiB
Text
Raw Normal View History

2016-06-28 01:26:57 +00:00
<?xml version="1.0" encoding="utf-8"?>
2016-08-28 04:10:23 +00:00
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2016-08-25 22:53:15 +00:00
2016-08-27 22:57:14 +00:00
<UsingTask TaskName="DotNetDebTool" AssemblyFile="$(CLIBuildDll)" />
2016-08-30 18:45:58 +00:00
<Import Project="Microsoft.DotNet.Cli.Installer.DEB.targets" />
2016-08-19 21:52:06 +00:00
<Target Name="GenerateDebs"
2016-08-30 18:45:58 +00:00
DependsOnTargets="SetupDebProps;
TestDebuild;
2016-08-28 00:49:21 +00:00
BuildSdkDeb;
2016-08-19 21:52:06 +00:00
TestSdkDeb;"
2016-08-28 04:10:23 +00:00
Condition=" '$(OSName)' == 'ubuntu' "
Outputs="@(GeneratedInstallers)"/>
2016-08-18 17:11:20 +00:00
2016-08-28 00:49:21 +00:00
<Target Name="BuildSdkDeb"
2016-08-18 17:11:20 +00:00
Condition=" '$(OSName)' == 'ubuntu' and '$(DebuildPresent)' == 'true' "
2016-08-27 22:57:14 +00:00
DependsOnTargets="PrepareDotnetDebDirectories;
2016-08-19 21:52:06 +00:00
PrepareDotnetDebTool;"
2016-08-28 00:49:21 +00:00
Inputs="@(CLISdkFiles)"
2016-08-18 17:11:20 +00:00
Outputs="$(SdkInstallerFile)" >
2016-08-28 00:49:21 +00:00
<!-- Install Shared Framework 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)" />
2016-08-28 00:49:21 +00:00
<!-- Create layout: Binaries -->
2016-08-19 21:52:06 +00:00
<Copy
2016-08-28 00:49:21 +00:00
DestinationFiles="@(CLISdkFiles->'$(LayoutPackageRootDir)/sdk/%(RecursiveDir)%(Filename)%(Extension)')"
SourceFiles="@(CLISdkFiles)"
2016-08-19 21:52:06 +00:00
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
2016-08-28 00:49:21 +00:00
UseHardlinksIfPossible="False" />
<!-- Create layout: Man Pages -->
2016-08-19 21:52:06 +00:00
<Copy
2016-08-28 00:49:21 +00:00
DestinationFiles="@(SdkDebManPageFiles->'$(LayoutDocsDir)/%(RecursiveDir)%(Filename)-$(SdkVersion)%(Extension)')"
2016-08-19 21:52:06 +00:00
SourceFiles="@(SdkDebManPageFiles)"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
2016-08-28 00:49:21 +00:00
UseHardlinksIfPossible="False" />
2016-08-19 21:52:06 +00:00
2016-08-28 00:49:21 +00:00
<!-- Create layout: Generate and Place debian_config.json -->
2016-08-27 22:57:14 +00:00
<ReplaceFileContents
InputFile="$(DebianConfigTemplateFile)"
DestinationFile="$(DebianConfigJsonFile)"
2016-08-28 00:49:21 +00:00
ReplacementPatterns="@(DebianConfigTokenValues -> '%(Identity)')"
ReplacementStrings="@(DebianConfigTokenValues -> '%(ReplacementString)')" />
2016-08-27 22:57:14 +00:00
2016-08-28 00:49:21 +00:00
<!-- Build SDK Deb package -->
<DotNetDebTool ToolPath="$(Stage0PjDirectory)"
2016-08-28 00:49:21 +00:00
InputDirectory="$(LayoutDirectory)"
OutputDirectory="$(DotNetDebToolOutputDirectory)"
2016-08-19 21:52:06 +00:00
PackageName="$(SdkDebianPackageName)"
PackageVersion="$(SdkVersion)"
WorkingDirectory="$(DotnetDebToolDir)" />
2016-08-27 22:57:14 +00:00
2016-08-28 00:49:21 +00:00
<!-- Copy SDK package to output -->
2016-08-27 22:57:14 +00:00
<ItemGroup>
<GeneratedDebFiles Include="$(DotNetDebToolOutputDirectory)/*.deb" />
</ItemGroup>
<Error Text="@(GeneratedDebFiles->Count()) .deb files generated." Condition="'@(GeneratedDebFiles->Count())' != 1" />
<Copy
DestinationFiles="$(SdkInstallerFile)"
SourceFiles="@(GeneratedDebFiles)"
OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False"
UseHardlinksIfPossible="False" />
2016-08-18 17:11:20 +00:00
2016-08-28 00:49:21 +00:00
<!-- Remove Shared Framework and Debian Packages -->
2016-08-18 17:11:20 +00:00
<Exec Command="sudo dpkg -r $(SdkDebianPackageName)" />
2016-08-28 00:49:21 +00:00
<Exec Command="sudo dpkg -r $(SharedFxDebianPackageName)" />
2016-08-18 17:11:20 +00:00
<Exec Command="sudo dpkg -r $(HostFxrDebianPackageName)" />
<Exec Command="sudo dpkg -r $(AdditionalSharedFxDebianPackageName)" />
<Exec Command="sudo dpkg -r $(AdditionalHostFxrDebianPackageName)" />
2016-08-28 00:49:21 +00:00
<Exec Command="sudo dpkg -r $(HostDebianPackageName)" />
2016-08-18 17:11:20 +00:00
</Target>
<Target Name="TestSdkDeb"
Condition=" '$(OSName)' == 'ubuntu' and '$(DebuildPresent)' == 'true' "
Inputs="$(DownloadedSharedHostInstallerFile);
$(DownloadedHostFxrInstallerFile);
$(DownloadedSharedFrameworkInstallerFile);
$(SdkInstallerFile);"
Outputs="$(DebianTestResultsXmlFile)" >
2016-08-28 00:49:21 +00:00
<!-- Install Dependencies and SDK 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 $(AdditionalDownloadedSharedHostInstallerFile)" />
<Exec Command="sudo dpkg -i $(AdditionalDownloadedHostFxrInstallerFile)" />
<Exec Command="sudo dpkg -i $(AdditionalDownloadedSharedFrameworkInstallerFile)" />
2016-08-18 17:11:20 +00:00
<Exec Command="sudo dpkg -i $(SdkInstallerFile)" />
<!-- Run E2E -->
<DotNetRestore ProjectPath="$(EndToEndTestProject)"
ToolPath="$(Stage0Directory)" />
<DotNetTest ProjectPath="$(EndToEndTestProject)"
2016-08-18 17:11:20 +00:00
EnvironmentVariables="@(TestSdkDebTaskEnvironmentVariables)"
ToolPath="$(Stage0Directory)" />
2016-08-18 17:11:20 +00:00
2016-08-28 00:49:21 +00:00
<!-- Clean up Packages -->
2016-08-18 17:11:20 +00:00
<Exec Command="sudo dpkg -r $(SdkDebianPackageName)" />
2016-08-28 00:49:21 +00:00
<Exec Command="sudo dpkg -r $(SharedFxDebianPackageName)" />
2016-08-18 17:11:20 +00:00
<Exec Command="sudo dpkg -r $(HostFxrDebianPackageName)" />
<Exec Command="sudo dpkg -r $(AdditionalSharedFxDebianPackageName)" />
<Exec Command="sudo dpkg -r $(AdditionalHostFxrDebianPackageName)" />
2016-08-28 00:49:21 +00:00
<Exec Command="sudo dpkg -r $(HostDebianPackageName)" />
2016-08-18 17:11:20 +00:00
</Target>
2016-08-19 21:52:06 +00:00
<Target Name="PrepareDotnetDebDirectories">
<!-- Clean the workspace -->
<ItemGroup>
2016-08-28 00:49:21 +00:00
<FilesToClean Remove="*" />
<FilesToClean Include="$(SdkInstallerFile)" />
<WorkspaceDirectories Remove="*" />
<WorkspaceDirectories Include="$(SdkDebianIntermediateDirectory);
$(LayoutDirectory)" />
<LayoutSubDirectories Remove="*" />
<LayoutSubDirectories Include="$(LayoutPackageRootDir);
$(LayoutAbsolutePlacementDir);
$(LayoutSamplesDir);
$(LayoutDocsDir);
$(LayoutDebianFilesDir)" />
2016-08-19 21:52:06 +00:00
</ItemGroup>
2016-08-28 00:49:21 +00:00
<Delete Files="@(FilesToClean)" />
<RemoveDir Directories="@(WorkspaceDirectories)" />
<!-- Rebuild the workspace -->
<MakeDir Directories="@(WorkspaceDirectories)" />
<MakeDir Directories="@(LayoutSubDirectories)" />
<MakeDir Directories="$(DotNetDebToolOutputDirectory)" />
2016-08-19 21:52:06 +00:00
</Target>
2016-08-18 17:11:20 +00:00
<Target Name="PrepareDotnetDebTool"
DependsOnTargets="WriteDotnetDebToolProjectJson;">
<DotNetRestorePj FallbackSource="$(DotnetDebToolPackageSource)"
ToolPath="$(Stage0PjDirectory)"
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">
2016-08-28 00:49:21 +00:00
<MakeDir Condition=" !Exists($(DotnetDebToolDir)) "
Directories="$(DotnetDebToolDir)" />
2016-08-19 21:52:06 +00:00
2016-08-27 22:57:14 +00:00
<WriteLinesToFile File="$(DotnetDebToolDir)/project.json"
Lines="@(DotnetDebToolProjectJsonLines)"
Overwrite="True" />
2016-08-25 22:53:15 +00:00
</Target>
2016-08-27 22:57:14 +00:00
<Target Name="TestDebuild">
2016-08-29 18:18:34 +00:00
<Message Text="Don't remove this" />
2016-08-28 00:49:21 +00:00
<!-- run Debuild -->
2016-08-25 22:53:15 +00:00
<Exec Command="/usr/bin/env debuild -h" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="DebuildExitCode" />
</Exec>
2016-08-28 00:49:21 +00:00
<!-- Check if it returned 0 -->
2016-08-25 22:53:15 +00:00
<PropertyGroup>
<DebuildPresent>false</DebuildPresent>
<DebuildPresent Condition=" '$(DebuildExitCode)' == '0' ">true</DebuildPresent>
</PropertyGroup>
<!-- 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" />
</Target>
2016-06-28 01:26:57 +00:00
</Project>