Skip to content

Commit

Permalink
Merge pull request #5546 from Microsoft/users/aldoms/releases/m123
Browse files Browse the repository at this point in the history
Split multiple search patterns by semi-colon
  • Loading branch information
aldoms authored Oct 3, 2017
2 parents f0f8813 + f57c60f commit 7a7373a
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"loc.input.label.verbosityRestore": "Verbosity",
"loc.input.help.verbosityRestore": "Specifies the amount of detail displayed in the output.",
"loc.input.label.searchPatternPush": "Path to NuGet package(s) to publish",
"loc.input.help.searchPatternPush": "The pattern to match or path to nupkg files to be uploaded. Multiple patterns can be separated by a semicolon.",
"loc.input.help.searchPatternPush": "The pattern to match or path to nupkg files to be uploaded. Multiple patterns can be separated by a semicolon, and you can make a pattern negative by prefixing it with '-:'. Example: `**\\*.nupkg;-:**\\*.Tests.nupkg`",
"loc.input.label.nuGetFeedType": "Target feed location",
"loc.input.label.feedPublish": "Target feed",
"loc.input.help.feedPublish": "Select a feed hosted in this account. You must have Package Management installed and licensed to select a feed here.",
Expand Down
27 changes: 15 additions & 12 deletions Tasks/DotNetCoreCLI/Tests/DotnetMockHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ import * as auth from 'nuget-task-common/Authentication'
export class DotnetMockHelper {
private defaultNugetVersion = '4.0.0';
private defaultNugetVersionInfo = [4,0,0,0];

constructor(
private tmr: tmrm.TaskMockRunner) {
private tmr: tmrm.TaskMockRunner) {
process.env['AGENT_HOMEDIRECTORY'] = "c:\\agent\\home\\directory";
process.env['BUILD_SOURCESDIRECTORY'] = "c:\\agent\\home\\directory\\sources",
process.env['ENDPOINT_AUTH_SYSTEMVSSCONNECTION'] = "{\"parameters\":{\"AccessToken\":\"token\"},\"scheme\":\"OAuth\"}";
process.env['ENDPOINT_URL_SYSTEMVSSCONNECTION'] = "https://example.visualstudio.com/defaultcollection";
process.env['SYSTEM_DEFAULTWORKINGDIRECTORY'] = "c:\\agent\\home\\directory";
process.env['SYSTEM_TEAMFOUNDATIONCOLLECTIONURI'] = "https://example.visualstudio.com/defaultcollection";
process.env['BUILD_BUILDID'] = "1";
process.env['BUILD_BUILDID'] = "1";
}

public setNugetVersionInputDefault() {
}

public registerDefaultNugetVersionMock() {
this.registerNugetVersionMock(this.defaultNugetVersion, this.defaultNugetVersionInfo);
this.registerNugetToolGetterMock();
Expand All @@ -33,7 +33,7 @@ export class DotnetMockHelper {
},
} )
}

public registerNugetVersionMock(productVersion: string, versionInfoVersion: number[]) {
this.registerNugetVersionMockInternal(productVersion, versionInfoVersion);
this.registerMockWithMultiplePaths(['nuget-task-common/pe-parser', './pe-parser'], {
Expand Down Expand Up @@ -62,9 +62,12 @@ export class DotnetMockHelper {
}
})
}

public registerNugetUtilityMock(projectFile: string[]) {
this.tmr.registerMock('nuget-task-common/Utility', {
getPatternsArrayFromInput: function(input) {
return [`fromMockedUtility-${input}`];
},
resolveFilterSpec: function(filterSpec, basePath?, allowEmptyMatch?) {
return projectFile;
},
Expand Down Expand Up @@ -110,13 +113,13 @@ export class DotnetMockHelper {
this.tmr.registerMock('vso-node-api/WebApi', {
getBearerHandler: function(token){
return {};
},
},
WebApi: function(url, handler){
return {
getCoreApi: function() {
return {
return {
vsoClient: {
getVersioningData: function (ApiVersion, PackagingAreaName, PackageAreaId, Obj) {
getVersioningData: function (ApiVersion, PackagingAreaName, PackageAreaId, Obj) {
return { requestUrl:"foobar" }
}
}
Expand All @@ -126,7 +129,7 @@ export class DotnetMockHelper {
}
})
}

public setAnswers(a) {
a.osType["osType"] = "Windows_NT";
a.exist["c:\\agent\\home\\directory\\externals\\nuget\\nuget.exe"] = true;
Expand All @@ -140,4 +143,4 @@ export class DotnetMockHelper {
this.tmr.registerMock(paths[i], mock);
}
}
}
}
6 changes: 3 additions & 3 deletions Tasks/DotNetCoreCLI/Tests/PackTests/noProjectsFound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
}
},
"exist": {
"C:\\out\\dir": true
"C:\\out\\dir": true
},
"stats": {
"c:\\agent\\home\\directory\\foo.nuspec": {
"isFile": true
}
},
},
"findMatch": {
"foo.nuspec" : []
"fromMockedUtility-foo.nuspec" : []
}
};
nmh.setAnswers(a);
Expand Down
6 changes: 3 additions & 3 deletions Tasks/DotNetCoreCLI/Tests/PackTests/packBuildNumber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
}
},
"exist": {
"C:\\out\\dir": true
"C:\\out\\dir": true
},
"stats": {
"c:\\agent\\home\\directory\\single.csproj": {
"isFile": true
}
},
},
"findMatch": {
"single.csproj": ["c:\\agent\\home\\directory\\single.csproj"]
"fromMockedUtility-single.csproj": ["c:\\agent\\home\\directory\\single.csproj"]
}
};
nmh.setAnswers(a);
Expand Down
6 changes: 3 additions & 3 deletions Tasks/DotNetCoreCLI/Tests/PackTests/packEnvVar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
}
},
"exist": {
"C:\\out\\dir": true
"C:\\out\\dir": true
},
"stats": {
"c:\\agent\\home\\directory\\foo.nuspec": {
"isFile": true
}
},
},
"findMatch": {
"foo.nuspec" : ["c:\\agent\\home\\directory\\foo.nuspec"]
"fromMockedUtility-foo.nuspec" : ["c:\\agent\\home\\directory\\foo.nuspec"]
}
};
nmh.setAnswers(a);
Expand Down
6 changes: 3 additions & 3 deletions Tasks/DotNetCoreCLI/Tests/PackTests/packPrerelease.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
}
},
"exist": {
"C:\\out\\dir": true
"C:\\out\\dir": true
},
"stats": {
"c:\\agent\\home\\directory\\foo.nuspec": {
"isFile": true
}
},
},
"findMatch": {
"foo.nuspec" : ["c:\\agent\\home\\directory\\foo.nuspec"]
"fromMockedUtility-foo.nuspec" : ["c:\\agent\\home\\directory\\foo.nuspec"]
}
};
nmh.setAnswers(a);
Expand Down
2 changes: 1 addition & 1 deletion Tasks/DotNetCoreCLI/Tests/PushTests/internalFeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
}
},
"findMatch": {
"foo.nupkg" : ["c:\\agent\\home\\directory\\foo.nupkg"]
"fromMockedUtility-foo.nupkg" : ["c:\\agent\\home\\directory\\foo.nupkg"]
}
};
nmh.setAnswers(a);
Expand Down
2 changes: 1 addition & 1 deletion Tasks/DotNetCoreCLI/Tests/PushTests/internalFeedOnPrem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
}
},
"findMatch": {
"foo.nupkg" : ["c:\\agent\\home\\directory\\foo.nupkg"]
"fromMockedUtility-foo.nupkg" : ["c:\\agent\\home\\directory\\foo.nupkg"]
}
};
nmh.setAnswers(a);
Expand Down
2 changes: 1 addition & 1 deletion Tasks/DotNetCoreCLI/Tests/PushTests/noProjectsFound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
}
},
"findMatch": {
"foo.nupkg": []
"fromMockedUtility-foo.nupkg": []
}
};
nmh.setAnswers(a);
Expand Down
4 changes: 2 additions & 2 deletions Tasks/DotNetCoreCLI/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vsts-tasks-dotnetcoreexe",
"version": "2.1.3",
"version": "2.1.5",
"description": "Dotnet core exe",
"main": "dotnetcore.js",
"scripts": {
Expand All @@ -23,4 +23,4 @@
"vso-node-api": "6.0.1-preview",
"vsts-task-lib": "2.0.6"
}
}
}
9 changes: 5 additions & 4 deletions Tasks/DotNetCoreCLI/packcommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { IExecOptions } from "vsts-task-lib/toolrunner";

export async function run(): Promise<void> {

let searchPattern = tl.getPathInput("searchPatternPack", true);
let searchPatternInput = tl.getPathInput("searchPatternPack", true);
let configuration = tl.getInput("configurationToPack");
let versioningScheme = tl.getInput("versioningScheme");
let versionEnvVar = tl.getInput("versionEnvVar");
Expand Down Expand Up @@ -84,17 +84,18 @@ export async function run(): Promise<void> {

let useLegacyFind: boolean = tl.getVariable("NuGet.UseLegacyFindFiles") === "true";
let filesList: string[] = [];
if (!searchPattern) {
if (!searchPatternInput) {
// Use empty string when no project file is specified to operate on the current directory
filesList = [""];
} else {
if (!useLegacyFind) {
let findOptions: tl.FindOptions = <tl.FindOptions>{};
let matchOptions: tl.MatchOptions = <tl.MatchOptions>{};
filesList = tl.findMatch(undefined, searchPattern, findOptions, matchOptions);
let searchPatterns: string[] = nutil.getPatternsArrayFromInput(searchPatternInput);
filesList = tl.findMatch(undefined, searchPatterns, findOptions, matchOptions);
}
else {
filesList = nutil.resolveFilterSpec(searchPattern);
filesList = nutil.resolveFilterSpec(searchPatternInput);
}
}

Expand Down
5 changes: 3 additions & 2 deletions Tasks/DotNetCoreCLI/pushcommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ export async function run(): Promise<void> {
let buildIdentityAccount: string = null;
try {
// Get list of files to publish
const searchPattern = tl.getPathInput("searchPatternPush", true, false);
const searchPatternInput = tl.getPathInput("searchPatternPush", true, false);
let findOptions: tl.FindOptions = <tl.FindOptions>{};
let matchOptions: tl.MatchOptions = <tl.MatchOptions>{};
const filesList = tl.findMatch(undefined, searchPattern, findOptions, matchOptions);
let searchPatterns: string[] = nutil.getPatternsArrayFromInput(searchPatternInput);
const filesList = tl.findMatch(undefined, searchPatterns, findOptions, matchOptions);

filesList.forEach(packageFile => {
if (!tl.stats(packageFile).isFile()) {
Expand Down
4 changes: 2 additions & 2 deletions Tasks/DotNetCoreCLI/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"version": {
"Major": 2,
"Minor": 1,
"Patch": 4
"Patch": 5
},
"minimumAgentVersion": "2.0.0",
"instanceNameFormat": "dotnet $(command)",
Expand Down Expand Up @@ -233,7 +233,7 @@
"type": "filePath",
"label": "Path to NuGet package(s) to publish",
"defaultValue": "$(Build.ArtifactStagingDirectory)/*.nupkg",
"helpMarkDown": "The pattern to match or path to nupkg files to be uploaded. Multiple patterns can be separated by a semicolon.",
"helpMarkDown": "The pattern to match or path to nupkg files to be uploaded. Multiple patterns can be separated by a semicolon, and you can make a pattern negative by prefixing it with '-:'. Example: `**\\*.nupkg;-:**\\*.Tests.nupkg`",
"required": true,
"visibleRule": "command = push"
},
Expand Down
2 changes: 1 addition & 1 deletion Tasks/DotNetCoreCLI/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"version": {
"Major": 2,
"Minor": 1,
"Patch": 4
"Patch": 5
},
"minimumAgentVersion": "2.0.0",
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",
Expand Down

0 comments on commit 7a7373a

Please sign in to comment.