From b2cbbb290fa26a708205f63210a3d1781d75762c Mon Sep 17 00:00:00 2001 From: jonathon wei Date: Wed, 6 Jan 2021 23:09:29 +1100 Subject: [PATCH 1/3] update template framework variable to be passed from option with default 5.0 --- .../.template.config/template.json | 12 ++++++------ .../_BenchmarkProjectName_.csproj | 6 +----- .../.template.config/template.json | 12 ++++++------ .../_BenchmarkProjectName_.fsproj | 6 +----- .../.template.config/template.json | 12 ++++++------ .../_BenchmarkProjectName_.vbproj | 6 +----- 6 files changed, 21 insertions(+), 33 deletions(-) diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json index 091015d7a2..70aa767225 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json @@ -32,32 +32,32 @@ "frameworks": { "type": "parameter", "datatype": "string", - "description": "The target framework(s) for the project (e.g. netstandard2.0;net472).", - "defaultValue": "netstandard2.0", + "description": "The target framework(s) for the project (e.g. netstandard2.0;net472). Default \"net5.0\"", + "defaultValue": "net5.0", "replaces": "$(Frameworks)" }, "config": { "type": "parameter", "datatype": "bool", - "description": "Adds a benchmark config class.", + "description": "Adds a benchmark config class. Default \"false\"", "defaultValue": "false" }, "skipRestore": { "type": "parameter", "datatype": "bool", - "description": "If specified, skips the automatic restore of the project on create.", + "description": "If specified, skips the automatic restore of the project on create. Default \"false\"", "defaultValue": "false" }, "consoleApp": { "type": "parameter", "datatype": "bool", - "description": "If specified, the project is set up as console app.", + "description": "If specified, the project is set up as console app. Default \"false\"", "defaultValue": "false" }, "version": { "type": "parameter", "datatype": "string", - "description": "Version of BenchmarkDotNet that will be referenced.", + "description": "Version of BenchmarkDotNet that will be referenced. Default \"0.12.0\"", "defaultValue": "0.12.0", "replaces": "$(BenchmarkDotNetVersion)" } diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/_BenchmarkProjectName_.csproj b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/_BenchmarkProjectName_.csproj index 58211d957b..783e194c29 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/_BenchmarkProjectName_.csproj +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/_BenchmarkProjectName_.csproj @@ -1,9 +1,5 @@ - - netcoreapp3.0 - Exe - - + $(Frameworks) diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json index 5313f82061..d7d84730d3 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json @@ -32,32 +32,32 @@ "frameworks": { "type": "parameter", "datatype": "string", - "description": "The target framework(s) for the project (e.g. netstandard2.0;net472).", - "defaultValue": "netstandard2.0", + "description": "The target framework(s) for the project (e.g. netstandard2.0;net472). Default \"net5.0\"", + "defaultValue": "net5.0", "replaces": "$(Frameworks)" }, "config": { "type": "parameter", "datatype": "bool", - "description": "Adds a benchmark config class.", + "description": "Adds a benchmark config class. Default \"false\"", "defaultValue": "false" }, "skipRestore": { "type": "parameter", "datatype": "bool", - "description": "If specified, skips the automatic restore of the project on create.", + "description": "If specified, skips the automatic restore of the project on create. Default \"false\"", "defaultValue": "false" }, "consoleApp": { "type": "parameter", "datatype": "bool", - "description": "If specified, the project is set up as console app.", + "description": "If specified, the project is set up as console app. Default \"false\"", "defaultValue": "false" }, "version": { "type": "parameter", "datatype": "string", - "description": "Version of BenchmarkDotNet that will be referenced.", + "description": "Version of BenchmarkDotNet that will be referenced. Default \"0.12.0\"", "defaultValue": "0.12.0", "replaces": "$(BenchmarkDotNetVersion)" } diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/_BenchmarkProjectName_.fsproj b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/_BenchmarkProjectName_.fsproj index aecb861e5d..6e50bc89fd 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/_BenchmarkProjectName_.fsproj +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/_BenchmarkProjectName_.fsproj @@ -1,9 +1,5 @@  - - netcoreapp3.0 - Exe - - + $(Frameworks) diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json index 6dec6d5033..9d493543e0 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json @@ -32,32 +32,32 @@ "frameworks": { "type": "parameter", "datatype": "string", - "description": "The target framework(s) for the project (e.g. netstandard2.0;net472).", - "defaultValue": "netstandard2.0", + "description": "The target framework(s) for the project (e.g. netstandard2.0;net472). Default \"net5.0\"", + "defaultValue": "net5.0", "replaces": "$(Frameworks)" }, "config": { "type": "parameter", "datatype": "bool", - "description": "Adds a benchmark config class.", + "description": "Adds a benchmark config class. Default \"false\"", "defaultValue": "false" }, "skipRestore": { "type": "parameter", "datatype": "bool", - "description": "If specified, skips the automatic restore of the project on create.", + "description": "If specified, skips the automatic restore of the project on create. Default \"false\"", "defaultValue": "false" }, "consoleApp": { "type": "parameter", "datatype": "bool", - "description": "If specified, the project is set up as console app.", + "description": "If specified, the project is set up as console app. Default \"false\"", "defaultValue": "false" }, "version": { "type": "parameter", "datatype": "string", - "description": "Version of BenchmarkDotNet that will be referenced.", + "description": "Version of BenchmarkDotNet that will be referenced. Default \"0.12.0\"", "defaultValue": "0.12.0", "replaces": "$(BenchmarkDotNetVersion)" } diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/_BenchmarkProjectName_.vbproj b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/_BenchmarkProjectName_.vbproj index 58211d957b..783e194c29 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/_BenchmarkProjectName_.vbproj +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/_BenchmarkProjectName_.vbproj @@ -1,9 +1,5 @@ - - netcoreapp3.0 - Exe - - + $(Frameworks) From 3139a26eac28edd1dc889d756ecbb3e8a389cd77 Mon Sep 17 00:00:00 2001 From: jonathon wei Date: Thu, 7 Jan 2021 21:14:11 +1100 Subject: [PATCH 2/3] refine the framework parameters. --- .../.template.config/template.json | 45 ++++++++++++++++++- .../.template.config/template.json | 45 ++++++++++++++++++- .../.template.config/template.json | 45 ++++++++++++++++++- 3 files changed, 129 insertions(+), 6 deletions(-) diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json index 70aa767225..dc65b70f0b 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json @@ -32,8 +32,49 @@ "frameworks": { "type": "parameter", "datatype": "string", - "description": "The target framework(s) for the project (e.g. netstandard2.0;net472). Default \"net5.0\"", - "defaultValue": "net5.0", + "description": "The target framework(s) for the project (e.g. netstandard2.0;net472). Default \"net5.0\" if \"--console-app\" is true, \"netstandard2.0\" if \"--console-app\" is true", + "defaultValue": "" + }, + "frameworksDefaults": { + "type": "generated", + "generator": "switch", + "description": "generate a default framework value based on consoleApp", + "parameters": { + "evaluator": "C++", + "datatype": "string", + "cases": [ + { + "condition": "(frameworks == '' && consoleApp == true)", + "value": "net5.0" + }, + { + "condition": "(frameworks == '' && consoleApp == false)", + "value": "netstandard2.0" + }, + { + "condition": "(frameworks != '')", + "value": "" + } + ] + }, + "replaces": "$(Frameworks)" + }, + "frameworksValue": { + "type": "generated", + "generator": "join", + "description": "join frameworks and frameworksDefaults", + "parameters": { + "symbols": [ + { + "type": "ref", + "value": "frameworks" + }, + { + "type": "ref", + "value": "frameworksDefaults" + } + ] + }, "replaces": "$(Frameworks)" }, "config": { diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json index d7d84730d3..b812e79296 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json @@ -32,8 +32,49 @@ "frameworks": { "type": "parameter", "datatype": "string", - "description": "The target framework(s) for the project (e.g. netstandard2.0;net472). Default \"net5.0\"", - "defaultValue": "net5.0", + "description": "The target framework(s) for the project (e.g. netstandard2.0;net472). Default \"net5.0\" if \"--console-app\" is true, \"netstandard2.0\" if \"--console-app\" is true", + "defaultValue": "" + }, + "frameworksDefaults": { + "type": "generated", + "generator": "switch", + "description": "generate a default framework value based on consoleApp", + "parameters": { + "evaluator": "C++", + "datatype": "string", + "cases": [ + { + "condition": "(frameworks == '' && consoleApp == true)", + "value": "net5.0" + }, + { + "condition": "(frameworks == '' && consoleApp == false)", + "value": "netstandard2.0" + }, + { + "condition": "(frameworks != '')", + "value": "" + } + ] + }, + "replaces": "$(Frameworks)" + }, + "frameworksValue": { + "type": "generated", + "generator": "join", + "description": "join frameworks and frameworksDefaults", + "parameters": { + "symbols": [ + { + "type": "ref", + "value": "frameworks" + }, + { + "type": "ref", + "value": "frameworksDefaults" + } + ] + }, "replaces": "$(Frameworks)" }, "config": { diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json index 9d493543e0..fdcd8822ad 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json @@ -32,8 +32,49 @@ "frameworks": { "type": "parameter", "datatype": "string", - "description": "The target framework(s) for the project (e.g. netstandard2.0;net472). Default \"net5.0\"", - "defaultValue": "net5.0", + "description": "The target framework(s) for the project (e.g. netstandard2.0;net472). Default \"net5.0\" if \"--console-app\" is true, \"netstandard2.0\" if \"--console-app\" is true", + "defaultValue": "" + }, + "frameworksDefaults": { + "type": "generated", + "generator": "switch", + "description": "generate a default framework value based on consoleApp", + "parameters": { + "evaluator": "C++", + "datatype": "string", + "cases": [ + { + "condition": "(frameworks == '' && consoleApp == true)", + "value": "net5.0" + }, + { + "condition": "(frameworks == '' && consoleApp == false)", + "value": "netstandard2.0" + }, + { + "condition": "(frameworks != '')", + "value": "" + } + ] + }, + "replaces": "$(Frameworks)" + }, + "frameworksValue": { + "type": "generated", + "generator": "join", + "description": "join frameworks and frameworksDefaults", + "parameters": { + "symbols": [ + { + "type": "ref", + "value": "frameworks" + }, + { + "type": "ref", + "value": "frameworksDefaults" + } + ] + }, "replaces": "$(Frameworks)" }, "config": { From 7035cd2fdd433dd81726f8e9607bbac20766cb7b Mon Sep 17 00:00:00 2001 From: jonathon wei Date: Thu, 7 Jan 2021 21:28:28 +1100 Subject: [PATCH 3/3] remove duplicate infomation. --- .../.template.config/template.json | 8 ++++---- .../.template.config/template.json | 8 ++++---- .../.template.config/template.json | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json index dc65b70f0b..ee3057ff34 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json @@ -80,25 +80,25 @@ "config": { "type": "parameter", "datatype": "bool", - "description": "Adds a benchmark config class. Default \"false\"", + "description": "Adds a benchmark config class.", "defaultValue": "false" }, "skipRestore": { "type": "parameter", "datatype": "bool", - "description": "If specified, skips the automatic restore of the project on create. Default \"false\"", + "description": "If specified, skips the automatic restore of the project on create.", "defaultValue": "false" }, "consoleApp": { "type": "parameter", "datatype": "bool", - "description": "If specified, the project is set up as console app. Default \"false\"", + "description": "If specified, the project is set up as console app.", "defaultValue": "false" }, "version": { "type": "parameter", "datatype": "string", - "description": "Version of BenchmarkDotNet that will be referenced. Default \"0.12.0\"", + "description": "Version of BenchmarkDotNet that will be referenced.", "defaultValue": "0.12.0", "replaces": "$(BenchmarkDotNetVersion)" } diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json index b812e79296..7abd02e798 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json @@ -80,25 +80,25 @@ "config": { "type": "parameter", "datatype": "bool", - "description": "Adds a benchmark config class. Default \"false\"", + "description": "Adds a benchmark config class.", "defaultValue": "false" }, "skipRestore": { "type": "parameter", "datatype": "bool", - "description": "If specified, skips the automatic restore of the project on create. Default \"false\"", + "description": "If specified, skips the automatic restore of the project on create.", "defaultValue": "false" }, "consoleApp": { "type": "parameter", "datatype": "bool", - "description": "If specified, the project is set up as console app. Default \"false\"", + "description": "If specified, the project is set up as console app.", "defaultValue": "false" }, "version": { "type": "parameter", "datatype": "string", - "description": "Version of BenchmarkDotNet that will be referenced. Default \"0.12.0\"", + "description": "Version of BenchmarkDotNet that will be referenced.", "defaultValue": "0.12.0", "replaces": "$(BenchmarkDotNetVersion)" } diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json index fdcd8822ad..841f94dbe3 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json @@ -80,25 +80,25 @@ "config": { "type": "parameter", "datatype": "bool", - "description": "Adds a benchmark config class. Default \"false\"", + "description": "Adds a benchmark config class.", "defaultValue": "false" }, "skipRestore": { "type": "parameter", "datatype": "bool", - "description": "If specified, skips the automatic restore of the project on create. Default \"false\"", + "description": "If specified, skips the automatic restore of the project on create.", "defaultValue": "false" }, "consoleApp": { "type": "parameter", "datatype": "bool", - "description": "If specified, the project is set up as console app. Default \"false\"", + "description": "If specified, the project is set up as console app.", "defaultValue": "false" }, "version": { "type": "parameter", "datatype": "string", - "description": "Version of BenchmarkDotNet that will be referenced. Default \"0.12.0\"", + "description": "Version of BenchmarkDotNet that will be referenced.", "defaultValue": "0.12.0", "replaces": "$(BenchmarkDotNetVersion)" }