This commit is contained in:
PiotrP 2016-08-25 15:53:15 -07:00
parent c5b4e48410
commit ed66c70106
4 changed files with 134 additions and 89 deletions

View file

@ -3,13 +3,34 @@
<Import Project="$(MSBuildThisFileDirectory)/package/Microsoft.DotNet.Cli.Layout.targets" /> <Import Project="$(MSBuildThisFileDirectory)/package/Microsoft.DotNet.Cli.Layout.targets" />
<Import Project="$(MSBuildThisFileDirectory)/package/Microsoft.DotNet.Cli.Archive.targets" /> <Import Project="$(MSBuildThisFileDirectory)/package/Microsoft.DotNet.Cli.Archive.targets" />
<Import Project="$(MSBuildThisFileDirectory)/package/Microsoft.DotNet.Cli.Nupkg.targets" /> <Import Project="$(MSBuildThisFileDirectory)/package/Microsoft.DotNet.Cli.Nupkg.targets" />
<Import Project="$(MSBuildThisFileDirectory)/package/Microsoft.DotNet.Cli.Installer.DEB.targets" />
<Import Project="$(MSBuildThisFileDirectory)/package/Microsoft.DotNet.Cli.Installer.MSI.targets" /> <Import Project="$(MSBuildThisFileDirectory)/package/Microsoft.DotNet.Cli.Installer.MSI.targets" />
<Import Project="$(MSBuildThisFileDirectory)/package/Microsoft.DotNet.Cli.Installer.PKG.targets" /> <Import Project="$(MSBuildThisFileDirectory)/package/Microsoft.DotNet.Cli.Installer.PKG.targets" />
<Target Name="GenerateInstallers" <Target Name="GenerateInstallers"
DependsOnTargets="Init;Layout;GeneratePkgs;GenerateDebs;GenerateMsis" /> DependsOnTargets="Init;Layout;GeneratePkgs;GenerateDebs;GenerateMsis" />
<Target Name="GenerateDebs"
DependsOnTargets="Init;"
Condition=" '$(OSName)' == 'ubuntu' ">
<MSBuild
BuildInParallel="False"
Projects="$(RepoRoot)/build/package/Microsoft.DotNet.Cli.Installer.DEB.proj"
Properties="CliSdkRoot=$(Stage2Directory)/sdk;
RepoRoot=$(RepoRoot);
PackagesDirectory=$(PackagesDirectory);
IntermediateDirectory=$(IntermediateDirectory);
HostFxrVersion=$(HostFxrVersion);
SdkVersion=$(SdkVersion);
SharedFrameworkName=$(SharedFrameworkName);
SharedFrameworkVersion=$(SharedFrameworkVersion);
SharedFrameworkBrandName=$(SharedFrameworkBrandName);
SdkBrandName=$(SdkBrandName);"
ToolsVersion="4.0"
UnloadProjectsOnCompletion="False"
UseResultsCache="True">
</MSBuild>
</Target>
<Target Name="Package" <Target Name="Package"
DependsOnTargets="BuildDotnetCliBuildFramework; DependsOnTargets="BuildDotnetCliBuildFramework;
Init; Init;

View file

@ -1,86 +1,17 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
DefaultTarget="GenerateDebs">
<Import Project="Microsoft.DotNet.Cli.Installer.DEB.props" /> <Import Project="Microsoft.DotNet.Cli.Installer.DEB.props" />
<Target Name="GenerateDebs" <Target Name="GenerateDebs"
DependsOnTargets="Init; DependsOnTargets="GenerateSdkDeb;
GenerateSdkDeb;
TestSdkDeb;" TestSdkDeb;"
Condition=" '$(OSName)' == 'ubuntu' " /> Condition=" '$(OSName)' == 'ubuntu' " />
<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>
<DebuildPresent>false</DebuildPresent>
<DebuildPresent Condition=" '$(DebuildExitCode)' == '0' ">true</DebuildPresent>
<DotnetDebToolDir></DotnetDebToolDir>
<DotnetDebToolVersion></DotnetDebToolVersion>
<DotnetDebToolPackageSource></DotnetDebToolPackageSource>
<DebianPackagingScript>$(RepoRoot)/scripts/package/package-debian.sh</DebianPackagingScript>
<ManpagesDirectory>$(RepoRoot)/Documentation/manpages</ManpagesDirectory>
<InstallerOutputDirectory>$(PackagesDirectory)</InstallerOutputDirectory>
<SdkInstallerFile>$(InstallerOutputDirectory)/$(ArtifactNameWithVersionSdk)$(InstallerExtension)</SdkInstallerFile>
<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>
<SdkDebianIntermediateDirectory>$(IntermediateDirectory)/debian/sdk</SdkDebianIntermediateDirectory>
<DebianTestResultsXmlFile>$(SdkDebianIntermediateDirectory)/debian-testResults.xml</DebianTestResultsXmlFile>
<DebianInstalledDirectory>/usr/share/dotnet</DebianInstalledDirectory>
<EndToEndTestDirectory>$(RepoRoot)/test/EndToEnd</EndToEndTestDirectory>
<DotnetDebToolConfigJsonFilePath>$(SdkDebianLayoutOutputDirectory)/$(DotnetDebToolConfigJsonFileName)</DotnetDebToolConfigJsonFilePath>
</PropertyGroup>
<ItemGroup>
<TestSdkDebTaskEnvironmentVariables Include="PATH=$(DebianInstalledDirectory)$(PathListSeparator)$(PATH)" />
<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 -->
<GeneratedInstallers Include="$(SdkInstallerFile)" />
<SdkDebInputFiles Include="$(SdkLayoutOutputDirectory)/**/*" />
<SdkDebManPageFiles Include="$(ManpagesDirectory)/**/*" />
</ItemGroup>
</Target>
<Target Name="GenerateSdkDeb" <Target Name="GenerateSdkDeb"
Condition=" '$(OSName)' == 'ubuntu' and '$(DebuildPresent)' == 'true' " Condition=" '$(OSName)' == 'ubuntu' and '$(DebuildPresent)' == 'true' "
DependsOnTargets="SetupGenerateDebInputsOutputs; DependsOnTargets="EnsureDebuild;
PrepareDotnetDebDirectories; PrepareDotnetDebDirectories;
PrepareDotnetDebTool;" PrepareDotnetDebTool;"
Inputs="@(SdkDebInputFiles)" Inputs="@(SdkDebInputFiles)"
@ -93,7 +24,7 @@
<!-- Create layout --> <!-- Create layout -->
<Copy <Copy
DestinationFiles="@(SourceFile->'$(DebLayoutPackageRootDirName)/%(RecursiveDir)%(Filename)%(Extension)')" DestinationFiles="@(SourceFile->'$(DebLayoutPackageRootDir)/%(RecursiveDir)%(Filename)%(Extension)')"
OverwriteReadOnlyFiles="True" OverwriteReadOnlyFiles="True"
SkipUnchangedFiles="False" SkipUnchangedFiles="False"
SourceFiles="@(SdkLayoutOutputDirectory)" SourceFiles="@(SdkLayoutOutputDirectory)"
@ -159,7 +90,7 @@
<Target Name="PrepareDotnetDebDirectories"> <Target Name="PrepareDotnetDebDirectories">
<PropertyGroup> <PropertyGroup>
<DebLayoutPackageRootDir>$(SdkDebianLayoutOutputDirectory)/$(DebLayoutPackageRootDirName)</DebLayoutPackageRootDirName> <DebLayoutPackageRootDir>$(SdkDebianLayoutOutputDirectory)/$(DebLayoutPackageRootDirName)</DebLayoutPackageRootDir>
<DebLayoutAbsolutePlacementDir>$(SdkDebianLayoutOutputDirectory)/$(DebLayoutAbsolutePlacementDirName)</DebLayoutAbsolutePlacementDir> <DebLayoutAbsolutePlacementDir>$(SdkDebianLayoutOutputDirectory)/$(DebLayoutAbsolutePlacementDirName)</DebLayoutAbsolutePlacementDir>
<DebLayoutSamplesDir>$(SdkDebianLayoutOutputDirectory)/$(DebLayoutSamplesDirName)</DebLayoutSamplesDir> <DebLayoutSamplesDir>$(SdkDebianLayoutOutputDirectory)/$(DebLayoutSamplesDirName)</DebLayoutSamplesDir>
<DebLayoutDocsDir>$(SdkDebianLayoutOutputDirectory)/$(DebLayoutDocsDirName)</DebLayoutDocsDir> <DebLayoutDocsDir>$(SdkDebianLayoutOutputDirectory)/$(DebLayoutDocsDirName)</DebLayoutDocsDir>
@ -210,7 +141,22 @@
DestinationFile="$(DotnetDebToolConfigJsonFilePath)" DestinationFile="$(DotnetDebToolConfigJsonFilePath)"
ReplacementPatterns="@(SdkDebianPackageTemplateReplacement -> '%(Identity)')" ReplacementPatterns="@(SdkDebianPackageTemplateReplacement -> '%(Identity)')"
ReplacementStrings="@(SdkDebianPackageTemplateReplacement -> '%(ReplacementString)')" /> ReplacementStrings="@(SdkDebianPackageTemplateReplacement -> '%(ReplacementString)')" />
</Target>
<Target Name="EnsureDebuild">
<Exec Command="/usr/bin/env debuild -h" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="DebuildExitCode" />
</Exec>
<!-- Debuild -->
<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> </Target>
</Project> </Project>

View file

@ -1,20 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- dotnet deb-tool -->
<PropertyGroup> <PropertyGroup>
<DotnetDebToolPackageId>dotnet-deb-tool</DotnetDebToolPackageId> <DotnetDebToolPackageId>dotnet-deb-tool</DotnetDebToolPackageId>
<DotnetDebToolVersion>1.0.0-*</DotnetDebToolVersion> <DotnetDebToolVersion Condition=" '$(DotnetDebToolVersion)' == '' ">1.0.0-*</DotnetDebToolVersion>
<DotnetDebToolConsumerProjectName>dotnet-deb-tool-consumer</DotnetDebToolConsumerProjectName> <DotnetDebToolConsumerProjectName>dotnet-deb-tool-consumer</DotnetDebToolConsumerProjectName>
<DotnetDebToolConfigJsonFileName>debian_config.json</DotnetDebToolConfigJsonFileName> <DotnetDebToolDir>$(IntermediateDirectory)/$(DotnetDebToolConsumerProjectName)</DotnetDebToolDir>
<DotnetDebToolPackageSource Condition=" '$(DotnetDebToolPackageSource)' == '' "></DotnetDebToolPackageSource>
<DebLayoutPackageRootDirName>package_root</DebLayoutPackageRoot> </PropertyGroup>
<DebLayoutAbsolutePlacementDirName>$</DebLayoutAbsolutePlacement>
<DebLayoutSamplesDirName>samples</DebLayoutSamplesDirName>
<DebLayoutDocsDirName>docs</DebLayoutDocsDirName>
<DebLayoutDebianFilesDirName>debian</DebLayoutDebianFilesDirName>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<DotnetDebToolProjectJsonLines Remove="*" />
<DotnetDebToolProjectJsonLines Include="{" /> <DotnetDebToolProjectJsonLines Include="{" />
<DotnetDebToolProjectJsonLines Include="%20%20%20%20&quot;version&quot;: &quot;1.0.0-*&quot;," /> <DotnetDebToolProjectJsonLines Include="%20%20%20%20&quot;version&quot;: &quot;1.0.0-*&quot;," />
<DotnetDebToolProjectJsonLines Include="%20%20%20%20&quot;name&quot;: &quot;$(DotnetDebToolConsumerProjectName)&quot;," /> <DotnetDebToolProjectJsonLines Include="%20%20%20%20&quot;name&quot;: &quot;$(DotnetDebToolConsumerProjectName)&quot;," />
@ -22,4 +17,84 @@
<DotnetDebToolProjectJsonLines Include="%20%20%20%20&quot;tools&quot;: {&quot;$(DotnetDebToolPackageId)&quot;: &quot;$(DotnetDebToolVersion)&quot; }" /> <DotnetDebToolProjectJsonLines Include="%20%20%20%20&quot;tools&quot;: {&quot;$(DotnetDebToolPackageId)&quot;: &quot;$(DotnetDebToolVersion)&quot; }" />
<DotnetDebToolProjectJsonLines Include="}" /> <DotnetDebToolProjectJsonLines Include="}" />
</ItemGroup> </ItemGroup>
<!-- constants -->
<PropertyGroup>
<DebianInstalledDirectory>/usr/share/dotnet</DebianInstalledDirectory>
<DebLayoutPackageRootDirName>package_root</DebLayoutPackageRootDirName>
<DebLayoutAbsolutePlacementDirName>$</DebLayoutAbsolutePlacementDirName>
<DebLayoutSamplesDirName>samples</DebLayoutSamplesDirName>
<DebLayoutDocsDirName>docs</DebLayoutDocsDirName>
<DebLayoutDebianFilesDirName>debian</DebLayoutDebianFilesDirName>
</PropertyGroup>
<!-- Package Identities -->
<PropertyGroup>
<SdkDebianPackageVersion>$(SdkVersion)</SdkDebianPackageVersion>
<SdkDebianPackageName>dotnet-dev-$(SdkDebianPackageVersion)</SdkDebianPackageName>
<SharedFrameworkDebianPackageVersion>$(SharedFrameworkVersion)</SharedFrameworkDebianPackageVersion>
<SharedFrameworkDebianPackageName>dotnet-sharedframework-$(SharedFrameworkName)-$(SharedFrameworkDebianPackageVersion)</SharedFrameworkDebianPackageName>
<SharedFrameworkDebianPackageName>$(SharedFrameworkDebianPackageName.ToLower())</SharedFrameworkDebianPackageName>
<HostFxrDebianPackageVersion>$(HostFxrVersion)</HostFxrDebianPackageVersion>
<HostFxrDebianPackageName>dotnet-hostfxr-$(HostFxrDebianPackageVersion)</HostFxrDebianPackageName>
<HostFxrDebianPackageName>$(HostFxrDebianPackageName.ToLower())</HostFxrDebianPackageName>
<SharedHostDebianPackageName>dotnet-host</SharedHostDebianPackageName>
</PropertyGroup>
<!-- Inputs -->
<PropertyGroup>
<ManpagesDirectory>$(RepoRoot)/Documentation/manpages</ManpagesDirectory>
<EndToEndTestDirectory>$(RepoRoot)/test/EndToEnd</EndToEndTestDirectory>
</PropertyGroup>
<ItemGroup>
<SdkDebInputFiles Include="$(SdkLayoutOutputDirectory)/**/*" />
<SdkDebManPageFiles Include="$(ManpagesDirectory)/**/*" />
</ItemGroup>
<!-- Output Directories -->
<PropertyGroup>
<InstallerOutputDirectory>$(PackagesDirectory)</InstallerOutputDirectory>
<SdkInstallerFile>$(InstallerOutputDirectory)/$(ArtifactNameWithVersionSdk)$(InstallerExtension)</SdkInstallerFile>
<SdkDebianIntermediateDirectory>$(IntermediateDirectory)/debian/sdk</SdkDebianIntermediateDirectory>
<DebianTestResultsXmlFile>$(SdkDebianIntermediateDirectory)/debian-testResults.xml</DebianTestResultsXmlFile>
</PropertyGroup>
<!-- debian_config.json -->
<PropertyGroup>
<DebianConfigTemplateFileName>dotnet-debian_config.json</DebianConfigTemplateFileName>
<DebianConfigTemplateFile>$(RepoRoot)/packaging/deb/$(DebianConfigTemplateFileName)</DebianConfigTemplateFile>
<DebianConfigJsonFileName>debian_config.json</DebianConfigJsonFileName>
<DebianConfigJsonFile>$(SdkDebianLayoutOutputDirectory)/$(DebianConfigJsonFileName)</DebianConfigJsonFile>
</PropertyGroup>
<ItemGroup>
<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>
</ItemGroup>
<ItemGroup>
<TestSdkDebTaskEnvironmentVariables Include="PATH=$(DebianInstalledDirectory)$(PathListSeparator)$(PATH)" />
<!-- Consumed By Publish -->
<GeneratedInstallers Include="$(SdkInstallerFile)" />
</ItemGroup>
</Project> </Project>

View file

@ -1,6 +1,9 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved. // Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information. // Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Microsoft.DotNet.Cli.Build namespace Microsoft.DotNet.Cli.Build
{ {
public class DotNetDebTool : DotNetTool public class DotNetDebTool : DotNetTool