Skip to content

Commit

Permalink
[DotNetCoreCLIV2]adding option in case packageFile is .nuspec (#13712)
Browse files Browse the repository at this point in the history
* adding option in case packageFile is .nuspec

* fixing tests

* correcting the command

* updated L0.js

* using NuspecFile instead of NugetConfig

* updated task version
  • Loading branch information
NinadKavimandan authored Oct 28, 2020
1 parent cc2a5cc commit 8c47ce2
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Tasks/DotNetCoreCLIV2/Tests/L0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ describe('DotNetCoreExe Suite', function () {

tr.run();
assert(tr.invokedToolCount == 1, 'should have run dotnet once');
assert(tr.ran('c:\\path\\dotnet.exe pack c:\\agent\\home\\directory\\foo.nuspec --output C:\\out\\dir /p:PackageVersion=x.y.z-CI-YYYYMMDD-HHMMSS'), 'it should have run dotnet');
assert(tr.ran('c:\\path\\dotnet.exe pack -p:NuspecFile=c:\\agent\\home\\directory\\foo.nuspec --output C:\\out\\dir /p:PackageVersion=x.y.z-CI-YYYYMMDD-HHMMSS'), 'it should have run dotnet');
assert(tr.stdOutContained('dotnet output'), "should have dotnet output");
assert(tr.succeeded, 'should have succeeded');
assert.equal(tr.errorIssues.length, 0, "should have no errors");
Expand All @@ -369,7 +369,7 @@ describe('DotNetCoreExe Suite', function () {

tr.run();
assert(tr.invokedToolCount == 1, 'should have run dotnet once');
assert(tr.ran('c:\\path\\dotnet.exe pack c:\\agent\\home\\directory\\foo.nuspec --output C:\\out\\dir /p:PackageVersion=XX.YY.ZZ'), 'it should have run dotnet');
assert(tr.ran('c:\\path\\dotnet.exe pack -p:NuspecFile=c:\\agent\\home\\directory\\foo.nuspec --output C:\\out\\dir /p:PackageVersion=XX.YY.ZZ'), 'it should have run dotnet');
assert(tr.stdOutContained('dotnet output'), "should have dotnet output");
assert(tr.succeeded, 'should have succeeded');
assert.equal(tr.errorIssues.length, 0, "should have no errors");
Expand Down
2 changes: 1 addition & 1 deletion Tasks/DotNetCoreCLIV2/Tests/PackTests/packEnvVar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
"dotnet": "c:\\path\\dotnet.exe"
},
"exec": {
"c:\\path\\dotnet.exe pack c:\\agent\\home\\directory\\foo.nuspec --output C:\\out\\dir /p:PackageVersion=XX.YY.ZZ": {
"c:\\path\\dotnet.exe pack -p:NuspecFile=c:\\agent\\home\\directory\\foo.nuspec --output C:\\out\\dir /p:PackageVersion=XX.YY.ZZ": {
"code": 0,
"stdout": "dotnet output",
"stderr": ""
Expand Down
2 changes: 1 addition & 1 deletion Tasks/DotNetCoreCLIV2/Tests/PackTests/packPrerelease.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
"dotnet": "c:\\path\\dotnet.exe"
},
"exec": {
"c:\\path\\dotnet.exe pack c:\\agent\\home\\directory\\foo.nuspec --output C:\\out\\dir /p:PackageVersion=x.y.z-CI-YYYYMMDD-HHMMSS": {
"c:\\path\\dotnet.exe pack -p:NuspecFile=c:\\agent\\home\\directory\\foo.nuspec --output C:\\out\\dir /p:PackageVersion=x.y.z-CI-YYYYMMDD-HHMMSS": {
"code": 0,
"stdout": "dotnet output",
"stderr": ""
Expand Down
6 changes: 5 additions & 1 deletion Tasks/DotNetCoreCLIV2/packcommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ function dotnetPackAsync(dotnetPath: string, packageFile: string, outputDir: str
let dotnet = tl.tool(dotnetPath);

dotnet.arg("pack");
dotnet.arg(packageFile);

if(packageFile.endsWith(".nuspec")) {
dotnet.arg("-p:NuspecFile="+packageFile);
}
else dotnet.arg(packageFile);

if (outputDir) {
dotnet.arg("--output");
Expand Down
2 changes: 1 addition & 1 deletion Tasks/DotNetCoreCLIV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"demands": [],
"version": {
"Major": 2,
"Minor": 175,
"Minor": 177,
"Patch": 0
},
"minimumAgentVersion": "2.115.0",
Expand Down
4 changes: 2 additions & 2 deletions Tasks/DotNetCoreCLIV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"demands": [],
"version": {
"Major": 2,
"Minor": 175,
"Minor": 177,
"Patch": 0
},
"minimumAgentVersion": "2.115.0",
Expand Down Expand Up @@ -571,4 +571,4 @@
"NetCore3Update": "ms-resource:loc.messages.NetCore3Update",
"DeprecatedDotnet2_2_And_3_0": "ms-resource:loc.messages.DeprecatedDotnet2_2_And_3_0"
}
}
}

0 comments on commit 8c47ce2

Please sign in to comment.