Merge branch 'rel'
This commit is contained in:
commit
b5329995d8
51 changed files with 481 additions and 623 deletions
|
@ -16,8 +16,9 @@
|
|||
<PackageReference Include="Microsoft.NETCore.App">
|
||||
<Version>1.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.NETCore.Sdk">
|
||||
<Version>1.0.0-alpha-20161007-1</Version>
|
||||
<PackageReference Include="Microsoft.NET.Sdk">
|
||||
<Version>1.0.0-alpha-20161010-1</Version>
|
||||
<PrivateAssets>All</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"frameworks": {
|
||||
"netstandard1.5": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Sdk": "1.0.0-alpha-20160923-4",
|
||||
"Microsoft.NET.Sdk": "1.0.0-alpha-20161010-1",
|
||||
"NETStandard.Library": "1.6.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"frameworks": {
|
||||
"netstandard1.5": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Sdk": "1.0.0-alpha-20160923-4",
|
||||
"Microsoft.NET.Sdk": "1.0.0-alpha-20161010-1",
|
||||
"NETStandard.Library": "1.6.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"frameworks": {
|
||||
"netstandard1.5": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Sdk": "1.0.0-alpha-20160923-4",
|
||||
"Microsoft.NET.Sdk": "1.0.0-alpha-20161010-1",
|
||||
"NETStandard.Library": "1.6.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,9 @@
|
|||
<PackageReference Include="Microsoft.NETCore.App">
|
||||
<Version>1.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.NETCore.Sdk">
|
||||
<Version>1.0.0-alpha-20161007-1</Version>
|
||||
<PackageReference Include="Microsoft.NET.Sdk">
|
||||
<Version>1.0.0-alpha-20161010-1</Version>
|
||||
<PrivateAssets>All</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MSTest.TestAdapter">
|
||||
<Version>1.0.3-preview</Version>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
DependsOnTargets="BuildDotnetCliBuildFramework" >
|
||||
|
||||
<!-- Current Runtime Information -->
|
||||
<GetCurrentRuntimeInformation>
|
||||
<GetCurrentRuntimeInformation OverrideRid="$(OverrideRid)">
|
||||
<Output TaskParameter="Rid" PropertyName="Rid" />
|
||||
<Output TaskParameter="Architecture" PropertyName="Architecture" />
|
||||
<Output TaskParameter="OSName" PropertyName="OSName" />
|
||||
|
|
|
@ -26,6 +26,12 @@
|
|||
<SdkInstallerNupkgFile>$(InstallerOutputDirectory)/VS.Redist.Common.Net.Core.SDK.$(Architecture).$(NugetVersion).nupkg</SdkInstallerNupkgFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Generate SDK MSI Inputs -->
|
||||
<ItemGroup>
|
||||
<GenerateSdkMsiInputs Include="$(SdkLayoutOutputDirectory)/**/*;
|
||||
$(SdkGenerateMsiPowershellScript)" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Consumed By Publish -->
|
||||
<ItemGroup>
|
||||
<GeneratedInstallers Include="$(SdkInstallerFile);$(CombinedFrameworkSdkHostInstallerFile)" />
|
||||
|
@ -75,8 +81,7 @@
|
|||
<Target Name="GenerateSdkMsi"
|
||||
DependsOnTargets="Init;Layout;AcquireWix;MsiTargetsSetupInputOutputs"
|
||||
Condition=" '$(OS)' == 'Windows_NT'"
|
||||
Inputs="$(SdkLayoutOutputDirectory);
|
||||
$(SdkGenerateMsiPowershellScript)"
|
||||
Inputs="@(GenerateSdkMsiInputs)"
|
||||
Outputs="$(SdkInstallerFile)">
|
||||
|
||||
<Exec Command="powershell -NoProfile -NoLogo $(SdkGenerateMsiPowershellScript)
|
||||
|
|
|
@ -224,15 +224,6 @@
|
|||
<Clean>False</Clean>
|
||||
<Frameworks>netstandard1.3</Frameworks>
|
||||
</BaseTestPackageProject>
|
||||
<BaseTestPackageProject Include="src/dotnet-compile-fsc">
|
||||
<Name>dotnet-compile-fsc</Name>
|
||||
<IsTool>True</IsTool>
|
||||
<IsApplicable>True</IsApplicable>
|
||||
<VersionPrefix>1.0.0-preview3-</VersionPrefix>
|
||||
<VersionSuffix>$(TestPackageBuildVersionSuffix)</VersionSuffix>
|
||||
<Clean>True</Clean>
|
||||
<Frameworks>netcoreapp1.0</Frameworks>
|
||||
</BaseTestPackageProject>
|
||||
|
||||
<TestPackageProjectFrameworksExcludes Condition=" '$(IsDesktopAvailable)' != 'True' " Include="net45" />
|
||||
<TestPackageProjectFrameworksExcludes Condition=" '$(IsDesktopAvailable)' != 'True' " Include="net451" />
|
||||
|
|
|
@ -38,9 +38,6 @@
|
|||
Include="test$(PathSeparator)TestingAbstractions$(PathSeparator)Microsoft.Extensions.Testing.Abstractions.Tests$(PathSeparator)project.json;
|
||||
test$(PathSeparator)TestingAbstractions$(PathSeparator)Microsoft.Extensions.Testing.Abstractions.UnitTests$(PathSeparator)project.json;" />
|
||||
|
||||
<PreTestProjectsToExclude Condition=" 'https://github.com/dotnet/cli/issues/3558' != 'fixed' "
|
||||
Include="test$(PathSeparator)dotnet-compile-fsc.Tests$(PathSeparator)project.json" />
|
||||
|
||||
<PreTestProjectsToExclude Condition=" 'https://github.com/dotnet/cli/issues/3216' != 'fixed' "
|
||||
Include="test$(PathSeparator)Kestrel.Tests$(PathSeparator)project.json" />
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
{
|
||||
public class GetCurrentRuntimeInformation : Task
|
||||
{
|
||||
public string OverrideRid { get; set; }
|
||||
|
||||
[Output]
|
||||
public string Rid { get; set; }
|
||||
|
||||
|
@ -20,7 +22,7 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
|
||||
public override bool Execute()
|
||||
{
|
||||
Rid = RuntimeEnvironment.GetRuntimeIdentifier();
|
||||
Rid = string.IsNullOrEmpty(OverrideRid) ? RuntimeEnvironment.GetRuntimeIdentifier() : OverrideRid;
|
||||
Architecture = RuntimeEnvironment.RuntimeArchitecture;
|
||||
OSName = Monikers.GetOSShortName();
|
||||
|
||||
|
|
15
scripts/obtain/dotnet-install.ps1
vendored
15
scripts/obtain/dotnet-install.ps1
vendored
|
@ -47,6 +47,8 @@
|
|||
.PARAMETER AzureFeed
|
||||
Default: https://dotnetcli.azureedge.net/dotnet
|
||||
This parameter should not be usually changed by user. It allows to change URL for the Azure feed used by this installer.
|
||||
.PARAMETER ProxyAddress
|
||||
If set, the installer will use the proxy when making web requests
|
||||
#>
|
||||
[cmdletbinding()]
|
||||
param(
|
||||
|
@ -59,7 +61,8 @@ param(
|
|||
[switch]$DryRun,
|
||||
[switch]$NoPath,
|
||||
[string]$AzureFeed="https://dotnetcli.azureedge.net/dotnet",
|
||||
[string]$UncachedFeed="https://dotnetcli.blob.core.windows.net/dotnet"
|
||||
[string]$UncachedFeed="https://dotnetcli.blob.core.windows.net/dotnet",
|
||||
[string]$ProxyAddress
|
||||
)
|
||||
|
||||
Set-StrictMode -Version Latest
|
||||
|
@ -133,7 +136,15 @@ function GetHTTPResponse([Uri] $Uri)
|
|||
try {
|
||||
# HttpClient is used vs Invoke-WebRequest in order to support Nano Server which doesn't support the Invoke-WebRequest cmdlet.
|
||||
Load-Assembly -Assembly System.Net.Http
|
||||
$HttpClient = New-Object System.Net.Http.HttpClient
|
||||
if($ProxyAddress){
|
||||
$HttpClientHandler = New-Object System.Net.Http.HttpClientHandler
|
||||
$HttpClientHandler.Proxy = New-Object System.Net.WebProxy -Property @{Address=$ProxyAddress}
|
||||
$HttpClient = New-Object System.Net.Http.HttpClient -ArgumentList $HttpClientHandler
|
||||
}
|
||||
else {
|
||||
$HttpClient = New-Object System.Net.Http.HttpClient
|
||||
}
|
||||
|
||||
$Response = $HttpClient.GetAsync($Uri).Result
|
||||
if (($Response -eq $null) -or (-not ($Response.IsSuccessStatusCode)))
|
||||
{
|
||||
|
|
|
@ -5,3 +5,4 @@ using System.Runtime.CompilerServices;
|
|||
[assembly: InternalsVisibleTo("dotnet, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("Microsoft.DotNet.Tools.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("Microsoft.DotNet.Cli.Utils.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("Microsoft.DotNet.Tools.Tests.Utilities, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
|
|
|
@ -5,6 +5,6 @@ namespace Microsoft.DotNet.ProjectJsonMigration
|
|||
{
|
||||
public class ConstantPackageNames
|
||||
{
|
||||
public const string CSdkPackageName = "Microsoft.NETCore.Sdk";
|
||||
public const string CSdkPackageName = "Microsoft.NET.Sdk";
|
||||
}
|
||||
}
|
|
@ -11,6 +11,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Models
|
|||
|
||||
private readonly string _metadataValue;
|
||||
private readonly Func<T, string> _metadataValueFunc;
|
||||
private readonly Func<T, bool> _writeMetadataConditionFunc;
|
||||
|
||||
public ItemMetadataValue(string metadataName, string metadataValue)
|
||||
{
|
||||
|
@ -18,10 +19,16 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Models
|
|||
_metadataValue = metadataValue;
|
||||
}
|
||||
|
||||
public ItemMetadataValue(string metadataName, Func<T, string> metadataValueFunc)
|
||||
public ItemMetadataValue(string metadataName, Func<T, string> metadataValueFunc, Func<T, bool> writeMetadataConditionFunc = null)
|
||||
{
|
||||
MetadataName = metadataName;
|
||||
_metadataValueFunc = metadataValueFunc;
|
||||
_writeMetadataConditionFunc = writeMetadataConditionFunc;
|
||||
}
|
||||
|
||||
public bool ShouldWriteMetadata(T source)
|
||||
{
|
||||
return _writeMetadataConditionFunc == null || _writeMetadataConditionFunc(source);
|
||||
}
|
||||
|
||||
public string GetMetadataValue(T source)
|
||||
|
|
|
@ -43,7 +43,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
|
|||
new PackageDependencyInfo
|
||||
{
|
||||
Name = ConstantPackageNames.CSdkPackageName,
|
||||
Version = migrationSettings.SdkPackageVersion
|
||||
Version = migrationSettings.SdkPackageVersion,
|
||||
PrivateAssets = "All"
|
||||
}), migrationRuleInputs.CommonItemGroup);
|
||||
|
||||
// Migrate Direct Deps first
|
||||
|
@ -128,7 +129,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
|
|||
itemGroup.Condition = condition;
|
||||
|
||||
foreach (var packageDependency in packageDependencies)
|
||||
{
|
||||
{
|
||||
MigrationTrace.Instance.WriteLine(packageDependency.Name);
|
||||
AddItemTransform<ProjectLibraryDependency> transform;
|
||||
|
||||
|
@ -139,9 +140,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
|
|||
else
|
||||
{
|
||||
transform = PackageDependencyTransform();
|
||||
if (packageDependency.Type == LibraryDependencyType.Build)
|
||||
if (packageDependency.Type.Equals(LibraryDependencyType.Build))
|
||||
{
|
||||
transform = transform.WithMetadata("PrivateAssets", "all");
|
||||
transform = transform.WithMetadata("PrivateAssets", "All");
|
||||
}
|
||||
else if (packageDependency.SuppressParent != LibraryIncludeFlagUtils.DefaultSuppressParent)
|
||||
{
|
||||
|
@ -162,11 +163,16 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
|
|||
|
||||
private string ReadLibraryIncludeFlags(LibraryIncludeFlags includeFlags)
|
||||
{
|
||||
if ((includeFlags & LibraryIncludeFlags.All) == LibraryIncludeFlags.All)
|
||||
if ((includeFlags ^ LibraryIncludeFlags.All) == 0)
|
||||
{
|
||||
return "All";
|
||||
}
|
||||
|
||||
if ((includeFlags ^ LibraryIncludeFlags.None) == 0)
|
||||
{
|
||||
return "None";
|
||||
}
|
||||
|
||||
var flagString = "";
|
||||
var allFlagsAndNames = new List<Tuple<string, LibraryIncludeFlags>>
|
||||
{
|
||||
|
@ -228,7 +234,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
|
|||
dep => dep.Name,
|
||||
dep => "",
|
||||
dep => true)
|
||||
.WithMetadata("Version", r => r.Version);
|
||||
.WithMetadata("Version", r => r.Version)
|
||||
.WithMetadata("PrivateAssets", r => r.PrivateAssets, r => !string.IsNullOrEmpty(r.PrivateAssets));
|
||||
|
||||
private AddItemTransform<ProjectLibraryDependency> ToolTransform => new AddItemTransform<ProjectLibraryDependency>(
|
||||
"DotNetCliToolReference",
|
||||
|
@ -247,6 +254,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
|
|||
{
|
||||
public string Name {get; set;}
|
||||
public string Version {get; set;}
|
||||
public string PrivateAssets {get; set;}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,9 +82,12 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
return this;
|
||||
}
|
||||
|
||||
public AddItemTransform<T> WithMetadata(string metadataName, Func<T, string> metadataValueFunc)
|
||||
public AddItemTransform<T> WithMetadata(
|
||||
string metadataName,
|
||||
Func<T, string> metadataValueFunc,
|
||||
Func<T, bool> writeMetadataConditionFunc = null)
|
||||
{
|
||||
_metadata.Add(new ItemMetadataValue<T>(metadataName, metadataValueFunc));
|
||||
_metadata.Add(new ItemMetadataValue<T>(metadataName, metadataValueFunc, writeMetadataConditionFunc));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -104,7 +107,10 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
|
||||
foreach (var metadata in _metadata)
|
||||
{
|
||||
item.AddMetadata(metadata.MetadataName, metadata.GetMetadataValue(source));
|
||||
if (metadata.ShouldWriteMetadata(source))
|
||||
{
|
||||
item.AddMetadata(metadata.MetadataName, metadata.GetMetadataValue(source));
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
|
|
|
@ -885,7 +885,7 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
}
|
||||
else
|
||||
{
|
||||
values = token.Value<string[]>();
|
||||
values = token.Values<string>();
|
||||
}
|
||||
result = values
|
||||
.SelectMany(value => value.Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries));
|
||||
|
|
|
@ -1,363 +0,0 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using Microsoft.DotNet.Cli.CommandLine;
|
||||
using Microsoft.DotNet.Cli.Compiler.Common;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.ProjectModel;
|
||||
using Microsoft.DotNet.ProjectModel.Resolution;
|
||||
using NuGet.Configuration;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Compiler.Fsc
|
||||
{
|
||||
public class CompileFscCommand
|
||||
{
|
||||
private const int ExitFailed = 1;
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
DebugHelper.HandleDebugSwitch(ref args);
|
||||
|
||||
CommandLineApplication app = new CommandLineApplication();
|
||||
app.Name = "dotnet compile-fsc";
|
||||
app.FullName = ".NET F# Compiler";
|
||||
app.Description = "F# Compiler for the .NET Platform";
|
||||
app.HandleResponseFiles = true;
|
||||
app.HelpOption("-h|--help");
|
||||
|
||||
CommonCompilerOptionsCommandLine commonCompilerCommandLine = CommonCompilerOptionsCommandLine.AddOptions(app);
|
||||
AssemblyInfoOptionsCommandLine assemblyInfoCommandLine = AssemblyInfoOptionsCommandLine.AddOptions(app);
|
||||
|
||||
CommandOption tempOutputOption = app.Option("--temp-output <arg>", "Compilation temporary directory", CommandOptionType.SingleValue);
|
||||
CommandOption outputNameOption = app.Option("--out <arg>", "Name of the output assembly", CommandOptionType.SingleValue);
|
||||
CommandOption referencesOption = app.Option("--reference <arg>...", "Path to a compiler metadata reference", CommandOptionType.MultipleValue);
|
||||
CommandOption resourcesOption = app.Option("--resource <arg>...", "Resources to embed", CommandOptionType.MultipleValue);
|
||||
CommandArgument sourcesArgument = app.Argument("<source-files>...", "Compilation sources", multipleValues: true);
|
||||
|
||||
app.OnExecute(() =>
|
||||
{
|
||||
if (!tempOutputOption.HasValue())
|
||||
{
|
||||
Reporter.Error.WriteLine("Option '--temp-output' is required");
|
||||
return ExitFailed;
|
||||
}
|
||||
|
||||
CommonCompilerOptions commonOptions = commonCompilerCommandLine.GetOptionValues();
|
||||
|
||||
AssemblyInfoOptions assemblyInfoOptions = assemblyInfoCommandLine.GetOptionValues();
|
||||
|
||||
// TODO less hacky
|
||||
bool targetNetCore =
|
||||
commonOptions.Defines.Contains("DNXCORE50") ||
|
||||
commonOptions.Defines.Where(d => d.StartsWith("NETSTANDARDAPP1_")).Any() ||
|
||||
commonOptions.Defines.Where(d => d.StartsWith("NETCOREAPP1_")).Any() ||
|
||||
commonOptions.Defines.Where(d => d.StartsWith("NETSTANDARD1_")).Any();
|
||||
|
||||
// Get FSC Path upfront to use it for win32manifest path
|
||||
string tempOutDir = tempOutputOption.Value();
|
||||
var fscCommandSpec = ResolveFsc(null, tempOutDir);
|
||||
var fscExeFile = fscCommandSpec.FscExeFile;
|
||||
var fscExeDir = fscCommandSpec.FscExeDir;
|
||||
|
||||
// FSC arguments
|
||||
var allArgs = new List<string>();
|
||||
|
||||
//HACK fsc raise error FS0208 if target exe doesnt have extension .exe
|
||||
bool hackFS0208 = targetNetCore && commonOptions.EmitEntryPoint == true;
|
||||
|
||||
string outputName = outputNameOption.Value();
|
||||
var originalOutputName = outputName;
|
||||
|
||||
if (outputName != null)
|
||||
{
|
||||
if (hackFS0208)
|
||||
{
|
||||
outputName = Path.ChangeExtension(outputName, ".exe");
|
||||
}
|
||||
|
||||
allArgs.Add($"--out:{outputName}");
|
||||
}
|
||||
|
||||
//let's pass debugging type only if options.DebugType is specified, until
|
||||
//portablepdb are confirmed to work.
|
||||
//so it's possibile to test portable pdb without breaking existing build
|
||||
if (string.IsNullOrEmpty(commonOptions.DebugType))
|
||||
{
|
||||
//debug info (only windows pdb supported, not portablepdb)
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
allArgs.Add("--debug");
|
||||
//TODO check if full or pdbonly
|
||||
allArgs.Add("--debug:pdbonly");
|
||||
}
|
||||
else
|
||||
allArgs.Add("--debug-");
|
||||
}
|
||||
else
|
||||
{
|
||||
allArgs.Add("--debug");
|
||||
allArgs.Add($"--debug:{commonOptions.DebugType}");
|
||||
}
|
||||
|
||||
// Default options
|
||||
allArgs.Add("--noframework");
|
||||
allArgs.Add("--nologo");
|
||||
allArgs.Add("--simpleresolution");
|
||||
allArgs.Add("--nocopyfsharpcore");
|
||||
|
||||
// project.json compilationOptions
|
||||
if (commonOptions.Defines != null)
|
||||
{
|
||||
allArgs.AddRange(commonOptions.Defines.Select(def => $"--define:{def}"));
|
||||
}
|
||||
|
||||
if (commonOptions.GenerateXmlDocumentation == true)
|
||||
{
|
||||
allArgs.Add($"--doc:{Path.ChangeExtension(outputName, "xml")}");
|
||||
}
|
||||
|
||||
if (commonOptions.KeyFile != null)
|
||||
{
|
||||
allArgs.Add($"--keyfile:{commonOptions.KeyFile}");
|
||||
}
|
||||
|
||||
if (commonOptions.Optimize == true)
|
||||
{
|
||||
allArgs.Add("--optimize+");
|
||||
}
|
||||
|
||||
//--resource doesnt expect "
|
||||
//bad: --resource:"path/to/file",name
|
||||
//ok: --resource:path/to/file,name
|
||||
allArgs.AddRange(resourcesOption.Values.Select(resource => $"--resource:{resource.Replace("\"", "")}"));
|
||||
|
||||
allArgs.AddRange(referencesOption.Values.Select(r => $"-r:{r}"));
|
||||
|
||||
if (commonOptions.EmitEntryPoint != true)
|
||||
{
|
||||
allArgs.Add("--target:library");
|
||||
}
|
||||
else
|
||||
{
|
||||
allArgs.Add("--target:exe");
|
||||
|
||||
//HACK we need default.win32manifest for exe
|
||||
var win32manifestPath = Path.Combine(fscExeDir, "..", "..", "runtimes", "any", "native", "default.win32manifest");
|
||||
allArgs.Add($"--win32manifest:{win32manifestPath}");
|
||||
}
|
||||
|
||||
if (commonOptions.SuppressWarnings != null && commonOptions.SuppressWarnings.Any())
|
||||
{
|
||||
allArgs.Add("--nowarn:" + string.Join(",", commonOptions.SuppressWarnings.ToArray()));
|
||||
}
|
||||
|
||||
if (commonOptions.LanguageVersion != null)
|
||||
{
|
||||
// Not used in fsc
|
||||
}
|
||||
|
||||
if (commonOptions.Platform != null)
|
||||
{
|
||||
allArgs.Add($"--platform:{commonOptions.Platform}");
|
||||
}
|
||||
|
||||
if (commonOptions.AllowUnsafe == true)
|
||||
{
|
||||
}
|
||||
|
||||
if (commonOptions.WarningsAsErrors == true)
|
||||
{
|
||||
allArgs.Add("--warnaserror");
|
||||
}
|
||||
|
||||
//set target framework
|
||||
if (targetNetCore)
|
||||
{
|
||||
allArgs.Add("--targetprofile:netcore");
|
||||
}
|
||||
|
||||
if (commonOptions.DelaySign == true)
|
||||
{
|
||||
allArgs.Add("--delaysign+");
|
||||
}
|
||||
|
||||
if (commonOptions.PublicSign == true)
|
||||
{
|
||||
}
|
||||
|
||||
if (commonOptions.AdditionalArguments != null)
|
||||
{
|
||||
// Additional arguments are added verbatim
|
||||
allArgs.AddRange(commonOptions.AdditionalArguments);
|
||||
}
|
||||
|
||||
// Generate assembly info
|
||||
var assemblyInfo = Path.Combine(tempOutDir, $"dotnet-compile.assemblyinfo.fs");
|
||||
File.WriteAllText(assemblyInfo, AssemblyInfoFileGenerator.GenerateFSharp(assemblyInfoOptions));
|
||||
|
||||
//source files + assemblyInfo
|
||||
allArgs.AddRange(GetSourceFiles(sourcesArgument.Values, assemblyInfo).ToArray());
|
||||
|
||||
//TODO check the switch enabled in fsproj in RELEASE and DEBUG configuration
|
||||
|
||||
var rsp = Path.Combine(tempOutDir, "dotnet-compile-fsc.rsp");
|
||||
File.WriteAllLines(rsp, allArgs, Encoding.UTF8);
|
||||
|
||||
// Execute FSC!
|
||||
var result = RunFsc(new List<string> { $"@{rsp}" }, tempOutDir)
|
||||
.ForwardStdErr()
|
||||
.ForwardStdOut()
|
||||
.Execute();
|
||||
|
||||
bool successFsc = result.ExitCode == 0;
|
||||
|
||||
if (hackFS0208 && File.Exists(outputName))
|
||||
{
|
||||
if (File.Exists(originalOutputName))
|
||||
File.Delete(originalOutputName);
|
||||
File.Move(outputName, originalOutputName);
|
||||
}
|
||||
|
||||
//HACK dotnet build require a pdb (crash without), fsc atm cant generate a portable pdb, so an empty pdb is created
|
||||
string pdbPath = Path.ChangeExtension(outputName, ".pdb");
|
||||
if (successFsc && !File.Exists(pdbPath))
|
||||
{
|
||||
File.WriteAllBytes(pdbPath, Array.Empty<byte>());
|
||||
}
|
||||
|
||||
return result.ExitCode;
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
return app.Execute(args);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Reporter.Error.WriteLine(ex.ToString());
|
||||
#else
|
||||
Reporter.Error.WriteLine(ex.Message);
|
||||
#endif
|
||||
return ExitFailed;
|
||||
}
|
||||
}
|
||||
|
||||
// The assembly info must be in the last minus 1 position because:
|
||||
// - assemblyInfo should be in the end to override attributes
|
||||
// - assemblyInfo cannot be in the last position, because last file contains the main
|
||||
private static IEnumerable<string> GetSourceFiles(IReadOnlyList<string> sourceFiles, string assemblyInfo)
|
||||
{
|
||||
if (!sourceFiles.Any())
|
||||
{
|
||||
yield return assemblyInfo;
|
||||
yield break;
|
||||
}
|
||||
|
||||
foreach (var s in sourceFiles.Take(sourceFiles.Count() - 1))
|
||||
yield return s;
|
||||
|
||||
yield return assemblyInfo;
|
||||
|
||||
yield return sourceFiles.Last();
|
||||
}
|
||||
|
||||
private static Command RunFsc(List<string> fscArgs, string temp)
|
||||
{
|
||||
var fscEnvExe = Environment.GetEnvironmentVariable("DOTNET_FSC_PATH");
|
||||
var exec = Environment.GetEnvironmentVariable("DOTNET_FSC_EXEC")?.ToUpper() ?? "COREHOST";
|
||||
|
||||
var muxer = new Muxer();
|
||||
|
||||
if (fscEnvExe != null)
|
||||
{
|
||||
switch (exec)
|
||||
{
|
||||
case "RUN":
|
||||
return Command.Create(fscEnvExe, fscArgs.ToArray());
|
||||
|
||||
case "COREHOST":
|
||||
default:
|
||||
var host = muxer.MuxerPath;
|
||||
return Command.Create(host, new[] { fscEnvExe }.Concat(fscArgs).ToArray());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var fscCommandSpec = ResolveFsc(fscArgs, temp)?.Spec;
|
||||
return Command.Create(fscCommandSpec);
|
||||
}
|
||||
}
|
||||
|
||||
private static FscCommandSpec ResolveFsc(List<string> fscArgs, string temp)
|
||||
{
|
||||
var nugetPackagesRoot = NuGetPathContext.Create(Directory.GetCurrentDirectory())?.UserPackageFolder;
|
||||
var depsFile = Path.Combine(AppContext.BaseDirectory, "dotnet-compile-fsc" + FileNameSuffixes.DepsJson);
|
||||
|
||||
var depsJsonCommandResolver = new DepsJsonCommandResolver(nugetPackagesRoot);
|
||||
var dependencyContext = depsJsonCommandResolver.LoadDependencyContextFromFile(depsFile);
|
||||
var fscPath = depsJsonCommandResolver.GetCommandPathFromDependencyContext("fsc", dependencyContext);
|
||||
|
||||
|
||||
var commandResolverArgs = new CommandResolverArguments()
|
||||
{
|
||||
CommandName = "fsc",
|
||||
CommandArguments = fscArgs,
|
||||
DepsJsonFile = depsFile
|
||||
};
|
||||
|
||||
var fscCommandSpec = depsJsonCommandResolver.Resolve(commandResolverArgs);
|
||||
|
||||
var runtimeConfigFile = Path.Combine(
|
||||
Path.GetDirectoryName(typeof(CompileFscCommand).GetTypeInfo().Assembly.Location)
|
||||
, "dotnet-compile-fsc" + FileNameSuffixes.RuntimeConfigJson);
|
||||
|
||||
|
||||
CopyRuntimeConfigForFscExe(runtimeConfigFile, "fsc", depsFile, nugetPackagesRoot, fscPath);
|
||||
|
||||
return new FscCommandSpec
|
||||
{
|
||||
Spec = fscCommandSpec,
|
||||
FscExeDir = Path.GetDirectoryName(fscPath),
|
||||
FscExeFile = fscPath
|
||||
};
|
||||
}
|
||||
|
||||
private static void CopyRuntimeConfigForFscExe(
|
||||
string runtimeConfigFile,
|
||||
string commandName,
|
||||
string depsJsonFile,
|
||||
string nugetPackagesRoot,
|
||||
string fscPath)
|
||||
{
|
||||
var newFscRuntimeConfigDir = Path.GetDirectoryName(fscPath);
|
||||
var newFscRuntimeConfigFile = Path.Combine(
|
||||
newFscRuntimeConfigDir,
|
||||
Path.GetFileNameWithoutExtension(fscPath) + FileNameSuffixes.RuntimeConfigJson);
|
||||
|
||||
try
|
||||
{
|
||||
File.Copy(runtimeConfigFile, newFscRuntimeConfigFile, true);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Reporter.Error.WriteLine("Failed to copy fsc runtimeconfig.json");
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private class FscCommandSpec
|
||||
{
|
||||
public CommandSpec Spec { get; set; }
|
||||
public string FscExeDir { get; set; }
|
||||
public string FscExeFile { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>60cf7e6c-d6c8-439d-b7b7-d8a27e29be2c</ProjectGuid>
|
||||
<RootNamespace>Microsoft.DotNet.Tools.Compiler.Fsc</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
|
@ -1,39 +0,0 @@
|
|||
{
|
||||
"version": "1.0.0-preview3-*",
|
||||
"buildOptions": {
|
||||
"emitEntryPoint": true,
|
||||
"compile": {
|
||||
"include": [
|
||||
"**/*.cs",
|
||||
"../dotnet/CommandLine/*.cs",
|
||||
"../dotnet/commands/dotnet-compile-csc/AssemblyInfoOptionsCommandLine.cs",
|
||||
"../dotnet/commands/dotnet-compile-csc/CommonCompilerOptionsCommandLine.cs"
|
||||
]
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.FSharp.Compiler.netcore": "1.0.0-alpha-160509",
|
||||
"Microsoft.DotNet.ProjectModel": {
|
||||
"target": "project"
|
||||
},
|
||||
"Microsoft.DotNet.Compiler.Common": {
|
||||
"target": "project"
|
||||
},
|
||||
"Microsoft.DotNet.Cli.Utils": {
|
||||
"target": "project"
|
||||
},
|
||||
"Microsoft.NETCore.App": {
|
||||
"type": "platform",
|
||||
"version": "1.0.1"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
"imports": [
|
||||
"dnxcore50",
|
||||
"portable-net45+win81",
|
||||
"netstandard1.3"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@ using Microsoft.DotNet.PlatformAbstractions;
|
|||
using Microsoft.DotNet.ProjectModel.Server;
|
||||
using Microsoft.DotNet.Tools.Build;
|
||||
using Microsoft.DotNet.Tools.Build3;
|
||||
using Microsoft.DotNet.Tools.Clean3;
|
||||
using Microsoft.DotNet.Tools.Compiler;
|
||||
using Microsoft.DotNet.Tools.Compiler.Csc;
|
||||
using Microsoft.DotNet.Tools.Help;
|
||||
|
@ -47,6 +48,7 @@ namespace Microsoft.DotNet.Cli
|
|||
["run"] = RunCommand.Run,
|
||||
["test"] = TestCommand.Run,
|
||||
["build3"] = Build3Command.Run,
|
||||
["clean3"] = Clean3Command.Run,
|
||||
["msbuild"] = MSBuildCommand.Run,
|
||||
["run3"] = Run3Command.Run,
|
||||
["restore3"] = Restore3Command.Run,
|
||||
|
|
68
src/dotnet/commands/dotnet-clean3/Program.cs
Normal file
68
src/dotnet/commands/dotnet-clean3/Program.cs
Normal file
|
@ -0,0 +1,68 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.DotNet.Cli.CommandLine;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.Tools.MSBuild;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Clean3
|
||||
{
|
||||
public class Clean3Command
|
||||
{
|
||||
public static int Run(string[] args)
|
||||
{
|
||||
DebugHelper.HandleDebugSwitch(ref args);
|
||||
|
||||
CommandLineApplication app = new CommandLineApplication(throwOnUnexpectedArg: false)
|
||||
{
|
||||
Name = "dotnet clean3",
|
||||
FullName = ".NET Clean Command",
|
||||
Description = "Command to clean previously generated build outputs.",
|
||||
AllowArgumentSeparator = true
|
||||
};
|
||||
app.HelpOption("-h|--help");
|
||||
|
||||
CommandArgument projectArgument = app.Argument("<PROJECT>",
|
||||
"The MSBuild project file to build. If a project file is not specified," +
|
||||
" MSBuild searches the current working directory for a file that has a file extension that ends in `proj` and uses that file.");
|
||||
|
||||
CommandOption outputOption = app.Option("-o|--output <OUTPUT_DIR>", "Directory in which the build outputs have been placed", CommandOptionType.SingleValue);
|
||||
CommandOption frameworkOption = app.Option("-f|--framework <FRAMEWORK>", "Clean a specific framework", CommandOptionType.SingleValue);
|
||||
CommandOption configurationOption = app.Option("-c|--configuration <CONFIGURATION>", "Clean a specific configuration", CommandOptionType.SingleValue);
|
||||
|
||||
app.OnExecute(() =>
|
||||
{
|
||||
List<string> msbuildArgs = new List<string>();
|
||||
|
||||
if (!string.IsNullOrEmpty(projectArgument.Value))
|
||||
{
|
||||
msbuildArgs.Add(projectArgument.Value);
|
||||
}
|
||||
|
||||
msbuildArgs.Add("/t:Clean");
|
||||
|
||||
if (outputOption.HasValue())
|
||||
{
|
||||
msbuildArgs.Add($"/p:OutputPath={outputOption.Value()}");
|
||||
}
|
||||
|
||||
if (frameworkOption.HasValue())
|
||||
{
|
||||
msbuildArgs.Add($"/p:TargetFramework={frameworkOption.Value()}");
|
||||
}
|
||||
|
||||
if (configurationOption.HasValue())
|
||||
{
|
||||
msbuildArgs.Add($"/p:Configuration={configurationOption.Value()}");
|
||||
}
|
||||
|
||||
msbuildArgs.AddRange(app.RemainingArguments);
|
||||
|
||||
return new MSBuildForwardingApp(msbuildArgs).Execute();
|
||||
});
|
||||
|
||||
return app.Execute(args);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -195,21 +195,24 @@ namespace Microsoft.DotNet.Tools.Migrate
|
|||
else if (projectArg.EndsWith(GlobalSettings.FileName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
projects = GetProjectsFromGlobalJson(projectArg);
|
||||
if (!projects.Any())
|
||||
{
|
||||
throw new Exception("Unable to find any projects in global.json");
|
||||
}
|
||||
}
|
||||
else if (Directory.Exists(projectArg))
|
||||
{
|
||||
projects = Directory.EnumerateFiles(projectArg, Project.FileName, SearchOption.AllDirectories);
|
||||
if (!projects.Any())
|
||||
{
|
||||
throw new Exception($"No project.json file found in '{projectArg}'");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"Invalid project argument - '{projectArg}' is not a project.json or a global.json file and a directory named '{projectArg}' doesn't exist.");
|
||||
}
|
||||
|
||||
if (!projects.Any())
|
||||
{
|
||||
throw new Exception($"Invalid project argument - Unable to find any projects in global.json or directory '{projectArg}'");
|
||||
}
|
||||
|
||||
|
||||
foreach(var project in projects)
|
||||
{
|
||||
yield return GetProjectJsonPath(project);
|
||||
|
|
|
@ -69,6 +69,7 @@ namespace Microsoft.DotNet.Tools.Migrate
|
|||
#else
|
||||
Reporter.Error.WriteLine(ex.Message);
|
||||
#endif
|
||||
Reporter.Error.WriteLine("Migration failed.");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,9 @@
|
|||
<PackageReference Include="Microsoft.NETCore.App">
|
||||
<Version>1.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.NETCore.Sdk">
|
||||
<Version>1.0.0-alpha-20161007-1</Version>
|
||||
<PackageReference Include="Microsoft.NET.Sdk">
|
||||
<Version>1.0.0-alpha-20161010-1</Version>
|
||||
<PrivateAssets>All</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
"exclude": "compile"
|
||||
},
|
||||
|
||||
"Microsoft.Build": "15.1.298-preview5",
|
||||
"Microsoft.Build": "15.1.316-preview5",
|
||||
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000933"
|
||||
},
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"tool_nuget": "1.0.0-preview3-*",
|
||||
"tool_msbuild": "1.0.0-preview3-*",
|
||||
|
||||
"Microsoft.Build.Runtime": "15.1.298-preview5",
|
||||
"Microsoft.Build.Runtime": "15.1.316-preview5",
|
||||
"Microsoft.CodeAnalysis.Build.Tasks": "2.0.0-beta6-60922-08",
|
||||
"System.Runtime.Serialization.Xml": "4.1.1",
|
||||
"NuGet.Build.Tasks": "3.6.0-rc-1954",
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"type": "platform",
|
||||
"version": "1.0.1"
|
||||
},
|
||||
"Microsoft.Build.Runtime": "15.1.298-preview5",
|
||||
"Microsoft.Build.Runtime": "15.1.316-preview5",
|
||||
"Microsoft.Net.Compilers.netcore": "2.0.0-beta6-60922-08",
|
||||
"Microsoft.CodeAnalysis.Build.Tasks": "2.0.0-beta6-60922-08",
|
||||
"Microsoft.Cci": "4.0.0-rc3-24128-00",
|
||||
|
|
|
@ -196,7 +196,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
|
|||
TestProject = Path.Combine(TestDirectory, "project.json");
|
||||
OutputDirectory = Path.Combine(TestDirectory, s_outputdirName);
|
||||
|
||||
Rid = RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier();
|
||||
Rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
|
||||
}
|
||||
|
||||
private static void SetupStaticTestProject()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.IO;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Xunit;
|
||||
|
||||
|
@ -9,7 +10,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
|
|||
public class GivenDotNetUsesMSBuild : TestBase
|
||||
{
|
||||
[Fact]
|
||||
public void ItCanNewRestoreBuildRunMSBuildProject()
|
||||
public void ItCanNewRestoreBuildRunCleanMSBuildProject()
|
||||
{
|
||||
using (DisposableDirectory directory = Temp.CreateDirectory())
|
||||
{
|
||||
|
@ -41,6 +42,17 @@ namespace Microsoft.DotNet.Tests.EndToEnd
|
|||
.Pass()
|
||||
.And
|
||||
.HaveStdOutContaining("Hello World!");
|
||||
|
||||
var binDirectory = new DirectoryInfo(projectDirectory).Sub("bin");
|
||||
binDirectory.Should().HaveFilesMatching("*.dll", SearchOption.AllDirectories);
|
||||
|
||||
new Clean3Command()
|
||||
.WithWorkingDirectory(projectDirectory)
|
||||
.Execute()
|
||||
.Should()
|
||||
.Pass();
|
||||
|
||||
binDirectory.Should().NotHaveFilesMatching("*.dll", SearchOption.AllDirectories);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using FluentAssertions;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.ProjectModel;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
|
@ -227,8 +228,8 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
var projectContext = ProjectContext.Create(
|
||||
testInstance.Path,
|
||||
FrameworkConstants.CommonFrameworks.NetCoreApp10,
|
||||
RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers());
|
||||
|
||||
DotnetRuntimeIdentifiers.InferCurrentRuntimeIdentifiers());
|
||||
|
||||
var depsFilePath =
|
||||
projectContext.GetOutputPaths("Debug", outputPath: outputDir).RuntimeFiles.DepsJson;
|
||||
|
||||
|
@ -267,7 +268,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
var projectContext = ProjectContext.Create(
|
||||
testInstance.Path,
|
||||
FrameworkConstants.CommonFrameworks.NetCoreApp10,
|
||||
RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers());
|
||||
DotnetRuntimeIdentifiers.InferCurrentRuntimeIdentifiers());
|
||||
|
||||
var depsFilePath =
|
||||
projectContext.GetOutputPaths("Debug", buildBasePath).RuntimeFiles.DepsJson;
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace StreamForwarderTests
|
|||
{
|
||||
public class StreamForwarderTests : TestBase
|
||||
{
|
||||
private static readonly string s_rid = RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier();
|
||||
private static readonly string s_rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
|
||||
|
||||
public static void Main()
|
||||
{
|
||||
|
|
|
@ -9,8 +9,12 @@
|
|||
"../../TestAssets/TestProjects/TestAppWithArgs/*",
|
||||
"../../TestAssets/TestProjects/AppWithDirectAndToolDependency/**/*",
|
||||
"../../TestAssets/TestProjects/AppWithDirectDependency/**/*",
|
||||
"../../TestAssets/TestProjects/AppWithToolDependency/**/*"
|
||||
]
|
||||
"../../TestAssets/TestProjects/AppWithToolDependency/**/*",
|
||||
"../../artifacts/*/stage2/sdk/*/.version"
|
||||
],
|
||||
"mappings": {
|
||||
".version": "../../artifacts/*/stage2/sdk/*/.version"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -6,6 +6,7 @@ using Microsoft.DotNet.Tools.Test.Utilities;
|
|||
using System.Linq;
|
||||
using Xunit;
|
||||
using FluentAssertions;
|
||||
using Microsoft.DotNet.ProjectJsonMigration;
|
||||
using Microsoft.DotNet.ProjectJsonMigration.Rules;
|
||||
using System;
|
||||
|
||||
|
@ -27,6 +28,126 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
EmitsPackageReferences(mockProj, Tuple.Create("APackage", "1.0.0-preview", ""), Tuple.Create("BPackage", "1.0.0", ""));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void It_migrates_type_build_to_PrivateAssets()
|
||||
{
|
||||
var mockProj = RunPackageDependenciesRuleOnPj(@"
|
||||
{
|
||||
""dependencies"": {
|
||||
""APackage"" : {
|
||||
""version"": ""1.0.0-preview"",
|
||||
""type"": ""build""
|
||||
}
|
||||
}
|
||||
}");
|
||||
|
||||
|
||||
var packageRef = mockProj.Items.First(i => i.Include == "APackage" && i.ItemType == "PackageReference");
|
||||
|
||||
var privateAssetsMetadata = packageRef.GetMetadataWithName("PrivateAssets");
|
||||
privateAssetsMetadata.Value.Should().NotBeNull();
|
||||
privateAssetsMetadata.Value.Should().Be("All");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void It_migrates_suppress_parent_array_to_PrivateAssets()
|
||||
{
|
||||
var mockProj = RunPackageDependenciesRuleOnPj(@"
|
||||
{
|
||||
""dependencies"": {
|
||||
""APackage"" : {
|
||||
""version"": ""1.0.0-preview"",
|
||||
""suppressParent"":[ ""runtime"", ""native"" ]
|
||||
}
|
||||
}
|
||||
}");
|
||||
var packageRef = mockProj.Items.First(i => i.Include == "APackage" && i.ItemType == "PackageReference");
|
||||
|
||||
var privateAssetsMetadata = packageRef.GetMetadataWithName("PrivateAssets");
|
||||
privateAssetsMetadata.Value.Should().NotBeNull();
|
||||
privateAssetsMetadata.Value.Should().Be("Native;Runtime");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void It_migrates_suppress_parent_string_to_PrivateAssets()
|
||||
{
|
||||
var mockProj = RunPackageDependenciesRuleOnPj(@"
|
||||
{
|
||||
""dependencies"": {
|
||||
""APackage"" : {
|
||||
""version"": ""1.0.0-preview"",
|
||||
""suppressParent"":""runtime""
|
||||
}
|
||||
}
|
||||
}");
|
||||
var packageRef = mockProj.Items.First(i => i.Include == "APackage" && i.ItemType == "PackageReference");
|
||||
|
||||
var privateAssetsMetadata = packageRef.GetMetadataWithName("PrivateAssets");
|
||||
privateAssetsMetadata.Value.Should().NotBeNull();
|
||||
privateAssetsMetadata.Value.Should().Be("Runtime");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void It_migrates_include_exclude_arrays_to_IncludeAssets()
|
||||
{
|
||||
var mockProj = RunPackageDependenciesRuleOnPj(@"
|
||||
{
|
||||
""dependencies"": {
|
||||
""APackage"" : {
|
||||
""version"": ""1.0.0-preview"",
|
||||
""include"": [ ""compile"", ""runtime"", ""native"" ],
|
||||
""exclude"": [ ""native"" ]
|
||||
}
|
||||
}
|
||||
}");
|
||||
var packageRef = mockProj.Items.First(i => i.Include == "APackage" && i.ItemType == "PackageReference");
|
||||
|
||||
var includeAssetsMetadata = packageRef.GetMetadataWithName("IncludeAssets");
|
||||
includeAssetsMetadata.Value.Should().NotBeNull();
|
||||
includeAssetsMetadata.Value.Should().Be("Compile;Runtime");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void It_migrates_include_string_to_IncludeAssets()
|
||||
{
|
||||
var mockProj = RunPackageDependenciesRuleOnPj(@"
|
||||
{
|
||||
""dependencies"": {
|
||||
""APackage"" : {
|
||||
""version"": ""1.0.0-preview"",
|
||||
""include"": ""compile"",
|
||||
""exclude"": ""runtime""
|
||||
}
|
||||
}
|
||||
}");
|
||||
var packageRef = mockProj.Items.First(i => i.Include == "APackage" && i.ItemType == "PackageReference");
|
||||
|
||||
var includeAssetsMetadata = packageRef.GetMetadataWithName("IncludeAssets");
|
||||
includeAssetsMetadata.Value.Should().NotBeNull();
|
||||
includeAssetsMetadata.Value.Should().Be("Compile");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void It_migrates_include_exclude_overlapping_strings_to_IncludeAssets()
|
||||
{
|
||||
var mockProj = RunPackageDependenciesRuleOnPj(@"
|
||||
{
|
||||
""dependencies"": {
|
||||
""APackage"" : {
|
||||
""version"": ""1.0.0-preview"",
|
||||
""include"": ""compile"",
|
||||
""exclude"": ""compile"",
|
||||
}
|
||||
}
|
||||
}");
|
||||
var packageRef = mockProj.Items.First(i => i.Include == "APackage" && i.ItemType == "PackageReference");
|
||||
|
||||
var includeAssetsMetadata = packageRef.GetMetadataWithName("IncludeAssets");
|
||||
includeAssetsMetadata.Value.Should().NotBeNull();
|
||||
includeAssetsMetadata.Value.Should().Be("None");
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void It_migrates_Tools()
|
||||
{
|
||||
|
|
|
@ -56,6 +56,15 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
return new AndConstraint<DirectoryInfoAssertions>(this);
|
||||
}
|
||||
|
||||
public AndConstraint<DirectoryInfoAssertions> HaveFilesMatching(string expectedFilesSearchPattern, SearchOption searchOption)
|
||||
{
|
||||
var matchingFileExists = _dirInfo.EnumerateFiles(expectedFilesSearchPattern, searchOption).Any();
|
||||
Execute.Assertion.ForCondition(matchingFileExists == true)
|
||||
.FailWith("Expected directory {0} to contain files matching {1}, but no matching file exists.",
|
||||
_dirInfo.FullName, expectedFilesSearchPattern);
|
||||
return new AndConstraint<DirectoryInfoAssertions>(this);
|
||||
}
|
||||
|
||||
public AndConstraint<DirectoryInfoAssertions> NotHaveFiles(IEnumerable<string> expectedFiles)
|
||||
{
|
||||
foreach (var expectedFile in expectedFiles)
|
||||
|
@ -66,6 +75,15 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
return new AndConstraint<DirectoryInfoAssertions>(this);
|
||||
}
|
||||
|
||||
public AndConstraint<DirectoryInfoAssertions> NotHaveFilesMatching(string expectedFilesSearchPattern, SearchOption searchOption)
|
||||
{
|
||||
var matchingFileCount = _dirInfo.EnumerateFiles(expectedFilesSearchPattern, searchOption).Count();
|
||||
Execute.Assertion.ForCondition(matchingFileCount == 0)
|
||||
.FailWith("Found {0} files that should not exist in directory {1}. No file matching {2} should exist.",
|
||||
matchingFileCount, _dirInfo.FullName, expectedFilesSearchPattern);
|
||||
return new AndConstraint<DirectoryInfoAssertions>(this);
|
||||
}
|
||||
|
||||
public AndConstraint<DirectoryInfoAssertions> HaveDirectory(string expectedDir)
|
||||
{
|
||||
var dir = _dirInfo.EnumerateDirectories(expectedDir, SearchOption.TopDirectoryOnly).SingleOrDefault();
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.DotNet.ProjectModel;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||
{
|
||||
public sealed class Clean3Command : TestCommand
|
||||
{
|
||||
public Clean3Command()
|
||||
: base("dotnet")
|
||||
{
|
||||
}
|
||||
|
||||
public override CommandResult Execute(string args = "")
|
||||
{
|
||||
args = $"clean3 {args}";
|
||||
return base.Execute(args);
|
||||
}
|
||||
|
||||
public override CommandResult ExecuteWithCapturedOutput(string args = "")
|
||||
{
|
||||
args = $"clean3 {args}";
|
||||
return base.ExecuteWithCapturedOutput(args);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -72,7 +72,9 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
|
||||
if (!portable)
|
||||
{
|
||||
var runtime = string.IsNullOrEmpty(_runtime) ? RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier() : _runtime;
|
||||
var runtime = string.IsNullOrEmpty(_runtime) ?
|
||||
DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier() :
|
||||
_runtime;
|
||||
return Path.Combine(config, framework, runtime, PublishSubfolderName);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||
{
|
||||
public static class DotnetLegacyRuntimeIdentifiers
|
||||
{
|
||||
public static string InferLegacyRestoreRuntimeIdentifier()
|
||||
{
|
||||
if (RuntimeEnvironment.OperatingSystemPlatform != Platform.Windows)
|
||||
{
|
||||
FrameworkDependencyFile fxDepsFile = new FrameworkDependencyFile();
|
||||
return fxDepsFile.SupportsCurrentRuntime() ?
|
||||
RuntimeEnvironment.GetRuntimeIdentifier() :
|
||||
DotnetFiles.VersionFileObject.BuildRid;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var arch = RuntimeEnvironment.RuntimeArchitecture.ToLowerInvariant();
|
||||
return "win7-" + arch;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.TestFramework;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using FluentAssertions;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Compiler.Tests
|
||||
{
|
||||
public class GivenThatIWantToCompileFSharpPrograms
|
||||
{
|
||||
private readonly static string s_testProjectsRoot = Path.Combine(
|
||||
AppContext.BaseDirectory,
|
||||
"TestAssets",
|
||||
"TestProjects",
|
||||
"FSharpTestProjects");
|
||||
|
||||
[Fact]
|
||||
public void Compilation_of_app_with_invalid_source_should_fail()
|
||||
{
|
||||
var testProject = Path.Combine(s_testProjectsRoot, "CompileFailApp", "project.json");
|
||||
var buildCommand = new BuildCommand(testProject);
|
||||
|
||||
var oldDirectory = Directory.GetCurrentDirectory();
|
||||
Directory.SetCurrentDirectory(Path.GetDirectoryName(testProject));
|
||||
|
||||
buildCommand.Execute().Should().Fail();
|
||||
|
||||
Directory.SetCurrentDirectory(oldDirectory);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Compilation_of_valid_app_should_succeed()
|
||||
{
|
||||
var testProject = Path.Combine(s_testProjectsRoot, "TestAppWithArgs", "project.json");
|
||||
var buildCommand = new BuildCommand(testProject);
|
||||
|
||||
var oldDirectory = Directory.GetCurrentDirectory();
|
||||
Directory.SetCurrentDirectory(Path.GetDirectoryName(testProject));
|
||||
|
||||
buildCommand.Execute().Should().Pass();
|
||||
|
||||
Directory.SetCurrentDirectory(oldDirectory);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Compilation_of_app_with_P2P_reference_to_fsharp_library_should_be_runnable()
|
||||
{
|
||||
var testProject = Path.Combine(s_testProjectsRoot, "TestApp", "project.json");
|
||||
var runCommand = new RunCommand(testProject);
|
||||
|
||||
var oldDirectory = Directory.GetCurrentDirectory();
|
||||
Directory.SetCurrentDirectory(Path.GetDirectoryName(testProject));
|
||||
|
||||
var result = runCommand.Execute();
|
||||
|
||||
result.Should().Pass();
|
||||
|
||||
Directory.SetCurrentDirectory(oldDirectory);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0.23107" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.23107</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>833ffee1-7eed-4f51-8dfd-946d48893d6e</ProjectGuid>
|
||||
<RootNamespace>Microsoft.DotNet.Tools.Compiler.Tests</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
|
@ -1,46 +0,0 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"type": "platform",
|
||||
"version": "1.0.1"
|
||||
},
|
||||
"Microsoft.DotNet.Tools.Tests.Utilities": {
|
||||
"target": "project"
|
||||
},
|
||||
"Microsoft.DotNet.Cli.Utils": {
|
||||
"target": "project"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-350904-49"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
"imports": [
|
||||
"dotnet5.4",
|
||||
"portable-net451+win8"
|
||||
]
|
||||
}
|
||||
},
|
||||
"testRunner": "xunit",
|
||||
"publishOptions": {
|
||||
"include": [
|
||||
"../../TestAssets/TestProjects/FSharpTestProjects/CompileFailApp/**/*",
|
||||
"../../TestAssets/TestProjects/FSharpTestProjects/TestApp/**/*",
|
||||
"../../TestAssets/TestProjects/FSharpTestProjects/TestAppWithArgs/**/*",
|
||||
"../../TestAssets/TestProjects/FSharpTestProjects/TestLibrary/**/*",
|
||||
"../../TestAssets/TestProjects/FSharpTestProjects/global.json"
|
||||
]
|
||||
},
|
||||
"buildOptions": {
|
||||
"copyToOutput": {
|
||||
"include": [
|
||||
"../../TestAssets/TestProjects/FSharpTestProjects/CompileFailApp/**/*",
|
||||
"../../TestAssets/TestProjects/FSharpTestProjects/TestApp/**/*",
|
||||
"../../TestAssets/TestProjects/FSharpTestProjects/TestAppWithArgs/**/*",
|
||||
"../../TestAssets/TestProjects/FSharpTestProjects/TestLibrary/**/*",
|
||||
"../../TestAssets/TestProjects/FSharpTestProjects/global.json"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ using FluentAssertions;
|
|||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.ProjectModel;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Moq;
|
||||
using NuGet.Frameworks;
|
||||
using Xunit;
|
||||
|
@ -69,7 +70,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
|
|||
[Fact]
|
||||
public void It_passes_a_RuntimeOutputDir_variable_to_the_pre_compile_scripts_if_rid_is_set_in_the_ProjectContext()
|
||||
{
|
||||
var rid = RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier();
|
||||
var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
|
||||
var fixture = ScriptVariablesFixture.GetFixtureWithRids(rid);
|
||||
fixture.PreCompileScriptVariables.Should().ContainKey("compile:RuntimeOutputDir");
|
||||
fixture.PreCompileScriptVariables["compile:RuntimeOutputDir"].Should().Be(fixture.RuntimeOutputDir);
|
||||
|
@ -128,7 +129,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
|
|||
[Fact]
|
||||
public void It_passes_a_RuntimeOutputDir_variable_to_the_post_compile_scripts_if_rid_is_set_in_the_ProjectContext()
|
||||
{
|
||||
var rid = RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier();
|
||||
var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
|
||||
var fixture = ScriptVariablesFixture.GetFixtureWithRids(rid);
|
||||
fixture.PostCompileScriptVariables.Should().ContainKey("compile:RuntimeOutputDir");
|
||||
fixture.PostCompileScriptVariables["compile:RuntimeOutputDir"].Should().Be(fixture.RuntimeOutputDir);
|
||||
|
|
|
@ -4,8 +4,12 @@
|
|||
"keyFile": "../../tools/Key.snk",
|
||||
"copyToOutput": {
|
||||
"include": [
|
||||
"../../TestAssets/TestProjects/TestAppWithLibrary/**/*"
|
||||
]
|
||||
"../../TestAssets/TestProjects/TestAppWithLibrary/**/*",
|
||||
"../../artifacts/*/stage2/sdk/*/.version"
|
||||
],
|
||||
"mappings": {
|
||||
".version": "../../artifacts/*/stage2/sdk/*/.version"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -29,6 +33,9 @@
|
|||
"Microsoft.DotNet.ProjectModel": {
|
||||
"target": "project"
|
||||
},
|
||||
"Microsoft.DotNet.Tools.Tests.Utilities": {
|
||||
"target": "project"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-350904-49",
|
||||
"moq.netcore": "4.4.0-beta8",
|
||||
|
|
|
@ -268,8 +268,54 @@ namespace Microsoft.DotNet.Migration.Tests
|
|||
outputsIdentical.Should().BeTrue();
|
||||
VerifyAllMSBuildOutputsRunnable(projectDirectory);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
// https://github.com/dotnet/cli/issues/4313
|
||||
[InlineData(true)]
|
||||
[InlineData(false)]
|
||||
public void Migration_outputs_error_when_no_projects_found(bool useGlobalJson)
|
||||
{
|
||||
var projectDirectory = TestAssetsManager.CreateTestDirectory("Migration_outputs_error_when_no_projects_found");
|
||||
|
||||
private void VerifyMigration(IEnumerable<string> expectedProjects, string rootDir)
|
||||
string argstr = string.Empty;
|
||||
string errorMessage = string.Empty;
|
||||
|
||||
if (useGlobalJson)
|
||||
{
|
||||
var globalJsonPath = Path.Combine(projectDirectory.Path, "global.json");
|
||||
using (FileStream fs = File.Create(globalJsonPath))
|
||||
{
|
||||
using (StreamWriter sw = new StreamWriter(fs))
|
||||
{
|
||||
sw.WriteLine("{");
|
||||
sw.WriteLine("\"projects\": [ \".\" ]");
|
||||
sw.WriteLine("}");
|
||||
}
|
||||
}
|
||||
|
||||
argstr = globalJsonPath;
|
||||
errorMessage = "Unable to find any projects in global.json";
|
||||
}
|
||||
else
|
||||
{
|
||||
argstr = projectDirectory.Path;
|
||||
errorMessage = $"No project.json file found in '{projectDirectory.Path}'";
|
||||
}
|
||||
|
||||
var result = new TestCommand("dotnet")
|
||||
.WithWorkingDirectory(projectDirectory.Path)
|
||||
.ExecuteWithCapturedOutput($"migrate {argstr}");
|
||||
|
||||
// Expecting an error exit code.
|
||||
result.ExitCode.Should().Be(1);
|
||||
|
||||
// Verify the error messages. Note that debug builds also show the call stack, so we search
|
||||
// for the error strings that should be present (rather than an exact match).
|
||||
result.StdErr.Should().Contain(errorMessage);
|
||||
result.StdErr.Should().Contain("Migration failed.");
|
||||
}
|
||||
|
||||
private void VerifyMigration(IEnumerable<string> expectedProjects, string rootDir)
|
||||
{
|
||||
var migratedProjects = Directory.EnumerateFiles(rootDir, "project.json", SearchOption.AllDirectories)
|
||||
.Where(s => Directory.EnumerateFiles(Path.GetDirectoryName(s), "*.csproj").Count() == 1)
|
||||
|
|
|
@ -54,7 +54,9 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
|
|||
[InlineData("KestrelDesktop", "http://localhost:20207", "win7-x86", "libuv.dll", false)]
|
||||
public async Task DesktopApp_WithKestrel_WorksWhenPublished(string project, string url, string runtime, string libuvName, bool forceRunnable)
|
||||
{
|
||||
var runnable = forceRunnable || string.IsNullOrEmpty(runtime) || (RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier().Contains(runtime));
|
||||
var runnable = forceRunnable ||
|
||||
string.IsNullOrEmpty(runtime) ||
|
||||
(DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier().Contains(runtime));
|
||||
|
||||
var testInstance = GetTestInstance()
|
||||
.WithLockFiles();
|
||||
|
|
|
@ -58,11 +58,11 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
|
|||
{
|
||||
new object[] { "1", "", "", "", "" },
|
||||
new object[] { "2", "netcoreapp1.0", "", "", "" },
|
||||
new object[] { "3", "", RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier(), "", "" },
|
||||
new object[] { "3", "", DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier(), "", "" },
|
||||
new object[] { "4", "", "", "Release", "" },
|
||||
new object[] { "5", "", "", "", "some/dir"},
|
||||
new object[] { "6", "", "", "", "some/dir/with spaces" },
|
||||
new object[] { "7", "netcoreapp1.0", RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier(), "Debug", "some/dir" },
|
||||
new object[] { "7", "netcoreapp1.0", DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier(), "Debug", "some/dir" },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -221,7 +221,10 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
|
|||
publishCommand.GetOutputDirectory().Should().HaveFile("Newtonsoft.Json.dll");
|
||||
publishCommand.GetOutputDirectory().Delete(true);
|
||||
|
||||
publishCommand = new PublishCommand(lesserTestProject, "netcoreapp1.0", RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier());
|
||||
publishCommand = new PublishCommand(
|
||||
lesserTestProject,
|
||||
"netcoreapp1.0",
|
||||
DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier());
|
||||
publishCommand.Execute().Should().Pass();
|
||||
|
||||
publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryLesser.dll");
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"buildOptions": {
|
||||
"copyToOutput": {
|
||||
"include": [
|
||||
"../../artifacts/*/stage2/sdk/*/.version"
|
||||
],
|
||||
"mappings": {
|
||||
".version": "../../artifacts/*/stage2/sdk/*/.version"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"type": "platform",
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace Microsoft.DotNet.Cli.Publish3.Tests
|
|||
.CreateTestInstance(testAppName);
|
||||
|
||||
var testProjectDirectory = testInstance.TestRoot;
|
||||
var rid = RuntimeEnvironment.GetRuntimeIdentifier();
|
||||
var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
|
||||
|
||||
new Publish3Command()
|
||||
.WithFramework("netcoreapp1.0")
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"buildOptions": {
|
||||
"copyToOutput": {
|
||||
"include": [
|
||||
"../../artifacts/*/stage2/sdk/*/.version"
|
||||
],
|
||||
"mappings": {
|
||||
".version": "../../artifacts/*/stage2/sdk/*/.version"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"type": "platform",
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"buildOptions": {
|
||||
"copyToOutput": {
|
||||
"include": [
|
||||
"../../artifacts/*/stage2/sdk/*/.version"
|
||||
],
|
||||
"mappings": {
|
||||
".version": "../../artifacts/*/stage2/sdk/*/.version"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"type": "platform",
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Microsoft.DotNet.Tests
|
|||
{
|
||||
get
|
||||
{
|
||||
var rid = RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier();
|
||||
var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
|
||||
var projectOutputPath = $"AppWithDirectDepDesktopAndPortable\\bin\\Debug\\net451\\{rid}\\dotnet-desktop-and-portable.exe";
|
||||
return new[]
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ namespace Microsoft.DotNet.Tests
|
|||
{
|
||||
get
|
||||
{
|
||||
var rid = RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier();
|
||||
var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
|
||||
var projectOutputPath = $"LibraryWithDirectDependencyDesktopAndPortable\\bin\\Debug\\net451\\dotnet-desktop-and-portable.exe";
|
||||
return new[]
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue