From 99371436f3499c28ff25cc62263983ab886c689b Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Wed, 6 Apr 2016 19:45:38 -0500 Subject: [PATCH] Consume NETCore.App --- .gitignore | 8 ++- .../project.json | 4 +- .../src/EmptyNetCoreApp/project.json | 2 +- .../project.json | 2 +- .../dotnet-desktop-and-portable/project.json | 2 +- .../TestPackages/dotnet-portable/project.json | 2 +- .../TestAppPortable/project.json | 2 +- .../TestAppPortableDeps/project.json | 2 +- .../PortableTests/PortableApp/project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../PortableAppWithNative/project.json | 2 +- .../PortableTests/StandaloneApp/project.json | 2 +- scripts/dotnet-cli-build/CompileTargets.cs | 58 +++++++++++++++---- scripts/dotnet-cli-build/PrepareTargets.cs | 50 ++++++++++++---- scripts/dotnet-cli-build/TestTargets.cs | 15 +++-- .../dotnet-cli-build/Utils/BuildVersion.cs | 1 + scripts/dotnet-cli-build/Utils/Dirs.cs | 1 + scripts/dotnet-cli-build/Utils/JsonUtils.cs | 28 +++++++++ .../update-dependencies/UpdateFilesTargets.cs | 6 +- src/compilers/project.json | 2 +- src/dotnet-compile-fsc/project.json | 2 +- ...json.template => project.json.pretemplate} | 2 +- ...json.template => project.json.pretemplate} | 2 +- src/dotnet/project.json | 2 +- src/sharedframework/framework/project.json | 26 --------- .../framework/project.json.template | 19 ++++++ test/ArgumentForwardingTests/project.json | 2 +- test/ArgumentsReflector/project.json | 2 +- test/EndToEnd/project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- .../project.json | 2 +- test/ScriptExecutorTests/project.json | 2 +- test/dotnet-build.Tests/project.json | 2 +- test/dotnet-compile.Tests/project.json | 2 +- test/dotnet-pack.Tests/project.json | 2 +- .../project.json | 2 +- test/dotnet-publish.Tests/project.json | 2 +- test/dotnet-resgen.Tests/project.json | 2 +- test/dotnet-run.Tests/project.json | 2 +- test/dotnet-test.Tests/project.json | 2 +- test/dotnet-test.UnitTests/project.json | 2 +- test/dotnet.Tests/project.json | 2 +- 46 files changed, 190 insertions(+), 96 deletions(-) create mode 100644 scripts/dotnet-cli-build/Utils/JsonUtils.cs rename src/dotnet/commands/dotnet-new/CSharp_Console/{project.json.template => project.json.pretemplate} (84%) rename src/dotnet/commands/dotnet-new/FSharp_Console/{project.json.template => project.json.pretemplate} (93%) delete mode 100644 src/sharedframework/framework/project.json create mode 100644 src/sharedframework/framework/project.json.template diff --git a/.gitignore b/.gitignore index 7a5b1af63..24c566a59 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,10 @@ cmake/ # stage0 install directory .dotnet_stage0 +# `dotnet new` project.json.template files are generated by a pre-build step. +# ignore these files +/src/dotnet/commands/dotnet-new/**/project.json.template + ### VisualStudio.gitignore from https://raw.githubusercontent.com/github/gitignore/master/VisualStudio.gitignore ### ## Ignore Visual Studio temporary files, build results, and @@ -115,10 +119,12 @@ _Chutzpah* ipch/ *.aps *.ncb -*.opensdf *.opendb +*.opensdf *.sdf *.cachefile +*.VC.db +*.VC.VC.opendb # Visual Studio profiler *.psess diff --git a/TestAssets/DesktopTestProjects/AppWithDirectDependencyDesktopAndPortable/project.json b/TestAssets/DesktopTestProjects/AppWithDirectDependencyDesktopAndPortable/project.json index 20964ecd1..5e054c559 100644 --- a/TestAssets/DesktopTestProjects/AppWithDirectDependencyDesktopAndPortable/project.json +++ b/TestAssets/DesktopTestProjects/AppWithDirectDependencyDesktopAndPortable/project.json @@ -7,11 +7,11 @@ "dotnet-desktop-and-portable": "1.0.0-*" }, "frameworks": { - "netstandardapp1.5": { + "netstandard1.5": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" } }, "imports": [ diff --git a/TestAssets/ProjectModelServer/DthTestProjects/src/EmptyNetCoreApp/project.json b/TestAssets/ProjectModelServer/DthTestProjects/src/EmptyNetCoreApp/project.json index 7e4153889..076dcb75b 100644 --- a/TestAssets/ProjectModelServer/DthTestProjects/src/EmptyNetCoreApp/project.json +++ b/TestAssets/ProjectModelServer/DthTestProjects/src/EmptyNetCoreApp/project.json @@ -6,7 +6,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" }, "Newtonsoft.Json": "8.0.3" } diff --git a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/project.json b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/project.json index 0726f91a8..b18b1272f 100644 --- a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/project.json +++ b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/project.json @@ -6,7 +6,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" }, "Microsoft.DotNet.Cli.Utils": "1.0.0-*", "Microsoft.DotNet.ProjectModel": "1.0.0-*", diff --git a/TestAssets/TestPackages/dotnet-desktop-and-portable/project.json b/TestAssets/TestPackages/dotnet-desktop-and-portable/project.json index 7cfc2e94f..a5c7723d7 100644 --- a/TestAssets/TestPackages/dotnet-desktop-and-portable/project.json +++ b/TestAssets/TestPackages/dotnet-desktop-and-portable/project.json @@ -8,7 +8,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" } }, "imports": [ diff --git a/TestAssets/TestPackages/dotnet-portable/project.json b/TestAssets/TestPackages/dotnet-portable/project.json index f04db7245..7e7295a2e 100644 --- a/TestAssets/TestPackages/dotnet-portable/project.json +++ b/TestAssets/TestPackages/dotnet-portable/project.json @@ -12,7 +12,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" } } } diff --git a/TestAssets/TestProjects/DependencyContextValidator/TestAppPortable/project.json b/TestAssets/TestProjects/DependencyContextValidator/TestAppPortable/project.json index 7d3d8f139..bcf6d06ad 100644 --- a/TestAssets/TestProjects/DependencyContextValidator/TestAppPortable/project.json +++ b/TestAssets/TestProjects/DependencyContextValidator/TestAppPortable/project.json @@ -7,7 +7,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" }, "DependencyContextValidator": "1.0.0-*" }, diff --git a/TestAssets/TestProjects/DependencyContextValidator/TestAppPortableDeps/project.json b/TestAssets/TestProjects/DependencyContextValidator/TestAppPortableDeps/project.json index f761a6c75..864170b2d 100644 --- a/TestAssets/TestProjects/DependencyContextValidator/TestAppPortableDeps/project.json +++ b/TestAssets/TestProjects/DependencyContextValidator/TestAppPortableDeps/project.json @@ -6,7 +6,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" }, "DependencyContextValidator": "1.0.0-*" }, diff --git a/TestAssets/TestProjects/PortableTests/PortableApp/project.json b/TestAssets/TestProjects/PortableTests/PortableApp/project.json index f86ac470f..932c1708f 100644 --- a/TestAssets/TestProjects/PortableTests/PortableApp/project.json +++ b/TestAssets/TestProjects/PortableTests/PortableApp/project.json @@ -12,7 +12,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" } } } diff --git a/TestAssets/TestProjects/PortableTests/PortableAppCompilationContext/project.json b/TestAssets/TestProjects/PortableTests/PortableAppCompilationContext/project.json index 161bcc122..ce4ee1ac2 100644 --- a/TestAssets/TestProjects/PortableTests/PortableAppCompilationContext/project.json +++ b/TestAssets/TestProjects/PortableTests/PortableAppCompilationContext/project.json @@ -13,7 +13,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" } } } diff --git a/TestAssets/TestProjects/PortableTests/PortableAppWithIntentionalManagedDowngrade/project.json b/TestAssets/TestProjects/PortableTests/PortableAppWithIntentionalManagedDowngrade/project.json index 4aea1df3e..1d7079bb6 100644 --- a/TestAssets/TestProjects/PortableTests/PortableAppWithIntentionalManagedDowngrade/project.json +++ b/TestAssets/TestProjects/PortableTests/PortableAppWithIntentionalManagedDowngrade/project.json @@ -12,7 +12,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" }, "System.Linq": "4.0.0" } diff --git a/TestAssets/TestProjects/PortableTests/PortableAppWithNative/project.json b/TestAssets/TestProjects/PortableTests/PortableAppWithNative/project.json index 0c76e76d5..ba5c3e08c 100644 --- a/TestAssets/TestProjects/PortableTests/PortableAppWithNative/project.json +++ b/TestAssets/TestProjects/PortableTests/PortableAppWithNative/project.json @@ -11,7 +11,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" }, "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*" } diff --git a/TestAssets/TestProjects/PortableTests/StandaloneApp/project.json b/TestAssets/TestProjects/PortableTests/StandaloneApp/project.json index 6398bac17..402647c35 100644 --- a/TestAssets/TestProjects/PortableTests/StandaloneApp/project.json +++ b/TestAssets/TestProjects/PortableTests/StandaloneApp/project.json @@ -9,7 +9,7 @@ "portable-net45+win8" ], "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008" + "NETStandard.Library": "1.5.0-rc2-24008" } } }, diff --git a/scripts/dotnet-cli-build/CompileTargets.cs b/scripts/dotnet-cli-build/CompileTargets.cs index 6a691db15..cfbf3b1c0 100644 --- a/scripts/dotnet-cli-build/CompileTargets.cs +++ b/scripts/dotnet-cli-build/CompileTargets.cs @@ -49,7 +49,9 @@ namespace Microsoft.DotNet.Cli.Build return c.Success(); } - [Target(nameof(PrepareTargets.Init), nameof(PackagePkgProjects), nameof(CompileStage1), nameof(CompileStage2))] + // Moving PrepareTargets.RestorePackages after PackagePkgProjects because managed code depends on the + // Microsoft.NETCore.App package that is created during PackagePkgProjects. + [Target(nameof(PrepareTargets.Init), nameof(PackagePkgProjects), nameof(PrepareTargets.RestorePackages), nameof(CompileStage1), nameof(CompileStage2))] public static BuildTargetResult Compile(BuildTargetContext c) { return c.Success(); @@ -330,9 +332,26 @@ namespace Microsoft.DotNet.Cli.Build public static void PublishSharedFramework(BuildTargetContext c, string outputDir, DotNetCli dotnetCli) { - string SharedFrameworkSourceRoot = Path.Combine(Dirs.RepoRoot, "src", "sharedframework", "framework"); + string SharedFrameworkTemplateSourceRoot = Path.Combine(Dirs.RepoRoot, "src", "sharedframework", "framework"); string SharedFrameworkNugetVersion = c.BuildContext.Get("SharedFrameworkNugetVersion"); + string sharedFrameworkRid; + if (PlatformServices.Default.Runtime.OperatingSystemPlatform == Platform.Windows) + { + sharedFrameworkRid = $"win7-{PlatformServices.Default.Runtime.RuntimeArchitecture}"; + } + else + { + sharedFrameworkRid = PlatformServices.Default.Runtime.GetRuntimeIdentifier(); + } + + string SharedFrameworkSourceRoot = GenerateSharedFrameworkProject(c, SharedFrameworkTemplateSourceRoot, sharedFrameworkRid); + + dotnetCli.Restore("--verbosity", "verbose", "--disable-parallel", "--infer-runtimes", "--fallbacksource", Dirs.Corehost) + .WorkingDirectory(SharedFrameworkSourceRoot) + .Execute() + .EnsureSuccessful(); + // 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); c.BuildContext["SharedFrameworkPath"] = SharedFrameworkNameAndVersionRoot; @@ -343,19 +362,10 @@ namespace Microsoft.DotNet.Cli.Build } 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.Publish( "--output", SharedFrameworkNameAndVersionRoot, - "-r", publishRuntime, + "-r", sharedFrameworkRid, "-f", publishFramework, SharedFrameworkSourceRoot).Execute().EnsureSuccessful(); @@ -428,6 +438,30 @@ namespace Microsoft.DotNet.Cli.Build File.WriteAllText(Path.Combine(SharedFrameworkNameAndVersionRoot, ".version"), content); } + /// + /// Generates the real shared framework project that will get published. + /// + /// The "sharedFramework" source template folder. + private static string GenerateSharedFrameworkProject(BuildTargetContext c, string sharedFrameworkTemplatePath, string rid) + { + string sharedFrameworkProjectPath = Path.Combine(Dirs.Intermediate, "sharedFramework", "framework"); + Utils.DeleteDirectory(sharedFrameworkProjectPath); + CopyRecursive(sharedFrameworkTemplatePath, sharedFrameworkProjectPath, true); + + string templateFile = Path.Combine(sharedFrameworkProjectPath, "project.json.template"); + JObject sharedFrameworkProject = JsonUtils.ReadProject(templateFile); + sharedFrameworkProject["dependencies"]["Microsoft.NETCore.App"] = c.BuildContext.Get("BuildVersion").NetCoreAppVersion; + ((JObject)sharedFrameworkProject["runtimes"]).RemoveAll(); + sharedFrameworkProject["runtimes"][rid] = new JObject(); + + string projectJsonPath = Path.Combine(sharedFrameworkProjectPath, "project.json"); + JsonUtils.WriteProject(sharedFrameworkProject, projectJsonPath); + + Rm(templateFile); + + return sharedFrameworkProjectPath; + } + private static BuildTargetResult CompileCliSdk(BuildTargetContext c, DotNetCli dotnet, string outputDir) { var configuration = c.BuildContext.Get("Configuration"); diff --git a/scripts/dotnet-cli-build/PrepareTargets.cs b/scripts/dotnet-cli-build/PrepareTargets.cs index 778bda8b4..d1559421c 100644 --- a/scripts/dotnet-cli-build/PrepareTargets.cs +++ b/scripts/dotnet-cli-build/PrepareTargets.cs @@ -1,23 +1,24 @@ -using Microsoft.DotNet.Cli.Build.Framework; -using Microsoft.Extensions.PlatformAbstractions; -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Text; - +using System.Text.RegularExpressions; +using Microsoft.DotNet.Cli.Build.Framework; +using Microsoft.Extensions.PlatformAbstractions; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers; using static Microsoft.DotNet.Cli.Build.FS; using static Microsoft.DotNet.Cli.Build.Utils; -using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers; -using System.Text.RegularExpressions; namespace Microsoft.DotNet.Cli.Build { public class PrepareTargets { - [Target(nameof(Init), nameof(RestorePackages))] + [Target(nameof(Init))] public static BuildTargetResult Prepare(BuildTargetContext c) => c.Success(); [Target(nameof(CheckPrereqCmakePresent), nameof(CheckPlatformDependencies))] @@ -33,7 +34,7 @@ namespace Microsoft.DotNet.Cli.Build public static BuildTargetResult CheckInstallerBuildPlatformDependencies(BuildTargetContext c) => c.Success(); // All major targets will depend on this in order to ensure variables are set up right if they are run independently - [Target(nameof(GenerateVersions), nameof(CheckPrereqs), nameof(LocateStage0), nameof(ExpectedBuildArtifacts))] + [Target(nameof(GenerateVersions), nameof(UpdateTemplateVersions), nameof(CheckPrereqs), nameof(LocateStage0), nameof(ExpectedBuildArtifacts))] public static BuildTargetResult Init(BuildTargetContext c) { var runtimeInfo = PlatformServices.Default.Runtime; @@ -82,7 +83,7 @@ namespace Microsoft.DotNet.Cli.Build }; c.BuildContext["BuildVersion"] = buildVersion; c.BuildContext["CommitHash"] = commitHash; - c.BuildContext["SharedFrameworkNugetVersion"] = GetVersionFromProjectJson(Path.Combine(Dirs.RepoRoot, "src", "sharedframework", "framework", "project.json")); + c.BuildContext["SharedFrameworkNugetVersion"] = buildVersion.NetCoreAppVersion; c.Info($"Building Version: {buildVersion.SimpleVersion} (NuGet Packages: {buildVersion.NuGetVersion})"); c.Info($"From Commit: {commitHash}"); @@ -90,6 +91,27 @@ namespace Microsoft.DotNet.Cli.Build return c.Success(); } + /// + /// Updates the Microsoft.NETCore.App version number in the `dotnet new` project.json.template files. + /// + [Target] + public static BuildTargetResult UpdateTemplateVersions(BuildTargetContext c) + { + IEnumerable templateFiles = Directory.GetFiles( + Path.Combine(Dirs.RepoRoot, @"src\dotnet\commands\dotnet-new"), + "project.json.pretemplate", + SearchOption.AllDirectories); + + foreach (string templateFile in templateFiles) + { + JObject projectRoot = JsonUtils.ReadProject(templateFile); + projectRoot["dependencies"]["Microsoft.NETCore.App"]["version"] = c.BuildContext.Get("BuildVersion").NetCoreAppVersion; + JsonUtils.WriteProject(projectRoot, Path.ChangeExtension(templateFile, "template")); + } + + return c.Success(); + } + [Target] public static BuildTargetResult LocateStage0(BuildTargetContext c) { @@ -206,8 +228,14 @@ namespace Microsoft.DotNet.Cli.Build { var dotnet = DotNetCli.Stage0; - dotnet.Restore("--verbosity", "verbose", "--disable-parallel", "--infer-runtimes").WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "src")).Execute().EnsureSuccessful(); - dotnet.Restore("--verbosity", "verbose", "--disable-parallel", "--infer-runtimes").WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "tools")).Execute().EnsureSuccessful(); + dotnet.Restore("--verbosity", "verbose", "--disable-parallel", "--infer-runtimes", "--fallbacksource", Dirs.Corehost) + .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "src")) + .Execute() + .EnsureSuccessful(); + dotnet.Restore("--verbosity", "verbose", "--disable-parallel", "--infer-runtimes") + .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "tools")) + .Execute() + .EnsureSuccessful(); return c.Success(); } diff --git a/scripts/dotnet-cli-build/TestTargets.cs b/scripts/dotnet-cli-build/TestTargets.cs index d99541222..5e394ba1d 100644 --- a/scripts/dotnet-cli-build/TestTargets.cs +++ b/scripts/dotnet-cli-build/TestTargets.cs @@ -70,7 +70,7 @@ namespace Microsoft.DotNet.Cli.Build CleanNuGetTempCache(); var dotnet = DotNetCli.Stage2; - dotnet.Restore("--verbosity", "verbose", "--infer-runtimes") + dotnet.Restore("--verbosity", "verbose", "--infer-runtimes", "--fallbacksource", Dirs.Corehost) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "TestPackages")) .Execute() .EnsureSuccessful(); @@ -90,14 +90,16 @@ namespace Microsoft.DotNet.Cli.Build dotnet.Restore( "--verbosity", "verbose", "--infer-runtimes", - "--fallbacksource", Dirs.TestPackages) + "--fallbacksource", Dirs.TestPackages, + "--fallbacksource", Dirs.Corehost) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "TestProjects")) .Execute().EnsureSuccessful(); // The 'ProjectModelServer' directory contains intentionally-unresolved dependencies, so don't check for success. Also, suppress the output dotnet.Restore( "--verbosity", "verbose", - "--infer-runtimes") + "--infer-runtimes", + "--fallbacksource", Dirs.Corehost) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "ProjectModelServer", "DthTestProjects")) .Execute(); @@ -118,7 +120,8 @@ namespace Microsoft.DotNet.Cli.Build dotnet.Restore("--verbosity", "verbose", "--infer-runtimes", - "--fallbacksource", Dirs.TestPackages) + "--fallbacksource", Dirs.TestPackages, + "--fallbacksource", Dirs.Corehost) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "DesktopTestProjects")) .Execute().EnsureSuccessful(); @@ -255,7 +258,9 @@ namespace Microsoft.DotNet.Cli.Build CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "test")); CleanNuGetTempCache(); - DotNetCli.Stage2.Restore("--verbosity", "verbose", "--infer-runtimes", "--fallbacksource", Dirs.TestPackages) + DotNetCli.Stage2.Restore("--verbosity", "verbose", + "--fallbacksource", Dirs.TestPackages, + "--fallbacksource", Dirs.Corehost) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "test")) .Execute() .EnsureSuccessful(); diff --git a/scripts/dotnet-cli-build/Utils/BuildVersion.cs b/scripts/dotnet-cli-build/Utils/BuildVersion.cs index c7e2f50c7..6c10e1ee3 100644 --- a/scripts/dotnet-cli-build/Utils/BuildVersion.cs +++ b/scripts/dotnet-cli-build/Utils/BuildVersion.cs @@ -12,6 +12,7 @@ public string SimpleVersion => $"{Major}.{Minor}.{Patch}.{CommitCountString}"; public string VersionSuffix => $"{ReleaseSuffix}-{CommitCountString}"; public string NuGetVersion => $"{Major}.{Minor}.{Patch}-{VersionSuffix}"; + public string NetCoreAppVersion => $"{Major}.{Minor}.{Patch}-rc2-3{CommitCountString}"; public string ProductionVersion => $"{Major}.{Minor}.{Patch}"; public string GenerateMsiVersion() diff --git a/scripts/dotnet-cli-build/Utils/Dirs.cs b/scripts/dotnet-cli-build/Utils/Dirs.cs index cec5db1cb..918f60517 100644 --- a/scripts/dotnet-cli-build/Utils/Dirs.cs +++ b/scripts/dotnet-cli-build/Utils/Dirs.cs @@ -13,6 +13,7 @@ namespace Microsoft.DotNet.Cli.Build "artifacts", PlatformServices.Default.Runtime.GetRuntimeIdentifier()); + public static readonly string Intermediate = Path.Combine(Output, "intermediate"); public static readonly string PackagesIntermediate = Path.Combine(Output, "packages/intermediate"); public static readonly string Packages = Path.Combine(Output, "packages"); public static readonly string Stage1 = Path.Combine(Output, "stage1"); diff --git a/scripts/dotnet-cli-build/Utils/JsonUtils.cs b/scripts/dotnet-cli-build/Utils/JsonUtils.cs new file mode 100644 index 000000000..18fb5b22b --- /dev/null +++ b/scripts/dotnet-cli-build/Utils/JsonUtils.cs @@ -0,0 +1,28 @@ +using System; +using System.IO; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Microsoft.DotNet.Cli.Build +{ + public static class JsonUtils + { + public static JObject ReadProject(string projectJsonPath) + { + using (TextReader projectFileReader = File.OpenText(projectJsonPath)) + { + var projectJsonReader = new JsonTextReader(projectFileReader); + + var serializer = new JsonSerializer(); + return serializer.Deserialize(projectJsonReader); + } + } + + public static void WriteProject(JObject projectRoot, string projectJsonPath) + { + string projectJson = JsonConvert.SerializeObject(projectRoot, Formatting.Indented); + + File.WriteAllText(projectJsonPath, projectJson + Environment.NewLine); + } + } +} diff --git a/scripts/update-dependencies/UpdateFilesTargets.cs b/scripts/update-dependencies/UpdateFilesTargets.cs index 93e58fd91..3c59592e2 100644 --- a/scripts/update-dependencies/UpdateFilesTargets.cs +++ b/scripts/update-dependencies/UpdateFilesTargets.cs @@ -32,7 +32,7 @@ namespace Microsoft.DotNet.Scripts coreFxLkgVersion = coreFxLkgVersion.Trim(); const string coreFxIdPattern = @"^(?i)((System\..*)|(NETStandard\.Library)|(Microsoft\.CSharp)|(Microsoft\.NETCore.*)|(Microsoft\.TargetingPack\.Private\.(CoreCLR|NETNative))|(Microsoft\.Win32\..*)|(Microsoft\.VisualBasic))$"; - const string coreFxIdExclusionPattern = @"System.CommandLine"; + const string coreFxIdExclusionPattern = @"System.CommandLine|Microsoft.NETCore.App"; List dependencyInfos = c.GetDependencyInfos(); dependencyInfos.Add(new DependencyInfo() @@ -57,9 +57,7 @@ namespace Microsoft.DotNet.Scripts { List dependencyInfos = c.GetDependencyInfos(); - IEnumerable projectJsonFiles = Enumerable.Union( - Directory.GetFiles(Dirs.RepoRoot, "project.json", SearchOption.AllDirectories), - Directory.GetFiles(Path.Combine(Dirs.RepoRoot, @"src\dotnet\commands\dotnet-new"), "project.json.template", SearchOption.AllDirectories)); + IEnumerable projectJsonFiles = Directory.GetFiles(Dirs.RepoRoot, "project.json", SearchOption.AllDirectories); JObject projectRoot; foreach (string projectJsonFile in projectJsonFiles) diff --git a/src/compilers/project.json b/src/compilers/project.json index 64dea980c..0e006bea6 100644 --- a/src/compilers/project.json +++ b/src/compilers/project.json @@ -6,7 +6,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" }, "Microsoft.CodeAnalysis.CSharp": "1.3.0-beta1-20160405-05", "Microsoft.Net.Compilers.netcore": "1.3.0-beta1-20160405-05", diff --git a/src/dotnet-compile-fsc/project.json b/src/dotnet-compile-fsc/project.json index 786e35418..0e72f2897 100644 --- a/src/dotnet-compile-fsc/project.json +++ b/src/dotnet-compile-fsc/project.json @@ -11,7 +11,7 @@ "Microsoft.DotNet.Cli.Utils": "1.0.0-*", "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" } }, "frameworks": { diff --git a/src/dotnet/commands/dotnet-new/CSharp_Console/project.json.template b/src/dotnet/commands/dotnet-new/CSharp_Console/project.json.pretemplate similarity index 84% rename from src/dotnet/commands/dotnet-new/CSharp_Console/project.json.template rename to src/dotnet/commands/dotnet-new/CSharp_Console/project.json.pretemplate index c1c73dfa9..666dee54e 100644 --- a/src/dotnet/commands/dotnet-new/CSharp_Console/project.json.template +++ b/src/dotnet/commands/dotnet-new/CSharp_Console/project.json.pretemplate @@ -6,7 +6,7 @@ "dependencies": { "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "$(NetCoreAppVersion)" } }, "frameworks": { diff --git a/src/dotnet/commands/dotnet-new/FSharp_Console/project.json.template b/src/dotnet/commands/dotnet-new/FSharp_Console/project.json.pretemplate similarity index 93% rename from src/dotnet/commands/dotnet-new/FSharp_Console/project.json.template rename to src/dotnet/commands/dotnet-new/FSharp_Console/project.json.pretemplate index 492a26337..e527b7159 100644 --- a/src/dotnet/commands/dotnet-new/FSharp_Console/project.json.template +++ b/src/dotnet/commands/dotnet-new/FSharp_Console/project.json.pretemplate @@ -11,7 +11,7 @@ "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-160316", "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "$(NetCoreAppVersion)" } }, "tools": { diff --git a/src/dotnet/project.json b/src/dotnet/project.json index 08f102aa5..72c39425c 100644 --- a/src/dotnet/project.json +++ b/src/dotnet/project.json @@ -41,7 +41,7 @@ "Microsoft.NETCore.TestHost": "1.0.0-rc2-24008", "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-24008" + "version": "1.0.0-rc2-*" }, "System.Diagnostics.TraceSource": "4.0.0-rc2-24008", "System.Diagnostics.TextWriterTraceListener": "4.0.0-rc2-24008", diff --git a/src/sharedframework/framework/project.json b/src/sharedframework/framework/project.json deleted file mode 100644 index 6d9bc2088..000000000 --- a/src/sharedframework/framework/project.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "version": "1.0.0-*", - "compilationOptions": { - "emitEntryPoint": true - }, - "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008" - }, - "runtimes": { - "win7-x64": {}, - "win7-x86": {}, - "osx.10.10-x64": {}, - "osx.10.11-x64": {}, - "ubuntu.14.04-x64": {}, - "centos.7-x64": {}, - "rhel.7.2-x64": {}, - "debian.8.2-x64": {} - }, - "frameworks": { - "dnxcore50": { - "imports": [ - "portable-net45+win8" - ] - } - } -} diff --git a/src/sharedframework/framework/project.json.template b/src/sharedframework/framework/project.json.template new file mode 100644 index 000000000..fde657ccc --- /dev/null +++ b/src/sharedframework/framework/project.json.template @@ -0,0 +1,19 @@ +{ + "version": "1.0.0-*", + "compilationOptions": { + "emitEntryPoint": true + }, + "dependencies": { + "Microsoft.NETCore.App": "$(NetCoreAppVersion)" + }, + "runtimes": { + "$(RID)": {} + }, + "frameworks": { + "dnxcore50": { + "imports": [ + "portable-net45+win8" + ] + } + } +} diff --git a/test/ArgumentForwardingTests/project.json b/test/ArgumentForwardingTests/project.json index 7cfded314..48d686660 100644 --- a/test/ArgumentForwardingTests/project.json +++ b/test/ArgumentForwardingTests/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.ProjectModel": { "target": "project" diff --git a/test/ArgumentsReflector/project.json b/test/ArgumentsReflector/project.json index 37f50ec47..6762af944 100644 --- a/test/ArgumentsReflector/project.json +++ b/test/ArgumentsReflector/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008" + "Microsoft.NETCore.App": "1.0.0-rc2-*" }, "frameworks": { "netstandardapp1.5": { diff --git a/test/EndToEnd/project.json b/test/EndToEnd/project.json index 7f147431e..5f372543a 100644 --- a/test/EndToEnd/project.json +++ b/test/EndToEnd/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.ProjectModel": { "target": "project" diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/project.json b/test/Microsoft.DotNet.Cli.Utils.Tests/project.json index 4a48665fb..6f30484c5 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/project.json +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/project.json @@ -4,7 +4,7 @@ "emitEntryPoint": true }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "NuGet.Versioning": "3.5.0-beta-1130", "NuGet.Packaging": "3.5.0-beta-1130", diff --git a/test/Microsoft.DotNet.Compiler.Common.Tests/project.json b/test/Microsoft.DotNet.Compiler.Common.Tests/project.json index 396dc3c1a..e9f279f08 100644 --- a/test/Microsoft.DotNet.Compiler.Common.Tests/project.json +++ b/test/Microsoft.DotNet.Compiler.Common.Tests/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" diff --git a/test/Microsoft.DotNet.ProjectModel.Tests/project.json b/test/Microsoft.DotNet.ProjectModel.Tests/project.json index ed31f5e14..446f872d4 100644 --- a/test/Microsoft.DotNet.ProjectModel.Tests/project.json +++ b/test/Microsoft.DotNet.ProjectModel.Tests/project.json @@ -4,7 +4,7 @@ "keyFile": "../../tools/test_key.snk" }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.ProjectModel": { "target": "project" diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/project.json b/test/Microsoft.DotNet.Tools.Tests.Utilities/project.json index 71542fac1..fba3d1fb5 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/project.json +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/project.json @@ -5,7 +5,7 @@ "keyFile": "../../tools/Key.snk" }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "System.Collections.Immutable": "1.2.0-rc2-24008", "System.Net.NetworkInformation": "4.1.0-rc2-24008", diff --git a/test/Microsoft.Extensions.DependencyModel.Tests/project.json b/test/Microsoft.Extensions.DependencyModel.Tests/project.json index 2393ecc24..c1cd852fa 100644 --- a/test/Microsoft.Extensions.DependencyModel.Tests/project.json +++ b/test/Microsoft.Extensions.DependencyModel.Tests/project.json @@ -5,7 +5,7 @@ "keyFile": "../../tools/Key.snk" }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" }, diff --git a/test/ScriptExecutorTests/project.json b/test/ScriptExecutorTests/project.json index d72919c8a..9b0dc4a13 100644 --- a/test/ScriptExecutorTests/project.json +++ b/test/ScriptExecutorTests/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "Microsoft.DotNet.ProjectModel": { "target": "project" }, diff --git a/test/dotnet-build.Tests/project.json b/test/dotnet-build.Tests/project.json index bb86ad070..fd2d4eb9d 100644 --- a/test/dotnet-build.Tests/project.json +++ b/test/dotnet-build.Tests/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" diff --git a/test/dotnet-compile.Tests/project.json b/test/dotnet-compile.Tests/project.json index bb5d589c0..de84dfc87 100644 --- a/test/dotnet-compile.Tests/project.json +++ b/test/dotnet-compile.Tests/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" diff --git a/test/dotnet-pack.Tests/project.json b/test/dotnet-pack.Tests/project.json index 6afeb6cbc..30ce4fea7 100644 --- a/test/dotnet-pack.Tests/project.json +++ b/test/dotnet-pack.Tests/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "System.IO.Compression.ZipFile": "4.0.1-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { diff --git a/test/dotnet-projectmodel-server.Tests/project.json b/test/dotnet-projectmodel-server.Tests/project.json index db79a5cdc..af5615ef9 100644 --- a/test/dotnet-projectmodel-server.Tests/project.json +++ b/test/dotnet-projectmodel-server.Tests/project.json @@ -1,6 +1,6 @@ { "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "dotnet": { "target": "project" }, diff --git a/test/dotnet-publish.Tests/project.json b/test/dotnet-publish.Tests/project.json index 546719974..b8ebd4eef 100644 --- a/test/dotnet-publish.Tests/project.json +++ b/test/dotnet-publish.Tests/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.TestFramework": "1.0.0-*", "Microsoft.DotNet.Tools.Tests.Utilities": { diff --git a/test/dotnet-resgen.Tests/project.json b/test/dotnet-resgen.Tests/project.json index ebb353742..a305b46f1 100644 --- a/test/dotnet-resgen.Tests/project.json +++ b/test/dotnet-resgen.Tests/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" diff --git a/test/dotnet-run.Tests/project.json b/test/dotnet-run.Tests/project.json index 29ca2db06..416e8b721 100644 --- a/test/dotnet-run.Tests/project.json +++ b/test/dotnet-run.Tests/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" diff --git a/test/dotnet-test.Tests/project.json b/test/dotnet-test.Tests/project.json index dcaec7496..26eae31c5 100644 --- a/test/dotnet-test.Tests/project.json +++ b/test/dotnet-test.Tests/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "Newtonsoft.Json": "7.0.1", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" diff --git a/test/dotnet-test.UnitTests/project.json b/test/dotnet-test.UnitTests/project.json index 068385484..679ee4215 100644 --- a/test/dotnet-test.UnitTests/project.json +++ b/test/dotnet-test.UnitTests/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "Newtonsoft.Json": "7.0.1", "dotnet": { "target": "project" diff --git a/test/dotnet.Tests/project.json b/test/dotnet.Tests/project.json index 7342ee11c..21eaff1f5 100644 --- a/test/dotnet.Tests/project.json +++ b/test/dotnet.Tests/project.json @@ -1,7 +1,7 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-24008", + "Microsoft.NETCore.App": "1.0.0-rc2-*", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project"