Merge branch 'rel/1.0.0' into drop_suffix
This commit is contained in:
commit
a88df7953c
3 changed files with 55 additions and 20 deletions
|
@ -3,8 +3,8 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<CLI_MSBuild_Version>15.1.0-preview-000545-01</CLI_MSBuild_Version>
|
<CLI_MSBuild_Version>15.1.0-preview-000545-01</CLI_MSBuild_Version>
|
||||||
<CLI_Roslyn_Version>2.0.0-rc4-61325-08</CLI_Roslyn_Version>
|
<CLI_Roslyn_Version>2.0.0-rc4-61325-08</CLI_Roslyn_Version>
|
||||||
<CLI_NETSDK_Version>1.0.0-alpha-20170205-2</CLI_NETSDK_Version>
|
<CLI_NETSDK_Version>1.0.0-alpha-20170207-4</CLI_NETSDK_Version>
|
||||||
<CLI_NuGet_Version>4.0.0-rtm-2265</CLI_NuGet_Version>
|
<CLI_NuGet_Version>4.0.0-rtm-2275</CLI_NuGet_Version>
|
||||||
<CLI_WEBSDK_Version>1.0.0-alpha-20170130-3-281</CLI_WEBSDK_Version>
|
<CLI_WEBSDK_Version>1.0.0-alpha-20170130-3-281</CLI_WEBSDK_Version>
|
||||||
<CLI_TestPlatform_Version>15.0.0-preview-20170125-04</CLI_TestPlatform_Version>
|
<CLI_TestPlatform_Version>15.0.0-preview-20170125-04</CLI_TestPlatform_Version>
|
||||||
<TemplateEngineVersion>1.0.0-beta1-20170202-111</TemplateEngineVersion>
|
<TemplateEngineVersion>1.0.0-beta1-20170202-111</TemplateEngineVersion>
|
||||||
|
|
|
@ -591,25 +591,10 @@ namespace Microsoft.DotNet.Internal.ProjectModel
|
||||||
var rawOptions = rawObject.Value<JToken>("buildOptions") as JObject;
|
var rawOptions = rawObject.Value<JToken>("buildOptions") as JObject;
|
||||||
if (rawOptions == null)
|
if (rawOptions == null)
|
||||||
{
|
{
|
||||||
rawOptions = rawObject.Value<JToken>("compilationOptions") as JObject;
|
return new CommonCompilerOptions
|
||||||
if (rawOptions == null)
|
|
||||||
{
|
{
|
||||||
return new CommonCompilerOptions
|
CompilerName = compilerName ?? "csc"
|
||||||
{
|
};
|
||||||
CompilerName = compilerName ?? "csc"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
var lineInfo = (IJsonLineInfo)rawOptions;
|
|
||||||
|
|
||||||
project.Diagnostics.Add(
|
|
||||||
new DiagnosticMessage(
|
|
||||||
ErrorCodes.DOTNET1015,
|
|
||||||
$"The 'compilationOptions' option is deprecated. Use 'buildOptions' instead.",
|
|
||||||
project.ProjectFilePath,
|
|
||||||
DiagnosticMessageSeverity.Warning,
|
|
||||||
lineInfo.LineNumber,
|
|
||||||
lineInfo.LinePosition));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var analyzerOptionsJson = rawOptions.Value<JToken>("analyzerOptions") as JObject;
|
var analyzerOptionsJson = rawOptions.Value<JToken>("analyzerOptions") as JObject;
|
||||||
|
@ -814,6 +799,9 @@ namespace Microsoft.DotNet.Internal.ProjectModel
|
||||||
|
|
||||||
private static void AddProjectFilesDeprecationDiagnostics(JObject rawProject, Project project)
|
private static void AddProjectFilesDeprecationDiagnostics(JObject rawProject, Project project)
|
||||||
{
|
{
|
||||||
|
var compilationOptionsWarning = "'buildOptions'";
|
||||||
|
AddDeprecatedDiagnosticMessage(rawProject, project, "compilationOptions", compilationOptionsWarning);
|
||||||
|
|
||||||
var compileWarning = "'compile' in 'buildOptions'";
|
var compileWarning = "'compile' in 'buildOptions'";
|
||||||
AddDeprecatedDiagnosticMessage(rawProject, project, "compile", compileWarning);
|
AddDeprecatedDiagnosticMessage(rawProject, project, "compile", compileWarning);
|
||||||
AddDeprecatedDiagnosticMessage(rawProject, project, "compileExclude", compileWarning);
|
AddDeprecatedDiagnosticMessage(rawProject, project, "compileExclude", compileWarning);
|
||||||
|
@ -870,6 +858,7 @@ namespace Microsoft.DotNet.Internal.ProjectModel
|
||||||
|
|
||||||
private static void ConvertDeprecatedToSupportedFormat(JObject rawProject)
|
private static void ConvertDeprecatedToSupportedFormat(JObject rawProject)
|
||||||
{
|
{
|
||||||
|
ConvertToBuildOptions(rawProject);
|
||||||
ConvertToBuildOptionsCompile(rawProject);
|
ConvertToBuildOptionsCompile(rawProject);
|
||||||
ConvertToBuildOptionsEmbed(rawProject);
|
ConvertToBuildOptionsEmbed(rawProject);
|
||||||
ConvertToBuildOptionsCopyToOutput(rawProject);
|
ConvertToBuildOptionsCopyToOutput(rawProject);
|
||||||
|
@ -877,6 +866,21 @@ namespace Microsoft.DotNet.Internal.ProjectModel
|
||||||
ConvertToPublishOptions(rawProject);
|
ConvertToPublishOptions(rawProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void ConvertToBuildOptions(JObject rawProject)
|
||||||
|
{
|
||||||
|
var jpath = "buildOptions";
|
||||||
|
if (AreDeprecatedOptionsIgnored(rawProject, jpath))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var deprecatedValue = rawProject.Value<JToken>("compilationOptions");
|
||||||
|
if (deprecatedValue != null)
|
||||||
|
{
|
||||||
|
rawProject["buildOptions"] = deprecatedValue.DeepClone();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void ConvertToBuildOptionsCompile(JObject rawProject)
|
private static void ConvertToBuildOptionsCompile(JObject rawProject)
|
||||||
{
|
{
|
||||||
var jpath = "buildOptions.compile";
|
var jpath = "buildOptions.compile";
|
||||||
|
|
|
@ -16,6 +16,37 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
{
|
{
|
||||||
public class GivenThatIWantToMigrateBuildOptions : TestBase
|
public class GivenThatIWantToMigrateBuildOptions : TestBase
|
||||||
{
|
{
|
||||||
|
[Fact]
|
||||||
|
public void MigratingDeprecatedCompilationOptionsWithEmitEntryPointPopulatesOutputTypeField()
|
||||||
|
{
|
||||||
|
var mockProj = RunBuildOptionsRuleOnPj(@"
|
||||||
|
{
|
||||||
|
""compilationOptions"": {
|
||||||
|
""emitEntryPoint"": ""true""
|
||||||
|
},
|
||||||
|
""exclude"": [
|
||||||
|
""node_modules""
|
||||||
|
]
|
||||||
|
}");
|
||||||
|
|
||||||
|
mockProj.Properties.Count(p => p.Name == "OutputType").Should().Be(1);
|
||||||
|
mockProj.Properties.First(p => p.Name == "OutputType").Value.Should().Be("Exe");
|
||||||
|
|
||||||
|
mockProj.Items.Count(i => i.ItemType.Equals("Compile", StringComparison.Ordinal))
|
||||||
|
.Should().Be(1);
|
||||||
|
mockProj.Items.Count(i =>
|
||||||
|
i.ItemType.Equals("Compile", StringComparison.Ordinal) &&
|
||||||
|
i.Remove.Equals("node_modules"))
|
||||||
|
.Should().Be(1);
|
||||||
|
|
||||||
|
mockProj.Items.Count(i => i.ItemType.Equals("EmbeddedResource", StringComparison.Ordinal))
|
||||||
|
.Should().Be(1);
|
||||||
|
mockProj.Items.Count(i =>
|
||||||
|
i.ItemType.Equals("EmbeddedResource", StringComparison.Ordinal) &&
|
||||||
|
i.Remove.Equals("node_modules"))
|
||||||
|
.Should().Be(1);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void SpecifiedDefaultPropertiesAreRemovedWhenTheyExistInTheCsprojTemplate()
|
public void SpecifiedDefaultPropertiesAreRemovedWhenTheyExistInTheCsprojTemplate()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue