From fa0641591ad58579ae3e4dcd7ee66cb5d437ac50 Mon Sep 17 00:00:00 2001 From: Ryan Yandle Date: Wed, 27 Mar 2019 10:53:41 -0700 Subject: [PATCH 1/6] -Add additional arguments parameter to pack command -Add Include Symbols parameter to pack command -Add Include Source parameter to pack command Build and tests passing. --- Tasks/DotNetCoreCLIV2/README.md | 2 ++ .../resources.resjson/en-US/resources.resjson | 6 ++++ Tasks/DotNetCoreCLIV2/packcommand.ts | 17 ++++++++-- Tasks/DotNetCoreCLIV2/task.json | 20 ++++++++++- Tasks/DotNetCoreCLIV2/task.loc.json | 33 +++++++++++++++++-- 5 files changed, 72 insertions(+), 6 deletions(-) diff --git a/Tasks/DotNetCoreCLIV2/README.md b/Tasks/DotNetCoreCLIV2/README.md index a87018c2064a..205bb9fabb2e 100644 --- a/Tasks/DotNetCoreCLIV2/README.md +++ b/Tasks/DotNetCoreCLIV2/README.md @@ -35,6 +35,8 @@ Options specific to **dotnet pack** command * **Configuration to Package\*:** When using a csproj file this specifies the configuration to package. * **Package Folder\*:** Folder where packages will be created. If empty, packages will be created alongside the csproj file. * **Do not build\*:** Don't build the project before packing. Corresponds to the --no-build command line parameter. +* **Include Symbols\*:** Additionally creates symbol nuget packages. Corresponds to the --include-symbols command line parameter. +* **Include Source\*:** Includes source code in the package. Corresponds to the --include-source command line parameter. * **Automatic package versioning\*:** Cannot be used with include referenced projects. If you choose 'Use the date and time', this will generate a SemVer -compliant version formatted as X.Y.Z-ci-datetime where you choose X, Y, and Z. If you choose 'Use an environment variable', you must select an environment variable and ensure it contains the version number you want to use. If you choose 'Use the build number', this will use the build number to version your package. Note: Under Options set the build number format to be '$(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r) diff --git a/Tasks/DotNetCoreCLIV2/Strings/resources.resjson/en-US/resources.resjson b/Tasks/DotNetCoreCLIV2/Strings/resources.resjson/en-US/resources.resjson index 51c6dcf6d056..2eed464e1f27 100644 --- a/Tasks/DotNetCoreCLIV2/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/DotNetCoreCLIV2/Strings/resources.resjson/en-US/resources.resjson @@ -22,6 +22,8 @@ "loc.input.help.arguments": "Arguments to the selected command. For example, build configuration, output folder, runtime. The arguments depend on the command selected.", "loc.input.label.publishTestResults": "Publish test results and code coverage", "loc.input.help.publishTestResults": "Enabling this option will generate a test results TRX file in `$(Agent.TempDirectory)` and results will be published to the server.
This option appends `--logger trx --results-directory $(Agent.TempDirectory)` to the command line arguments.

Code coverage can be collected by adding `--collect \"Code coverage\"` option to the command line arguments. This is currently only available on the Windows platform.", + "loc.input.label.testRunTitle": "Test run title", + "loc.input.help.testRunTitle": "Provide a name for the test run.", "loc.input.label.zipAfterPublish": "Zip Published Projects", "loc.input.help.zipAfterPublish": "If true, folder created by the publish command will be zipped.", "loc.input.label.modifyOutputPath": "Add project name to publish path", @@ -59,6 +61,10 @@ "loc.input.help.outputDir": "Folder where packages will be created. If empty, packages will be created alongside the csproj file.", "loc.input.label.nobuild": "Do not build", "loc.input.help.nobuild": "Don't build the project before packing. Corresponds to the --no-build command line parameter.", + "loc.input.label.includesymbols": "Include Symbols", + "loc.input.help.includesymbols": "Additionally creates symbol nuget packages. Corresponds to the --include-symbols command line parameter.", + "loc.input.label.includesource": "Include Source", + "loc.input.help.includesource": "Includes source code in the package. Corresponds to the --include-source command line parameter.", "loc.input.label.versioningScheme": "Automatic package versioning", "loc.input.help.versioningScheme": "Cannot be used with include referenced projects. If you choose 'Use the date and time', this will generate a [SemVer](http://semver.org/spec/v1.0.0.html)-compliant version formatted as `X.Y.Z-ci-datetime` where you choose X, Y, and Z.\n\nIf you choose 'Use an environment variable', you must select an environment variable and ensure it contains the version number you want to use.\n\nIf you choose 'Use the build number', this will use the build number to version your package. **Note:** Under Options set the build number format to be '[$(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)](https://go.microsoft.com/fwlink/?LinkID=627416)'.", "loc.input.label.versionEnvVar": "Environment variable", diff --git a/Tasks/DotNetCoreCLIV2/packcommand.ts b/Tasks/DotNetCoreCLIV2/packcommand.ts index 5319e461c9a4..068be4d67a13 100644 --- a/Tasks/DotNetCoreCLIV2/packcommand.ts +++ b/Tasks/DotNetCoreCLIV2/packcommand.ts @@ -18,6 +18,9 @@ export async function run(): Promise { let propertiesInput = tl.getInput("buildProperties"); let verbosity = tl.getInput("verbosityPack"); let nobuild = tl.getBoolInput("nobuild"); + let includeSymbols = tl.getBoolInput("includesymbols"); + let includeSource = tl.getBoolInput("includesource"); + let additionalArguments = tl.getInput("arguments") || ""; let outputDir = undefined; try { @@ -124,7 +127,7 @@ export async function run(): Promise { const dotnetPath = tl.which("dotnet", true); for (const file of filesList) { - await dotnetPackAsync(dotnetPath, file, outputDir, nobuild, version, props, verbosity); + await dotnetPackAsync(dotnetPath, file, outputDir, nobuild, includeSymbols, includeSource, additionalArguments, version, props, verbosity); } } catch (err) { tl.error(err); @@ -132,7 +135,7 @@ export async function run(): Promise { } } -function dotnetPackAsync(dotnetPath: string, packageFile: string, outputDir: string, nobuild: boolean, version: string, properties: string[], verbosity: string): Q.Promise { +function dotnetPackAsync(dotnetPath: string, packageFile: string, outputDir: string, nobuild: boolean, includeSymbols: boolean, includeSource: boolean, additionalArguments: string, version: string, properties: string[], verbosity: string): Q.Promise { let dotnet = tl.tool(dotnetPath); dotnet.arg("pack"); @@ -147,6 +150,14 @@ function dotnetPackAsync(dotnetPath: string, packageFile: string, outputDir: str dotnet.arg("--no-build"); } + if (includeSymbols) { + dotnet.arg("--include-symbols"); + } + + if (includeSource) { + dotnet.arg("--include-source"); + } + if (properties && properties.length > 0) { dotnet.arg("/p:" + properties.join(";")); } @@ -160,5 +171,7 @@ function dotnetPackAsync(dotnetPath: string, packageFile: string, outputDir: str dotnet.arg(verbosity); } + dotnet.line(additionalArguments); + return dotnet.exec({ cwd: path.dirname(packageFile) } as IExecOptions); } diff --git a/Tasks/DotNetCoreCLIV2/task.json b/Tasks/DotNetCoreCLIV2/task.json index 9a7f16ed90ab..efd240360025 100644 --- a/Tasks/DotNetCoreCLIV2/task.json +++ b/Tasks/DotNetCoreCLIV2/task.json @@ -120,7 +120,7 @@ "type": "string", "label": "Arguments", "defaultValue": "", - "visibleRule": "command = build || command = publish || command = run || command = test || command = custom", + "visibleRule": "command = build || command = publish || command = run || command = test || command = custom || command = pack", "required": false, "helpMarkDown": "Arguments to the selected command. For example, build configuration, output folder, runtime. The arguments depend on the command selected." }, @@ -367,6 +367,24 @@ "required": false, "visibleRule": "command = pack" }, + { + "name": "includesymbols", + "type": "boolean", + "label": "Include Symbols", + "defaultValue": "false", + "helpMarkDown": "Additionally creates symbol nuget packages. Corresponds to the --include-symbols command line parameter.", + "required": false, + "visibleRule": "command = pack" + }, + { + "name": "includesource", + "type": "boolean", + "label": "Include Source", + "defaultValue": "false", + "helpMarkDown": "Includes source code in the package. Corresponds to the --include-source command line parameter.", + "required": false, + "visibleRule": "command = pack" + }, { "name": "versioningScheme", "type": "pickList", diff --git a/Tasks/DotNetCoreCLIV2/task.loc.json b/Tasks/DotNetCoreCLIV2/task.loc.json index 6cbd0f85a14b..48b72c384a09 100644 --- a/Tasks/DotNetCoreCLIV2/task.loc.json +++ b/Tasks/DotNetCoreCLIV2/task.loc.json @@ -17,8 +17,8 @@ "demands": [], "version": { "Major": 2, - "Minor": 148, - "Patch": 2 + "Minor": 150, + "Patch": 0 }, "minimumAgentVersion": "2.115.0", "instanceNameFormat": "ms-resource:loc.instanceNameFormat", @@ -120,7 +120,7 @@ "type": "string", "label": "ms-resource:loc.input.label.arguments", "defaultValue": "", - "visibleRule": "command = build || command = publish || command = run || command = test || command = custom", + "visibleRule": "command = build || command = publish || command = run || command = test || command = custom || command = pack", "required": false, "helpMarkDown": "ms-resource:loc.input.help.arguments" }, @@ -133,6 +133,15 @@ "required": false, "helpMarkDown": "ms-resource:loc.input.help.publishTestResults" }, + { + "name": "testRunTitle", + "type": "string", + "label": "ms-resource:loc.input.label.testRunTitle", + "defaultValue": "", + "visibleRule": "command = test", + "required": false, + "helpMarkDown": "ms-resource:loc.input.help.testRunTitle" + }, { "name": "zipAfterPublish", "type": "boolean", @@ -358,6 +367,24 @@ "required": false, "visibleRule": "command = pack" }, + { + "name": "includesymbols", + "type": "boolean", + "label": "ms-resource:loc.input.label.includesymbols", + "defaultValue": "false", + "helpMarkDown": "ms-resource:loc.input.help.includesymbols", + "required": false, + "visibleRule": "command = pack" + }, + { + "name": "includesource", + "type": "boolean", + "label": "ms-resource:loc.input.label.includesource", + "defaultValue": "false", + "helpMarkDown": "ms-resource:loc.input.help.includesource", + "required": false, + "visibleRule": "command = pack" + }, { "name": "versioningScheme", "type": "pickList", From dc50c3682cb5b0d883dd0036c77c7f853b1443c0 Mon Sep 17 00:00:00 2001 From: Ryan Yandle Date: Thu, 18 Apr 2019 20:57:43 -0700 Subject: [PATCH 2/6] remove additional args --- Tasks/DotNetCoreCLIV2/packcommand.ts | 7 ++----- Tasks/DotNetCoreCLIV2/task.json | 2 +- Tasks/DotNetCoreCLIV2/task.loc.json | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Tasks/DotNetCoreCLIV2/packcommand.ts b/Tasks/DotNetCoreCLIV2/packcommand.ts index f01bf412f435..c09a32f5c812 100644 --- a/Tasks/DotNetCoreCLIV2/packcommand.ts +++ b/Tasks/DotNetCoreCLIV2/packcommand.ts @@ -20,7 +20,6 @@ export async function run(): Promise { let nobuild = tl.getBoolInput("nobuild"); let includeSymbols = tl.getBoolInput("includesymbols"); let includeSource = tl.getBoolInput("includesource"); - let additionalArguments = tl.getInput("arguments") || ""; let outputDir = undefined; try { @@ -127,7 +126,7 @@ export async function run(): Promise { const dotnetPath = tl.which("dotnet", true); for (const file of filesList) { - await dotnetPackAsync(dotnetPath, file, outputDir, nobuild, includeSymbols, includeSource, additionalArguments, version, props, verbosity); + await dotnetPackAsync(dotnetPath, file, outputDir, nobuild, includeSymbols, includeSource, version, props, verbosity); } } catch (err) { tl.error(err); @@ -135,7 +134,7 @@ export async function run(): Promise { } } -function dotnetPackAsync(dotnetPath: string, packageFile: string, outputDir: string, nobuild: boolean, includeSymbols: boolean, includeSource: boolean, additionalArguments: string, version: string, properties: string[], verbosity: string): Q.Promise { +function dotnetPackAsync(dotnetPath: string, packageFile: string, outputDir: string, nobuild: boolean, includeSymbols: boolean, includeSource: boolean, version: string, properties: string[], verbosity: string): Q.Promise { let dotnet = tl.tool(dotnetPath); dotnet.arg("pack"); @@ -171,7 +170,5 @@ function dotnetPackAsync(dotnetPath: string, packageFile: string, outputDir: str dotnet.arg(verbosity); } - dotnet.line(additionalArguments); - return dotnet.exec({ cwd: path.dirname(packageFile) } as IExecOptions); } diff --git a/Tasks/DotNetCoreCLIV2/task.json b/Tasks/DotNetCoreCLIV2/task.json index b222173444ed..9a6589db295a 100644 --- a/Tasks/DotNetCoreCLIV2/task.json +++ b/Tasks/DotNetCoreCLIV2/task.json @@ -120,7 +120,7 @@ "type": "string", "label": "Arguments", "defaultValue": "", - "visibleRule": "command = build || command = publish || command = run || command = test || command = custom || command = pack", + "visibleRule": "command = build || command = publish || command = run || command = test || command = custom", "required": false, "helpMarkDown": "Arguments to the selected command. For example, build configuration, output folder, runtime. The arguments depend on the command selected." }, diff --git a/Tasks/DotNetCoreCLIV2/task.loc.json b/Tasks/DotNetCoreCLIV2/task.loc.json index 76a1df14ac74..2cfc4f3d75cc 100644 --- a/Tasks/DotNetCoreCLIV2/task.loc.json +++ b/Tasks/DotNetCoreCLIV2/task.loc.json @@ -120,7 +120,7 @@ "type": "string", "label": "ms-resource:loc.input.label.arguments", "defaultValue": "", - "visibleRule": "command = build || command = publish || command = run || command = test || command = custom || command = pack", + "visibleRule": "command = build || command = publish || command = run || command = test || command = custom", "required": false, "helpMarkDown": "ms-resource:loc.input.help.arguments" }, From c59118257b6dfa5ab89bea5b8b7c5d13a4b6af8b Mon Sep 17 00:00:00 2001 From: David Staheli Date: Fri, 19 Apr 2019 17:15:14 -0700 Subject: [PATCH 3/6] Update Tasks/DotNetCoreCLIV2/task.json change capitalization of NuGet Co-Authored-By: ryandle --- Tasks/DotNetCoreCLIV2/task.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tasks/DotNetCoreCLIV2/task.json b/Tasks/DotNetCoreCLIV2/task.json index e22a8fe920a7..683420016dcf 100644 --- a/Tasks/DotNetCoreCLIV2/task.json +++ b/Tasks/DotNetCoreCLIV2/task.json @@ -372,7 +372,7 @@ "type": "boolean", "label": "Include Symbols", "defaultValue": "false", - "helpMarkDown": "Additionally creates symbol nuget packages. Corresponds to the --include-symbols command line parameter.", + "helpMarkDown": "Additionally creates symbol NuGet packages. Corresponds to the --include-symbols command line parameter.", "required": false, "visibleRule": "command = pack" }, From cc5cfc2e8d131eb824727bdf925dbad203036621 Mon Sep 17 00:00:00 2001 From: Ryan Yandle Date: Fri, 19 Apr 2019 17:17:04 -0700 Subject: [PATCH 4/6] Update task version from 2.151.0 to 2.152.0 --- Tasks/DotNetCoreCLIV2/task.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tasks/DotNetCoreCLIV2/task.json b/Tasks/DotNetCoreCLIV2/task.json index 9a6589db295a..cf7a5783c907 100644 --- a/Tasks/DotNetCoreCLIV2/task.json +++ b/Tasks/DotNetCoreCLIV2/task.json @@ -17,7 +17,7 @@ "demands": [], "version": { "Major": 2, - "Minor": 151, + "Minor": 152, "Patch": 0 }, "minimumAgentVersion": "2.115.0", From 6b0b4025db2db2ff09a06d91b7fa1e7871819907 Mon Sep 17 00:00:00 2001 From: Ryan Yandle Date: Sat, 20 Apr 2019 13:59:40 -0700 Subject: [PATCH 5/6] -run build to update tasks.loc.json and en-US resource strings -fix the other NuGet capitalization in readme.md --- Tasks/DotNetCoreCLIV2/README.md | 2 +- .../Strings/resources.resjson/en-US/resources.resjson | 2 +- Tasks/DotNetCoreCLIV2/task.loc.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Tasks/DotNetCoreCLIV2/README.md b/Tasks/DotNetCoreCLIV2/README.md index 205bb9fabb2e..519eaf8eef82 100644 --- a/Tasks/DotNetCoreCLIV2/README.md +++ b/Tasks/DotNetCoreCLIV2/README.md @@ -35,7 +35,7 @@ Options specific to **dotnet pack** command * **Configuration to Package\*:** When using a csproj file this specifies the configuration to package. * **Package Folder\*:** Folder where packages will be created. If empty, packages will be created alongside the csproj file. * **Do not build\*:** Don't build the project before packing. Corresponds to the --no-build command line parameter. -* **Include Symbols\*:** Additionally creates symbol nuget packages. Corresponds to the --include-symbols command line parameter. +* **Include Symbols\*:** Additionally creates symbol NuGet packages. Corresponds to the --include-symbols command line parameter. * **Include Source\*:** Includes source code in the package. Corresponds to the --include-source command line parameter. * **Automatic package versioning\*:** Cannot be used with include referenced projects. If you choose 'Use the date and time', this will generate a SemVer -compliant version formatted as X.Y.Z-ci-datetime where you choose X, Y, and Z. If you choose 'Use an environment variable', you must select an environment variable and ensure it contains the version number you want to use. diff --git a/Tasks/DotNetCoreCLIV2/Strings/resources.resjson/en-US/resources.resjson b/Tasks/DotNetCoreCLIV2/Strings/resources.resjson/en-US/resources.resjson index 4a9838a09eef..5a3349b829d6 100644 --- a/Tasks/DotNetCoreCLIV2/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/DotNetCoreCLIV2/Strings/resources.resjson/en-US/resources.resjson @@ -62,7 +62,7 @@ "loc.input.label.nobuild": "Do not build", "loc.input.help.nobuild": "Don't build the project before packing. Corresponds to the --no-build command line parameter.", "loc.input.label.includesymbols": "Include Symbols", - "loc.input.help.includesymbols": "Additionally creates symbol nuget packages. Corresponds to the --include-symbols command line parameter.", + "loc.input.help.includesymbols": "Additionally creates symbol NuGet packages. Corresponds to the --include-symbols command line parameter.", "loc.input.label.includesource": "Include Source", "loc.input.help.includesource": "Includes source code in the package. Corresponds to the --include-source command line parameter.", "loc.input.label.versioningScheme": "Automatic package versioning", diff --git a/Tasks/DotNetCoreCLIV2/task.loc.json b/Tasks/DotNetCoreCLIV2/task.loc.json index 025297d2330a..9c351b163013 100644 --- a/Tasks/DotNetCoreCLIV2/task.loc.json +++ b/Tasks/DotNetCoreCLIV2/task.loc.json @@ -17,8 +17,8 @@ "demands": [], "version": { "Major": 2, - "Minor": 151, - "Patch": 1 + "Minor": 152, + "Patch": 0 }, "minimumAgentVersion": "2.115.0", "instanceNameFormat": "ms-resource:loc.instanceNameFormat", From c5acf637ce88184d2b516e5db69eab6191671997 Mon Sep 17 00:00:00 2001 From: Ryan Yandle Date: Sat, 20 Apr 2019 14:03:49 -0700 Subject: [PATCH 6/6] add back newline at end of file --- Tasks/DotNetCoreCLIV2/task.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tasks/DotNetCoreCLIV2/task.json b/Tasks/DotNetCoreCLIV2/task.json index 3db6f39efc68..8e53665d8f85 100644 --- a/Tasks/DotNetCoreCLIV2/task.json +++ b/Tasks/DotNetCoreCLIV2/task.json @@ -558,4 +558,4 @@ "NGCommon_UnableToFindTool": "Unable to find tool %s", "Warning_UpdatingNuGetVersion": "Updating version of NuGet.exe to %s from %s. Behavior changes or breaking changes might occur as NuGet updates to a new version. If this is not desired, deselect the 'Check for Latest Version' option in the task." } -} \ No newline at end of file +}