Fix Package targets to respect the new CLI SDK layout.
This commit is contained in:
parent
4d19e4d866
commit
5150bae60c
10 changed files with 100 additions and 291 deletions
|
@ -139,7 +139,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
{
|
{
|
||||||
CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "src"));
|
CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "src"));
|
||||||
CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "test"));
|
CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "test"));
|
||||||
|
|
||||||
if (Directory.Exists(Dirs.Stage1))
|
if (Directory.Exists(Dirs.Stage1))
|
||||||
{
|
{
|
||||||
Utils.DeleteDirectory(Dirs.Stage1);
|
Utils.DeleteDirectory(Dirs.Stage1);
|
||||||
|
@ -147,7 +147,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
Directory.CreateDirectory(Dirs.Stage1);
|
Directory.CreateDirectory(Dirs.Stage1);
|
||||||
|
|
||||||
CopySharedHost(Dirs.Stage1);
|
CopySharedHost(Dirs.Stage1);
|
||||||
PackageSharedFramework(c, Dirs.Stage1, DotNetCli.Stage0);
|
PublishSharedFramework(c, Dirs.Stage1, DotNetCli.Stage0);
|
||||||
return CompileCliSdk(c,
|
return CompileCliSdk(c,
|
||||||
dotnet: DotNetCli.Stage0,
|
dotnet: DotNetCli.Stage0,
|
||||||
outputDir: Dirs.Stage1);
|
outputDir: Dirs.Stage1);
|
||||||
|
@ -160,14 +160,14 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
|
|
||||||
CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "src"));
|
CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "src"));
|
||||||
CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "test"));
|
CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "test"));
|
||||||
|
|
||||||
if (Directory.Exists(Dirs.Stage2))
|
if (Directory.Exists(Dirs.Stage2))
|
||||||
{
|
{
|
||||||
Utils.DeleteDirectory(Dirs.Stage2);
|
Utils.DeleteDirectory(Dirs.Stage2);
|
||||||
}
|
}
|
||||||
Directory.CreateDirectory(Dirs.Stage2);
|
Directory.CreateDirectory(Dirs.Stage2);
|
||||||
|
|
||||||
PackageSharedFramework(c, Dirs.Stage2, DotNetCli.Stage1);
|
PublishSharedFramework(c, Dirs.Stage2, DotNetCli.Stage1);
|
||||||
CopySharedHost(Dirs.Stage2);
|
CopySharedHost(Dirs.Stage2);
|
||||||
var result = CompileCliSdk(c,
|
var result = CompileCliSdk(c,
|
||||||
dotnet: DotNetCli.Stage1,
|
dotnet: DotNetCli.Stage1,
|
||||||
|
@ -211,10 +211,10 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
Path.Combine(outputDir, DotnetHostFxrBaseName), true);
|
Path.Combine(outputDir, DotnetHostFxrBaseName), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void PackageSharedFramework(BuildTargetContext c, string outputDir, DotNetCli dotnetCli)
|
public static void PublishSharedFramework(BuildTargetContext c, string outputDir, DotNetCli dotnetCli)
|
||||||
{
|
{
|
||||||
string SharedFrameworkSourceRoot = Path.Combine(Dirs.RepoRoot, "src", "sharedframework", "framework");
|
string SharedFrameworkSourceRoot = Path.Combine(Dirs.RepoRoot, "src", "sharedframework", "framework");
|
||||||
string SharedFrameworkNugetVersion = GetVersionFromProjectJson(Path.Combine(Path.Combine(Dirs.RepoRoot, "src", "sharedframework", "framework"), "project.json"));
|
string SharedFrameworkNugetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
|
||||||
|
|
||||||
// We publish to a sub folder of the PublishRoot so tools like heat and zip can generate folder structures easier.
|
// We publish to a sub folder of the PublishRoot so tools like heat and zip can generate folder structures easier.
|
||||||
string SharedFrameworkNameAndVersionRoot = Path.Combine(outputDir, "shared", SharedFrameworkName, SharedFrameworkNugetVersion);
|
string SharedFrameworkNameAndVersionRoot = Path.Combine(outputDir, "shared", SharedFrameworkName, SharedFrameworkNugetVersion);
|
||||||
|
@ -303,23 +303,6 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
CrossgenSharedFx(c, SharedFrameworkNameAndVersionRoot);
|
CrossgenSharedFx(c, SharedFrameworkNameAndVersionRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new InvalidOperationException("Unable to match the version name from " + pathToProjectJson);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static BuildTargetResult CompileCliSdk(BuildTargetContext c, DotNetCli dotnet, string outputDir)
|
private static BuildTargetResult CompileCliSdk(BuildTargetContext c, DotNetCli dotnet, string outputDir)
|
||||||
{
|
{
|
||||||
var configuration = c.BuildContext.Get<string>("Configuration");
|
var configuration = c.BuildContext.Get<string>("Configuration");
|
||||||
|
@ -499,7 +482,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
c.Warn("Skipping crossgen for SharedFx because CROSSGEN_SHAREDFRAMEWORK is not set to 1");
|
c.Warn("Skipping crossgen for SharedFx because CROSSGEN_SHAREDFRAMEWORK is not set to 1");
|
||||||
return c.Success();
|
return c.Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var file in Directory.GetFiles(pathToAssemblies))
|
foreach (var file in Directory.GetFiles(pathToAssemblies))
|
||||||
{
|
{
|
||||||
string fileName = Path.GetFileName(file);
|
string fileName = Path.GetFileName(file);
|
||||||
|
|
|
@ -99,7 +99,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
|
|
||||||
Cmd(Path.Combine(Dirs.RepoRoot, "scripts", "package", "package-sharedframework-debian.sh"),
|
Cmd(Path.Combine(Dirs.RepoRoot, "scripts", "package", "package-sharedframework-debian.sh"),
|
||||||
"--input", inputRoot, "--output", debFile, "--package-name", packageName,
|
"--input", inputRoot, "--output", debFile, "--package-name", packageName,
|
||||||
"--framework-nuget-name", SharedFrameworkTargets.SharedFrameworkName,
|
"--framework-nuget-name", Monikers.SharedFrameworkName,
|
||||||
"--framework-nuget-version", c.BuildContext.Get<string>("SharedFrameworkNugetVersion"),
|
"--framework-nuget-version", c.BuildContext.Get<string>("SharedFrameworkNugetVersion"),
|
||||||
"--obj-root", objRoot, "--version", version)
|
"--obj-root", objRoot, "--version", version)
|
||||||
.Execute()
|
.Execute()
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
[BuildPlatforms(BuildPlatform.Windows)]
|
[BuildPlatforms(BuildPlatform.Windows)]
|
||||||
public static BuildTargetResult InitMsi(BuildTargetContext c)
|
public static BuildTargetResult InitMsi(BuildTargetContext c)
|
||||||
{
|
{
|
||||||
SdkBundle = c.BuildContext.Get<string>("SdkInstallerFile");
|
SdkBundle = c.BuildContext.Get<string>("CombinedFrameworkSDKHostInstallerFile");
|
||||||
SdkMsi = Path.ChangeExtension(SdkBundle, "msi");
|
SdkMsi = Path.ChangeExtension(SdkBundle, "msi");
|
||||||
Engine = Path.Combine(Path.GetDirectoryName(SdkBundle), ENGINE);
|
Engine = Path.Combine(Path.GetDirectoryName(SdkBundle), ENGINE);
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
public static BuildTargetResult GenerateDotnetSharedFrameworkMsi(BuildTargetContext c)
|
public static BuildTargetResult GenerateDotnetSharedFrameworkMsi(BuildTargetContext c)
|
||||||
{
|
{
|
||||||
var inputDir = c.BuildContext.Get<string>("SharedFrameworkPublishRoot");
|
var inputDir = c.BuildContext.Get<string>("SharedFrameworkPublishRoot");
|
||||||
var sharedFrameworkNuGetName = SharedFrameworkTargets.SharedFrameworkName;
|
var sharedFrameworkNuGetName = Monikers.SharedFrameworkName;
|
||||||
var sharedFrameworkNuGetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
|
var sharedFrameworkNuGetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
|
||||||
var upgradeCode = Utils.GenerateGuidFromName($"{sharedFrameworkNuGetName}-{sharedFrameworkNuGetVersion}-{Arch}").ToString().ToUpper();
|
var upgradeCode = Utils.GenerateGuidFromName($"{sharedFrameworkNuGetName}-{sharedFrameworkNuGetVersion}-{Arch}").ToString().ToUpper();
|
||||||
var wixObjRoot = Path.Combine(Dirs.Output, "obj", "wix", "sharedframework");
|
var wixObjRoot = Path.Combine(Dirs.Output, "obj", "wix", "sharedframework");
|
||||||
|
|
|
@ -13,8 +13,8 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
public static class PackageTargets
|
public static class PackageTargets
|
||||||
{
|
{
|
||||||
[Target(nameof(PackageTargets.CopyCLISDKLayout),
|
[Target(nameof(PackageTargets.CopyCLISDKLayout),
|
||||||
nameof(SharedFrameworkTargets.PublishSharedHost),
|
nameof(PackageTargets.CopySharedHostLayout),
|
||||||
nameof(SharedFrameworkTargets.PublishSharedFramework),
|
nameof(PackageTargets.CopySharedFxLayout),
|
||||||
nameof(PackageTargets.CopyCombinedFrameworkSDKHostLayout),
|
nameof(PackageTargets.CopyCombinedFrameworkSDKHostLayout),
|
||||||
nameof(PackageTargets.CopyCombinedFrameworkHostLayout))]
|
nameof(PackageTargets.CopyCombinedFrameworkHostLayout))]
|
||||||
public static BuildTargetResult InitPackage(BuildTargetContext c)
|
public static BuildTargetResult InitPackage(BuildTargetContext c)
|
||||||
|
@ -52,45 +52,62 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
[Target]
|
[Target]
|
||||||
public static BuildTargetResult CopyCLISDKLayout(BuildTargetContext c)
|
public static BuildTargetResult CopyCLISDKLayout(BuildTargetContext c)
|
||||||
{
|
{
|
||||||
var nugetVersion = c.BuildContext.Get<BuildVersion>("BuildVersion").NuGetVersion;
|
|
||||||
var cliSdkRoot = Path.Combine(Dirs.Output, "obj", "clisdk");
|
var cliSdkRoot = Path.Combine(Dirs.Output, "obj", "clisdk");
|
||||||
var cliSdk = Path.Combine(cliSdkRoot, "sdk", nugetVersion);
|
|
||||||
|
|
||||||
if (Directory.Exists(cliSdkRoot))
|
if (Directory.Exists(cliSdkRoot))
|
||||||
{
|
{
|
||||||
Utils.DeleteDirectory(cliSdkRoot);
|
Utils.DeleteDirectory(cliSdkRoot);
|
||||||
}
|
}
|
||||||
Directory.CreateDirectory(cliSdk);
|
|
||||||
|
|
||||||
var binPath = Path.Combine(Dirs.Stage2, "bin");
|
|
||||||
foreach (var file in Directory.GetFiles(binPath, "*", SearchOption.AllDirectories))
|
|
||||||
{
|
|
||||||
string destFile = file.Replace(binPath, cliSdk);
|
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(destFile));
|
|
||||||
File.Copy(file, destFile, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
File.Copy(Path.Combine(Dirs.Stage2, ".version"), Path.Combine(cliSdk, ".version"), true);
|
|
||||||
|
|
||||||
// copy stage2 to "cliSdkRoot\bin".
|
|
||||||
// this is a temp hack until we fix the build scripts to use the new shared fx and shared host
|
|
||||||
// the current build scripts need the CLI sdk to be in the bin folder.
|
|
||||||
|
|
||||||
foreach (var file in Directory.GetFiles(Dirs.Stage2, "*", SearchOption.AllDirectories))
|
|
||||||
{
|
|
||||||
string destFile = file.Replace(Dirs.Stage2, cliSdkRoot);
|
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(destFile));
|
|
||||||
File.Copy(file, destFile, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Directory.CreateDirectory(cliSdkRoot);
|
||||||
|
Utils.CopyDirectoryRecursively(Path.Combine(Dirs.Stage2, "sdk"), cliSdkRoot, true);
|
||||||
c.BuildContext["CLISDKRoot"] = cliSdkRoot;
|
c.BuildContext["CLISDKRoot"] = cliSdkRoot;
|
||||||
return c.Success();
|
return c.Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Target]
|
||||||
|
public static BuildTargetResult CopySharedHostLayout(BuildTargetContext c)
|
||||||
|
{
|
||||||
|
var sharedHostRoot = Path.Combine(Dirs.Output, "obj", "sharedHost");
|
||||||
|
if (Directory.Exists(sharedHostRoot))
|
||||||
|
{
|
||||||
|
Utils.DeleteDirectory(sharedHostRoot);
|
||||||
|
}
|
||||||
|
|
||||||
|
Directory.CreateDirectory(sharedHostRoot);
|
||||||
|
|
||||||
|
foreach (var file in Directory.GetFiles(Dirs.Stage2, "*", SearchOption.TopDirectoryOnly))
|
||||||
|
{
|
||||||
|
var destFile = file.Replace(Dirs.Stage2, sharedHostRoot);
|
||||||
|
File.Copy(file, destFile, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
c.BuildContext["SharedHostPublishRoot"] = sharedHostRoot;
|
||||||
|
return c.Success();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Target]
|
||||||
|
public static BuildTargetResult CopySharedFxLayout(BuildTargetContext c)
|
||||||
|
{
|
||||||
|
var sharedFxRoot = Path.Combine(Dirs.Output, "obj", "sharedFx");
|
||||||
|
if (Directory.Exists(sharedFxRoot))
|
||||||
|
{
|
||||||
|
Utils.DeleteDirectory(sharedFxRoot);
|
||||||
|
}
|
||||||
|
|
||||||
|
Directory.CreateDirectory(sharedFxRoot);
|
||||||
|
Utils.CopyDirectoryRecursively(Path.Combine(Dirs.Stage2, "shared"), sharedFxRoot, true);
|
||||||
|
c.BuildContext["SharedFrameworkPublishRoot"] = sharedFxRoot;
|
||||||
|
return c.Success();
|
||||||
|
}
|
||||||
|
|
||||||
[Target]
|
[Target]
|
||||||
public static BuildTargetResult CopyCombinedFrameworkSDKHostLayout(BuildTargetContext c)
|
public static BuildTargetResult CopyCombinedFrameworkSDKHostLayout(BuildTargetContext c)
|
||||||
{
|
{
|
||||||
var combinedRoot = Path.Combine(Dirs.Output, "obj", "combined-framework-sdk-host");
|
var combinedRoot = Path.Combine(Dirs.Output, "obj", "combined-framework-sdk-host");
|
||||||
|
if (Directory.Exists(combinedRoot))
|
||||||
|
{
|
||||||
|
Utils.DeleteDirectory(combinedRoot);
|
||||||
|
}
|
||||||
|
|
||||||
string sdkPublishRoot = c.BuildContext.Get<string>("CLISDKRoot");
|
string sdkPublishRoot = c.BuildContext.Get<string>("CLISDKRoot");
|
||||||
Utils.CopyDirectoryRecursively(sdkPublishRoot, combinedRoot);
|
Utils.CopyDirectoryRecursively(sdkPublishRoot, combinedRoot);
|
||||||
|
@ -109,6 +126,11 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
public static BuildTargetResult CopyCombinedFrameworkHostLayout(BuildTargetContext c)
|
public static BuildTargetResult CopyCombinedFrameworkHostLayout(BuildTargetContext c)
|
||||||
{
|
{
|
||||||
var combinedRoot = Path.Combine(Dirs.Output, "obj", "combined-framework-host");
|
var combinedRoot = Path.Combine(Dirs.Output, "obj", "combined-framework-host");
|
||||||
|
if (Directory.Exists(combinedRoot))
|
||||||
|
{
|
||||||
|
Utils.DeleteDirectory(combinedRoot);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
string sharedFrameworkPublishRoot = c.BuildContext.Get<string>("SharedFrameworkPublishRoot");
|
string sharedFrameworkPublishRoot = c.BuildContext.Get<string>("SharedFrameworkPublishRoot");
|
||||||
Utils.CopyDirectoryRecursively(sharedFrameworkPublishRoot, combinedRoot);
|
Utils.CopyDirectoryRecursively(sharedFrameworkPublishRoot, combinedRoot);
|
||||||
|
@ -130,9 +152,6 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
[BuildPlatforms(BuildPlatform.Windows)]
|
[BuildPlatforms(BuildPlatform.Windows)]
|
||||||
public static BuildTargetResult GenerateZip(BuildTargetContext c)
|
public static BuildTargetResult GenerateZip(BuildTargetContext c)
|
||||||
{
|
{
|
||||||
CreateZipFromDirectory(c.BuildContext.Get<string>("SharedHostPublishRoot"), c.BuildContext.Get<string>("SharedHostCompressedFile"));
|
|
||||||
CreateZipFromDirectory(c.BuildContext.Get<string>("SharedFrameworkPublishRoot"), c.BuildContext.Get<string>("SharedFrameworkCompressedFile"));
|
|
||||||
CreateZipFromDirectory(c.BuildContext.Get<string>("CLISDKRoot"), c.BuildContext.Get<string>("SdkCompressedFile"));
|
|
||||||
CreateZipFromDirectory(c.BuildContext.Get<string>("CombinedFrameworkSDKHostRoot"), c.BuildContext.Get<string>("CombinedFrameworkSDKHostCompressedFile"));
|
CreateZipFromDirectory(c.BuildContext.Get<string>("CombinedFrameworkSDKHostRoot"), c.BuildContext.Get<string>("CombinedFrameworkSDKHostCompressedFile"));
|
||||||
CreateZipFromDirectory(c.BuildContext.Get<string>("CombinedFrameworkHostRoot"), c.BuildContext.Get<string>("CombinedFrameworkHostCompressedFile"));
|
CreateZipFromDirectory(c.BuildContext.Get<string>("CombinedFrameworkHostRoot"), c.BuildContext.Get<string>("CombinedFrameworkHostCompressedFile"));
|
||||||
|
|
||||||
|
@ -143,9 +162,6 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
[BuildPlatforms(BuildPlatform.Unix)]
|
[BuildPlatforms(BuildPlatform.Unix)]
|
||||||
public static BuildTargetResult GenerateTarBall(BuildTargetContext c)
|
public static BuildTargetResult GenerateTarBall(BuildTargetContext c)
|
||||||
{
|
{
|
||||||
CreateTarBallFromDirectory(c.BuildContext.Get<string>("SharedHostPublishRoot"), c.BuildContext.Get<string>("SharedHostCompressedFile"));
|
|
||||||
CreateTarBallFromDirectory(c.BuildContext.Get<string>("SharedFrameworkPublishRoot"), c.BuildContext.Get<string>("SharedFrameworkCompressedFile"));
|
|
||||||
CreateTarBallFromDirectory(c.BuildContext.Get<string>("CLISDKRoot"), c.BuildContext.Get<string>("SdkCompressedFile"));
|
|
||||||
CreateTarBallFromDirectory(c.BuildContext.Get<string>("CombinedFrameworkSDKHostRoot"), c.BuildContext.Get<string>("CombinedFrameworkSDKHostCompressedFile"));
|
CreateTarBallFromDirectory(c.BuildContext.Get<string>("CombinedFrameworkSDKHostRoot"), c.BuildContext.Get<string>("CombinedFrameworkSDKHostCompressedFile"));
|
||||||
CreateTarBallFromDirectory(c.BuildContext.Get<string>("CombinedFrameworkHostRoot"), c.BuildContext.Get<string>("CombinedFrameworkHostCompressedFile"));
|
CreateTarBallFromDirectory(c.BuildContext.Get<string>("CombinedFrameworkHostRoot"), c.BuildContext.Get<string>("CombinedFrameworkHostCompressedFile"));
|
||||||
|
|
||||||
|
@ -159,7 +175,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
var versionSuffix = c.BuildContext.Get<BuildVersion>("BuildVersion").VersionSuffix;
|
var versionSuffix = c.BuildContext.Get<BuildVersion>("BuildVersion").VersionSuffix;
|
||||||
var env = GetCommonEnvVars(c);
|
var env = GetCommonEnvVars(c);
|
||||||
Cmd("powershell", "-NoProfile", "-NoLogo",
|
Cmd("powershell", "-NoProfile", "-NoLogo",
|
||||||
Path.Combine(Dirs.RepoRoot, "packaging", "nuget", "package.ps1"), Path.Combine(Dirs.Stage2, "bin"), versionSuffix)
|
Path.Combine(Dirs.RepoRoot, "packaging", "nuget", "package.ps1"), Dirs.Stage2, versionSuffix)
|
||||||
.Environment(env)
|
.Environment(env)
|
||||||
.Execute()
|
.Execute()
|
||||||
.EnsureSuccessful();
|
.EnsureSuccessful();
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
[BuildPlatforms(BuildPlatform.OSX)]
|
[BuildPlatforms(BuildPlatform.OSX)]
|
||||||
public static BuildTargetResult GenerateSharedFrameworkProductArchive(BuildTargetContext c)
|
public static BuildTargetResult GenerateSharedFrameworkProductArchive(BuildTargetContext c)
|
||||||
{
|
{
|
||||||
string sharedFrameworkNugetName = SharedFrameworkTargets.SharedFrameworkName;
|
string sharedFrameworkNugetName = Monikers.SharedFrameworkName;
|
||||||
string sharedFrameworkNugetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
|
string sharedFrameworkNugetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
|
||||||
string version = c.BuildContext.Get<BuildVersion>("BuildVersion").SimpleVersion;
|
string version = c.BuildContext.Get<BuildVersion>("BuildVersion").SimpleVersion;
|
||||||
string id = $"com.microsoft.dotnet.sharedframework.{sharedFrameworkNugetName}.{sharedFrameworkNugetVersion}.osx.x64";
|
string id = $"com.microsoft.dotnet.sharedframework.{sharedFrameworkNugetName}.{sharedFrameworkNugetVersion}.osx.x64";
|
||||||
|
@ -53,9 +53,9 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
"shared-framework-distribution-template.xml");
|
"shared-framework-distribution-template.xml");
|
||||||
string distTemplate = File.ReadAllText(inputDistTemplatePath);
|
string distTemplate = File.ReadAllText(inputDistTemplatePath);
|
||||||
string distributionPath = Path.Combine(packageIntermediatesPath, "shared-framework-formatted-distribution.xml");
|
string distributionPath = Path.Combine(packageIntermediatesPath, "shared-framework-formatted-distribution.xml");
|
||||||
string formattedDistContents =
|
string formattedDistContents =
|
||||||
distTemplate.Replace("{SharedFrameworkNugetVersion}", sharedFrameworkNugetVersion)
|
distTemplate.Replace("{SharedFrameworkNugetVersion}", sharedFrameworkNugetVersion)
|
||||||
.Replace("{SharedFrameworkNugetName}", SharedFrameworkTargets.SharedFrameworkName)
|
.Replace("{SharedFrameworkNugetName}", Monikers.SharedFrameworkName)
|
||||||
.Replace("{VERSION}", version);
|
.Replace("{VERSION}", version);
|
||||||
File.WriteAllText(distributionPath, formattedDistContents);
|
File.WriteAllText(distributionPath, formattedDistContents);
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
"--version", version,
|
"--version", version,
|
||||||
"--identifier", id,
|
"--identifier", id,
|
||||||
"--package-path", packageIntermediatesPath,
|
"--package-path", packageIntermediatesPath,
|
||||||
"--resources", resourcePath,
|
"--resources", resourcePath,
|
||||||
"--distribution", distributionPath,
|
"--distribution", distributionPath,
|
||||||
outFilePath)
|
outFilePath)
|
||||||
.Execute()
|
.Execute()
|
||||||
|
@ -76,7 +76,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
[BuildPlatforms(BuildPlatform.OSX)]
|
[BuildPlatforms(BuildPlatform.OSX)]
|
||||||
public static BuildTargetResult GenerateSharedFrameworkPkg(BuildTargetContext c)
|
public static BuildTargetResult GenerateSharedFrameworkPkg(BuildTargetContext c)
|
||||||
{
|
{
|
||||||
string sharedFrameworkNugetName = SharedFrameworkTargets.SharedFrameworkName;
|
string sharedFrameworkNugetName = Monikers.SharedFrameworkName;
|
||||||
string sharedFrameworkNugetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
|
string sharedFrameworkNugetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
|
||||||
Directory.CreateDirectory(Path.Combine(Dirs.Output, "obj", "pkg"));
|
Directory.CreateDirectory(Path.Combine(Dirs.Output, "obj", "pkg"));
|
||||||
string version = c.BuildContext.Get<BuildVersion>("BuildVersion").SimpleVersion;
|
string version = c.BuildContext.Get<BuildVersion>("BuildVersion").SimpleVersion;
|
||||||
|
|
|
@ -10,6 +10,7 @@ using System.Text;
|
||||||
using static Microsoft.DotNet.Cli.Build.FS;
|
using static Microsoft.DotNet.Cli.Build.FS;
|
||||||
using static Microsoft.DotNet.Cli.Build.Utils;
|
using static Microsoft.DotNet.Cli.Build.Utils;
|
||||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Cli.Build
|
namespace Microsoft.DotNet.Cli.Build
|
||||||
{
|
{
|
||||||
|
@ -45,6 +46,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
|
|
||||||
c.BuildContext["Configuration"] = configEnv;
|
c.BuildContext["Configuration"] = configEnv;
|
||||||
c.BuildContext["Channel"] = Environment.GetEnvironmentVariable("CHANNEL");
|
c.BuildContext["Channel"] = Environment.GetEnvironmentVariable("CHANNEL");
|
||||||
|
c.BuildContext["SharedFrameworkNugetVersion"] = GetVersionFromProjectJson(Path.Combine(Dirs.RepoRoot, "src", "sharedframework", "framework", "project.json"));
|
||||||
|
|
||||||
c.Info($"Building {c.BuildContext["Configuration"]} to: {Dirs.Output}");
|
c.Info($"Building {c.BuildContext["Configuration"]} to: {Dirs.Output}");
|
||||||
c.Info("Build Environment:");
|
c.Info("Build Environment:");
|
||||||
|
@ -112,11 +114,11 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
var versionBadgeName = $"{CurrentPlatform.Current}_{CurrentArchitecture.Current}_{config}_version_badge.svg";
|
var versionBadgeName = $"{CurrentPlatform.Current}_{CurrentArchitecture.Current}_{config}_version_badge.svg";
|
||||||
c.BuildContext["VersionBadge"] = Path.Combine(Dirs.Output, versionBadgeName);
|
c.BuildContext["VersionBadge"] = Path.Combine(Dirs.Output, versionBadgeName);
|
||||||
|
|
||||||
AddInstallerArtifactToContext(c, "dotnet", "Sdk");
|
AddInstallerArtifactToContext(c, "dotnet-sdk", "Sdk");
|
||||||
AddInstallerArtifactToContext(c, "dotnet-host", "SharedHost");
|
AddInstallerArtifactToContext(c, "dotnet-host", "SharedHost");
|
||||||
AddInstallerArtifactToContext(c, "dotnet-sharedframework", "SharedFramework");
|
AddInstallerArtifactToContext(c, "dotnet-sharedframework", "SharedFramework");
|
||||||
AddInstallerArtifactToContext(c, "dotnet-combined-framework-sdk-host", "CombinedFrameworkSDKHost");
|
AddInstallerArtifactToContext(c, "dotnet-dev", "CombinedFrameworkSDKHost");
|
||||||
AddInstallerArtifactToContext(c, "dotnet-combined-framework-host", "CombinedFrameworkHost");
|
AddInstallerArtifactToContext(c, "dotnet", "CombinedFrameworkHost");
|
||||||
|
|
||||||
return c.Success();
|
return c.Success();
|
||||||
}
|
}
|
||||||
|
@ -315,6 +317,23 @@ cmake is required to build the native host 'corehost'";
|
||||||
return c.Success();
|
return c.Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string GetVersionFromProjectJson(string pathToProjectJson)
|
||||||
|
{
|
||||||
|
Regex r = new Regex($"\"{Regex.Escape(Monikers.SharedFrameworkName)}\"\\s*:\\s*\"(?'version'[^\"]*)\"");
|
||||||
|
|
||||||
|
foreach (var line in File.ReadAllLines(pathToProjectJson))
|
||||||
|
{
|
||||||
|
var m = r.Match(line);
|
||||||
|
|
||||||
|
if (m.Success)
|
||||||
|
{
|
||||||
|
return m.Groups["version"].Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new InvalidOperationException("Unable to match the version name from " + pathToProjectJson);
|
||||||
|
}
|
||||||
|
|
||||||
private static bool AptPackageIsInstalled(string packageName)
|
private static bool AptPackageIsInstalled(string packageName)
|
||||||
{
|
{
|
||||||
var result = Command.Create("dpkg", "-s", packageName)
|
var result = Command.Create("dpkg", "-s", packageName)
|
||||||
|
|
|
@ -1,218 +0,0 @@
|
||||||
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;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Cli.Build
|
|
||||||
{
|
|
||||||
public class SharedFrameworkTargets
|
|
||||||
{
|
|
||||||
public const string SharedFrameworkName = "Microsoft.NETCore.App";
|
|
||||||
|
|
||||||
private const string CoreHostBaseName = "corehost";
|
|
||||||
private const string DotnetHostFxrBaseName = "hostfxr";
|
|
||||||
private const string HostPolicyBaseName = "hostpolicy";
|
|
||||||
|
|
||||||
[Target(nameof(PackageSharedFramework), nameof(CrossGenAllManagedAssemblies))]
|
|
||||||
public static BuildTargetResult PublishSharedFramework(BuildTargetContext c)
|
|
||||||
{
|
|
||||||
return c.Success();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Target]
|
|
||||||
public static BuildTargetResult PackageSharedFramework(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))
|
|
||||||
{
|
|
||||||
Utils.DeleteDirectory(SharedFrameworkPublishRoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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);
|
|
||||||
|
|
||||||
string publishFramework = "dnxcore50"; // Temporary, use "netcoreapp" when we update nuget.
|
|
||||||
string publishRuntime;
|
|
||||||
if (PlatformServices.Default.Runtime.OperatingSystemPlatform == Platform.Windows)
|
|
||||||
{
|
|
||||||
publishRuntime = $"win7-{PlatformServices.Default.Runtime.RuntimeArchitecture}";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
publishRuntime = PlatformServices.Default.Runtime.GetRuntimeIdentifier();
|
|
||||||
}
|
|
||||||
|
|
||||||
DotNetCli.Stage2.Publish(
|
|
||||||
"--output", SharedFrameworkNameAndVersionRoot,
|
|
||||||
"-r", publishRuntime,
|
|
||||||
"-f", publishFramework,
|
|
||||||
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"));
|
|
||||||
File.Delete(Path.Combine(SharedFrameworkNameAndVersionRoot, "framework.runtimeconfig.json"));
|
|
||||||
|
|
||||||
// Rename the .deps file
|
|
||||||
var destinationDeps = Path.Combine(SharedFrameworkNameAndVersionRoot, $"{SharedFrameworkName}.deps.json");
|
|
||||||
File.Move(Path.Combine(SharedFrameworkNameAndVersionRoot, "framework.deps"), Path.Combine(SharedFrameworkNameAndVersionRoot, $"{SharedFrameworkName}.deps"));
|
|
||||||
File.Move(Path.Combine(SharedFrameworkNameAndVersionRoot, "framework.deps.json"), destinationDeps);
|
|
||||||
|
|
||||||
// Generate RID fallback graph
|
|
||||||
string runtimeGraphGeneratorRuntime = null;
|
|
||||||
switch (PlatformServices.Default.Runtime.OperatingSystemPlatform)
|
|
||||||
{
|
|
||||||
case Platform.Windows:
|
|
||||||
runtimeGraphGeneratorRuntime = "win";
|
|
||||||
break;
|
|
||||||
case Platform.Linux:
|
|
||||||
runtimeGraphGeneratorRuntime = "linux";
|
|
||||||
break;
|
|
||||||
case Platform.Darwin:
|
|
||||||
runtimeGraphGeneratorRuntime = "osx";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!string.IsNullOrEmpty(runtimeGraphGeneratorRuntime))
|
|
||||||
{
|
|
||||||
var runtimeGraphGeneratorName = "RuntimeGraphGenerator";
|
|
||||||
var runtimeGraphGeneratorProject = Path.Combine(c.BuildContext.BuildDirectory, "tools", runtimeGraphGeneratorName);
|
|
||||||
var runtimeGraphGeneratorOutput = Path.Combine(Dirs.Output, "tools", runtimeGraphGeneratorName);
|
|
||||||
|
|
||||||
DotNetCli.Stage2.Publish(
|
|
||||||
"--output", runtimeGraphGeneratorOutput,
|
|
||||||
runtimeGraphGeneratorProject).Execute().EnsureSuccessful();
|
|
||||||
var runtimeGraphGeneratorExe = Path.Combine(runtimeGraphGeneratorOutput, $"{runtimeGraphGeneratorName}{Constants.ExeSuffix}");
|
|
||||||
|
|
||||||
Cmd(runtimeGraphGeneratorExe, "--project", SharedFrameworkSourceRoot, "--deps", destinationDeps, runtimeGraphGeneratorRuntime)
|
|
||||||
.Execute();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
c.Error($"Could not determine rid graph generation runtime for platform {PlatformServices.Default.Runtime.OperatingSystemPlatform}");
|
|
||||||
}
|
|
||||||
|
|
||||||
// corehost will be renamed to dotnet at some point and then we will not need to rename it here.
|
|
||||||
File.Copy(
|
|
||||||
Path.Combine(Dirs.Corehost, $"{CoreHostBaseName}{Constants.ExeSuffix}"),
|
|
||||||
Path.Combine(SharedFrameworkNameAndVersionRoot, $"dotnet{Constants.ExeSuffix}"));
|
|
||||||
File.Copy(
|
|
||||||
Path.Combine(Dirs.Corehost, $"{Constants.DynamicLibPrefix}{HostPolicyBaseName}{Constants.DynamicLibSuffix}"),
|
|
||||||
Path.Combine(SharedFrameworkNameAndVersionRoot, $"{Constants.DynamicLibPrefix}{HostPolicyBaseName}{Constants.DynamicLibSuffix}"), true);
|
|
||||||
|
|
||||||
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"));
|
|
||||||
c.BuildContext["SharedFrameworkNameAndVersionRoot"] = SharedFrameworkNameAndVersionRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
return c.Success();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Target]
|
|
||||||
public static BuildTargetResult PublishSharedHost(BuildTargetContext c)
|
|
||||||
{
|
|
||||||
string SharedHostPublishRoot = Path.Combine(Dirs.Output, "obj", "sharedhost");
|
|
||||||
|
|
||||||
if (Directory.Exists(SharedHostPublishRoot))
|
|
||||||
{
|
|
||||||
Utils.DeleteDirectory(SharedHostPublishRoot);
|
|
||||||
}
|
|
||||||
Directory.CreateDirectory(SharedHostPublishRoot);
|
|
||||||
|
|
||||||
// corehost will be renamed to dotnet at some point and then this can be removed.
|
|
||||||
File.Copy(
|
|
||||||
Path.Combine(Dirs.Corehost, $"{CoreHostBaseName}{Constants.ExeSuffix}"),
|
|
||||||
Path.Combine(SharedHostPublishRoot, $"dotnet{Constants.ExeSuffix}"));
|
|
||||||
File.Copy(
|
|
||||||
Path.Combine(Dirs.Corehost, $"{Constants.DynamicLibPrefix}{DotnetHostFxrBaseName}{Constants.DynamicLibSuffix}"),
|
|
||||||
Path.Combine(SharedHostPublishRoot, $"{Constants.DynamicLibPrefix}{DotnetHostFxrBaseName}{Constants.DynamicLibSuffix}"));
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new InvalidOperationException("Unable to match the version name from " + pathToProjectJson);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Target]
|
|
||||||
[Environment("CROSSGEN_SHAREDFRAMEWORK", "1", "true")]
|
|
||||||
public static BuildTargetResult CrossGenAllManagedAssemblies(BuildTargetContext c)
|
|
||||||
{
|
|
||||||
string pathToAssemblies = c.BuildContext.Get<string>("SharedFrameworkNameAndVersionRoot");
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
return c.Success();
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -8,6 +8,8 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
{
|
{
|
||||||
public class Monikers
|
public class Monikers
|
||||||
{
|
{
|
||||||
|
public const string SharedFrameworkName = "Microsoft.NETCore.App";
|
||||||
|
|
||||||
public static string GetProductMoniker(BuildTargetContext c, string artifactPrefix)
|
public static string GetProductMoniker(BuildTargetContext c, string artifactPrefix)
|
||||||
{
|
{
|
||||||
string osname = GetOSShortName();
|
string osname = GetOSShortName();
|
||||||
|
@ -31,7 +33,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
case "rtm":
|
case "rtm":
|
||||||
packageName = "dotnet";
|
packageName = "dotnet";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Exception($"Unknown channel - {channel}");
|
throw new Exception($"Unknown channel - {channel}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +44,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
{
|
{
|
||||||
var sharedFrameworkNugetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
|
var sharedFrameworkNugetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
|
||||||
|
|
||||||
return $"dotnet-sharedframework-{SharedFrameworkTargets.SharedFrameworkName}-{sharedFrameworkNugetVersion}".ToLower();
|
return $"dotnet-sharedframework-{SharedFrameworkName}-{sharedFrameworkNugetVersion}".ToLower();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetOSShortName()
|
public static string GetOSShortName()
|
||||||
|
|
|
@ -101,8 +101,15 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CopyDirectoryRecursively(string path, string destination)
|
public static void CopyDirectoryRecursively(string path, string destination, bool keepParentDir = false)
|
||||||
{
|
{
|
||||||
|
if (keepParentDir)
|
||||||
|
{
|
||||||
|
path = path.TrimEnd(Path.DirectorySeparatorChar);
|
||||||
|
destination = Path.Combine(destination, Path.GetFileName(path));
|
||||||
|
Directory.CreateDirectory(destination);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var file in Directory.GetFiles(path, "*", SearchOption.AllDirectories))
|
foreach (var file in Directory.GetFiles(path, "*", SearchOption.AllDirectories))
|
||||||
{
|
{
|
||||||
string destFile = file.Replace(path, destination);
|
string destFile = file.Replace(path, destination);
|
||||||
|
|
|
@ -38,7 +38,7 @@ $testName = "Microsoft.DotNet.Cli.Msi.Tests"
|
||||||
$testDir="$PSScriptRoot\$testName"
|
$testDir="$PSScriptRoot\$testName"
|
||||||
$testBin="$RepoRoot\artifacts\tests\$testName"
|
$testBin="$RepoRoot\artifacts\tests\$testName"
|
||||||
|
|
||||||
pushd "$Stage2Dir\bin"
|
pushd "$Stage2Dir"
|
||||||
|
|
||||||
try {
|
try {
|
||||||
.\dotnet restore `
|
.\dotnet restore `
|
||||||
|
|
Loading…
Reference in a new issue