Skip to content

Commit f08623a

Browse files
authored
Update tasks owned by build to use new version of azure-pipelines-task-lib (#12374)
* Update tasks owned by build to use new version of azure-pipelines-task-lib * Bump task versions of dependent tasks * rebuild updated tasks * Stop warning coming from xamarin tests * logging error in NodeToolV0 tests * Fix tool-lib mocks
1 parent 89875cb commit f08623a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+355
-525
lines changed

Tasks/CMakeV1/cmaketask.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22

33
import path = require('path');
4-
import tl = require('vsts-task-lib/task');
5-
import trm = require('vsts-task-lib/toolrunner');
4+
import tl = require('azure-pipelines-task-lib/task');
5+
import trm = require('azure-pipelines-task-lib/toolrunner');
66

77
async function run() {
88
try {

Tasks/CMakeV1/package-lock.json

Lines changed: 17 additions & 71 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tasks/CMakeV1/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
},
1818
"homepage": "https://github.com/Microsoft/azure-pipelines-tasks#readme",
1919
"dependencies": {
20-
"vsts-task-lib": "^0.9.20"
20+
"azure-pipelines-task-lib": "^2.9.3"
2121
}
2222
}

Tasks/CMakeV1/task.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
],
1616
"version": {
1717
"Major": 1,
18-
"Minor": 151,
19-
"Patch": 1
18+
"Minor": 166,
19+
"Patch": 0
2020
},
2121
"minimumAgentVersion": "1.91.0",
2222
"instanceNameFormat": "CMake $(cmakeArgs)",

Tasks/CMakeV1/task.loc.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
],
1616
"version": {
1717
"Major": 1,
18-
"Minor": 151,
19-
"Patch": 1
18+
"Minor": 166,
19+
"Patch": 0
2020
},
2121
"minimumAgentVersion": "1.91.0",
2222
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",

Tasks/Common/MSBuildHelpers/msbuildhelpers.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import tl = require('vsts-task-lib/task');
2-
import { ToolRunner } from 'vsts-task-lib/toolrunner';
1+
import tl = require('azure-pipelines-task-lib/task');
32

43
/**
54
* Finds the tool path for msbuild/xbuild based on specified msbuild version on Mac or Linux agent

Tasks/Common/MSBuildHelpers/package-lock.json

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tasks/Common/MSBuildHelpers/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
},
1818
"homepage": "https://github.com/Microsoft/azure-pipelines-tasks#readme",
1919
"dependencies": {
20-
"vsts-task-lib": "^2.0.3-preview"
20+
"azure-pipelines-task-lib": "^2.9.3"
2121
}
2222
}

Tasks/GruntV0/grunttask.ts

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import path = require('path');
2-
import tl = require('vsts-task-lib/task');
2+
import tl = require('azure-pipelines-task-lib/task');
3+
import minimatch = require('minimatch');
34

45
tl.setResourcePath(path.join(__dirname, 'task.json'));
56

67
var gruntFile = tl.getPathInput('gruntFile', true, true);
8+
tl.debug('check grunt file :' + gruntFile);
79
var grunt = tl.which('grunt', false);
810
var isCodeCoverageEnabled = tl.getBoolInput('enableCodeCoverage');
911
var publishJUnitResults = tl.getBoolInput('publishJUnitResults');
@@ -15,33 +17,33 @@ tl.cd(cwd);
1517
tl.debug('check path : ' + grunt);
1618
if (!tl.exist(grunt)) {
1719
tl.debug('not found global installed grunt-cli, try to find grunt-cli locally.');
18-
var gt = tl.createToolRunner(tl.which('node', true));
20+
var gt = tl.tool(tl.which('node', true));
1921
var gtcli = tl.getInput('gruntCli', true);
2022
gtcli = path.resolve(cwd, gtcli);
2123
tl.debug('check path : ' + gtcli);
2224
if (!tl.exist(gtcli)) {
2325
tl.setResult(tl.TaskResult.Failed, tl.loc('GruntCliNotInstalled', gtcli));
2426
}
25-
gt.pathArg(gtcli);
27+
gt.arg(gtcli);
2628
}
2729
else {
28-
var gt = tl.createToolRunner(grunt);
30+
var gt = tl.tool(grunt);
2931
}
3032

3133
if (isCodeCoverageEnabled) {
32-
var npm = tl.createToolRunner(tl.which('npm', true));
33-
npm.argString('install istanbul');
34+
var npm = tl.tool(tl.which('npm', true));
35+
npm.line('install istanbul');
3436
var testFramework = tl.getInput('testFramework', true);
3537
var srcFiles = tl.getInput('srcFiles', false);
3638
var testSrc = tl.getPathInput('testFiles', true, false);
37-
var istanbul = tl.createToolRunner(tl.which('node', true));
39+
var istanbul = tl.tool(tl.which('node', true));
3840
istanbul.arg('./node_modules/istanbul/lib/cli.js');
39-
istanbul.argString('cover --report cobertura --report html');
41+
istanbul.line('cover --report cobertura --report html');
4042
if (srcFiles) {
41-
istanbul.argString('-i .' + path.sep + path.join(srcFiles));
43+
istanbul.line('-i .' + path.sep + path.join(srcFiles));
4244
}
4345
if (testFramework.toLowerCase() == 'jasmine') {
44-
istanbul.argString('./node_modules/jasmine/bin/jasmine.js JASMINE_CONFIG_PATH=node_modules/jasmine/lib/examples/jasmine.json');
46+
istanbul.line('./node_modules/jasmine/bin/jasmine.js JASMINE_CONFIG_PATH=node_modules/jasmine/lib/examples/jasmine.json');
4547
} else {
4648
istanbul.arg('./node_modules/mocha/bin/_mocha');
4749
}
@@ -52,9 +54,8 @@ if (isCodeCoverageEnabled) {
5254

5355
// optional - no targets will concat nothing
5456
gt.arg(tl.getDelimitedInput('targets', ' ', false));
55-
gt.arg('--gruntfile');
56-
gt.pathArg(gruntFile);
57-
gt.argString(tl.getInput('arguments', false));
57+
gt.arg(['--gruntfile', gruntFile]);
58+
gt.line(tl.getInput('arguments', false));
5859
gt.exec().then(function (code) {
5960
publishTestResults(publishJUnitResults, testResultsFiles);
6061
if (isCodeCoverageEnabled) {
@@ -87,7 +88,7 @@ function publishTestResults(publishJUnitResults, testResultsFiles: string) {
8788
tl.debug('Pattern found in testResultsFiles parameter');
8889
var buildFolder = tl.getVariable('System.DefaultWorkingDirectory');
8990
var allFiles = tl.find(buildFolder);
90-
var matchingTestResultsFiles = tl.match(allFiles, testResultsFiles, { matchBase: true });
91+
var matchingTestResultsFiles = minimatch.match(allFiles, testResultsFiles, { matchBase: true });
9192
}
9293
else {
9394
tl.debug('No pattern found in testResultsFiles parameter');
@@ -99,7 +100,7 @@ function publishTestResults(publishJUnitResults, testResultsFiles: string) {
99100
}
100101
var tp = new tl.TestPublisher("JUnit");
101102
try {
102-
tp.publish(matchingTestResultsFiles, true, "", "", "", true);
103+
tp.publish(matchingTestResultsFiles, 'true', "", "", "", 'true');
103104
} catch (error) {
104105
tl.warning(error);
105106
}

0 commit comments

Comments
 (0)