Skip to content

Commit

Permalink
fixes dotnet/templating#3380 Remove the --nullable option from the ap…
Browse files Browse the repository at this point in the history
…p and classlib template
  • Loading branch information
vlada-shubina committed Jul 7, 2021
1 parent 7f3b11f commit 0269e31
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 52 deletions.
@@ -1,18 +1,15 @@
{
"$schema": "http://json.schemastore.org/dotnetcli.host",
"symbolInfo": {
"target-framework-override": {
"isHidden": "true",
"shortName": ""
},
"no-restore": {
"shortName": ""
},
"langVersion": {
"shortName": ""
},
"nullable": {
"shortName": ""
}
"$schema": "http://json.schemastore.org/dotnetcli.host",
"symbolInfo": {
"target-framework-override": {
"isHidden": "true",
"shortName": ""
},
"no-restore": {
"shortName": ""
},
"langVersion": {
"shortName": ""
}
}
}
Expand Up @@ -49,13 +49,6 @@
"defaultValue": "false",
"displayName": "Skip restore"
},
"nullable": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "true",
"description": "Whether to enable nullable reference types for this project.",
"displayName": "Enable nullable"
},
"target-framework-override": {
"type": "parameter",
"description": "Overrides the target framework",
Expand Down Expand Up @@ -104,4 +97,4 @@
"continueOnError": true
}
]
}
}
Expand Up @@ -5,7 +5,7 @@
<TargetFramework Condition="'$(target-framework-override)' == ''">net6.0</TargetFramework>
<TargetFramework Condition="'$(target-framework-override)' != ''">target-framework-override</TargetFramework>
<LangVersion Condition="'$(langVersion)' != ''">$(ProjectLanguageVersion)</LangVersion>
<Nullable Condition="'$(nullable)' == 'true'">enable</Nullable>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
Expand Up @@ -16,10 +16,6 @@
"langVersion": {
"longName": "langVersion",
"shortName": ""
},
"Nullable": {
"longName": "nullable",
"shortName": ""
}
},
"usageExamples": [
Expand Down
Expand Up @@ -84,13 +84,6 @@
"description": "If specified, skips the automatic restore of the project on create.",
"defaultValue": "false",
"displayName": "Skip restore"
},
"Nullable": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "true",
"description": "Whether to enable nullable reference types for this project.",
"displayName": "Enable nullable"
}
},
"primaryOutputs": [
Expand Down Expand Up @@ -128,4 +121,4 @@
"continueOnError": true
}
]
}
}
Expand Up @@ -5,7 +5,7 @@
<TargetFramework Condition="'$(TargetFrameworkOverride)' != ''">TargetFrameworkOverride</TargetFramework>
<RootNamespace Condition="'$(name)' != '$(name{-VALUE-FORMS-}safe_namespace)'">Company.ClassLibrary1</RootNamespace>
<LangVersion Condition="'$(langVersion)' != ''">$(ProjectLanguageVersion)</LangVersion>
<Nullable Condition="('$(Nullable)' == 'true') AND ('$(Framework)' != 'netstandard2.0')">enable</Nullable>
<Nullable Condition="('$(Framework)' != 'netstandard2.0')">enable</Nullable>
</PropertyGroup>

</Project>
7 changes: 1 addition & 6 deletions test/dotnet-new3.UnitTests/CommonTemplatesTests.cs
Expand Up @@ -261,6 +261,7 @@ public void AllCommonItemsCreate(string expectedTemplateName, string templateSho
[InlineData("LangVersion", null, "Class Library", "classlib", null, null)]
[InlineData("TargetFramework", "net6.0", "Class Library", "classlib", null, null)]
[InlineData("Nullable", null, "Class Library", "classlib", null, "netstandard2.0")]
[InlineData("Nullable", "enable", "Class Library", "classlib", null, "netstandard2.1")]

[InlineData("Nullable", null, "Class Library", "classlib", "F#", null)]
[InlineData("CheckForOverflowUnderflow", null, "Class Library", "classlib", "F#", null)]
Expand Down Expand Up @@ -321,12 +322,6 @@ public void SetPropertiesByDefault(string propertyName, string? propertyValue, s
}

[Theory]
//unset nullable
[InlineData("Nullable", null, "--nullable", "false", "Simple Console Application", "app", null, null)]
[InlineData("Nullable", null, "--nullable", "false", "Class Library", "classlib", null, null)]
[InlineData("Nullable", null, "--nullable", "true", "Class Library", "classlib", null, "netstandard2.0")]
[InlineData("Nullable", null, "--nullable", "false", "Class Library", "classlib", null, "netstandard2.0")]

//language version
[InlineData("LangVersion", "9.0", "--langVersion", "9.0", "Simple Console Application", "app", null, null)]
[InlineData("LangVersion", "9.0", "--langVersion", "9.0", "Console Application", "console", null, null)]
Expand Down
10 changes: 1 addition & 9 deletions test/dotnet-new3.UnitTests/DotnetNewHelp.cs
Expand Up @@ -102,10 +102,6 @@ public class DotnetNewHelp
bool - Optional
Default: false
--nullable Whether to enable nullable reference types for this project.
bool - Optional
Default: true
To see help for other template languages (F#, VB), use --language option:
dotnet new3 classlib -h --language F#";
Expand All @@ -120,11 +116,7 @@ public class DotnetNewHelp
--no-restore If specified, skips the automatic restore of the project on create.
bool - Optional
Default: false
--nullable Whether to enable nullable reference types for this project.
bool - Optional
Default: true ";
Default: false ";

#endregion
private readonly ITestOutputHelper _log;
Expand Down

0 comments on commit 0269e31

Please sign in to comment.