Skip to content

Commit

Permalink
updated all tasks to node20 along with version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
hey24sheep committed Sep 15, 2024
1 parent a2a62e2 commit 67fb8de
Show file tree
Hide file tree
Showing 20 changed files with 1,631 additions and 3,337 deletions.
135 changes: 46 additions & 89 deletions tasks/analyze/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,101 +8,58 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var task = require("azure-pipelines-task-lib/task");
var path = require("path");
var FLUTTER_TOOL_PATH_ENV_VAR = 'FlutterToolPath';
const task = require("azure-pipelines-task-lib/task");
const path = require("path");
const FLUTTER_TOOL_PATH_ENV_VAR = 'FlutterToolPath';
function main() {
return __awaiter(this, void 0, void 0, function () {
var flutterPath, projectDirectory, pubGet, extraArgs, extraArgSep;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
flutterPath = task.getVariable(FLUTTER_TOOL_PATH_ENV_VAR) || process.env[FLUTTER_TOOL_PATH_ENV_VAR] || task.getInput('flutterDirectory', false);
flutterPath = path.join(flutterPath, "flutter");
if (!flutterPath) {
throw new Error("The '".concat(FLUTTER_TOOL_PATH_ENV_VAR, "' environment variable must be set before using this task (you can use 'flutterinstall' task)."));
}
projectDirectory = task.getPathInput('projectDirectory', false, false);
if (projectDirectory) {
task.debug("Moving to ".concat(projectDirectory));
task.cd(projectDirectory);
}
task.debug("Project's directory : ".concat(task.cwd()));
pubGet = task.getBoolInput('pubGet', false);
extraArgs = task.getInput('extraArgs', false);
extraArgSep = task.getInput('extraArgsSeparator', false);
if (!extraArgSep || extraArgSep === '') {
extraArgSep = " ";
}
// 4. Builds
return [4 /*yield*/, runAnalyze(flutterPath, pubGet, extraArgs, extraArgSep)];
case 1:
// 4. Builds
_a.sent();
task.setResult(task.TaskResult.Succeeded, "Analyze succeeded");
return [2 /*return*/];
}
});
return __awaiter(this, void 0, void 0, function* () {
// 1. Check flutter environment
var flutterPath = task.getVariable(FLUTTER_TOOL_PATH_ENV_VAR) || process.env[FLUTTER_TOOL_PATH_ENV_VAR] || task.getInput('flutterDirectory', false);
flutterPath = path.join(flutterPath, "flutter");
if (!flutterPath) {
throw new Error(`The '${FLUTTER_TOOL_PATH_ENV_VAR}' environment variable must be set before using this task (you can use 'flutterinstall' task).`);
}
// 2. Move current working directory to project
let projectDirectory = task.getPathInput('projectDirectory', false, false);
if (projectDirectory) {
task.debug(`Moving to ${projectDirectory}`);
task.cd(projectDirectory);
}
task.debug(`Project's directory : ${task.cwd()}`);
// 3. Get common input
let pubGet = task.getBoolInput('pubGet', false);
let extraArgs = task.getInput('extraArgs', false);
let extraArgSep = task.getInput('extraArgsSeparator', false);
if (!extraArgSep || extraArgSep === '') {
extraArgSep = " ";
}
// 4. Builds
yield runAnalyze(flutterPath, pubGet, extraArgs, extraArgSep);
task.setResult(task.TaskResult.Succeeded, "Analyze succeeded");
});
}
function runAnalyze(flutter, pubGet, extraArgs, extraArgSep) {
return __awaiter(this, void 0, void 0, function () {
var args, splitted, result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
args = [
"analyze",
];
if (pubGet) {
args.push("--pub");
}
else {
args.push("--no-pub");
}
if (extraArgs) {
splitted = extraArgs.split(extraArgSep);
args.push.apply(args, splitted);
}
return [4 /*yield*/, task.exec(flutter, args)];
case 1:
result = _a.sent();
if (result !== 0) {
throw new Error("Analyze Failed");
}
return [2 /*return*/];
}
});
return __awaiter(this, void 0, void 0, function* () {
var args = [
"analyze",
];
if (pubGet) {
args.push("--pub");
}
else {
args.push("--no-pub");
}
if (extraArgs) {
var splitted = extraArgs.split(extraArgSep);
args.push(...splitted);
}
var result = yield task.exec(flutter, args);
if (result !== 0) {
throw new Error("Analyze Failed");
}
});
}
main().catch(function (error) {
main().catch(error => {
task.setResult(task.TaskResult.Failed, error);
});
4 changes: 2 additions & 2 deletions tasks/analyze/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tasks/analyze/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"author": "Hey24sheep",
"version": {
"Major": 0,
"Minor": 3,
"Patch": 1
"Minor": 4,
"Patch": 0
},
"groups": [],
"instanceNameFormat": "Flutter Analyze",
Expand Down
Loading

0 comments on commit 67fb8de

Please sign in to comment.