Create 'dotnet-dev' and 'dotnet' pkg.

- 'dotnet-dev' contains the sharedfx, shared host and CLI SDK.
- 'dotnet' contains the sharedfx and the shared host.
This commit is contained in:
Sridhar Periyasamy 2016-03-17 13:19:27 -07:00
parent de8b326872
commit ae83a73e35
5 changed files with 105 additions and 128 deletions

View file

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<installer-gui-script minSpecVersion="1">
<title>.NET CLI {VERSION}</title>
<license file="eula.rtf" mime-type="application/rtf" />
<background file="dotnetbackground.png" mime-type="image/png"/>
<options customize="never" require-scripts="false" />
<welcome file="welcome.html" mime-type="text/html" />
<conclusion file="conclusion.html" mime-type="text/html" />
<volume-check>
<allowed-os-version>
<os-version min="10.10" />
</allowed-os-version>
</volume-check>
<choices-outline>
<line choice="com.microsoft.dotnet.cli.pkg.dotnet-osx-x64"/>
</choices-outline>
<choice id="com.microsoft.dotnet.cli.pkg.dotnet-osx-x64" visible="true" title=".NET CLI (x64)" description=".NET CLI">
<pkg-ref id="com.microsoft.dotnet.cli.pkg.dotnet-osx-x64"/>
</choice>
<pkg-ref id="com.microsoft.dotnet.cli.pkg.dotnet-osx-x64">dotnet-osx-x64.{VERSION}.pkg</pkg-ref>
</installer-gui-script>

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<installer-gui-script minSpecVersion="1">
<title>.NET CLI {VERSION}</title>
<license file="eula.rtf" mime-type="application/rtf" />
<background file="dotnetbackground.png" mime-type="image/png"/>
<options customize="never" require-scripts="false" />
<welcome file="welcome.html" mime-type="text/html" />
<conclusion file="conclusion.html" mime-type="text/html" />
<volume-check>
<allowed-os-version>
<os-version min="10.10" />
</allowed-os-version>
</volume-check>
<choices-outline>
<line choice="com.microsoft.dotnet.sharedframework.{SharedFrameworkNugetName}.{SharedFrameworkNugetVersion}.component.osx.x64.pkg" />
<line choice="com.microsoft.dotnet.sharedhost.osx.x64" />
<line choice="com.microsoft.dotnet.sdk.osx.x64"/>
</choices-outline>
<choice id="com.microsoft.dotnet.sharedframework.{SharedFrameworkNugetName}.{SharedFrameworkNugetVersion}.component.osx.x64.pkg" visible="true" title=".NET Core Shared Framework (x64)" description="The .NET Core Shared Framework">
<pkg-ref id="com.microsoft.dotnet.sharedframework.{SharedFrameworkNugetName}.{SharedFrameworkNugetVersion}.component.osx.x64.pkg" />
</choice>
<choice id="com.microsoft.dotnet.sharedhost.osx.x64" visible="true" title=".NET Core Shared Host (x64)" description="The .NET Core Shared Host." >
<pkg-ref id="com.microsoft.dotnet.sharedhost.osx.x64" />
</choice>
<choice id="com.microsoft.dotnet.sdk.osx.x64" visible="true" title=".NET CLI (x64)" description=".NET CLI">
<pkg-ref id="com.microsoft.dotnet.sdk.osx.x64"/>
</choice>
<pkg-ref id="com.microsoft.dotnet.sharedframework.{SharedFrameworkNugetName}.{SharedFrameworkNugetVersion}.component.osx.x64.pkg">com.microsoft.dotnet.sharedframework.{SharedFrameworkNugetName}.{SharedFrameworkNugetVersion}.component.osx.x64.pkg</pkg-ref>
<pkg-ref id="com.microsoft.dotnet.sharedhost.osx.x64">com.microsoft.dotnet.sharedhost.osx.x64.pkg</pkg-ref>
<pkg-ref id="com.microsoft.dotnet.sdk.osx.x64">com.microsoft.dotnet.sdk.osx.x64.pkg</pkg-ref>
</installer-gui-script>

View file

@ -12,7 +12,7 @@ INSTALL_DESTINATION=$2
chmod -R 755 $INSTALL_DESTINATION
# Add the installation bin directory to the system-wide paths
echo $INSTALL_DESTINATION/bin | tee -a /etc/paths.d/dotnet
echo $INSTALL_DESTINATION | tee -a /etc/paths.d/dotnet
exit 0

View file

@ -1,86 +0,0 @@
#!/bin/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.
#
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 )"
help(){
echo "Usage: $0 [--version <pkg version>] [--input <input directory>] [--output <output pkg>] [--help]"
echo ""
echo "Options:"
echo " --version <pkg version> Specify a version for the package. Version format is 4 '.' separated numbers - <major>.<minor>.<patch>.<revision>"
echo " --input <input directory> Package the entire contents of the directory tree."
echo " --output <output pkg> The path to where the package will be written."
exit 1
}
while [[ $# > 0 ]]; do
lowerI="$(echo $1 | awk '{print tolower($0)}')"
case $lowerI in
-v|--version)
DOTNET_CLI_VERSION=$2
shift
;;
-o|--output)
OUTPUT_PKG=$2
shift
;;
-i|--input)
INPUT_DIR=$2
shift
;;
--help)
help
;;
*)
break
;;
esac
shift
done
if [ -z "$DOTNET_CLI_VERSION" ]; then
echo "Provide a version number. Missing option '--version'" && help
fi
if [ -z "$OUTPUT_PKG" ]; then
echo "Provide an output pkg. Missing option '--output'" && help
fi
if [ -z "$INPUT_DIR" ]; then
echo "Provide an input directory. Missing option '--input'" && help
fi
if [ ! -d "$INPUT_DIR" ]; then
echo "'$INPUT_DIR' - is either missing or not a directory" 1>&2
exit 1
fi
PACKAGE_DIR=$(dirname "${OUTPUT_PKG}")
[ -d "$PACKAGE_DIR" ] || mkdir -p $PACKAGE_DIR
PACKAGE_ID=$(basename "${OUTPUT_PKG}")
#chmod -R 755 $INPUT_DIR
pkgbuild --root $INPUT_DIR \
--version $DOTNET_CLI_VERSION \
--scripts $DIR/scripts \
--identifier com.microsoft.dotnet.cli.pkg.dotnet-osx-x64 \
--install-location /usr/local/share/dotnet \
$DIR/$PACKAGE_ID
cat $DIR/Distribution-Template | sed "/{VERSION}/s//$DOTNET_CLI_VERSION/g" > $DIR/Dist
productbuild --version $DOTNET_CLI_VERSION --identifier com.microsoft.dotnet.cli --package-path $DIR --resources $DIR/resources --distribution $DIR/Dist $OUTPUT_PKG
#Clean temp files
rm $DIR/$PACKAGE_ID
rm $DIR/Dist

View file

@ -12,25 +12,80 @@ namespace Microsoft.DotNet.Cli.Build
{
public class PkgTargets
{
[Target(nameof(GenerateSdkProductArchive), nameof(GenerateSharedFrameworkProductArchive))]
public static string PkgsIntermediateDir { get; set; }
[Target]
[BuildPlatforms(BuildPlatform.OSX)]
public static BuildTargetResult InitPkg(BuildTargetContext c)
{
PkgsIntermediateDir = Path.Combine(Dirs.Packages, "intermediate");
Directory.CreateDirectory(PkgsIntermediateDir);
return c.Success();
}
[Target(nameof(InitPkg), nameof(GenerateSharedFrameworkProductArchive), nameof(GenerateCLISdkProductArchive))]
[BuildPlatforms(BuildPlatform.OSX)]
public static BuildTargetResult GeneratePkgs(BuildTargetContext c)
{
return c.Success();
}
[Target(nameof(GenerateCLISdkPkg))]
[BuildPlatforms(BuildPlatform.OSX)]
public static BuildTargetResult GenerateCLISdkProductArchive(BuildTargetContext c)
{
string sharedFrameworkNugetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
string version = c.BuildContext.Get<BuildVersion>("BuildVersion").SimpleVersion;
string id = $"com.microsoft.dotnet.dev.{version}.osx.x64";
string resourcePath = Path.Combine(Dirs.RepoRoot, "packaging", "osx", "resources");
string outFilePath = Path.Combine(Dirs.Packages, c.BuildContext.Get<string>("CombinedFrameworkSDKHostInstallerFile"));
string inputDistTemplatePath = Path.Combine(
Dirs.RepoRoot,
"packaging",
"osx",
"clisdk",
"Distribution-Template");
string distTemplate = File.ReadAllText(inputDistTemplatePath);
string distributionPath = Path.Combine(PkgsIntermediateDir, "CLI-SDK-Formatted-Distribution-Template.xml");
string formattedDistContents =
distTemplate.Replace("{SharedFrameworkNugetVersion}", sharedFrameworkNugetVersion)
.Replace("{SharedFrameworkNugetName}", Monikers.SharedFrameworkName)
.Replace("{VERSION}", version);
File.WriteAllText(distributionPath, formattedDistContents);
Cmd("productbuild",
"--version", version,
"--identifier", id,
"--package-path", PkgsIntermediateDir,
"--resources", resourcePath,
"--distribution", distributionPath,
outFilePath)
.Execute()
.EnsureSuccessful();
return c.Success();
}
[Target]
[BuildPlatforms(BuildPlatform.OSX)]
public static BuildTargetResult GenerateSdkProductArchive(BuildTargetContext c)
public static BuildTargetResult GenerateCLISdkPkg(BuildTargetContext c)
{
var version = c.BuildContext.Get<BuildVersion>("BuildVersion").SimpleVersion;
var pkg = c.BuildContext.Get<string>("CombinedFrameworkSDKHostInstallerFile");
var input = c.BuildContext.Get<string>("CLISDKRoot");
string version = c.BuildContext.Get<BuildVersion>("BuildVersion").SimpleVersion;
string id = $"com.microsoft.dotnet.sdk.osx.x64";
string outFilePath = Path.Combine(PkgsIntermediateDir, id + ".pkg");
string installLocation = "/usr/local/share/dotnet";
string scriptsLocation = Path.Combine(Dirs.RepoRoot, "packaging", "osx", "clisdk", "scripts");
Cmd("pkgbuild",
"--root", c.BuildContext.Get<string>("CLISDKRoot"),
"--identifier", id,
"--version", version,
"--install-location", installLocation,
"--scripts", scriptsLocation,
outFilePath)
.Execute()
.EnsureSuccessful();
Cmd(Path.Combine(Dirs.RepoRoot, "packaging", "osx", "package-osx.sh"),
"-v", version, "-i", input, "-o", pkg)
.Execute()
.EnsureSuccessful();
return c.Success();
}
@ -41,10 +96,9 @@ namespace Microsoft.DotNet.Cli.Build
string sharedFrameworkNugetName = Monikers.SharedFrameworkName;
string sharedFrameworkNugetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
string version = c.BuildContext.Get<BuildVersion>("BuildVersion").SimpleVersion;
string id = $"com.microsoft.dotnet.sharedframework.{sharedFrameworkNugetName}.{sharedFrameworkNugetVersion}.osx.x64";
string packageIntermediatesPath = Path.Combine(Dirs.Output, "obj", "pkg");
string id = $"com.microsoft.dotnet.{sharedFrameworkNugetName}.{sharedFrameworkNugetVersion}.osx.x64";
string resourcePath = Path.Combine(Dirs.RepoRoot, "packaging", "osx", "resources");
string outFilePath = Path.Combine(packageIntermediatesPath, id + ".pkg");
string outFilePath = Path.Combine(PkgsIntermediateDir, c.BuildContext.Get<string>("CombinedFrameworkHostInstallerFile"));
string inputDistTemplatePath = Path.Combine(
Dirs.RepoRoot,
@ -53,7 +107,7 @@ namespace Microsoft.DotNet.Cli.Build
"sharedframework",
"shared-framework-distribution-template.xml");
string distTemplate = File.ReadAllText(inputDistTemplatePath);
string distributionPath = Path.Combine(packageIntermediatesPath, "shared-framework-formatted-distribution.xml");
string distributionPath = Path.Combine(PkgsIntermediateDir, "shared-framework-formatted-distribution.xml");
string formattedDistContents =
distTemplate.Replace("{SharedFrameworkNugetVersion}", sharedFrameworkNugetVersion)
.Replace("{SharedFrameworkNugetName}", Monikers.SharedFrameworkName)
@ -63,7 +117,7 @@ namespace Microsoft.DotNet.Cli.Build
Cmd("productbuild",
"--version", version,
"--identifier", id,
"--package-path", packageIntermediatesPath,
"--package-path", PkgsIntermediateDir,
"--resources", resourcePath,
"--distribution", distributionPath,
outFilePath)
@ -79,10 +133,9 @@ namespace Microsoft.DotNet.Cli.Build
{
string sharedFrameworkNugetName = Monikers.SharedFrameworkName;
string sharedFrameworkNugetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
Directory.CreateDirectory(Path.Combine(Dirs.Output, "obj", "pkg"));
string version = c.BuildContext.Get<BuildVersion>("BuildVersion").SimpleVersion;
string id = $"com.microsoft.dotnet.sharedframework.{sharedFrameworkNugetName}.{sharedFrameworkNugetVersion}.component.osx.x64";
string outFilePath = Path.Combine(Dirs.Output, "obj", "pkg", id + ".pkg");
string outFilePath = Path.Combine(PkgsIntermediateDir, id + ".pkg");
string installLocation = "/usr/local/share/dotnet";
string scriptsLocation = Path.Combine(Dirs.RepoRoot, "packaging", "osx", "sharedframework", "scripts");
@ -103,10 +156,9 @@ namespace Microsoft.DotNet.Cli.Build
[BuildPlatforms(BuildPlatform.OSX)]
public static BuildTargetResult GenerateSharedHostPkg(BuildTargetContext c)
{
Directory.CreateDirectory(Path.Combine(Dirs.Output, "obj", "pkg"));
string version = c.BuildContext.Get<BuildVersion>("BuildVersion").SimpleVersion;
string id = $"com.microsoft.dotnet.sharedhost.osx.x64";
string outFilePath = Path.Combine(Dirs.Output, "obj", "pkg", id + ".pkg");
string outFilePath = Path.Combine(PkgsIntermediateDir, id + ".pkg");
string installLocation = "/usr/local/share/dotnet";
string scriptsLocation = Path.Combine(Dirs.RepoRoot, "packaging", "osx", "sharedhost", "scripts");