diff --git a/packaging/host/debian/dotnet-sharedhost-debian_config.json b/packaging/host/debian/dotnet-sharedhost-debian_config.json new file mode 100644 index 000000000..840e5945f --- /dev/null +++ b/packaging/host/debian/dotnet-sharedhost-debian_config.json @@ -0,0 +1,35 @@ +{ + "maintainer_name":"Microsoft", + "maintainer_email": "dotnetcore@microsoft.com", + + "package_name": "dotnet-host", + "install_root": "/usr/share/dotnet", + + "short_description": ".NET Core Shared Host", + "long_description": ".NET Core is a cross-platform implementation of .NET Framework, a modern, modular platform\n for building diverse kinds of applications, from command-line applications to microservices and \n modern websites.\n This package contains the host that launches a .NET Core application.", + "homepage": "https://dotnet.github.io/core", + + "release":{ + "package_version":"1.0.0.0", + "package_revision":"1", + "urgency" : "low", + "changelog_message" : "Inital shared host." + }, + + "control": { + "priority":"standard", + "section":"libs", + "architecture":"amd64" + }, + + "copyright": "2015 Microsoft", + "license": { + "type": "MIT", + "full_text": "Copyright (c) 2015 Microsoft\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE." + }, + + "debian_dependencies":{ + "libssl-dev" : {}, + "libcurl3" : {} + } +} diff --git a/packaging/host/windows/generatemsi.ps1 b/packaging/host/windows/generatemsi.ps1 new file mode 100644 index 000000000..124a987e8 --- /dev/null +++ b/packaging/host/windows/generatemsi.ps1 @@ -0,0 +1,109 @@ +# 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. + +param( + [Parameter(Mandatory=$true)][string]$SharedHostPublishRoot, + [Parameter(Mandatory=$true)][string]$DotnetHostMSIOutput, + [Parameter(Mandatory=$true)][string]$WixRoot, + [Parameter(Mandatory=$true)][string]$DotnetMSIVersion, + [Parameter(Mandatory=$true)][string]$DotnetCLIVersion, + [Parameter(Mandatory=$true)][string]$Architecture, + [Parameter(Mandatory=$true)][string]$WixObjRoot +) + +. "$PSScriptRoot\..\..\..\scripts\common\_common.ps1" +$RepoRoot = Convert-Path "$PSScriptRoot\..\..\.." + +function RunCandle +{ + $result = $true + pushd "$WixRoot" + + Write-Host Running candle.. + $AuthWsxRoot = Join-Path $RepoRoot "packaging\host\windows" + + .\candle.exe -nologo ` + -out "$WixObjRoot\" ` + -ext WixDependencyExtension.dll ` + -dHostSrc="$SharedHostPublishRoot" ` + -dMicrosoftEula="$RepoRoot\packaging\osx\resources\en.lproj\eula.rtf" ` + -dBuildVersion="$DotnetMSIVersion" ` + -dDisplayVersion="$DotnetCLIVersion" ` + -arch $Architecture ` + "$AuthWsxRoot\host.wxs" ` + "$AuthWsxRoot\provider.wxs" ` + "$AuthWsxRoot\registrykeys.wxs" | Out-Host + + if($LastExitCode -ne 0) + { + $result = $false + Write-Host "Candle failed with exit code $LastExitCode." + } + + popd + return $result +} + +function RunLight +{ + $result = $true + pushd "$WixRoot" + + Write-Host Running light.. + + .\light.exe -nologo ` + -ext WixUIExtension.dll ` + -ext WixDependencyExtension.dll ` + -ext WixUtilExtension.dll ` + -cultures:en-us ` + "$WixObjRoot\host.wixobj" ` + "$WixObjRoot\provider.wixobj" ` + "$WixObjRoot\registrykeys.wixobj" ` + -out $DotnetHostMSIOutput | Out-Host + + if($LastExitCode -ne 0) + { + $result = $false + Write-Host "Light failed with exit code $LastExitCode." + } + + popd + return $result +} + +if(!(Test-Path $SharedHostPublishRoot)) +{ + throw "$SharedHostPublishRoot not found" +} + +if(!(Test-Path $WixObjRoot)) +{ + throw "$WixObjRoot not found" +} + +Write-Host "Creating shared host MSI at $DotnetHostMSIOutput" + +if([string]::IsNullOrEmpty($WixRoot)) +{ + Exit -1 +} + +if(-Not (RunCandle)) +{ + Exit -1 +} + +if(-Not (RunLight)) +{ + Exit -1 +} + +if(!(Test-Path $DotnetHostMSIOutput)) +{ + throw "Unable to create the shared host msi." + Exit -1 +} + +Write-Host -ForegroundColor Green "Successfully created shared host MSI - $DotnetHostMSIOutput" + +exit $LastExitCode \ No newline at end of file diff --git a/packaging/host/windows/host.wxs b/packaging/host/windows/host.wxs new file mode 100644 index 000000000..736beb665 --- /dev/null +++ b/packaging/host/windows/host.wxs @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packaging/host/windows/provider.wxs b/packaging/host/windows/provider.wxs new file mode 100644 index 000000000..be191eb7e --- /dev/null +++ b/packaging/host/windows/provider.wxs @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/packaging/host/windows/registrykeys.wxs b/packaging/host/windows/registrykeys.wxs new file mode 100644 index 000000000..6f5a3cad0 --- /dev/null +++ b/packaging/host/windows/registrykeys.wxs @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packaging/host/windows/variables.wxi b/packaging/host/windows/variables.wxi new file mode 100644 index 000000000..71ea4a1d8 --- /dev/null +++ b/packaging/host/windows/variables.wxi @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packaging/osx/sharedframework/scripts/postinstall b/packaging/osx/sharedframework/scripts/postinstall new file mode 100755 index 000000000..50fd8f1b7 --- /dev/null +++ b/packaging/osx/sharedframework/scripts/postinstall @@ -0,0 +1,13 @@ +#!/bin/sh +# +# 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. +# + +PACKAGE=$1 +INSTALL_DESTINATION=$2 + +# A temporary fix for the permissions issue(s) +chmod -R 755 $INSTALL_DESTINATION/shared + +exit 0 diff --git a/packaging/osx/sharedframework/shared-framework-distribution-template.xml b/packaging/osx/sharedframework/shared-framework-distribution-template.xml new file mode 100644 index 000000000..15ff9e92a --- /dev/null +++ b/packaging/osx/sharedframework/shared-framework-distribution-template.xml @@ -0,0 +1,24 @@ + + + .NET Core Shared Framework ({SharedFrameworkNugetName} {SharedFrameworkNugetVersion}) + + + + + + + + + + + + + + + + + + + com.microsoft.dotnet.sharedframework.{SharedFrameworkNugetName}.{SharedFrameworkNugetVersion}.component.osx.x64.pkg + com.microsoft.dotnet.sharedhost.osx.x64.pkg + diff --git a/packaging/osx/sharedhost/scripts/postinstall b/packaging/osx/sharedhost/scripts/postinstall new file mode 100755 index 000000000..bac3303f2 --- /dev/null +++ b/packaging/osx/sharedhost/scripts/postinstall @@ -0,0 +1,13 @@ +#!/bin/sh +# +# 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. +# + +PACKAGE=$1 +INSTALL_DESTINATION=$2 + +# A temporary fix for the permissions issue(s) +chmod 755 $INSTALL_DESTINATION/dotnet + +exit 0 diff --git a/packaging/sharedframework/debian/dotnet-sharedframework-debian_config.json b/packaging/sharedframework/debian/dotnet-sharedframework-debian_config.json new file mode 100644 index 000000000..93d32d198 --- /dev/null +++ b/packaging/sharedframework/debian/dotnet-sharedframework-debian_config.json @@ -0,0 +1,35 @@ +{ + "maintainer_name":"Microsoft", + "maintainer_email": "dotnetcore@microsoft.com", + + "package_name": "%SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME%", + "install_root": "/usr/share/dotnet", + + "short_description": ".NET Core Shared Framework %SHARED_FRAMEWORK_NUGET_NAME% %SHARED_FRAMEWORK_NUGET_VERSION%", + "long_description": ".NET Core is a cross-platform implementation of .NET Framework, a modern, modular platform\n for building diverse kinds of applications, from command-line applications to microservices and \n modern websites.\n This package contains a runtime and framework which can be used by .NET Core applications.", + "homepage": "https://dotnet.github.io/core", + + "release":{ + "package_version":"1.0.0.0", + "package_revision":"1", + "urgency" : "low", + "changelog_message" : "Inital shared framework." + }, + + "control": { + "priority":"standard", + "section":"libs", + "architecture":"amd64" + }, + + "copyright": "2015 Microsoft", + "license": { + "type": "MIT", + "full_text": "Copyright (c) 2015 Microsoft\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE." + }, + + "debian_dependencies":{ + "libssl1.0.0" : {}, + "libcurl3" : {} + } +} diff --git a/packaging/sharedframework/windows/generatemsi.ps1 b/packaging/sharedframework/windows/generatemsi.ps1 new file mode 100644 index 000000000..ed78f847d --- /dev/null +++ b/packaging/sharedframework/windows/generatemsi.ps1 @@ -0,0 +1,151 @@ +# 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. + +param( + [Parameter(Mandatory=$true)][string]$SharedFrameworkPublishRoot, + [Parameter(Mandatory=$true)][string]$SharedFrameworkMSIOutput, + [Parameter(Mandatory=$true)][string]$WixRoot, + [Parameter(Mandatory=$true)][string]$DotnetMSIVersion, + [Parameter(Mandatory=$true)][string]$SharedFrameworkNugetName, + [Parameter(Mandatory=$true)][string]$SharedFrameworkNugetVersion, + [Parameter(Mandatory=$true)][string]$SharedFrameworkUpgradeCode, + [Parameter(Mandatory=$true)][string]$Architecture, + [Parameter(Mandatory=$true)][string]$WixObjRoot +) + +. "$PSScriptRoot\..\..\..\scripts\common\_common.ps1" +$RepoRoot = Convert-Path "$PSScriptRoot\..\..\.." + +$InstallFileswsx = "$WixObjRoot\install-files.wxs" +$InstallFilesWixobj = "$WixObjRoot\install-files.wixobj" + + +function RunHeat +{ + $result = $true + pushd "$WixRoot" + + Write-Host Running heat.. + + .\heat.exe dir `"$SharedFrameworkPublishRoot`" ` + -nologo ` + -template fragment ` + -sreg -gg ` + -var var.SharedFrameworkSource ` + -cg InstallFiles ` + -srd ` + -dr DOTNETHOME ` + -out $InstallFileswsx | Out-Host + + if($LastExitCode -ne 0) + { + $result = $false + Write-Host "Heat failed with exit code $LastExitCode." + } + + popd + return $result +} + +function RunCandle +{ + $result = $true + pushd "$WixRoot" + + Write-Host Running candle.. + $AuthWsxRoot = Join-Path $RepoRoot "packaging\sharedframework\windows" + $SharedFrameworkComponentVersion = $SharedFrameworkNugetVersion.Replace('-', '_'); + + .\candle.exe -nologo ` + -out "$WixObjRoot\" ` + -dSharedFrameworkSource="$SharedFrameworkPublishRoot" ` + -dMicrosoftEula="$RepoRoot\packaging\osx\resources\en.lproj\eula.rtf" ` + -dFrameworkName="$SharedFrameworkNugetName" ` + -dFrameworkDisplayVersion="$SharedFrameworkNugetVersion" ` + -dFrameworkComponentVersion="$SharedFrameworkComponentVersion" ` + -dFrameworkUpgradeCode="$SharedFrameworkUpgradeCode" ` + -dBuildVersion="$DotnetMSIVersion" ` + -arch $Architecture ` + -ext WixDependencyExtension.dll ` + "$AuthWsxRoot\sharedframework.wxs" ` + "$AuthWsxRoot\provider.wxs" ` + "$AuthWsxRoot\registrykeys.wxs" ` + $InstallFileswsx | Out-Host + + if($LastExitCode -ne 0) + { + $result = $false + Write-Host "Candle failed with exit code $LastExitCode." + } + + popd + return $result +} + +function RunLight +{ + $result = $true + pushd "$WixRoot" + + Write-Host Running light.. + $CabCache = Join-Path $WixRoot "cabcache" + + .\light.exe -nologo -ext WixUIExtension -ext WixDependencyExtension -ext WixUtilExtension ` + -cultures:en-us ` + "$WixObjRoot\sharedframework.wixobj" ` + "$WixObjRoot\provider.wixobj" ` + "$WixObjRoot\registrykeys.wixobj" ` + "$InstallFilesWixobj" ` + -out $SharedFrameworkMSIOutput | Out-Host + + if($LastExitCode -ne 0) + { + $result = $false + Write-Host "Light failed with exit code $LastExitCode." + } + + popd + return $result +} + +if(!(Test-Path $SharedFrameworkPublishRoot)) +{ + throw "$SharedHostPublishRoot not found" +} + +if(!(Test-Path $WixObjRoot)) +{ + throw "$WixObjRoot not found" +} + +Write-Host "Creating dotnet shared framework MSI at $SharedFrameworkMSIOutput" + +if([string]::IsNullOrEmpty($WixRoot)) +{ + Exit -1 +} + +if(-Not (RunHeat)) +{ + Exit -1 +} + +if(-Not (RunCandle)) +{ + Exit -1 +} + +if(-Not (RunLight)) +{ + Exit -1 +} + +if(!(Test-Path $SharedFrameworkMSIOutput)) +{ + throw "Unable to create the dotnet shared framework msi." + Exit -1 +} + +Write-Host -ForegroundColor Green "Successfully created shared framework MSI - $SharedFrameworkMSIOutput" + +exit $LastExitCode diff --git a/packaging/sharedframework/windows/provider.wxs b/packaging/sharedframework/windows/provider.wxs new file mode 100644 index 000000000..665d58c4a --- /dev/null +++ b/packaging/sharedframework/windows/provider.wxs @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/packaging/sharedframework/windows/registrykeys.wxs b/packaging/sharedframework/windows/registrykeys.wxs new file mode 100644 index 000000000..51d322da1 --- /dev/null +++ b/packaging/sharedframework/windows/registrykeys.wxs @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packaging/sharedframework/windows/sharedframework.wxs b/packaging/sharedframework/windows/sharedframework.wxs new file mode 100644 index 000000000..88680f5f2 --- /dev/null +++ b/packaging/sharedframework/windows/sharedframework.wxs @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packaging/sharedframework/windows/variables.wxi b/packaging/sharedframework/windows/variables.wxi new file mode 100644 index 000000000..ad175258f --- /dev/null +++ b/packaging/sharedframework/windows/variables.wxi @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/scripts/dotnet-cli-build/CompileTargets.cs b/scripts/dotnet-cli-build/CompileTargets.cs index e7e29c510..3391a649c 100644 --- a/scripts/dotnet-cli-build/CompileTargets.cs +++ b/scripts/dotnet-cli-build/CompileTargets.cs @@ -293,41 +293,13 @@ namespace Microsoft.DotNet.Cli.Build } // Find crossgen - string arch = PlatformServices.Default.Runtime.RuntimeArchitecture; - string packageId; - if (CurrentPlatform.IsWindows) - { - packageId = $"runtime.win7-{arch}.Microsoft.NETCore.Runtime.CoreCLR"; - } - else if (CurrentPlatform.IsUbuntu) - { - packageId = "runtime.ubuntu.14.04-x64.Microsoft.NETCore.Runtime.CoreCLR"; - } - else if (CurrentPlatform.IsCentOS || CurrentPlatform.IsRHEL) - { - // CentOS runtime is in the runtime.rhel.7-x64... package. - packageId = "runtime.rhel.7-x64.Microsoft.NETCore.Runtime.CoreCLR"; - } - else if (CurrentPlatform.IsDebian) - { - packageId = "runtime.debian.8.2-x64.Microsoft.NETCore.Runtime.CoreCLR"; - } - else if (CurrentPlatform.IsOSX) - { - packageId = "runtime.osx.10.10-x64.Microsoft.NETCore.Runtime.CoreCLR"; - } - else + var crossGenExePath = Microsoft.DotNet.Cli.Build.Crossgen.GetCrossgenPathForVersion(CoreCLRVersion); + + if (string.IsNullOrEmpty(crossGenExePath)) { return c.Failed("Unsupported OS Platform"); } - var crossGenExePath = Path.Combine( - Dirs.NuGetPackages, - packageId, - CoreCLRVersion, - "tools", - $"crossgen{Constants.ExeSuffix}"); - // We have to copy crossgen next to mscorlib var crossgen = Path.Combine(outputDir, $"crossgen{Constants.ExeSuffix}"); File.Copy(crossGenExePath, crossgen, overwrite: true); diff --git a/scripts/dotnet-cli-build/InstallerTargets.cs b/scripts/dotnet-cli-build/InstallerTargets.cs index be1a4836a..097d37f18 100644 --- a/scripts/dotnet-cli-build/InstallerTargets.cs +++ b/scripts/dotnet-cli-build/InstallerTargets.cs @@ -14,23 +14,44 @@ namespace Microsoft.DotNet.Cli.Build { [Target(nameof(MsiTargets.GenerateMsis), nameof(MsiTargets.GenerateBundle), - nameof(InstallerTargets.GeneratePkg), - nameof(InstallerTargets.GenerateDeb))] + nameof(PkgTargets.GeneratePkgs), + nameof(InstallerTargets.GenerateDebs))] public static BuildTargetResult GenerateInstaller(BuildTargetContext c) { return c.Success(); } - + [Target(nameof(InstallerTargets.GenerateSdkDeb), + nameof(InstallerTargets.GenerateSharedFrameworkDeb), + nameof(InstallerTargets.GenerateSharedHostDeb))] + [BuildPlatforms(BuildPlatform.Ubuntu)] + public static BuildTargetResult GenerateDebs(BuildTargetContext c) + { + return c.Success(); + } [Target] - [BuildPlatforms(BuildPlatform.OSX)] - public static BuildTargetResult GeneratePkg(BuildTargetContext c) + [BuildPlatforms(BuildPlatform.Ubuntu)] + public static BuildTargetResult GenerateSdkDeb(BuildTargetContext c) { + var channel = c.BuildContext.Get("Channel").ToLower(); + var packageName = Monikers.GetDebianPackageName(c); var version = c.BuildContext.Get("BuildVersion").SimpleVersion; - var pkg = c.BuildContext.Get("InstallerFile"); - Cmd(Path.Combine(Dirs.RepoRoot, "packaging", "osx", "package-osx.sh"), - "-v", version, "-i", Dirs.Stage2, "-o", pkg) + var debFile = c.BuildContext.Get("SdkInstallerFile"); + var manPagesDir = Path.Combine(Dirs.RepoRoot, "Documentation", "manpages"); + var previousVersionURL = $"https://dotnetcli.blob.core.windows.net/dotnet/{channel}/Installers/Latest/dotnet-ubuntu-x64.latest.deb"; + + var objRoot = Path.Combine(Dirs.Output, "obj", "debian", "sdk"); + + if (Directory.Exists(objRoot)) + { + Directory.Delete(objRoot, true); + } + + Directory.CreateDirectory(objRoot); + + Cmd(Path.Combine(Dirs.RepoRoot, "scripts", "package", "package-debian.sh"), + "-v", version, "-i", Dirs.Stage2, "-o", debFile, "-p", packageName, "-m", manPagesDir, "--previous-version-url", previousVersionURL, "--obj-root", objRoot) .Execute() .EnsureSuccessful(); return c.Success(); @@ -38,17 +59,49 @@ namespace Microsoft.DotNet.Cli.Build [Target] [BuildPlatforms(BuildPlatform.Ubuntu)] - public static BuildTargetResult GenerateDeb(BuildTargetContext c) + public static BuildTargetResult GenerateSharedHostDeb(BuildTargetContext c) { - var channel = c.BuildContext.Get("Channel").ToLower(); - var packageName = Monikers.GetDebianPackageName(c); var version = c.BuildContext.Get("BuildVersion").SimpleVersion; - var debFile = c.BuildContext.Get("InstallerFile"); - var manPagesDir = Path.Combine(Dirs.RepoRoot, "Documentation", "manpages"); - var previousVersionURL = $"https://dotnetcli.blob.core.windows.net/dotnet/{channel}/Installers/Latest/dotnet-ubuntu-x64.latest.deb"; + var inputRoot = c.BuildContext.Get("SharedHostPublishRoot"); + var debFile = c.BuildContext.Get("SharedHostInstallerFile"); + var objRoot = Path.Combine(Dirs.Output, "obj", "debian", "sharedhost"); - Cmd(Path.Combine(Dirs.RepoRoot, "scripts", "package", "package-debian.sh"), - "-v", version, "-i", Dirs.Stage2, "-o", debFile, "-p", packageName, "-m", manPagesDir, "--previous-version-url", previousVersionURL) + if (Directory.Exists(objRoot)) + { + Directory.Delete(objRoot, true); + } + + Directory.CreateDirectory(objRoot); + + Cmd(Path.Combine(Dirs.RepoRoot, "scripts", "package", "package-sharedhost-debian.sh"), + "--input", inputRoot, "--output", debFile, "--obj-root", objRoot, "--version", version) + .Execute() + .EnsureSuccessful(); + return c.Success(); + } + + [Target] + [BuildPlatforms(BuildPlatform.Ubuntu)] + public static BuildTargetResult GenerateSharedFrameworkDeb(BuildTargetContext c) + { + var packageName = Monikers.GetDebianSharedFrameworkPackageName(c); + var version = c.BuildContext.Get("BuildVersion").SimpleVersion; + var inputRoot = c.BuildContext.Get("SharedFrameworkPublishRoot"); + var debFile = c.BuildContext.Get("SharedFrameworkInstallerFile"); + var objRoot = Path.Combine(Dirs.Output, "obj", "debian", "sharedframework"); + + if (Directory.Exists(objRoot)) + { + Directory.Delete(objRoot, true); + } + + Directory.CreateDirectory(objRoot); + + Cmd(Path.Combine(Dirs.RepoRoot, "scripts", "package", "package-sharedframework-debian.sh"), + "--input", inputRoot, "--output", debFile, "--package-name", packageName, + "--framework-nuget-name", SharedFrameworkTargets.SharedFrameworkName, + "--framework-nuget-version", c.BuildContext.Get("SharedFrameworkNugetVersion"), + "--obj-root", objRoot, "--version", version) .Execute() .EnsureSuccessful(); return c.Success(); diff --git a/scripts/dotnet-cli-build/MsiTargets.cs b/scripts/dotnet-cli-build/MsiTargets.cs index 6d83a8794..e0e3ecb37 100644 --- a/scripts/dotnet-cli-build/MsiTargets.cs +++ b/scripts/dotnet-cli-build/MsiTargets.cs @@ -22,9 +22,13 @@ namespace Microsoft.DotNet.Cli.Build } } - private static string Msi { get; set; } + private static string SdkMsi { get; set; } - private static string Bundle { get; set; } + private static string SdkBundle { get; set; } + + private static string SharedHostMsi { get; set; } + + private static string SharedFrameworkMsi { get; set; } private static string Engine { get; set; } @@ -60,9 +64,12 @@ namespace Microsoft.DotNet.Cli.Build [BuildPlatforms(BuildPlatform.Windows)] public static BuildTargetResult InitMsi(BuildTargetContext c) { - Bundle = c.BuildContext.Get("InstallerFile"); - Msi = Path.ChangeExtension(Bundle, "msi"); - Engine = Path.Combine(Path.GetDirectoryName(Bundle), ENGINE); + SdkBundle = c.BuildContext.Get("SdkInstallerFile"); + SdkMsi = Path.ChangeExtension(SdkBundle, "msi"); + Engine = Path.Combine(Path.GetDirectoryName(SdkBundle), ENGINE); + + SharedHostMsi = Path.ChangeExtension(c.BuildContext.Get("SharedHostInstallerFile"), "msi"); + SharedFrameworkMsi = Path.ChangeExtension(c.BuildContext.Get("SharedFrameworkInstallerFile"), "msi"); var buildVersion = c.BuildContext.Get("BuildVersion"); MsiVersion = buildVersion.GenerateMsiVersion(); @@ -74,9 +81,9 @@ namespace Microsoft.DotNet.Cli.Build } [Target(nameof(MsiTargets.InitMsi), - nameof(GenerateDotnetMuxerMsi), - nameof(GenerateDotnetSharedFxMsi), - nameof(GenerateCLISDKMsi))] + nameof(GenerateDotnetSharedHostMsi), + nameof(GenerateDotnetSharedFrameworkMsi), + nameof(GenerateCliSdkMsi))] [BuildPlatforms(BuildPlatform.Windows)] public static BuildTargetResult GenerateMsis(BuildTargetContext c) { @@ -85,11 +92,11 @@ namespace Microsoft.DotNet.Cli.Build [Target] [BuildPlatforms(BuildPlatform.Windows)] - public static BuildTargetResult GenerateCLISDKMsi(BuildTargetContext c) + public static BuildTargetResult GenerateCliSdkMsi(BuildTargetContext c) { Cmd("powershell", "-NoProfile", "-NoLogo", Path.Combine(Dirs.RepoRoot, "packaging", "windows", "generatemsi.ps1"), - Dirs.Stage2, Msi, WixRoot, MsiVersion, CliVersion, Arch, Channel) + Dirs.Stage2, SdkMsi, WixRoot, MsiVersion, CliVersion, Arch, Channel) .Execute() .EnsureSuccessful(); return c.Success(); @@ -97,15 +104,48 @@ namespace Microsoft.DotNet.Cli.Build [Target] [BuildPlatforms(BuildPlatform.Windows)] - public static BuildTargetResult GenerateDotnetMuxerMsi(BuildTargetContext c) + public static BuildTargetResult GenerateDotnetSharedHostMsi(BuildTargetContext c) { + var inputDir = c.BuildContext.Get("SharedHostPublishRoot"); + var wixObjRoot = Path.Combine(Dirs.Output, "obj", "wix", "sharedhost"); + + if (Directory.Exists(wixObjRoot)) + { + Directory.Delete(wixObjRoot, true); + } + + Directory.CreateDirectory(wixObjRoot); + + Cmd("powershell", "-NoProfile", "-NoLogo", + Path.Combine(Dirs.RepoRoot, "packaging", "host", "windows", "generatemsi.ps1"), + inputDir, SharedHostMsi, WixRoot, MsiVersion, CliVersion, Arch, wixObjRoot) + .Execute() + .EnsureSuccessful(); return c.Success(); } [Target] [BuildPlatforms(BuildPlatform.Windows)] - public static BuildTargetResult GenerateDotnetSharedFxMsi(BuildTargetContext c) + public static BuildTargetResult GenerateDotnetSharedFrameworkMsi(BuildTargetContext c) { + var inputDir = c.BuildContext.Get("SharedFrameworkPublishRoot"); + var sharedFrameworkNuGetName = SharedFrameworkTargets.SharedFrameworkName; + var sharedFrameworkNuGetVersion = c.BuildContext.Get("SharedFrameworkNugetVersion"); + var upgradeCode = Utils.GenerateGuidFromName($"{sharedFrameworkNuGetName}-{sharedFrameworkNuGetVersion}-{Arch}").ToString().ToUpper(); + var wixObjRoot = Path.Combine(Dirs.Output, "obj", "wix", "sharedframework"); + + if (Directory.Exists(wixObjRoot)) + { + Directory.Delete(wixObjRoot, true); + } + + Directory.CreateDirectory(wixObjRoot); + + Cmd("powershell", "-NoProfile", "-NoLogo", + Path.Combine(Dirs.RepoRoot, "packaging", "sharedframework", "windows", "generatemsi.ps1"), + inputDir, SharedFrameworkMsi, WixRoot, MsiVersion, sharedFrameworkNuGetName, sharedFrameworkNuGetVersion, upgradeCode, Arch, wixObjRoot) + .Execute() + .EnsureSuccessful(); return c.Success(); } @@ -116,7 +156,7 @@ namespace Microsoft.DotNet.Cli.Build { Cmd("powershell", "-NoProfile", "-NoLogo", Path.Combine(Dirs.RepoRoot, "packaging", "windows", "generatebundle.ps1"), - Msi, Bundle, WixRoot, MsiVersion, CliVersion, Arch, Channel) + SdkMsi, SdkBundle, WixRoot, MsiVersion, CliVersion, Arch, Channel) .EnvironmentVariable("Stage2Dir", Dirs.Stage2) .Execute() .EnsureSuccessful(); @@ -127,7 +167,7 @@ namespace Microsoft.DotNet.Cli.Build [BuildPlatforms(BuildPlatform.Windows)] public static BuildTargetResult ExtractEngineFromBundle(BuildTargetContext c) { - Cmd($"{WixRoot}\\insignia.exe", "-ib", Bundle, "-o", Engine) + Cmd($"{WixRoot}\\insignia.exe", "-ib", SdkBundle, "-o", Engine) .Execute() .EnsureSuccessful(); return c.Success(); @@ -137,7 +177,7 @@ namespace Microsoft.DotNet.Cli.Build [BuildPlatforms(BuildPlatform.Windows)] public static BuildTargetResult ReattachEngineToBundle(BuildTargetContext c) { - Cmd($"{WixRoot}\\insignia.exe", "-ab", Engine, Bundle, "-o", Bundle) + Cmd($"{WixRoot}\\insignia.exe", "-ab", Engine, SdkBundle, "-o", SdkBundle) .Execute() .EnsureSuccessful(); return c.Success(); diff --git a/scripts/dotnet-cli-build/PackageTargets.cs b/scripts/dotnet-cli-build/PackageTargets.cs index c43b201e1..11ba01b43 100644 --- a/scripts/dotnet-cli-build/PackageTargets.cs +++ b/scripts/dotnet-cli-build/PackageTargets.cs @@ -22,6 +22,8 @@ namespace Microsoft.DotNet.Cli.Build [Target(nameof(PrepareTargets.Init), nameof(PackageTargets.InitPackage), nameof(PackageTargets.GenerateVersionBadge), + nameof(SharedFrameworkTargets.PublishSharedHost), + nameof(SharedFrameworkTargets.PublishSharedFramework), nameof(PackageTargets.GenerateCompressedFile), nameof(InstallerTargets.GenerateInstaller), nameof(PackageTargets.GenerateNugetPackages))] @@ -55,14 +57,10 @@ namespace Microsoft.DotNet.Cli.Build [BuildPlatforms(BuildPlatform.Windows)] public static BuildTargetResult GenerateZip(BuildTargetContext c) { - var zipFile = c.BuildContext.Get("CompressedFile"); + CreateZipFromDirectory(c.BuildContext.Get("SharedHostPublishRoot"), c.BuildContext.Get("SharedHostCompressedFile")); + CreateZipFromDirectory(c.BuildContext.Get("SharedFrameworkPublishRoot"), c.BuildContext.Get("SharedFrameworkCompressedFile")); + CreateZipFromDirectory(Dirs.Stage2, c.BuildContext.Get("SdkCompressedFile")); - if (File.Exists(zipFile)) - { - File.Delete(zipFile); - } - - ZipFile.CreateFromDirectory(Dirs.Stage2, zipFile, CompressionLevel.Optimal, false); return c.Success(); } @@ -70,16 +68,10 @@ namespace Microsoft.DotNet.Cli.Build [BuildPlatforms(BuildPlatform.Unix)] public static BuildTargetResult GenerateTarBall(BuildTargetContext c) { - var tarFile = c.BuildContext.Get("CompressedFile"); + CreateTarBallFromDirectory(c.BuildContext.Get("SharedHostPublishRoot"), c.BuildContext.Get("SharedHostCompressedFile")); + CreateTarBallFromDirectory(c.BuildContext.Get("SharedFrameworkPublishRoot"), c.BuildContext.Get("SharedFrameworkCompressedFile")); + CreateTarBallFromDirectory(Dirs.Stage2, c.BuildContext.Get("SdkCompressedFile")); - if (File.Exists(tarFile)) - { - File.Delete(tarFile); - } - - Cmd("tar", "-czf", tarFile, "-C", Dirs.Stage2, ".") - .Execute() - .EnsureSuccessful(); return c.Success(); } @@ -134,5 +126,27 @@ namespace Microsoft.DotNet.Cli.Build return env; } + + private static void CreateZipFromDirectory(string directory, string artifactPath) + { + if (File.Exists(artifactPath)) + { + File.Delete(artifactPath); + } + + ZipFile.CreateFromDirectory(directory, artifactPath, CompressionLevel.Optimal, false); + } + + private static void CreateTarBallFromDirectory(string directory, string artifactPath) + { + if (File.Exists(artifactPath)) + { + File.Delete(artifactPath); + } + + Cmd("tar", "-czf", artifactPath, "-C", directory, ".") + .Execute() + .EnsureSuccessful(); + } } } diff --git a/scripts/dotnet-cli-build/PkgTargets.cs b/scripts/dotnet-cli-build/PkgTargets.cs new file mode 100644 index 000000000..1f082b069 --- /dev/null +++ b/scripts/dotnet-cli-build/PkgTargets.cs @@ -0,0 +1,125 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.IO.Compression; +using System.Runtime.InteropServices; +using Microsoft.DotNet.Cli.Build.Framework; +using Microsoft.Extensions.PlatformAbstractions; + +using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers; + +namespace Microsoft.DotNet.Cli.Build +{ + public class PkgTargets + { + [Target(nameof(GenerateSdkProductArchive), nameof(GenerateSharedFrameworkProductArchive))] + [BuildPlatforms(BuildPlatform.OSX)] + public static BuildTargetResult GeneratePkgs(BuildTargetContext c) + { + return c.Success(); + } + + [Target] + [BuildPlatforms(BuildPlatform.OSX)] + public static BuildTargetResult GenerateSdkProductArchive(BuildTargetContext c) + { + var version = c.BuildContext.Get("BuildVersion").SimpleVersion; + var pkg = c.BuildContext.Get("SdkInstallerFile"); + + Cmd(Path.Combine(Dirs.RepoRoot, "packaging", "osx", "package-osx.sh"), + "-v", version, "-i", Dirs.Stage2, "-o", pkg) + .Execute() + .EnsureSuccessful(); + return c.Success(); + } + + [Target(nameof(GenerateSharedFrameworkPkg), nameof(GenerateSharedHostPkg))] + [BuildPlatforms(BuildPlatform.OSX)] + public static BuildTargetResult GenerateSharedFrameworkProductArchive(BuildTargetContext c) + { + string sharedFrameworkNugetName = SharedFrameworkTargets.SharedFrameworkName; + string sharedFrameworkNugetVersion = c.BuildContext.Get("SharedFrameworkNugetVersion"); + string version = c.BuildContext.Get("BuildVersion").SimpleVersion; + string id = $"com.microsoft.dotnet.sharedframework.{sharedFrameworkNugetName}.{sharedFrameworkNugetVersion}.osx.x64"; + string packageIntermediatesPath = Path.Combine(Dirs.Output, "obj", "pkg"); + string resourcePath = Path.Combine(Dirs.RepoRoot, "packaging", "osx", "resources"); + string outFilePath = Path.Combine(packageIntermediatesPath, id + ".pkg"); + + string inputDistTemplatePath = Path.Combine( + Dirs.RepoRoot, + "packaging", + "osx", + "sharedframework", + "shared-framework-distribution-template.xml"); + string distTemplate = File.ReadAllText(inputDistTemplatePath); + string distributionPath = Path.Combine(packageIntermediatesPath, "shared-framework-formatted-distribution.xml"); + string formattedDistContents = + distTemplate.Replace("{SharedFrameworkNugetVersion}", sharedFrameworkNugetVersion) + .Replace("{SharedFrameworkNugetName}", SharedFrameworkTargets.SharedFrameworkName) + .Replace("{VERSION}", version); + File.WriteAllText(distributionPath, formattedDistContents); + + Cmd("productbuild", + "--version", version, + "--identifier", id, + "--package-path", packageIntermediatesPath, + "--resources", resourcePath, + "--distribution", distributionPath, + outFilePath) + .Execute() + .EnsureSuccessful(); + + return c.Success(); + } + + [Target] + [BuildPlatforms(BuildPlatform.OSX)] + public static BuildTargetResult GenerateSharedFrameworkPkg(BuildTargetContext c) + { + string sharedFrameworkNugetName = SharedFrameworkTargets.SharedFrameworkName; + string sharedFrameworkNugetVersion = c.BuildContext.Get("SharedFrameworkNugetVersion"); + Directory.CreateDirectory(Path.Combine(Dirs.Output, "obj", "pkg")); + string version = c.BuildContext.Get("BuildVersion").SimpleVersion; + string id = $"com.microsoft.dotnet.sharedframework.{sharedFrameworkNugetName}.{sharedFrameworkNugetVersion}.component.osx.x64"; + string outFilePath = Path.Combine(Dirs.Output, "obj", "pkg", id + ".pkg"); + string installLocation = "/usr/local/share/dotnet"; + string scriptsLocation = Path.Combine(Dirs.RepoRoot, "packaging", "osx", "sharedframework", "scripts"); + + Cmd("pkgbuild", + "--root", c.BuildContext.Get("SharedFrameworkPublishRoot"), + "--identifier", id, + "--version", version, + "--install-location", installLocation, + "--scripts", scriptsLocation, + outFilePath) + .Execute() + .EnsureSuccessful(); + + return c.Success(); + } + + [Target] + [BuildPlatforms(BuildPlatform.OSX)] + public static BuildTargetResult GenerateSharedHostPkg(BuildTargetContext c) + { + Directory.CreateDirectory(Path.Combine(Dirs.Output, "obj", "pkg")); + string version = c.BuildContext.Get("BuildVersion").SimpleVersion; + string id = $"com.microsoft.dotnet.sharedhost.osx.x64"; + string outFilePath = Path.Combine(Dirs.Output, "obj", "pkg", id + ".pkg"); + string installLocation = "/usr/local/share/dotnet"; + string scriptsLocation = Path.Combine(Dirs.RepoRoot, "packaging", "osx", "sharedhost", "scripts"); + + Cmd("pkgbuild", + "--root", c.BuildContext.Get("SharedHostPublishRoot"), + "--identifier", id, + "--version", version, + "--install-location", installLocation, + "--scripts", scriptsLocation, + outFilePath) + .Execute() + .EnsureSuccessful(); + + return c.Success(); + } + } +} \ No newline at end of file diff --git a/scripts/dotnet-cli-build/PrepareTargets.cs b/scripts/dotnet-cli-build/PrepareTargets.cs index 9a11d5b7e..08dca3e05 100644 --- a/scripts/dotnet-cli-build/PrepareTargets.cs +++ b/scripts/dotnet-cli-build/PrepareTargets.cs @@ -108,34 +108,13 @@ namespace Microsoft.DotNet.Cli.Build [Target] public static BuildTargetResult ExpectedBuildArtifacts(BuildTargetContext c) { - var productName = Monikers.GetProductMoniker(c); var config = Environment.GetEnvironmentVariable("CONFIGURATION"); var versionBadgeName = $"{CurrentPlatform.Current}_{CurrentArchitecture.Current}_{config}_version_badge.svg"; c.BuildContext["VersionBadge"] = Path.Combine(Dirs.Output, versionBadgeName); - var extension = CurrentPlatform.IsWindows ? ".zip" : ".tar.gz"; - c.BuildContext["CompressedFile"] = Path.Combine(Dirs.Packages, productName + extension); - - string installer = ""; - switch (CurrentPlatform.Current) - { - case BuildPlatform.Windows: - installer = productName + ".exe"; - break; - case BuildPlatform.OSX: - installer = productName + ".pkg"; - break; - case BuildPlatform.Ubuntu: - installer = productName + ".deb"; - break; - default: - break; - } - - if (!string.IsNullOrEmpty(installer)) - { - c.BuildContext["InstallerFile"] = Path.Combine(Dirs.Packages, installer); - } + AddInstallerArtifactToContext(c, "dotnet", "Sdk"); + AddInstallerArtifactToContext(c, "dotnet-host", "SharedHost"); + AddInstallerArtifactToContext(c, "dotnet-sharedframework", "SharedFramework"); return c.Success(); } @@ -361,5 +340,35 @@ cmake is required to build the native host 'corehost'"; } return dict; } + + private static void AddInstallerArtifactToContext(BuildTargetContext c, string artifactPrefix, string contextPrefix) + { + var productName = Monikers.GetProductMoniker(c, artifactPrefix); + + var extension = CurrentPlatform.IsWindows ? ".zip" : ".tar.gz"; + c.BuildContext[contextPrefix + "CompressedFile"] = Path.Combine(Dirs.Packages, productName + extension); + + string installer = ""; + switch (CurrentPlatform.Current) + { + case BuildPlatform.Windows: + installer = productName + ".exe"; + break; + case BuildPlatform.OSX: + installer = productName + ".pkg"; + break; + case BuildPlatform.Ubuntu: + installer = productName + ".deb"; + break; + default: + break; + } + + if (!string.IsNullOrEmpty(installer)) + { + c.BuildContext[contextPrefix + "InstallerFile"] = Path.Combine(Dirs.Packages, installer); + } + + } } } diff --git a/scripts/dotnet-cli-build/PublishTargets.cs b/scripts/dotnet-cli-build/PublishTargets.cs index 06dca3485..b90e0c56c 100644 --- a/scripts/dotnet-cli-build/PublishTargets.cs +++ b/scripts/dotnet-cli-build/PublishTargets.cs @@ -45,7 +45,7 @@ namespace Microsoft.DotNet.Cli.Build [Target(nameof(PublishTargets.PublishVersionBadge), nameof(PublishTargets.PublishCompressedFile), - nameof(PublishTargets.PublishInstallerFile), + nameof(PublishTargets.PublishSdkInstallerFile), nameof(PublishTargets.PublishLatestVersionTextFile))] public static BuildTargetResult PublishArtifacts(BuildTargetContext c) { @@ -67,7 +67,7 @@ namespace Microsoft.DotNet.Cli.Build [Target] public static BuildTargetResult PublishCompressedFile(BuildTargetContext c) { - var compressedFile = c.BuildContext.Get("CompressedFile"); + var compressedFile = c.BuildContext.Get("SdkCompressedFile"); var compressedFileBlob = $"{Channel}/Binaries/{Version}/{Path.GetFileName(compressedFile)}"; var latestCompressedFile = compressedFile.Replace(Version, "latest"); var latestCompressedFileBlob = $"{Channel}/Binaries/Latest/{Path.GetFileName(latestCompressedFile)}"; @@ -79,9 +79,9 @@ namespace Microsoft.DotNet.Cli.Build [Target] [BuildPlatforms(BuildPlatform.Windows, BuildPlatform.OSX, BuildPlatform.Ubuntu)] - public static BuildTargetResult PublishInstallerFile(BuildTargetContext c) + public static BuildTargetResult PublishSdkInstallerFile(BuildTargetContext c) { - var installerFile = c.BuildContext.Get("InstallerFile"); + var installerFile = c.BuildContext.Get("SdkInstallerFile"); var installerFileBlob = $"{Channel}/Installers/{Version}/{Path.GetFileName(installerFile)}"; var latestInstallerFile = installerFile.Replace(Version, "latest"); var latestInstallerFileBlob = $"{Channel}/Installers/Latest/{Path.GetFileName(latestInstallerFile)}"; @@ -102,12 +102,12 @@ namespace Microsoft.DotNet.Cli.Build return c.Success(); } - [Target(nameof(PublishInstallerFile))] + [Target(nameof(PublishSdkInstallerFile))] [BuildPlatforms(BuildPlatform.Ubuntu)] public static BuildTargetResult PublishDebFileToDebianRepo(BuildTargetContext c) { var packageName = Monikers.GetDebianPackageName(c); - var installerFile = c.BuildContext.Get("InstallerFile"); + var installerFile = c.BuildContext.Get("SdkInstallerFile"); var uploadUrl = $"https://dotnetcli.blob.core.windows.net/dotnet/{Channel}/Installers/{Version}/{Path.GetFileName(installerFile)}"; var uploadJson = GenerateUploadJsonFile(packageName, Version, uploadUrl); diff --git a/scripts/dotnet-cli-build/SharedFrameworkTargets.cs b/scripts/dotnet-cli-build/SharedFrameworkTargets.cs new file mode 100644 index 000000000..e2bbd53f9 --- /dev/null +++ b/scripts/dotnet-cli-build/SharedFrameworkTargets.cs @@ -0,0 +1,159 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.IO.Compression; +using System.Text.RegularExpressions; +using System.Reflection.PortableExecutable; +using System.Runtime.InteropServices; +using Microsoft.DotNet.Cli.Build.Framework; +using Microsoft.Extensions.PlatformAbstractions; + +using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers; + +namespace Microsoft.DotNet.Cli.Build +{ + public class SharedFrameworkTargets + { + public const string SharedFrameworkName = "NETStandard.Library"; + + private const string CoreHostBaseName = "corehost"; + + [Target] + public static BuildTargetResult PublishSharedFramework(BuildTargetContext c) + { + string SharedFrameworkPublishRoot = Path.Combine(Dirs.Output, "obj", "sharedframework"); + string SharedFrameworkSourceRoot = Path.Combine(Dirs.RepoRoot, "src", "sharedframework", "framework"); + string SharedFrameworkNugetVersion = GetVersionFromProjectJson(Path.Combine(Path.Combine(Dirs.RepoRoot, "src", "sharedframework", "framework"), "project.json")); + + if (Directory.Exists(SharedFrameworkPublishRoot)) + { + Directory.Delete(SharedFrameworkPublishRoot, true); + } + + // We publish to a sub folder of the PublishRoot so tools like heat and zip can generate folder structures easier. + string SharedFrameworkNameAndVersionRoot = Path.Combine(SharedFrameworkPublishRoot, "shared", SharedFrameworkName, SharedFrameworkNugetVersion); + + DotNetCli.Stage0.Publish("--output", SharedFrameworkNameAndVersionRoot, SharedFrameworkSourceRoot).Execute().EnsureSuccessful(); + + c.BuildContext["SharedFrameworkPublishRoot"] = SharedFrameworkPublishRoot; + c.BuildContext["SharedFrameworkNugetVersion"] = SharedFrameworkNugetVersion; + + // Clean up artifacts that dotnet-publish generates which we don't need + File.Delete(Path.Combine(SharedFrameworkNameAndVersionRoot, $"framework{Constants.ExeSuffix}")); + File.Delete(Path.Combine(SharedFrameworkNameAndVersionRoot, "framework.dll")); + File.Delete(Path.Combine(SharedFrameworkNameAndVersionRoot, "framework.pdb")); + + // Rename the .deps file + File.Move(Path.Combine(SharedFrameworkNameAndVersionRoot, "framework.deps"), Path.Combine(SharedFrameworkNameAndVersionRoot, $"{SharedFrameworkName}.deps")); + + // corehost will be renamed to dotnet at some point and then this can be removed. + File.Move(Path.Combine(SharedFrameworkNameAndVersionRoot, $"{CoreHostBaseName}{Constants.ExeSuffix}"), Path.Combine(SharedFrameworkNameAndVersionRoot, $"dotnet{Constants.ExeSuffix}")); + + // hostpolicy will be renamed to dotnet at some point and then this can be removed. + File.Move(Path.Combine(SharedFrameworkNameAndVersionRoot, $"{Constants.DynamicLibPrefix}hostpolicy{Constants.DynamicLibSuffix}"), Path.Combine(SharedFrameworkNameAndVersionRoot, $"{Constants.DynamicLibPrefix}dotnethostimpl{Constants.DynamicLibSuffix}")); + + if (File.Exists(Path.Combine(SharedFrameworkNameAndVersionRoot, "mscorlib.ni.dll"))) + { + // Publish already places the crossgen'd version of mscorlib into the output, so we can + // remove the IL version + File.Delete(Path.Combine(SharedFrameworkNameAndVersionRoot, "mscorlib.dll")); + + CrossGenAllManagedAssemblies(SharedFrameworkNameAndVersionRoot); + } + else + { + c.Warn("Shared framework will not be crossgen'd because mscorlib.ni.dll does not exist."); + } + + return c.Success(); + } + + [Target] + public static BuildTargetResult PublishSharedHost(BuildTargetContext c) + { + string SharedHostPublishRoot = Path.Combine(Dirs.Output, "obj", "sharedhost"); + + if (Directory.Exists(SharedHostPublishRoot)) + { + Directory.Delete(SharedHostPublishRoot, true); + } + + DotNetCli.Stage0.Publish("--output", SharedHostPublishRoot, Path.Combine(Dirs.RepoRoot, "src", "sharedframework", "host")).Execute().EnsureSuccessful(); + + // For the shared host, we only want corerun and not any of the other artifacts in the package (like the hostpolicy) + foreach (var filePath in Directory.GetFiles(SharedHostPublishRoot)) + { + if (Path.GetFileName(filePath) != $"{CoreHostBaseName}{Constants.ExeSuffix}") + { + File.Delete(filePath); + } + } + + // corehost will be renamed to dotnet at some point and then this can be removed. + File.Move(Path.Combine(SharedHostPublishRoot, $"{CoreHostBaseName}{Constants.ExeSuffix}"), Path.Combine(SharedHostPublishRoot, $"dotnet{Constants.ExeSuffix}")); + + c.BuildContext["SharedHostPublishRoot"] = SharedHostPublishRoot; + + return c.Success(); + } + + private static string GetVersionFromProjectJson(string pathToProjectJson) + { + Regex r = new Regex($"\"{Regex.Escape(SharedFrameworkName)}\"\\s*:\\s*\"(?'version'[^\"]*)\""); + + foreach(var line in File.ReadAllLines(pathToProjectJson)) + { + var m = r.Match(line); + + if (m.Success) + { + return m.Groups["version"].Value; + } + } + + return null; + } + + private static void CrossGenAllManagedAssemblies(string pathToAssemblies) + { + foreach (var file in Directory.GetFiles(pathToAssemblies)) + { + string fileName = Path.GetFileName(file); + + if (fileName == "mscorlib.dll" || fileName == "mscorlib.ni.dll" || !HasMetadata(file)) + { + continue; + } + + string tempPathName = Path.ChangeExtension(file, "readytorun"); + + // This is not always correct. The version of crossgen we need to pick up is whatever one was restored as part + // of the Microsoft.NETCore.Runtime.CoreCLR package that is part of the shared library. For now, the version hardcoded + // in CompileTargets and the one in the shared library project.json match and are updated in lock step, but long term + // we need to be able to look at the project.lock.json file and figure out what version of Microsoft.NETCore.Runtime.CoreCLR + // was used, and then select that version. + ExecSilent(Crossgen.GetCrossgenPathForVersion(CompileTargets.CoreCLRVersion), + "-readytorun", "-in", file, "-out", tempPathName, "-platform_assemblies_paths", pathToAssemblies); + + File.Delete(file); + File.Move(tempPathName, file); + } + } + + private static bool HasMetadata(string pathToFile) + { + try + { + using (var inStream = File.OpenRead(pathToFile)) + { + using (var peReader = new PEReader(inStream)) + { + return peReader.HasMetadata; + } + } + } catch (BadImageFormatException) { } + + return false; + } + } +} diff --git a/scripts/dotnet-cli-build/Utils/Crossgen.cs b/scripts/dotnet-cli-build/Utils/Crossgen.cs new file mode 100644 index 000000000..37cf836aa --- /dev/null +++ b/scripts/dotnet-cli-build/Utils/Crossgen.cs @@ -0,0 +1,50 @@ +using System.IO; +using System.Linq; +using System; +using System.Runtime.InteropServices; +using Microsoft.DotNet.Cli.Build.Framework; +using Microsoft.Extensions.PlatformAbstractions; + +namespace Microsoft.DotNet.Cli.Build +{ + internal static class Crossgen + { + public static string GetCrossgenPathForVersion(string coreClrVersion) + { + string arch = PlatformServices.Default.Runtime.RuntimeArchitecture; + string packageId; + if (CurrentPlatform.IsWindows) + { + packageId = $"runtime.win7-{arch}.Microsoft.NETCore.Runtime.CoreCLR"; + } + else if (CurrentPlatform.IsUbuntu) + { + packageId = "runtime.ubuntu.14.04-x64.Microsoft.NETCore.Runtime.CoreCLR"; + } + else if (CurrentPlatform.IsCentOS || CurrentPlatform.IsRHEL) + { + // CentOS runtime is in the runtime.rhel.7-x64... package. + packageId = "runtime.rhel.7-x64.Microsoft.NETCore.Runtime.CoreCLR"; + } + else if (CurrentPlatform.IsOSX) + { + packageId = "runtime.osx.10.10-x64.Microsoft.NETCore.Runtime.CoreCLR"; + } + else if (CurrentPlatform.IsDebian) + { + packageId = "runtime.debian.8.2-x64.Microsoft.NETCore.Runtime.CoreCLR"; + } + else + { + return null; + } + + return Path.Combine( + Dirs.NuGetPackages, + packageId, + coreClrVersion, + "tools", + $"crossgen{Constants.ExeSuffix}"); + } + } +} diff --git a/scripts/dotnet-cli-build/Utils/Monikers.cs b/scripts/dotnet-cli-build/Utils/Monikers.cs index ae8052636..b69c0d05b 100644 --- a/scripts/dotnet-cli-build/Utils/Monikers.cs +++ b/scripts/dotnet-cli-build/Utils/Monikers.cs @@ -8,12 +8,12 @@ namespace Microsoft.DotNet.Cli.Build { public class Monikers { - public static string GetProductMoniker(BuildTargetContext c) + public static string GetProductMoniker(BuildTargetContext c, string artifactPrefix) { string osname = GetOSShortName(); var arch = CurrentArchitecture.Current.ToString(); var version = c.BuildContext.Get("BuildVersion").SimpleVersion; - return $"dotnet-{osname}-{arch}.{version}"; + return $"{artifactPrefix}-{osname}-{arch}.{version}"; } public static string GetDebianPackageName(BuildTargetContext c) @@ -38,6 +38,13 @@ namespace Microsoft.DotNet.Cli.Build return packageName; } + public static string GetDebianSharedFrameworkPackageName(BuildTargetContext c) + { + var sharedFrameworkNugetVersion = c.BuildContext.Get("SharedFrameworkNugetVersion"); + + return $"dotnet-sharedframework-{SharedFrameworkTargets.SharedFrameworkName}-{sharedFrameworkNugetVersion}".ToLower(); + } + public static string GetOSShortName() { string osname = ""; diff --git a/scripts/dotnet-cli-build/Utils/Utils.cs b/scripts/dotnet-cli-build/Utils/Utils.cs index edbee23d1..21512a08b 100644 --- a/scripts/dotnet-cli-build/Utils/Utils.cs +++ b/scripts/dotnet-cli-build/Utils/Utils.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Runtime.InteropServices; +using System.Security.Cryptography; namespace Microsoft.DotNet.Cli.Build { @@ -34,5 +35,55 @@ namespace Microsoft.DotNet.Cli.Build throw new PlatformNotSupportedException(); } } + + // Generate a Version 5 (SHA1 Name Based) Guid from a name. + public static Guid GenerateGuidFromName(string name) + { + // Any fixed GUID will do for a namespace. + Guid namespaceId = new Guid("28F1468D-672B-489A-8E0C-7C5B3030630C"); + + using (SHA1 hasher = SHA1.Create()) + { + var nameBytes = System.Text.Encoding.UTF8.GetBytes(name ?? string.Empty); + var namespaceBytes = namespaceId.ToByteArray(); + + SwapGuidByteOrder(namespaceBytes); + + var streamToHash = new byte[namespaceBytes.Length + nameBytes.Length]; + + Array.Copy(namespaceBytes, streamToHash, namespaceBytes.Length); + Array.Copy(nameBytes, 0, streamToHash, namespaceBytes.Length, nameBytes.Length); + + var hashResult = hasher.ComputeHash(streamToHash); + + var res = new byte[16]; + + Array.Copy(hashResult, res, res.Length); + + unchecked { res[6] = (byte)(0x50 | (res[6] & 0x0F)); } + unchecked { res[8] = (byte)(0x40 | (res[8] & 0x3F)); } + + SwapGuidByteOrder(res); + + return new Guid(res); + } + } + + // Do a byte order swap, .NET GUIDs store multi byte components in little + // endian. + private static void SwapGuidByteOrder(byte[] b) + { + Swap(b, 0, 3); + Swap(b, 1, 2); + Swap(b, 5, 6); + Swap(b, 7, 8); + } + + private static void Swap(byte[] b, int x, int y) + { + byte t = b[x]; + b[x] = b[y]; + b[y] = t; + } } } diff --git a/scripts/dotnet-cli-build/project.json b/scripts/dotnet-cli-build/project.json index e76a7a1c3..f66171d24 100755 --- a/scripts/dotnet-cli-build/project.json +++ b/scripts/dotnet-cli-build/project.json @@ -8,9 +8,11 @@ "dependencies": { "NETStandard.Library": "1.0.0-rc2-23901", "System.IO.Compression.ZipFile": "4.0.1-rc2-23901", + "System.Security.Cryptography.Algorithms": "4.0.0-rc2-23901", "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16537", "Microsoft.DotNet.Cli.Build.Framework": "1.0.0-*", - "WindowsAzure.Storage" : "6.2.2-preview" + "WindowsAzure.Storage" : "6.2.2-preview", + "System.Reflection.Metadata" : "1.2.0" }, "frameworks": { diff --git a/scripts/package/package-debian.sh b/scripts/package/package-debian.sh index e06748739..1b54bfb02 100755 --- a/scripts/package/package-debian.sh +++ b/scripts/package/package-debian.sh @@ -29,6 +29,7 @@ help(){ echo " --output The full path to which the package will be written." echo " --package-name Package to identify during installation. Example - 'dotnet-nightly', 'dotnet'" echo " --previous-version-url Url to the previous version of the debian packge against which to run the upgrade tests." + echo " --obj-root Root folder for intermediate objects." exit 1 } @@ -61,6 +62,10 @@ parseargs(){ PREVIOUS_VERSION_URL=$2 shift ;; + --obj-root) + OBJECT_DIR=$2 + shift + ;; --help) help ;; @@ -103,9 +108,9 @@ parseargs $@ PACKAGING_ROOT="$REPOROOT/packaging/debian" PACKAGING_TOOL_DIR="$REPOROOT/tools/DebianPackageTool" -PACKAGE_OUTPUT_DIR=$(dirname "${OUTPUT_DEBIAN_FILE}") -PACKAGE_LAYOUT_DIR="$PACKAGE_OUTPUT_DIR/deb_intermediate" -TEST_STAGE_DIR="$PACKAGE_OUTPUT_DIR/debian_tests" +PACKAGE_OUTPUT_DIR="$OBJECT_DIR/deb_output" +PACKAGE_LAYOUT_DIR="$OBJECT_DIR/deb_intermediate" +TEST_STAGE_DIR="$OBJECT_DIR/debian_tests" # remove any residual deb files from earlier builds rm -f "$PACKAGE_OUTPUT_DIR/*.deb" diff --git a/scripts/package/package-sharedframework-debian.sh b/scripts/package/package-sharedframework-debian.sh new file mode 100755 index 000000000..ef904c0ee --- /dev/null +++ b/scripts/package/package-sharedframework-debian.sh @@ -0,0 +1,154 @@ +#!/usr/bin/env bash +# +# 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. + +# Debian Packaging Script +# Currently Intended to build on ubuntu14.04 + +set -e + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done +DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + +source "$DIR/../common/_common.sh" +REPOROOT="$DIR/../.." + +help(){ + echo "Usage: $0" + echo "" + echo "Options:" + echo " --input Package the entire contents of the directory tree." + echo " --output The full path to which the package will be written." + echo " --package-name Package to identify during installation. Example - 'dotnet-sharedframework'" + echo " --framework-nuget-name The name of the nuget package that produced this shared framework." + echo " --framework-nuget-version The versionf of the nuget package that produced this shared framework." + echo " --obj-root Root folder for intermediate objects." + echo " --version Version for the debain package." + exit 1 +} + +while [[ $# > 0 ]]; do + lowerI="$(echo $1 | awk '{print tolower($0)}')" + case $lowerI in + -o|--output) + OUTPUT_DEBIAN_FILE=$2 + shift + ;; + -i|--input) + REPO_BINARIES_DIR=$2 + shift + ;; + -p|--package-name) + SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME=$2 + shift + ;; + --framework-nuget-name) + SHARED_FRAMEWORK_NUGET_NAME=$2 + shift + ;; + --framework-nuget-version) + SHARED_FRAMEWORK_NUGET_VERSION=$2 + shift + ;; + --obj-root) + OBJECT_DIR=$2 + shift + ;; + --version) + SHARED_FRAMEWORK_DEBIAN_VERSION=$2 + shift + ;; + --help) + help + ;; + *) + break + ;; + esac + shift +done + +PACKAGING_ROOT="$REPOROOT/packaging/sharedframework/debian" +PACKAGING_TOOL_DIR="$REPOROOT/tools/DebianPackageTool" + +PACKAGE_OUTPUT_DIR="$OBJECT_DIR/deb_output" +PACKAGE_LAYOUT_DIR="$OBJECT_DIR/deb_intermediate" +TEST_STAGE_DIR="$OBJECT_DIR/debian_tests" + +execute_build(){ + create_empty_debian_layout + copy_files_to_debian_layout + update_debian_json + create_debian_package +} + +create_empty_debian_layout(){ + header "Creating empty debian package layout" + + rm -rf "$PACKAGE_LAYOUT_DIR" + mkdir -p "$PACKAGE_LAYOUT_DIR" + + mkdir "$PACKAGE_LAYOUT_DIR/\$" + mkdir "$PACKAGE_LAYOUT_DIR/package_root" + mkdir "$PACKAGE_LAYOUT_DIR/samples" + mkdir "$PACKAGE_LAYOUT_DIR/docs" +} + +copy_files_to_debian_layout(){ + header "Copying files to debian layout" + + # Copy Built Binaries + cp -a "$REPO_BINARIES_DIR/." "$PACKAGE_LAYOUT_DIR/package_root" + + # Copy config file + cp "$PACKAGING_ROOT/dotnet-sharedframework-debian_config.json" "$PACKAGE_LAYOUT_DIR/debian_config.json" +} + +create_debian_package(){ + header "Packing .deb" + + mkdir -p "$PACKAGE_OUTPUT_DIR" + + "$PACKAGING_TOOL_DIR/package_tool" -i "$PACKAGE_LAYOUT_DIR" -o "$PACKAGE_OUTPUT_DIR" -n "$SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME" -v "$SHARED_FRAMEWORK_DEBIAN_VERSION" +} + +update_debian_json() +{ + header "Updating debian.json file" + sed -i "s/%SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME%/$SHARED_FRAMEWORK_DEBIAN_PACKAGE_NAME/g" "$PACKAGE_LAYOUT_DIR"/debian_config.json + sed -i "s/%SHARED_FRAMEWORK_NUGET_NAME%/$SHARED_FRAMEWORK_NUGET_NAME/g" "$PACKAGE_LAYOUT_DIR"/debian_config.json + sed -i "s/%SHARED_FRAMEWORK_NUGET_VERSION%/$SHARED_FRAMEWORK_NUGET_VERSION/g" "$PACKAGE_LAYOUT_DIR"/debian_config.json +} + +test_debian_package(){ + header "Testing debian package" + + install_bats + run_package_integrity_tests +} + +install_bats() { + rm -rf $TEST_STAGE_DIR + git clone https://github.com/sstephenson/bats.git $TEST_STAGE_DIR +} + +run_package_integrity_tests() { + # Set LAST_VERSION_URL to enable upgrade tests + # export LAST_VERSION_URL="$PREVIOUS_VERSION_URL" + + $TEST_STAGE_DIR/bin/bats $PACKAGE_OUTPUT_DIR/test_package.bats +} + +execute_build + +DEBIAN_FILE=$(find $PACKAGE_OUTPUT_DIR -iname "*.deb") + +test_debian_package + +mv -f "$DEBIAN_FILE" "$OUTPUT_DEBIAN_FILE" diff --git a/scripts/package/package-sharedhost-debian.sh b/scripts/package/package-sharedhost-debian.sh new file mode 100755 index 000000000..4c4ecb8db --- /dev/null +++ b/scripts/package/package-sharedhost-debian.sh @@ -0,0 +1,130 @@ +#!/usr/bin/env bash +# +# 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. + +# Debian Packaging Script +# Currently Intended to build on ubuntu14.04 + +set -e + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done +DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + +source "$DIR/../common/_common.sh" +REPOROOT="$DIR/../.." + +help(){ + echo "Usage: $0" + echo "" + echo "Options:" + echo " --input Package the entire contents of the directory tree." + echo " --output The full path to which the package will be written." + echo " --obj-root Root folder for intermediate objects." + echo " --version Version for the debain package." + exit 1 +} + +while [[ $# > 0 ]]; do + lowerI="$(echo $1 | awk '{print tolower($0)}')" + case $lowerI in + -o|--output) + OUTPUT_DEBIAN_FILE=$2 + shift + ;; + -i|--input) + REPO_BINARIES_DIR=$2 + shift + ;; + --obj-root) + OBJECT_DIR=$2 + shift + ;; + --version) + SHARED_HOST_DEBIAN_VERSION=$2 + shift + ;; + --help) + help + ;; + *) + break + ;; + esac + shift +done + +PACKAGING_ROOT="$REPOROOT/packaging/host/debian" +PACKAGING_TOOL_DIR="$REPOROOT/tools/DebianPackageTool" + +PACKAGE_OUTPUT_DIR="$OBJECT_DIR/deb_output" +PACKAGE_LAYOUT_DIR="$OBJECT_DIR/deb_intermediate" +TEST_STAGE_DIR="$OBJECT_DIR/debian_tests" + +execute_build(){ + create_empty_debian_layout + copy_files_to_debian_layout + create_debian_package +} + +create_empty_debian_layout(){ + header "Creating empty debian package layout" + + rm -rf "$PACKAGE_LAYOUT_DIR" + mkdir -p "$PACKAGE_LAYOUT_DIR" + + mkdir "$PACKAGE_LAYOUT_DIR/\$" + mkdir "$PACKAGE_LAYOUT_DIR/package_root" + mkdir "$PACKAGE_LAYOUT_DIR/samples" + mkdir "$PACKAGE_LAYOUT_DIR/docs" +} + +copy_files_to_debian_layout(){ + header "Copying files to debian layout" + + # Copy Built Binaries + cp -a "$REPO_BINARIES_DIR/." "$PACKAGE_LAYOUT_DIR/package_root" + + # Copy config file + cp "$PACKAGING_ROOT/dotnet-sharedhost-debian_config.json" "$PACKAGE_LAYOUT_DIR/debian_config.json" +} + +create_debian_package(){ + header "Packing .deb" + + mkdir -p "$PACKAGE_OUTPUT_DIR" + + "$PACKAGING_TOOL_DIR/package_tool" -i "$PACKAGE_LAYOUT_DIR" -o "$PACKAGE_OUTPUT_DIR" -v "$SHARED_HOST_DEBIAN_VERSION" +} + +test_debian_package(){ + header "Testing debian package" + + install_bats + run_package_integrity_tests +} + +install_bats() { + rm -rf $TEST_STAGE_DIR + git clone https://github.com/sstephenson/bats.git $TEST_STAGE_DIR +} + +run_package_integrity_tests() { + # Set LAST_VERSION_URL to enable upgrade tests + # export LAST_VERSION_URL="$PREVIOUS_VERSION_URL" + + $TEST_STAGE_DIR/bin/bats $PACKAGE_OUTPUT_DIR/test_package.bats +} + +execute_build + +DEBIAN_FILE=$(find $PACKAGE_OUTPUT_DIR -iname "*.deb") + +test_debian_package + +mv -f "$DEBIAN_FILE" "$OUTPUT_DEBIAN_FILE" diff --git a/src/sharedframework/framework/Program.cs b/src/sharedframework/framework/Program.cs new file mode 100644 index 000000000..4aa370b90 --- /dev/null +++ b/src/sharedframework/framework/Program.cs @@ -0,0 +1,11 @@ +using System; + +namespace ConsoleApplication +{ + public class Program + { + public static void Main(string[] args) + { + } + } +} \ No newline at end of file diff --git a/src/sharedframework/framework/project.json b/src/sharedframework/framework/project.json new file mode 100644 index 000000000..48e835c95 --- /dev/null +++ b/src/sharedframework/framework/project.json @@ -0,0 +1,14 @@ +{ + "version": "1.0.0-*", + "compilationOptions": { + "emitEntryPoint": true + }, + + "dependencies": { + "NETStandard.Library": "1.0.0-rc2-23901" + }, + + "frameworks": { + "dnxcore50": { } + } +} \ No newline at end of file diff --git a/src/sharedframework/host/project.json b/src/sharedframework/host/project.json new file mode 100644 index 000000000..80a3611f2 --- /dev/null +++ b/src/sharedframework/host/project.json @@ -0,0 +1,11 @@ +{ + "version": "1.0.0-*", + + "dependencies": { + "NETStandard.Library": "1.0.0-rc2-23901" + }, + + "frameworks": { + "dnxcore50": { } + } +} \ No newline at end of file diff --git a/tools/DebianPackageTool/package_tool b/tools/DebianPackageTool/package_tool index c48da1755..3cc139878 100755 --- a/tools/DebianPackageTool/package_tool +++ b/tools/DebianPackageTool/package_tool @@ -132,7 +132,10 @@ parse_config_and_set_env_vars(){ DOCS_JSON_PATH="$INPUT_DIR/docs.json" PACKAGE_SOURCE_DIR="${OUTPUT_DIR}/${PACKAGE_NAME}-${PACKAGE_VERSION}" - INSTALL_ROOT="/usr/share/${PACKAGE_NAME}" + + if ! INSTALL_ROOT="$($extract_base_cmd $CONFIG "install_root")"; then + INSTALL_ROOT="/usr/share/$PACKAGE_NAME" + fi DEBIAN_DIR="${PACKAGE_SOURCE_DIR}/debian" DOCS_DIR="${PACKAGE_SOURCE_DIR}/docs"