2016-02-15 18:07:39 +00:00
|
|
|
|
using System;
|
2016-02-02 18:04:50 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
2016-04-02 04:52:08 +00:00
|
|
|
|
using System.Linq;
|
2016-02-02 18:04:50 +00:00
|
|
|
|
using System.Runtime.InteropServices;
|
2016-04-28 23:30:32 +00:00
|
|
|
|
using System.Text;
|
2016-02-15 18:07:39 +00:00
|
|
|
|
using Microsoft.DotNet.Cli.Build.Framework;
|
2016-04-28 23:30:32 +00:00
|
|
|
|
using Microsoft.DotNet.InternalAbstractions;
|
2016-04-02 04:52:08 +00:00
|
|
|
|
using Newtonsoft.Json;
|
2016-04-28 23:30:32 +00:00
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
|
|
|
|
using static Microsoft.DotNet.Cli.Build.FS;
|
2016-02-02 18:04:50 +00:00
|
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Cli.Build
|
|
|
|
|
{
|
|
|
|
|
public class CompileTargets
|
|
|
|
|
{
|
2016-02-27 00:00:54 +00:00
|
|
|
|
public static readonly bool IsWinx86 = CurrentPlatform.IsWindows && CurrentArchitecture.Isx86;
|
2016-02-02 18:04:50 +00:00
|
|
|
|
|
|
|
|
|
public static readonly string[] BinariesForCoreHost = new[]
|
|
|
|
|
{
|
2016-03-23 19:46:38 +00:00
|
|
|
|
"csc"
|
2016-02-02 18:04:50 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public static readonly string[] ProjectsToPublish = new[]
|
|
|
|
|
{
|
|
|
|
|
"dotnet"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public static readonly string[] FilesToClean = new[]
|
|
|
|
|
{
|
2016-03-23 19:46:38 +00:00
|
|
|
|
"vbc.exe"
|
2016-02-02 18:04:50 +00:00
|
|
|
|
};
|
|
|
|
|
|
2016-04-22 02:18:05 +00:00
|
|
|
|
public static string HostPackagePlatformRid => HostPackageSupportedRids[
|
2016-04-28 23:30:32 +00:00
|
|
|
|
(RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows)
|
|
|
|
|
? $"win7-{RuntimeEnvironment.RuntimeArchitecture}"
|
|
|
|
|
: RuntimeEnvironment.GetRuntimeIdentifier()];
|
2016-04-13 00:29:07 +00:00
|
|
|
|
|
2016-04-22 02:18:05 +00:00
|
|
|
|
public static readonly Dictionary<string, string> HostPackageSupportedRids = new Dictionary<string, string>()
|
2016-04-13 00:29:07 +00:00
|
|
|
|
{
|
2016-04-22 02:18:05 +00:00
|
|
|
|
// Key: Current platform RID. Value: The actual publishable (non-dummy) package name produced by the build system for this RID.
|
|
|
|
|
{ "win7-x64", "win7-x64" },
|
|
|
|
|
{ "win7-x86", "win7-x86" },
|
|
|
|
|
{ "osx.10.10-x64", "osx.10.10-x64" },
|
|
|
|
|
{ "osx.10.11-x64", "osx.10.10-x64" },
|
|
|
|
|
{ "ubuntu.14.04-x64", "ubuntu.14.04-x64" },
|
|
|
|
|
{ "centos.7-x64", "rhel.7-x64" },
|
|
|
|
|
{ "rhel.7-x64", "rhel.7-x64" },
|
|
|
|
|
{ "rhel.7.2-x64", "rhel.7-x64" },
|
|
|
|
|
{ "debian.8-x64", "debian.8-x64" }
|
2016-04-13 00:29:07 +00:00
|
|
|
|
};
|
|
|
|
|
|
2016-03-16 22:54:02 +00:00
|
|
|
|
public const string SharedFrameworkName = "Microsoft.NETCore.App";
|
|
|
|
|
|
2016-05-16 22:30:53 +00:00
|
|
|
|
public static Crossgen CrossgenUtil = new Crossgen(DependencyVersions.CoreCLRVersion);
|
2016-03-16 22:54:02 +00:00
|
|
|
|
|
2016-03-02 01:42:44 +00:00
|
|
|
|
// Updates the stage 2 with recent changes.
|
|
|
|
|
[Target(nameof(PrepareTargets.Init), nameof(CompileStage2))]
|
|
|
|
|
public static BuildTargetResult UpdateBuild(BuildTargetContext c)
|
|
|
|
|
{
|
|
|
|
|
return c.Success();
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-16 22:30:53 +00:00
|
|
|
|
[Target(nameof(PrepareTargets.Init), nameof(CompileStage1), nameof(CompileStage2))]
|
2016-02-02 18:04:50 +00:00
|
|
|
|
public static BuildTargetResult Compile(BuildTargetContext c)
|
|
|
|
|
{
|
|
|
|
|
return c.Success();
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-22 22:01:56 +00:00
|
|
|
|
[Target(nameof(PrepareTargets.Init))]
|
2016-02-02 18:04:50 +00:00
|
|
|
|
public static BuildTargetResult CompileStage1(BuildTargetContext c)
|
|
|
|
|
{
|
|
|
|
|
CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "src"));
|
2016-03-17 00:54:44 +00:00
|
|
|
|
|
2016-03-16 22:54:02 +00:00
|
|
|
|
if (Directory.Exists(Dirs.Stage1))
|
|
|
|
|
{
|
|
|
|
|
Utils.DeleteDirectory(Dirs.Stage1);
|
|
|
|
|
}
|
|
|
|
|
Directory.CreateDirectory(Dirs.Stage1);
|
|
|
|
|
|
2016-03-23 19:46:38 +00:00
|
|
|
|
var result = CompileCliSdk(c,
|
2016-02-02 18:04:50 +00:00
|
|
|
|
dotnet: DotNetCli.Stage0,
|
2016-05-16 22:30:53 +00:00
|
|
|
|
rootOutputDirectory: Dirs.Stage1);
|
2016-03-23 19:46:38 +00:00
|
|
|
|
|
|
|
|
|
CleanOutputDir(Path.Combine(Dirs.Stage1, "sdk"));
|
2016-04-05 03:13:13 +00:00
|
|
|
|
FS.CopyRecursive(Dirs.Stage1, Dirs.Stage1Symbols);
|
|
|
|
|
|
|
|
|
|
RemovePdbsFromDir(Path.Combine(Dirs.Stage1, "sdk"));
|
2016-03-23 19:46:38 +00:00
|
|
|
|
|
|
|
|
|
return result;
|
2016-02-02 18:04:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-22 22:01:56 +00:00
|
|
|
|
[Target(nameof(PrepareTargets.Init))]
|
2016-02-02 18:04:50 +00:00
|
|
|
|
public static BuildTargetResult CompileStage2(BuildTargetContext c)
|
|
|
|
|
{
|
2016-02-15 18:07:39 +00:00
|
|
|
|
var configuration = c.BuildContext.Get<string>("Configuration");
|
2016-02-02 18:04:50 +00:00
|
|
|
|
|
|
|
|
|
CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "src"));
|
2016-03-17 00:54:44 +00:00
|
|
|
|
|
2016-03-16 22:54:02 +00:00
|
|
|
|
if (Directory.Exists(Dirs.Stage2))
|
|
|
|
|
{
|
|
|
|
|
Utils.DeleteDirectory(Dirs.Stage2);
|
|
|
|
|
}
|
|
|
|
|
Directory.CreateDirectory(Dirs.Stage2);
|
|
|
|
|
|
|
|
|
|
var result = CompileCliSdk(c,
|
2016-02-02 18:04:50 +00:00
|
|
|
|
dotnet: DotNetCli.Stage1,
|
2016-05-16 22:30:53 +00:00
|
|
|
|
rootOutputDirectory: Dirs.Stage2);
|
2016-02-15 17:42:17 +00:00
|
|
|
|
|
2016-02-02 18:04:50 +00:00
|
|
|
|
if (!result.Success)
|
|
|
|
|
{
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
Extract dotnet-compile-fsc into a standalone command
Add basic Tests for dotnet-compile-fsc
Package Targets execute before TestTargets. Use Generated Nuget Packages in TestTargets. Generate Nuget packages on all platforms, and in C#
Fix bug in dotnet-restore, change fsharp new template, add support for native assets in DependencyContextCsvReader
copy fsc.exe to temp directory instead of package cache
fix rebase error
fix issue
fixes
fixes
fix
temporarily disable debian package e2e testing
fixes
bump fsc version
update fsc version
fix rebase errors
WIP update fsc tool
WIP, rebased and working again, need to solve issues with System.CommandLine
Working state for packaged, command, fsc.exe bugging out with dlopen(, 1): no suitable image found.
execute fsc like a unpublished standalone app
fixup after rebase
working? internet is out
working
cleanup
More cleanup, and run the debian package tests during the Test phase of the build.
update FSharp Test Projects NetStandard Library Version
Update Version Suffix when packing TestPackages. This will enable packing with the right dependency versions on Windows.
update dotnet-test version
Undo the reordering of the build
fix test package project pathsj
ignore net451 build failures for test packages which we need to build on non-windows
update dependency of desktop test app
add dotnetcli feed to nuget config for fsharp dotnet new
update deps after rebase
update dependency of dotnet-compile-fsc
pass args before commandPath when using muxer for tools
adjust testpackage cleaning not to clean packages which are also generated as part of the product from the nuget cache.
undo
Pass projectJson to pack instead of using WorkingDirectory
fix path separators using depsjsoncommandresolver on windows, fix building only specific frameworks for testpackages on non-windows.
PR Feedback
rebase
overwrite fsc runtimeconfig
2016-03-12 00:41:00 +00:00
|
|
|
|
if (CurrentPlatform.IsWindows)
|
2016-02-02 18:04:50 +00:00
|
|
|
|
{
|
Extract dotnet-compile-fsc into a standalone command
Add basic Tests for dotnet-compile-fsc
Package Targets execute before TestTargets. Use Generated Nuget Packages in TestTargets. Generate Nuget packages on all platforms, and in C#
Fix bug in dotnet-restore, change fsharp new template, add support for native assets in DependencyContextCsvReader
copy fsc.exe to temp directory instead of package cache
fix rebase error
fix issue
fixes
fixes
fix
temporarily disable debian package e2e testing
fixes
bump fsc version
update fsc version
fix rebase errors
WIP update fsc tool
WIP, rebased and working again, need to solve issues with System.CommandLine
Working state for packaged, command, fsc.exe bugging out with dlopen(, 1): no suitable image found.
execute fsc like a unpublished standalone app
fixup after rebase
working? internet is out
working
cleanup
More cleanup, and run the debian package tests during the Test phase of the build.
update FSharp Test Projects NetStandard Library Version
Update Version Suffix when packing TestPackages. This will enable packing with the right dependency versions on Windows.
update dotnet-test version
Undo the reordering of the build
fix test package project pathsj
ignore net451 build failures for test packages which we need to build on non-windows
update dependency of desktop test app
add dotnetcli feed to nuget config for fsharp dotnet new
update deps after rebase
update dependency of dotnet-compile-fsc
pass args before commandPath when using muxer for tools
adjust testpackage cleaning not to clean packages which are also generated as part of the product from the nuget cache.
undo
Pass projectJson to pack instead of using WorkingDirectory
fix path separators using depsjsoncommandresolver on windows, fix building only specific frameworks for testpackages on non-windows.
PR Feedback
rebase
overwrite fsc runtimeconfig
2016-03-12 00:41:00 +00:00
|
|
|
|
// build projects for nuget packages
|
2016-02-02 18:04:50 +00:00
|
|
|
|
var packagingOutputDir = Path.Combine(Dirs.Stage2Compilation, "forPackaging");
|
|
|
|
|
Mkdirp(packagingOutputDir);
|
Extract dotnet-compile-fsc into a standalone command
Add basic Tests for dotnet-compile-fsc
Package Targets execute before TestTargets. Use Generated Nuget Packages in TestTargets. Generate Nuget packages on all platforms, and in C#
Fix bug in dotnet-restore, change fsharp new template, add support for native assets in DependencyContextCsvReader
copy fsc.exe to temp directory instead of package cache
fix rebase error
fix issue
fixes
fixes
fix
temporarily disable debian package e2e testing
fixes
bump fsc version
update fsc version
fix rebase errors
WIP update fsc tool
WIP, rebased and working again, need to solve issues with System.CommandLine
Working state for packaged, command, fsc.exe bugging out with dlopen(, 1): no suitable image found.
execute fsc like a unpublished standalone app
fixup after rebase
working? internet is out
working
cleanup
More cleanup, and run the debian package tests during the Test phase of the build.
update FSharp Test Projects NetStandard Library Version
Update Version Suffix when packing TestPackages. This will enable packing with the right dependency versions on Windows.
update dotnet-test version
Undo the reordering of the build
fix test package project pathsj
ignore net451 build failures for test packages which we need to build on non-windows
update dependency of desktop test app
add dotnetcli feed to nuget config for fsharp dotnet new
update deps after rebase
update dependency of dotnet-compile-fsc
pass args before commandPath when using muxer for tools
adjust testpackage cleaning not to clean packages which are also generated as part of the product from the nuget cache.
undo
Pass projectJson to pack instead of using WorkingDirectory
fix path separators using depsjsoncommandresolver on windows, fix building only specific frameworks for testpackages on non-windows.
PR Feedback
rebase
overwrite fsc runtimeconfig
2016-03-12 00:41:00 +00:00
|
|
|
|
foreach (var project in PackageTargets.ProjectsToPack)
|
2016-02-02 18:04:50 +00:00
|
|
|
|
{
|
|
|
|
|
// Just build them, we'll pack later
|
Extract dotnet-compile-fsc into a standalone command
Add basic Tests for dotnet-compile-fsc
Package Targets execute before TestTargets. Use Generated Nuget Packages in TestTargets. Generate Nuget packages on all platforms, and in C#
Fix bug in dotnet-restore, change fsharp new template, add support for native assets in DependencyContextCsvReader
copy fsc.exe to temp directory instead of package cache
fix rebase error
fix issue
fixes
fixes
fix
temporarily disable debian package e2e testing
fixes
bump fsc version
update fsc version
fix rebase errors
WIP update fsc tool
WIP, rebased and working again, need to solve issues with System.CommandLine
Working state for packaged, command, fsc.exe bugging out with dlopen(, 1): no suitable image found.
execute fsc like a unpublished standalone app
fixup after rebase
working? internet is out
working
cleanup
More cleanup, and run the debian package tests during the Test phase of the build.
update FSharp Test Projects NetStandard Library Version
Update Version Suffix when packing TestPackages. This will enable packing with the right dependency versions on Windows.
update dotnet-test version
Undo the reordering of the build
fix test package project pathsj
ignore net451 build failures for test packages which we need to build on non-windows
update dependency of desktop test app
add dotnetcli feed to nuget config for fsharp dotnet new
update deps after rebase
update dependency of dotnet-compile-fsc
pass args before commandPath when using muxer for tools
adjust testpackage cleaning not to clean packages which are also generated as part of the product from the nuget cache.
undo
Pass projectJson to pack instead of using WorkingDirectory
fix path separators using depsjsoncommandresolver on windows, fix building only specific frameworks for testpackages on non-windows.
PR Feedback
rebase
overwrite fsc runtimeconfig
2016-03-12 00:41:00 +00:00
|
|
|
|
var packBuildResult = DotNetCli.Stage1.Build(
|
2016-02-02 18:04:50 +00:00
|
|
|
|
"--build-base-path",
|
|
|
|
|
packagingOutputDir,
|
|
|
|
|
"--configuration",
|
|
|
|
|
configuration,
|
|
|
|
|
Path.Combine(c.BuildContext.BuildDirectory, "src", project))
|
Extract dotnet-compile-fsc into a standalone command
Add basic Tests for dotnet-compile-fsc
Package Targets execute before TestTargets. Use Generated Nuget Packages in TestTargets. Generate Nuget packages on all platforms, and in C#
Fix bug in dotnet-restore, change fsharp new template, add support for native assets in DependencyContextCsvReader
copy fsc.exe to temp directory instead of package cache
fix rebase error
fix issue
fixes
fixes
fix
temporarily disable debian package e2e testing
fixes
bump fsc version
update fsc version
fix rebase errors
WIP update fsc tool
WIP, rebased and working again, need to solve issues with System.CommandLine
Working state for packaged, command, fsc.exe bugging out with dlopen(, 1): no suitable image found.
execute fsc like a unpublished standalone app
fixup after rebase
working? internet is out
working
cleanup
More cleanup, and run the debian package tests during the Test phase of the build.
update FSharp Test Projects NetStandard Library Version
Update Version Suffix when packing TestPackages. This will enable packing with the right dependency versions on Windows.
update dotnet-test version
Undo the reordering of the build
fix test package project pathsj
ignore net451 build failures for test packages which we need to build on non-windows
update dependency of desktop test app
add dotnetcli feed to nuget config for fsharp dotnet new
update deps after rebase
update dependency of dotnet-compile-fsc
pass args before commandPath when using muxer for tools
adjust testpackage cleaning not to clean packages which are also generated as part of the product from the nuget cache.
undo
Pass projectJson to pack instead of using WorkingDirectory
fix path separators using depsjsoncommandresolver on windows, fix building only specific frameworks for testpackages on non-windows.
PR Feedback
rebase
overwrite fsc runtimeconfig
2016-03-12 00:41:00 +00:00
|
|
|
|
.Execute();
|
|
|
|
|
|
|
|
|
|
packBuildResult.EnsureSuccessful();
|
2016-02-02 18:04:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-23 19:46:38 +00:00
|
|
|
|
CleanOutputDir(Path.Combine(Dirs.Stage2, "sdk"));
|
2016-04-05 03:13:13 +00:00
|
|
|
|
FS.CopyRecursive(Dirs.Stage2, Dirs.Stage2Symbols);
|
|
|
|
|
|
|
|
|
|
RemovePdbsFromDir(Path.Combine(Dirs.Stage2, "sdk"));
|
2016-03-23 19:46:38 +00:00
|
|
|
|
|
2016-02-02 18:04:50 +00:00
|
|
|
|
return c.Success();
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-23 19:46:38 +00:00
|
|
|
|
private static void CleanOutputDir(string directory)
|
|
|
|
|
{
|
2016-04-05 03:13:13 +00:00
|
|
|
|
foreach (var file in FilesToClean)
|
|
|
|
|
{
|
|
|
|
|
FS.RmFilesInDirRecursive(directory, file);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void RemovePdbsFromDir(string directory)
|
|
|
|
|
{
|
2016-03-23 19:46:38 +00:00
|
|
|
|
FS.RmFilesInDirRecursive(directory, "*.pdb");
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-16 22:30:53 +00:00
|
|
|
|
private static BuildTargetResult CompileCliSdk(BuildTargetContext c, DotNetCli dotnet, string rootOutputDirectory)
|
2016-03-16 22:54:02 +00:00
|
|
|
|
{
|
2016-02-15 18:07:39 +00:00
|
|
|
|
var configuration = c.BuildContext.Get<string>("Configuration");
|
2016-03-16 22:54:02 +00:00
|
|
|
|
var buildVersion = c.BuildContext.Get<BuildVersion>("BuildVersion");
|
2016-05-06 22:34:33 +00:00
|
|
|
|
var srcDir = Path.Combine(c.BuildContext.BuildDirectory, "src");
|
2016-05-16 22:30:53 +00:00
|
|
|
|
var sdkOutputDirectory = Path.Combine(rootOutputDirectory, "sdk", buildVersion.NuGetVersion);
|
|
|
|
|
|
|
|
|
|
CopySharedFramework(Dirs.SharedFrameworkPublish, rootOutputDirectory);
|
2016-02-02 18:04:50 +00:00
|
|
|
|
|
2016-05-06 22:34:33 +00:00
|
|
|
|
FS.CleanBinObj(c, srcDir);
|
2016-05-16 22:30:53 +00:00
|
|
|
|
Rmdir(sdkOutputDirectory);
|
|
|
|
|
Mkdirp(sdkOutputDirectory);
|
2016-02-02 18:04:50 +00:00
|
|
|
|
|
|
|
|
|
foreach (var project in ProjectsToPublish)
|
|
|
|
|
{
|
|
|
|
|
dotnet.Publish(
|
|
|
|
|
"--native-subdirectory",
|
2016-05-16 22:30:53 +00:00
|
|
|
|
"--output", sdkOutputDirectory,
|
2016-05-06 22:34:33 +00:00
|
|
|
|
"--configuration", configuration,
|
|
|
|
|
"--version-suffix", buildVersion.CommitCountString,
|
|
|
|
|
Path.Combine(srcDir, project))
|
2016-02-02 18:04:50 +00:00
|
|
|
|
.Execute()
|
|
|
|
|
.EnsureSuccessful();
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-16 22:30:53 +00:00
|
|
|
|
FixModeFlags(sdkOutputDirectory);
|
2016-02-02 18:04:50 +00:00
|
|
|
|
|
2016-03-24 16:36:05 +00:00
|
|
|
|
string compilersProject = Path.Combine(Dirs.RepoRoot, "src", "compilers");
|
|
|
|
|
dotnet.Publish(compilersProject,
|
|
|
|
|
"--output",
|
2016-05-16 22:30:53 +00:00
|
|
|
|
sdkOutputDirectory,
|
2016-03-24 16:36:05 +00:00
|
|
|
|
"--framework",
|
2016-04-02 04:52:08 +00:00
|
|
|
|
"netstandard1.5")
|
2016-03-24 16:36:05 +00:00
|
|
|
|
.Execute()
|
|
|
|
|
.EnsureSuccessful();
|
|
|
|
|
|
2016-05-16 22:30:53 +00:00
|
|
|
|
var compilersDeps = Path.Combine(sdkOutputDirectory, "compilers.deps.json");
|
|
|
|
|
var compilersRuntimeConfig = Path.Combine(sdkOutputDirectory, "compilers.runtimeconfig.json");
|
2016-03-24 16:36:05 +00:00
|
|
|
|
|
2016-02-02 18:04:50 +00:00
|
|
|
|
|
2016-05-22 23:42:14 +00:00
|
|
|
|
var binaryToCorehostifyRelDir = Path.Combine("runtimes", "any", "native");
|
2016-05-16 22:30:53 +00:00
|
|
|
|
var binaryToCorehostifyOutDir = Path.Combine(sdkOutputDirectory, binaryToCorehostifyRelDir);
|
2016-02-02 18:04:50 +00:00
|
|
|
|
// Corehostify binaries
|
2016-02-15 17:42:17 +00:00
|
|
|
|
foreach (var binaryToCorehostify in BinariesForCoreHost)
|
2016-02-02 18:04:50 +00:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// Yes, it is .exe even on Linux. This is the managed exe we're working with
|
2016-05-16 22:30:53 +00:00
|
|
|
|
File.Copy(Path.Combine(binaryToCorehostifyOutDir, $"{binaryToCorehostify}.exe"), Path.Combine(sdkOutputDirectory, $"{binaryToCorehostify}.dll"));
|
2016-03-24 16:36:05 +00:00
|
|
|
|
File.Delete(Path.Combine(binaryToCorehostifyOutDir, $"{binaryToCorehostify}.exe"));
|
2016-05-16 22:30:53 +00:00
|
|
|
|
var binaryToCoreHostifyDeps = Path.Combine(sdkOutputDirectory, binaryToCorehostify + ".deps.json");
|
|
|
|
|
|
|
|
|
|
File.Copy(compilersDeps, Path.Combine(sdkOutputDirectory, binaryToCorehostify + ".deps.json"));
|
|
|
|
|
File.Copy(compilersRuntimeConfig, Path.Combine(sdkOutputDirectory, binaryToCorehostify + ".runtimeconfig.json"));
|
|
|
|
|
PublishMutationUtilties.ChangeEntryPointLibraryName(binaryToCoreHostifyDeps, binaryToCorehostify);
|
2016-05-22 23:42:14 +00:00
|
|
|
|
foreach (var binaryToRemove in new string[] { "csc", "vbc" })
|
|
|
|
|
{
|
|
|
|
|
var assetPath = Path.Combine(binaryToCorehostifyRelDir, $"{binaryToRemove}.exe").Replace(Path.DirectorySeparatorChar, '/');
|
|
|
|
|
RemoveAssetFromDepsPackages(binaryToCoreHostifyDeps, "runtimeTargets", assetPath);
|
|
|
|
|
}
|
2016-02-02 18:04:50 +00:00
|
|
|
|
}
|
2016-02-15 17:42:17 +00:00
|
|
|
|
catch (Exception ex)
|
2016-02-02 18:04:50 +00:00
|
|
|
|
{
|
|
|
|
|
return c.Failed($"Failed to corehostify '{binaryToCorehostify}': {ex.ToString()}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-24 16:36:05 +00:00
|
|
|
|
// cleanup compilers project output we don't need
|
2016-05-16 22:30:53 +00:00
|
|
|
|
PublishMutationUtilties.CleanPublishOutput(
|
|
|
|
|
sdkOutputDirectory,
|
|
|
|
|
"compilers",
|
|
|
|
|
deleteRuntimeConfigJson: true,
|
|
|
|
|
deleteDepsJson: true);
|
|
|
|
|
|
|
|
|
|
// Crossgen SDK directory
|
2016-05-27 20:24:39 +00:00
|
|
|
|
var sharedFrameworkNugetVersion = CliDependencyVersions.SharedFrameworkVersion;
|
2016-05-16 22:30:53 +00:00
|
|
|
|
var sharedFrameworkNameVersionPath = SharedFrameworkPublisher.GetSharedFrameworkPublishPath(
|
|
|
|
|
rootOutputDirectory,
|
|
|
|
|
sharedFrameworkNugetVersion);
|
|
|
|
|
|
|
|
|
|
// Copy Host to SDK Directory
|
|
|
|
|
File.Copy(
|
|
|
|
|
Path.Combine(sharedFrameworkNameVersionPath, HostArtifactNames.DotnetHostBaseName),
|
|
|
|
|
Path.Combine(sdkOutputDirectory, $"corehost{Constants.ExeSuffix}"),
|
|
|
|
|
overwrite: true);
|
|
|
|
|
File.Copy(
|
|
|
|
|
Path.Combine(sharedFrameworkNameVersionPath, HostArtifactNames.DotnetHostFxrBaseName),
|
|
|
|
|
Path.Combine(sdkOutputDirectory, HostArtifactNames.DotnetHostFxrBaseName),
|
|
|
|
|
overwrite: true);
|
|
|
|
|
File.Copy(
|
|
|
|
|
Path.Combine(sharedFrameworkNameVersionPath, HostArtifactNames.HostPolicyBaseName),
|
|
|
|
|
Path.Combine(sdkOutputDirectory, HostArtifactNames.HostPolicyBaseName),
|
|
|
|
|
overwrite: true);
|
|
|
|
|
|
|
|
|
|
CrossgenUtil.CrossgenDirectory(
|
|
|
|
|
sharedFrameworkNameVersionPath,
|
|
|
|
|
sdkOutputDirectory);
|
2016-04-15 01:02:26 +00:00
|
|
|
|
|
2016-02-02 18:04:50 +00:00
|
|
|
|
// Generate .version file
|
2016-03-24 00:13:58 +00:00
|
|
|
|
var version = buildVersion.NuGetVersion;
|
2016-02-13 01:16:28 +00:00
|
|
|
|
var content = $@"{c.BuildContext["CommitHash"]}{Environment.NewLine}{version}{Environment.NewLine}";
|
2016-05-16 22:30:53 +00:00
|
|
|
|
File.WriteAllText(Path.Combine(sdkOutputDirectory, ".version"), content);
|
2016-02-02 18:04:50 +00:00
|
|
|
|
|
|
|
|
|
return c.Success();
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-22 23:42:14 +00:00
|
|
|
|
private static void RemoveAssetFromDepsPackages(string depsFile, string sectionName, string assetPath)
|
|
|
|
|
{
|
|
|
|
|
JToken deps;
|
|
|
|
|
using (var file = File.OpenText(depsFile))
|
|
|
|
|
using (JsonTextReader reader = new JsonTextReader(file))
|
|
|
|
|
{
|
|
|
|
|
deps = JObject.ReadFrom(reader);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (JProperty target in deps["targets"])
|
|
|
|
|
{
|
|
|
|
|
foreach (JProperty pv in target.Value.Children<JProperty>())
|
|
|
|
|
{
|
|
|
|
|
var section = pv.Value[sectionName];
|
|
|
|
|
if (section != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (JProperty relPath in section)
|
|
|
|
|
{
|
|
|
|
|
if (assetPath.Equals(relPath.Name))
|
|
|
|
|
{
|
|
|
|
|
relPath.Remove();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
using (var file = File.CreateText(depsFile))
|
|
|
|
|
using (var writer = new JsonTextWriter(file) { Formatting = Formatting.Indented })
|
|
|
|
|
{
|
|
|
|
|
deps.WriteTo(writer);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-16 22:30:53 +00:00
|
|
|
|
private static void CopySharedFramework(string sharedFrameworkPublish, string rootOutputDirectory)
|
2016-03-24 16:36:05 +00:00
|
|
|
|
{
|
2016-05-16 22:30:53 +00:00
|
|
|
|
CopyRecursive(sharedFrameworkPublish, rootOutputDirectory);
|
2016-03-24 16:36:05 +00:00
|
|
|
|
}
|
2016-02-02 18:04:50 +00:00
|
|
|
|
}
|
2016-05-18 13:48:55 +00:00
|
|
|
|
}
|