diff --git a/build.proj b/build.proj index 61ba87e7e..3935e56a4 100644 --- a/build.proj +++ b/build.proj @@ -1,7 +1,7 @@ - + @@ -49,14 +53,9 @@ - - - - - @@ -66,5 +65,6 @@ + diff --git a/build/Microsoft.DotNet.Cli.Compile.targets b/build/Microsoft.DotNet.Cli.Compile.targets new file mode 100644 index 000000000..46d2ca3ee --- /dev/null +++ b/build/Microsoft.DotNet.Cli.Compile.targets @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + $(RepoRoot)/src + + + + + + + + @(CompileStageInputs) + $(Stage1Directory) + $(Stage1SymbolsDirectory) + $(Stage0Path)/dotnet.exe + + + @(CompileStageInputs) + $(Stage2Directory) + $(Stage2SymbolsDirectory) + $(DotnetStage1) + + + + + + + .exe + + + + lib + + .dll + .dylib + .so + + dotnet$(ExeSuffix) + $(DynamicLibPrefix)hostfxr$(DynamicLibSuffix) + $(DynamicLibPrefix)hostpolicy$(DynamicLibSuffix) + + %(Stage.StageDirectory) + %(Stage.StageSymbolsDirectory) + $(StageDirectory)/sdk/$(SdkVersion) + runtimes/any/native + $(SdkOutputDirectory)/$(BinaryToCorehostifyRelDir) + $(SdkOutputDirectory)/runtimes/any/native + + $(StageDirectory)/shared/$(SharedFrameworkName)/$(SharedFrameworkVersion) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/build/Microsoft.DotNet.Cli.Prepare.targets b/build/Microsoft.DotNet.Cli.Prepare.targets index ed97b2f28..b5d76503d 100644 --- a/build/Microsoft.DotNet.Cli.Prepare.targets +++ b/build/Microsoft.DotNet.Cli.Prepare.targets @@ -29,11 +29,17 @@ $(Stage0Path) $(RepoRoot)/artifacts/$(Rid) - $(BaseOutputDirectory)/stage2/ + $(BaseOutputDirectory)/tools + $(BaseOutputDirectory)/stage1 + $(BaseOutputDirectory)/stage1symbols + $(Stage1Directory)/dotnet.exe + $(BaseOutputDirectory)/stage2 + $(BaseOutputDirectory)/stage2symbols + $(Stage2Directory)/dotnet.exe + $(Stage2Directory)/ $(BaseOutputDirectory)/stage2compilation $(BaseOutputDirectory)/intermediate - $(BaseOutputDirectory)/packages - $(BaseOutputDirectory)/stage2symbols + $(BaseOutputDirectory)/packages $(IntermediateDirectory)/sharedFrameworkPublish @@ -197,4 +203,4 @@ ForceZipArchive="true" /> - + \ No newline at end of file diff --git a/build/compile/Microsoft.DotNet.Cli.LzmaArchive.targets b/build/compile/Microsoft.DotNet.Cli.LzmaArchive.targets new file mode 100644 index 000000000..47873c488 --- /dev/null +++ b/build/compile/Microsoft.DotNet.Cli.LzmaArchive.targets @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(IntermediateDirectory)/NuGetPackagesArchiveProject + $(IntermediateDirectory)/NuGetPackagesArchiveFolder + $(ToolsOutputDirectory)/Archiver + $(IntermediateDirectory)/nuGetPackagesArchive.lzma + $(Stage2Directory)/sdk/$(SdkVersion)/nuGetPackagesArchive.lzma + + + + + + + + + \ No newline at end of file diff --git a/build/package/Microsoft.DotNet.Cli.Layout.targets b/build/package/Microsoft.DotNet.Cli.Layout.targets index 694da724c..37809a7fd 100644 --- a/build/package/Microsoft.DotNet.Cli.Layout.targets +++ b/build/package/Microsoft.DotNet.Cli.Layout.targets @@ -11,7 +11,7 @@ - + @@ -56,7 +56,7 @@ @(SdkDebugLayoutInput) - @(SdkDebugRelativeOutputFiles -> '$(SdkDebugLayoutOutputDirectory)/%(Identity)') + @(SdkDebugRelativeOutputFiles -> '$(SdkDebugLayoutOutputDirectory)/%(Identity)') $(ArtifactNameWithVersionSdkDebug) $(ArtifactNameSdkDebug) diff --git a/build/package/Microsoft.DotNet.Cli.Nupkg.targets b/build/package/Microsoft.DotNet.Cli.Nupkg.targets index deb65b3c7..ddb61ba9c 100644 --- a/build/package/Microsoft.DotNet.Cli.Nupkg.targets +++ b/build/package/Microsoft.DotNet.Cli.Nupkg.targets @@ -66,4 +66,16 @@ --configuration $(Configuration) --version-suffix $(NupkgVersionSuffix)" /> + + + + + + diff --git a/build_projects/dotnet-cli-build/ChangeEntryPointLibraryName.cs b/build_projects/dotnet-cli-build/ChangeEntryPointLibraryName.cs new file mode 100644 index 000000000..4eea67021 --- /dev/null +++ b/build_projects/dotnet-cli-build/ChangeEntryPointLibraryName.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.IO.Compression; +using System.Runtime.InteropServices; +using System.Net.Http; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using Microsoft.DotNet.Cli.Build.Framework; +using Microsoft.DotNet.InternalAbstractions; + +using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers; + +namespace Microsoft.DotNet.Cli.Build +{ + public class ChangeEntryPointLibraryName : Task + { + [Required] + public string DepsFile { get; set; } + + [Required] + public string NewName { get; set; } + + public override bool Execute() + { + PublishMutationUtilties.ChangeEntryPointLibraryName(DepsFile, NewName); + + return true; + } + } +} diff --git a/build_projects/dotnet-cli-build/CleanPublishOutput.cs b/build_projects/dotnet-cli-build/CleanPublishOutput.cs new file mode 100644 index 000000000..8ed3ba21c --- /dev/null +++ b/build_projects/dotnet-cli-build/CleanPublishOutput.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.IO.Compression; +using System.Runtime.InteropServices; +using System.Net.Http; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using Microsoft.DotNet.Cli.Build.Framework; +using Microsoft.DotNet.InternalAbstractions; + +using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers; + +namespace Microsoft.DotNet.Cli.Build +{ + public class CleanPublishOutput : Task + { + [Required] + public string Path { get; set; } + + [Required] + public string Name { get; set; } + + [Required] + public bool DeleteRuntimeConfigJson { get; set; } + + [Required] + public bool DeleteDepsJson { get; set; } + + public override bool Execute() + { + PublishMutationUtilties.CleanPublishOutput(Path, Name, DeleteRuntimeConfigJson, DeleteDepsJson); + + return true; + } + } +} diff --git a/build_projects/dotnet-cli-build/CompileTargets.cs b/build_projects/dotnet-cli-build/CompileTargets.cs index 6ed367568..3d0c84c87 100644 --- a/build_projects/dotnet-cli-build/CompileTargets.cs +++ b/build_projects/dotnet-cli-build/CompileTargets.cs @@ -220,9 +220,14 @@ namespace Microsoft.DotNet.Cli.Build foreach (var binaryToRemove in new string[] { "csc", "vbc" }) { var assetPath = Path.Combine(binaryToCorehostifyRelDir, $"{binaryToRemove}.exe").Replace(Path.DirectorySeparatorChar, '/'); - RemoveAssetFromDepsPackages(binaryToCoreHostifyDeps, "runtimeTargets", assetPath); - RemoveAssetFromDepsPackages( - Path.Combine(sdkOutputDirectory, "dotnet.deps.json"), "runtimeTargets", assetPath); + RemoveAssetFromDepsPackages.DoRemoveAssetFromDepsPackages( + binaryToCoreHostifyDeps, + "runtimeTargets", + assetPath); + RemoveAssetFromDepsPackages.DoRemoveAssetFromDepsPackages( + Path.Combine(sdkOutputDirectory, "dotnet.deps.json"), + "runtimeTargets", + assetPath); } } catch (Exception ex) @@ -360,40 +365,6 @@ namespace Microsoft.DotNet.Cli.Build File.Copy(intermediateArchive, finalArchive); } - 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()) - { - 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); - } - } - private static void CopySharedFramework(string sharedFrameworkPublish, string rootOutputDirectory) { CopyRecursive(sharedFrameworkPublish, rootOutputDirectory); diff --git a/build_projects/dotnet-cli-build/CrossgenDirectory.cs b/build_projects/dotnet-cli-build/CrossgenDirectory.cs new file mode 100644 index 000000000..2b03c012f --- /dev/null +++ b/build_projects/dotnet-cli-build/CrossgenDirectory.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.IO.Compression; +using System.Runtime.InteropServices; +using System.Net.Http; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using Microsoft.DotNet.Cli.Build.Framework; +using Microsoft.DotNet.InternalAbstractions; + +using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers; + +namespace Microsoft.DotNet.Cli.Build +{ + public class CrossgenDirectory : Task + { + [Required] + public string CoreCLRVersion { get; set; } + + [Required] + public string JitVersion { get; set; } + + [Required] + public string SharedFrameworkNameVersionPath { get; set; } + + [Required] + public string SdkOutputDirectory { get; set; } + + public override bool Execute() + { + var crossgenUtil = new Crossgen(CoreCLRVersion, JitVersion); + + crossgenUtil.CrossgenDirectory(SharedFrameworkNameVersionPath, SdkOutputDirectory); + + return true; + } + } +} diff --git a/build_projects/dotnet-cli-build/FixModeFlags.cs b/build_projects/dotnet-cli-build/FixModeFlags.cs new file mode 100644 index 000000000..7caf97333 --- /dev/null +++ b/build_projects/dotnet-cli-build/FixModeFlags.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.IO.Compression; +using System.Runtime.InteropServices; +using System.Net.Http; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using Microsoft.DotNet.Cli.Build.Framework; +using Microsoft.DotNet.InternalAbstractions; + +using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers; + +namespace Microsoft.DotNet.Cli.Build +{ + public class FixModeFlags : Task + { + [Required] + public string Dir { get; set; } + + public override bool Execute() + { + FS.FixModeFlags(Dir); + + return true; + } + } +} diff --git a/build_projects/dotnet-cli-build/RemoveAssetFromDepsPackages.cs b/build_projects/dotnet-cli-build/RemoveAssetFromDepsPackages.cs new file mode 100644 index 000000000..f2395df23 --- /dev/null +++ b/build_projects/dotnet-cli-build/RemoveAssetFromDepsPackages.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.IO.Compression; +using System.Runtime.InteropServices; +using System.Net.Http; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using Microsoft.DotNet.Cli.Build.Framework; +using Microsoft.DotNet.InternalAbstractions; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers; + +namespace Microsoft.DotNet.Cli.Build +{ + public class RemoveAssetFromDepsPackages : Task + { + [Required] + public string DepsFile { get; set; } + + [Required] + public string SectionName { get; set; } + + [Required] + public string AssetPath { get; set; } + + public override bool Execute() + { + DoRemoveAssetFromDepsPackages(DepsFile, SectionName, AssetPath); + + return true; + } + + public static void DoRemoveAssetFromDepsPackages(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()) + { + 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); + } + } + } +} diff --git a/tools/Archiver/project.json b/tools/Archiver/project.json index 899fd6995..092a22fe3 100644 --- a/tools/Archiver/project.json +++ b/tools/Archiver/project.json @@ -16,5 +16,17 @@ }, "frameworks": { "netcoreapp1.0": {} + }, + "runtimes": { + "win7-x64": {}, + "win7-x86": {}, + "osx.10.11-x64": {}, + "ubuntu.14.04-x64": {}, + "ubuntu.16.04-x64": {}, + "centos.7-x64": {}, + "rhel.7.2-x64": {}, + "debian.8-x64": {}, + "fedora.23-x64": {}, + "opensuse.13.2-x64": {} } } diff --git a/tools/MultiProjectValidator/project.json b/tools/MultiProjectValidator/project.json index 0edf465ca..a005cb00e 100644 --- a/tools/MultiProjectValidator/project.json +++ b/tools/MultiProjectValidator/project.json @@ -19,5 +19,17 @@ "dnxcore50" ] } + }, + "runtimes": { + "win7-x64": {}, + "win7-x86": {}, + "osx.10.11-x64": {}, + "ubuntu.14.04-x64": {}, + "ubuntu.16.04-x64": {}, + "centos.7-x64": {}, + "rhel.7.2-x64": {}, + "debian.8-x64": {}, + "fedora.23-x64": {}, + "opensuse.13.2-x64": {} } }