From 6774c4c672fa43cead8d1450f7e148276e40f248 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Thu, 28 Sep 2023 22:08:20 -0700 Subject: [PATCH 01/12] debugging issues around specifying the latest patch release --- .github/workflows/dart.yml | 2 +- README.md | 2 +- dist/main.cjs | 18 +++++++++++++++++- dist/sig.txt | 2 +- lib/main.dart | 7 ++++++- lib/node/actions/core.dart | 2 -- lib/node/process.dart | 2 ++ 7 files changed, 28 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index dae5275..22fe647 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -94,7 +94,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - sdk: [2.19, 3.1] + sdk: ['2.19', 3.0, '3.1'] fail-fast: false steps: - uses: actions/checkout@v3 diff --git a/README.md b/README.md index 99dc19f..6e99ded 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - sdk: [3.1, stable, beta, dev] + sdk: ['3.1', 'stable', 'beta'] steps: - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@v1 diff --git a/dist/main.cjs b/dist/main.cjs index 3973f14..c69ea75 100644 --- a/dist/main.cjs +++ b/dist/main.cjs @@ -5816,6 +5816,7 @@ sdk = A._asString(t2._as(t1.core).getInput("sdk")); if (J.get$length$asx(sdk) === 0) sdk = "stable"; + A.printString("*** sdk [" + A.S(sdk) + "] ***"); flavor = A._asString(t2._as(t1.core).getInput("flavor")); if (J.get$length$asx(flavor) === 0) flavor = J.$eq$(sdk, "main") ? "raw" : "release"; @@ -6136,11 +6137,26 @@ _fail(message) { var t1 = self, t2 = type$.JSObject; + t2._as(t1.process).exitCode = 1; t2._as(t1.core).error(message); - t2._as(t1.core).setFailed(message); }, findLatestSdkForRelease_closure: function findLatestSdkForRelease_closure() { }, + printString(string) { + if (typeof dartPrint == "function") { + dartPrint(string); + return; + } + if (typeof console == "object" && typeof console.log != "undefined") { + console.log(string); + return; + } + if (typeof print == "function") { + print(string); + return; + } + throw "Unable to print message: " + String(string); + }, throwLateFieldADI(fieldName) { A.throwExpressionWithWrapper(new A.LateError("Field '" + fieldName + "' has been assigned during initialization."), new Error()); }, diff --git a/dist/sig.txt b/dist/sig.txt index 4d8bc24..d58d17c 100644 --- a/dist/sig.txt +++ b/dist/sig.txt @@ -1 +1 @@ -593DCF2BE4538C54412F6D8B0953D4B3 +9711E190ED18E04786A274263CA27B62 diff --git a/lib/main.dart b/lib/main.dart index 7e58c1d..cd91c7f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -24,6 +24,8 @@ void main(List args) async { sdk = 'stable'; } + print('*** sdk [$sdk] ***'); + // flavor var flavor = core.getInput('flavor'); if (flavor.isEmpty) { @@ -252,6 +254,9 @@ Future findLatestSdkForRelease(String sdkRelease) async { } void _fail(String message) { + // 'core.setFailed' throws when we call it; see #107. + // core.setFailed(message); + + process.exitCode = 1; core.error(message); - core.setFailed(message); } diff --git a/lib/node/actions/core.dart b/lib/node/actions/core.dart index 575f6cc..e9e37a2 100644 --- a/lib/node/actions/core.dart +++ b/lib/node/actions/core.dart @@ -21,8 +21,6 @@ extension type Core (JSObject obj) { external void exportVariable(String name, String value); - external void setFailed(String name); - // JSPromise external JSPromise getIDToken(String audience); } diff --git a/lib/node/process.dart b/lib/node/process.dart index e78c3d7..7dbe6cb 100644 --- a/lib/node/process.dart +++ b/lib/node/process.dart @@ -18,4 +18,6 @@ extension type Process (JSObject obj) { /// Read the environment variable [variable]. String? env(String variable) => getProperty(_env, variable); + + external set exitCode(int value); } From 836f5610bc26118253d12615cd54c2f7289639c4 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Fri, 29 Sep 2023 04:06:43 -0700 Subject: [PATCH 02/12] exitCode as a field --- dist/sig.txt | 2 +- lib/node/process.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/sig.txt b/dist/sig.txt index d58d17c..d016697 100644 --- a/dist/sig.txt +++ b/dist/sig.txt @@ -1 +1 @@ -9711E190ED18E04786A274263CA27B62 +5111E392440C59002508BFE77559A111 diff --git a/lib/node/process.dart b/lib/node/process.dart index 7dbe6cb..867988d 100644 --- a/lib/node/process.dart +++ b/lib/node/process.dart @@ -19,5 +19,5 @@ extension type Process (JSObject obj) { /// Read the environment variable [variable]. String? env(String variable) => getProperty(_env, variable); - external set exitCode(int value); + external int exitCode; } From 5176c50d8c75dde709018ee3cc56d0e98611fb30 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Fri, 29 Sep 2023 10:31:12 -0700 Subject: [PATCH 03/12] handle converting '3' to '3.0' --- dist/main.cjs | 18 ++---------------- dist/sig.txt | 2 +- lib/main.dart | 9 +++++++-- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/dist/main.cjs b/dist/main.cjs index c69ea75..9656d21 100644 --- a/dist/main.cjs +++ b/dist/main.cjs @@ -5816,7 +5816,8 @@ sdk = A._asString(t2._as(t1.core).getInput("sdk")); if (J.get$length$asx(sdk) === 0) sdk = "stable"; - A.printString("*** sdk [" + A.S(sdk) + "] ***"); + if (A.Primitives_parseInt(sdk, null) != null && !J.contains$1$asx(sdk, ".")) + sdk = A.S(sdk) + ".0"; flavor = A._asString(t2._as(t1.core).getInput("flavor")); if (J.get$length$asx(flavor) === 0) flavor = J.$eq$(sdk, "main") ? "raw" : "release"; @@ -6142,21 +6143,6 @@ }, findLatestSdkForRelease_closure: function findLatestSdkForRelease_closure() { }, - printString(string) { - if (typeof dartPrint == "function") { - dartPrint(string); - return; - } - if (typeof console == "object" && typeof console.log != "undefined") { - console.log(string); - return; - } - if (typeof print == "function") { - print(string); - return; - } - throw "Unable to print message: " + String(string); - }, throwLateFieldADI(fieldName) { A.throwExpressionWithWrapper(new A.LateError("Field '" + fieldName + "' has been assigned during initialization."), new Error()); }, diff --git a/dist/sig.txt b/dist/sig.txt index d016697..86f61f1 100644 --- a/dist/sig.txt +++ b/dist/sig.txt @@ -1 +1 @@ -5111E392440C59002508BFE77559A111 +58C0A01999C04DC2B0696ED4A130EC97 diff --git a/lib/main.dart b/lib/main.dart index cd91c7f..7d7b544 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -23,8 +23,12 @@ void main(List args) async { if (sdk.isEmpty) { sdk = 'stable'; } - - print('*** sdk [$sdk] ***'); + // Work around an issue where a `3.0` in a workflow file reaches us as a `3` + // here. + if (int.tryParse(sdk) != null && !sdk.contains('.')) { + // Convert a '3' to a '3.0'. + sdk = '$sdk.0'; + } // flavor var flavor = core.getInput('flavor'); @@ -257,6 +261,7 @@ void _fail(String message) { // 'core.setFailed' throws when we call it; see #107. // core.setFailed(message); + // TODO: This line is not properly setting the exit code. process.exitCode = 1; core.error(message); } From d125707a81e95d0a1198a63a5adf25ee8234298a Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Fri, 29 Sep 2023 13:18:20 -0700 Subject: [PATCH 04/12] wrap sdk values in quotes --- .github/workflows/build.yml | 2 +- .github/workflows/dart.yml | 6 +++--- action.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d14b4d9..3309c25 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v3 - uses: ./ with: - sdk: dev + sdk: 'dev' - run: dart pub get - run: dart analyze --fatal-infos - run: dart tool/sig.dart --verify diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 22fe647..304aaa2 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - sdk: [2.12.4, stable, beta, dev] + sdk: ['2.12.4', 'stable', 'beta', 'dev'] fail-fast: false steps: - uses: actions/checkout@v3 @@ -42,7 +42,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - sdk: [dev, main] + sdk: ['dev', 'main'] flavor: [raw] fail-fast: false steps: @@ -75,7 +75,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - sdk: [2.12.0-29.10.beta] + sdk: ['2.12.0-29.10.beta'] fail-fast: false steps: - uses: actions/checkout@v3 diff --git a/action.yml b/action.yml index 5d3e1a2..033c5ff 100644 --- a/action.yml +++ b/action.yml @@ -7,7 +7,7 @@ inputs: sdk: description: >- This can be either the channel to install (i.e., 'stable', 'beta', 'dev'), - an SDK release version (i.e., `2.19`, `3.1`), or a specific SDK version + an SDK release version (i.e., '2.19', '3.1'), or a specific SDK version (i.e, '2.19.1', '3.0.0-1.4.beta'). required: false default: "stable" From 1167d44d139c51ce91da13d406c458d79e1433ef Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Sat, 7 Oct 2023 11:35:14 -0600 Subject: [PATCH 05/12] address process exit code issue --- dist/index.mjs | 223 +++++++++++------------ dist/main.cjs | 471 +++++++++++++++++++++++-------------------------- dist/sig.txt | 2 +- lib/main.dart | 224 +++++++++++------------ pubspec.yaml | 2 +- 5 files changed, 433 insertions(+), 489 deletions(-) diff --git a/dist/index.mjs b/dist/index.mjs index 2cb76e0..34f9727 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -1,7 +1,7 @@ import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module"; /******/ var __webpack_modules__ = ({ -/***/ 2690: +/***/ 3551: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -27,7 +27,7 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.issue = exports.issueCommand = void 0; const os = __importStar(__nccwpck_require__(2037)); -const utils_1 = __nccwpck_require__(353); +const utils_1 = __nccwpck_require__(2139); /** * Commands * @@ -99,7 +99,7 @@ function escapeProperty(s) { /***/ }), -/***/ 9935: +/***/ 2606: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -133,12 +133,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0; -const command_1 = __nccwpck_require__(2690); -const file_command_1 = __nccwpck_require__(5898); -const utils_1 = __nccwpck_require__(353); +const command_1 = __nccwpck_require__(3551); +const file_command_1 = __nccwpck_require__(3682); +const utils_1 = __nccwpck_require__(2139); const os = __importStar(__nccwpck_require__(2037)); const path = __importStar(__nccwpck_require__(1017)); -const oidc_utils_1 = __nccwpck_require__(7901); +const oidc_utils_1 = __nccwpck_require__(7539); /** * The code to exit an action */ @@ -423,17 +423,17 @@ exports.getIDToken = getIDToken; /** * Summary exports */ -var summary_1 = __nccwpck_require__(9050); +var summary_1 = __nccwpck_require__(2586); Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } })); /** * @deprecated use core.summary */ -var summary_2 = __nccwpck_require__(9050); +var summary_2 = __nccwpck_require__(2586); Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } })); /** * Path exports */ -var path_utils_1 = __nccwpck_require__(1341); +var path_utils_1 = __nccwpck_require__(5228); Object.defineProperty(exports, "toPosixPath", ({ enumerable: true, get: function () { return path_utils_1.toPosixPath; } })); Object.defineProperty(exports, "toWin32Path", ({ enumerable: true, get: function () { return path_utils_1.toWin32Path; } })); Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: function () { return path_utils_1.toPlatformPath; } })); @@ -441,7 +441,7 @@ Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: funct /***/ }), -/***/ 5898: +/***/ 3682: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -471,8 +471,8 @@ exports.prepareKeyValueMessage = exports.issueFileCommand = void 0; /* eslint-disable @typescript-eslint/no-explicit-any */ const fs = __importStar(__nccwpck_require__(7147)); const os = __importStar(__nccwpck_require__(2037)); -const uuid_1 = __nccwpck_require__(1368); -const utils_1 = __nccwpck_require__(353); +const uuid_1 = __nccwpck_require__(5941); +const utils_1 = __nccwpck_require__(2139); function issueFileCommand(command, message) { const filePath = process.env[`GITHUB_${command}`]; if (!filePath) { @@ -505,7 +505,7 @@ exports.prepareKeyValueMessage = prepareKeyValueMessage; /***/ }), -/***/ 7901: +/***/ 7539: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -520,9 +520,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.OidcClient = void 0; -const http_client_1 = __nccwpck_require__(3658); -const auth_1 = __nccwpck_require__(2660); -const core_1 = __nccwpck_require__(9935); +const http_client_1 = __nccwpck_require__(4215); +const auth_1 = __nccwpck_require__(885); +const core_1 = __nccwpck_require__(2606); class OidcClient { static createHttpClient(allowRetry = true, maxRetry = 10) { const requestOptions = { @@ -554,7 +554,7 @@ class OidcClient { .catch(error => { throw new Error(`Failed to get ID Token. \n Error Code : ${error.statusCode}\n - Error Message: ${error.message}`); + Error Message: ${error.result.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -588,7 +588,7 @@ exports.OidcClient = OidcClient; /***/ }), -/***/ 1341: +/***/ 5228: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -652,7 +652,7 @@ exports.toPlatformPath = toPlatformPath; /***/ }), -/***/ 9050: +/***/ 2586: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -941,7 +941,7 @@ exports.summary = _summary; /***/ }), -/***/ 353: +/***/ 2139: /***/ ((__unused_webpack_module, exports) => { @@ -987,7 +987,7 @@ exports.toCommandProperties = toCommandProperties; /***/ }), -/***/ 3409: +/***/ 69: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -1022,7 +1022,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getExecOutput = exports.exec = void 0; const string_decoder_1 = __nccwpck_require__(1576); -const tr = __importStar(__nccwpck_require__(1139)); +const tr = __importStar(__nccwpck_require__(5029)); /** * Exec a command. * Output will be streamed to the live console. @@ -1096,7 +1096,7 @@ exports.getExecOutput = getExecOutput; /***/ }), -/***/ 1139: +/***/ 5029: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -1134,8 +1134,8 @@ const os = __importStar(__nccwpck_require__(2037)); const events = __importStar(__nccwpck_require__(2361)); const child = __importStar(__nccwpck_require__(2081)); const path = __importStar(__nccwpck_require__(1017)); -const io = __importStar(__nccwpck_require__(2725)); -const ioUtil = __importStar(__nccwpck_require__(573)); +const io = __importStar(__nccwpck_require__(96)); +const ioUtil = __importStar(__nccwpck_require__(375)); const timers_1 = __nccwpck_require__(9512); /* eslint-disable @typescript-eslint/unbound-method */ const IS_WINDOWS = process.platform === 'win32'; @@ -1720,7 +1720,7 @@ class ExecState extends events.EventEmitter { /***/ }), -/***/ 2660: +/***/ 885: /***/ (function(__unused_webpack_module, exports) { @@ -1807,7 +1807,7 @@ exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHand /***/ }), -/***/ 3658: +/***/ 4215: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -1844,8 +1844,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0; const http = __importStar(__nccwpck_require__(3685)); const https = __importStar(__nccwpck_require__(5687)); -const pm = __importStar(__nccwpck_require__(9697)); -const tunnel = __importStar(__nccwpck_require__(7477)); +const pm = __importStar(__nccwpck_require__(6695)); +const tunnel = __importStar(__nccwpck_require__(5306)); var HttpCodes; (function (HttpCodes) { HttpCodes[HttpCodes["OK"] = 200] = "OK"; @@ -1935,19 +1935,6 @@ class HttpClientResponse { })); }); } - readBodyBuffer() { - return __awaiter(this, void 0, void 0, function* () { - return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () { - const chunks = []; - this.message.on('data', (chunk) => { - chunks.push(chunk); - }); - this.message.on('end', () => { - resolve(Buffer.concat(chunks)); - }); - })); - }); - } } exports.HttpClientResponse = HttpClientResponse; function isHttps(requestUrl) { @@ -2431,7 +2418,7 @@ const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCa /***/ }), -/***/ 9697: +/***/ 6695: /***/ ((__unused_webpack_module, exports) => { @@ -2451,13 +2438,7 @@ function getProxyUrl(reqUrl) { } })(); if (proxyVar) { - try { - return new URL(proxyVar); - } - catch (_a) { - if (!proxyVar.startsWith('http://') && !proxyVar.startsWith('https://')) - return new URL(`http://${proxyVar}`); - } + return new URL(proxyVar); } else { return undefined; @@ -2519,7 +2500,7 @@ function isLoopbackAddress(host) { /***/ }), -/***/ 573: +/***/ 375: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -2708,7 +2689,7 @@ exports.getCmdPath = getCmdPath; /***/ }), -/***/ 2725: +/***/ 96: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -2744,7 +2725,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0; const assert_1 = __nccwpck_require__(9491); const path = __importStar(__nccwpck_require__(1017)); -const ioUtil = __importStar(__nccwpck_require__(573)); +const ioUtil = __importStar(__nccwpck_require__(375)); /** * Copies a file or folder. * Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js @@ -3013,7 +2994,7 @@ function copyFile(srcFile, destFile, force) { /***/ }), -/***/ 7936: +/***/ 2033: /***/ (function(module, exports, __nccwpck_require__) { @@ -3047,8 +3028,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports._readLinuxVersionFile = exports._getOsVersion = exports._findMatch = void 0; -const semver = __importStar(__nccwpck_require__(7163)); -const core_1 = __nccwpck_require__(9935); +const semver = __importStar(__nccwpck_require__(537)); +const core_1 = __nccwpck_require__(2606); // needs to be require for core node modules to be mocked /* eslint @typescript-eslint/no-require-imports: 0 */ const os = __nccwpck_require__(2037); @@ -3147,7 +3128,7 @@ exports._readLinuxVersionFile = _readLinuxVersionFile; /***/ }), -/***/ 721: +/***/ 2182: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -3181,7 +3162,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.RetryHelper = void 0; -const core = __importStar(__nccwpck_require__(9935)); +const core = __importStar(__nccwpck_require__(2606)); /** * Internal class for retries */ @@ -3236,7 +3217,7 @@ exports.RetryHelper = RetryHelper; /***/ }), -/***/ 2275: +/***/ 1994: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -3273,20 +3254,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.evaluateVersions = exports.isExplicitVersion = exports.findFromManifest = exports.getManifestFromRepo = exports.findAllVersions = exports.find = exports.cacheFile = exports.cacheDir = exports.extractZip = exports.extractXar = exports.extractTar = exports.extract7z = exports.downloadTool = exports.HTTPError = void 0; -const core = __importStar(__nccwpck_require__(9935)); -const io = __importStar(__nccwpck_require__(2725)); +const core = __importStar(__nccwpck_require__(2606)); +const io = __importStar(__nccwpck_require__(96)); const fs = __importStar(__nccwpck_require__(7147)); -const mm = __importStar(__nccwpck_require__(7936)); +const mm = __importStar(__nccwpck_require__(2033)); const os = __importStar(__nccwpck_require__(2037)); const path = __importStar(__nccwpck_require__(1017)); -const httpm = __importStar(__nccwpck_require__(3658)); -const semver = __importStar(__nccwpck_require__(7163)); +const httpm = __importStar(__nccwpck_require__(4215)); +const semver = __importStar(__nccwpck_require__(537)); const stream = __importStar(__nccwpck_require__(2781)); const util = __importStar(__nccwpck_require__(3837)); const assert_1 = __nccwpck_require__(9491); -const v4_1 = __importDefault(__nccwpck_require__(4559)); -const exec_1 = __nccwpck_require__(3409); -const retry_helper_1 = __nccwpck_require__(721); +const v4_1 = __importDefault(__nccwpck_require__(6651)); +const exec_1 = __nccwpck_require__(69); +const retry_helper_1 = __nccwpck_require__(2182); class HTTPError extends Error { constructor(httpStatusCode) { super(`Unexpected HTTP response: ${httpStatusCode}`); @@ -3907,7 +3888,7 @@ function _unique(values) { /***/ }), -/***/ 6993: +/***/ 5792: /***/ ((module) => { /** @@ -3940,7 +3921,7 @@ module.exports = bytesToUuid; /***/ }), -/***/ 3480: +/***/ 7553: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { // Unique ID creation requires a high quality random # generator. In node.js @@ -3955,11 +3936,11 @@ module.exports = function nodeRNG() { /***/ }), -/***/ 4559: +/***/ 6651: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var rng = __nccwpck_require__(3480); -var bytesToUuid = __nccwpck_require__(6993); +var rng = __nccwpck_require__(7553); +var bytesToUuid = __nccwpck_require__(5792); function v4(options, buf, offset) { var i = buf && offset || 0; @@ -3991,7 +3972,7 @@ module.exports = v4; /***/ }), -/***/ 7163: +/***/ 537: /***/ ((module, exports) => { exports = module.exports = SemVer @@ -5641,15 +5622,15 @@ function coerce (version, options) { /***/ }), -/***/ 7477: +/***/ 5306: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = __nccwpck_require__(8162); +module.exports = __nccwpck_require__(1998); /***/ }), -/***/ 8162: +/***/ 1998: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -5920,7 +5901,7 @@ exports.debug = debug; // for test /***/ }), -/***/ 1368: +/***/ 5941: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -5983,29 +5964,29 @@ Object.defineProperty(exports, "parse", ({ } })); -var _v = _interopRequireDefault(__nccwpck_require__(3258)); +var _v = _interopRequireDefault(__nccwpck_require__(7174)); -var _v2 = _interopRequireDefault(__nccwpck_require__(2559)); +var _v2 = _interopRequireDefault(__nccwpck_require__(5714)); -var _v3 = _interopRequireDefault(__nccwpck_require__(2872)); +var _v3 = _interopRequireDefault(__nccwpck_require__(6142)); -var _v4 = _interopRequireDefault(__nccwpck_require__(5034)); +var _v4 = _interopRequireDefault(__nccwpck_require__(3946)); -var _nil = _interopRequireDefault(__nccwpck_require__(6051)); +var _nil = _interopRequireDefault(__nccwpck_require__(9687)); -var _version = _interopRequireDefault(__nccwpck_require__(6630)); +var _version = _interopRequireDefault(__nccwpck_require__(4312)); -var _validate = _interopRequireDefault(__nccwpck_require__(6879)); +var _validate = _interopRequireDefault(__nccwpck_require__(2644)); -var _stringify = _interopRequireDefault(__nccwpck_require__(2992)); +var _stringify = _interopRequireDefault(__nccwpck_require__(8551)); -var _parse = _interopRequireDefault(__nccwpck_require__(3783)); +var _parse = _interopRequireDefault(__nccwpck_require__(1728)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /***/ }), -/***/ 1102: +/***/ 7802: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6034,7 +6015,7 @@ exports["default"] = _default; /***/ }), -/***/ 6051: +/***/ 9687: /***/ ((__unused_webpack_module, exports) => { @@ -6048,7 +6029,7 @@ exports["default"] = _default; /***/ }), -/***/ 3783: +/***/ 1728: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6058,7 +6039,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(6879)); +var _validate = _interopRequireDefault(__nccwpck_require__(2644)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6099,7 +6080,7 @@ exports["default"] = _default; /***/ }), -/***/ 4557: +/***/ 808: /***/ ((__unused_webpack_module, exports) => { @@ -6113,7 +6094,7 @@ exports["default"] = _default; /***/ }), -/***/ 160: +/***/ 406: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6143,7 +6124,7 @@ function rng() { /***/ }), -/***/ 4850: +/***/ 2683: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6172,7 +6153,7 @@ exports["default"] = _default; /***/ }), -/***/ 2992: +/***/ 8551: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6182,7 +6163,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(6879)); +var _validate = _interopRequireDefault(__nccwpck_require__(2644)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6217,7 +6198,7 @@ exports["default"] = _default; /***/ }), -/***/ 3258: +/***/ 7174: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6227,9 +6208,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _rng = _interopRequireDefault(__nccwpck_require__(160)); +var _rng = _interopRequireDefault(__nccwpck_require__(406)); -var _stringify = _interopRequireDefault(__nccwpck_require__(2992)); +var _stringify = _interopRequireDefault(__nccwpck_require__(8551)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6330,7 +6311,7 @@ exports["default"] = _default; /***/ }), -/***/ 2559: +/***/ 5714: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6340,9 +6321,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _v = _interopRequireDefault(__nccwpck_require__(810)); +var _v = _interopRequireDefault(__nccwpck_require__(1130)); -var _md = _interopRequireDefault(__nccwpck_require__(1102)); +var _md = _interopRequireDefault(__nccwpck_require__(7802)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6352,7 +6333,7 @@ exports["default"] = _default; /***/ }), -/***/ 810: +/***/ 1130: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6363,9 +6344,9 @@ Object.defineProperty(exports, "__esModule", ({ exports["default"] = _default; exports.URL = exports.DNS = void 0; -var _stringify = _interopRequireDefault(__nccwpck_require__(2992)); +var _stringify = _interopRequireDefault(__nccwpck_require__(8551)); -var _parse = _interopRequireDefault(__nccwpck_require__(3783)); +var _parse = _interopRequireDefault(__nccwpck_require__(1728)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6436,7 +6417,7 @@ function _default(name, version, hashfunc) { /***/ }), -/***/ 2872: +/***/ 6142: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6446,9 +6427,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _rng = _interopRequireDefault(__nccwpck_require__(160)); +var _rng = _interopRequireDefault(__nccwpck_require__(406)); -var _stringify = _interopRequireDefault(__nccwpck_require__(2992)); +var _stringify = _interopRequireDefault(__nccwpck_require__(8551)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6479,7 +6460,7 @@ exports["default"] = _default; /***/ }), -/***/ 5034: +/***/ 3946: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6489,9 +6470,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _v = _interopRequireDefault(__nccwpck_require__(810)); +var _v = _interopRequireDefault(__nccwpck_require__(1130)); -var _sha = _interopRequireDefault(__nccwpck_require__(4850)); +var _sha = _interopRequireDefault(__nccwpck_require__(2683)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6501,7 +6482,7 @@ exports["default"] = _default; /***/ }), -/***/ 6879: +/***/ 2644: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6511,7 +6492,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _regex = _interopRequireDefault(__nccwpck_require__(4557)); +var _regex = _interopRequireDefault(__nccwpck_require__(808)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6524,7 +6505,7 @@ exports["default"] = _default; /***/ }), -/***/ 6630: +/***/ 4312: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6534,7 +6515,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(6879)); +var _validate = _interopRequireDefault(__nccwpck_require__(2644)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6670,7 +6651,7 @@ module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("util"); /***/ }), -/***/ 8405: +/***/ 3247: /***/ ((__webpack_module__, __unused_webpack___webpack_exports__, __nccwpck_require__) => { var _actions_core__WEBPACK_IMPORTED_MODULE_0___namespace_cache; @@ -6680,10 +6661,10 @@ var fs__WEBPACK_IMPORTED_MODULE_4___namespace_cache; var os__WEBPACK_IMPORTED_MODULE_6___namespace_cache; var process__WEBPACK_IMPORTED_MODULE_7___namespace_cache; __nccwpck_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try { -/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(9935); -/* harmony import */ var _actions_exec__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(3409); -/* harmony import */ var _actions_http_client__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(3658); -/* harmony import */ var _actions_tool_cache__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(2275); +/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(2606); +/* harmony import */ var _actions_exec__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(69); +/* harmony import */ var _actions_http_client__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(4215); +/* harmony import */ var _actions_tool_cache__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(1994); /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_4__ = __nccwpck_require__(7147); /* harmony import */ var module__WEBPACK_IMPORTED_MODULE_5__ = __nccwpck_require__(8188); /* harmony import */ var os__WEBPACK_IMPORTED_MODULE_6__ = __nccwpck_require__(2037); @@ -6904,6 +6885,6 @@ __webpack_async_result__(); /******/ // startup /******/ // Load entry module and return exports /******/ // This entry module used 'module' so it can't be inlined -/******/ var __webpack_exports__ = __nccwpck_require__(8405); +/******/ var __webpack_exports__ = __nccwpck_require__(3247); /******/ __webpack_exports__ = await __webpack_exports__; /******/ diff --git a/dist/main.cjs b/dist/main.cjs index 9656d21..ec69149 100644 --- a/dist/main.cjs +++ b/dist/main.cjs @@ -1,4 +1,4 @@ -// Generated by dart2js (NullSafetyMode.sound, csp, intern-composite-values), the Dart to JavaScript compiler version: 3.2.0-199.0.dev. +// Generated by dart2js (NullSafetyMode.sound, csp, intern-composite-values), the Dart to JavaScript compiler version: 3.3.0-0.0.dev. // The code supports the following hooks: // dartPrint(message): // if this function is defined it is called instead of the Dart [print] @@ -507,9 +507,6 @@ map$1$1$ax(receiver, a0, $T1) { return J.getInterceptor$ax(receiver).map$1$1(receiver, a0, $T1); }, - split$1$s(receiver, a0) { - return J.getInterceptor$s(receiver).split$1(receiver, a0); - }, toString$0$(receiver) { return J.getInterceptor$(receiver).toString$0(receiver); }, @@ -624,7 +621,7 @@ this.__internal$_message = t0; }, CodeUnits: function CodeUnits(t0) { - this.__internal$_string = t0; + this._string = t0; }, EfficientLengthIterable: function EfficientLengthIterable() { }, @@ -1643,13 +1640,13 @@ }, _AllMatchesIterable: function _AllMatchesIterable(t0, t1, t2) { this._re = t0; - this._string = t1; + this.__js_helper$_string = t1; this.__js_helper$_start = t2; }, _AllMatchesIterator: function _AllMatchesIterator(t0, t1, t2) { var _ = this; _._regExp = t0; - _._string = t1; + _.__js_helper$_string = t1; _._nextIndex = t2; _.__js_helper$_current = null; }, @@ -5243,7 +5240,7 @@ return new A.UriData(text, indices, sourceUri); }, _createTables() { - var _i, t1, t2, t3, t4, t5, + var _i, t1, t2, t3, b, _s77_ = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-._~!$&'()*+,;=", _s1_ = ".", _s1_0 = ":", _s1_1 = "/", _s1_2 = "\\", _s1_3 = "?", _s1_4 = "#", _s2_ = "/\\", tables = A._setArrayType(new Array(22), type$.JSArray_Uint8List); @@ -5252,139 +5249,138 @@ t1 = new A._createTables_build(tables); t2 = new A._createTables_setChars(); t3 = new A._createTables_setRange(); - t4 = type$.Uint8List; - t5 = t4._as(t1.call$2(0, 225)); - t2.call$3(t5, _s77_, 1); - t2.call$3(t5, _s1_, 14); - t2.call$3(t5, _s1_0, 34); - t2.call$3(t5, _s1_1, 3); - t2.call$3(t5, _s1_2, 227); - t2.call$3(t5, _s1_3, 172); - t2.call$3(t5, _s1_4, 205); - t5 = t4._as(t1.call$2(14, 225)); - t2.call$3(t5, _s77_, 1); - t2.call$3(t5, _s1_, 15); - t2.call$3(t5, _s1_0, 34); - t2.call$3(t5, _s2_, 234); - t2.call$3(t5, _s1_3, 172); - t2.call$3(t5, _s1_4, 205); - t5 = t4._as(t1.call$2(15, 225)); - t2.call$3(t5, _s77_, 1); - t2.call$3(t5, "%", 225); - t2.call$3(t5, _s1_0, 34); - t2.call$3(t5, _s1_1, 9); - t2.call$3(t5, _s1_2, 233); - t2.call$3(t5, _s1_3, 172); - t2.call$3(t5, _s1_4, 205); - t5 = t4._as(t1.call$2(1, 225)); - t2.call$3(t5, _s77_, 1); - t2.call$3(t5, _s1_0, 34); - t2.call$3(t5, _s1_1, 10); - t2.call$3(t5, _s1_2, 234); - t2.call$3(t5, _s1_3, 172); - t2.call$3(t5, _s1_4, 205); - t5 = t4._as(t1.call$2(2, 235)); - t2.call$3(t5, _s77_, 139); - t2.call$3(t5, _s1_1, 131); - t2.call$3(t5, _s1_2, 131); - t2.call$3(t5, _s1_, 146); - t2.call$3(t5, _s1_3, 172); - t2.call$3(t5, _s1_4, 205); - t5 = t4._as(t1.call$2(3, 235)); - t2.call$3(t5, _s77_, 11); - t2.call$3(t5, _s1_1, 68); - t2.call$3(t5, _s1_2, 68); - t2.call$3(t5, _s1_, 18); - t2.call$3(t5, _s1_3, 172); - t2.call$3(t5, _s1_4, 205); - t5 = t4._as(t1.call$2(4, 229)); - t2.call$3(t5, _s77_, 5); - t3.call$3(t5, "AZ", 229); - t2.call$3(t5, _s1_0, 102); - t2.call$3(t5, "@", 68); - t2.call$3(t5, "[", 232); - t2.call$3(t5, _s1_1, 138); - t2.call$3(t5, _s1_2, 138); - t2.call$3(t5, _s1_3, 172); - t2.call$3(t5, _s1_4, 205); - t5 = t4._as(t1.call$2(5, 229)); - t2.call$3(t5, _s77_, 5); - t3.call$3(t5, "AZ", 229); - t2.call$3(t5, _s1_0, 102); - t2.call$3(t5, "@", 68); - t2.call$3(t5, _s1_1, 138); - t2.call$3(t5, _s1_2, 138); - t2.call$3(t5, _s1_3, 172); - t2.call$3(t5, _s1_4, 205); - t5 = t4._as(t1.call$2(6, 231)); - t3.call$3(t5, "19", 7); - t2.call$3(t5, "@", 68); - t2.call$3(t5, _s1_1, 138); - t2.call$3(t5, _s1_2, 138); - t2.call$3(t5, _s1_3, 172); - t2.call$3(t5, _s1_4, 205); - t5 = t4._as(t1.call$2(7, 231)); - t3.call$3(t5, "09", 7); - t2.call$3(t5, "@", 68); - t2.call$3(t5, _s1_1, 138); - t2.call$3(t5, _s1_2, 138); - t2.call$3(t5, _s1_3, 172); - t2.call$3(t5, _s1_4, 205); - t2.call$3(t4._as(t1.call$2(8, 8)), "]", 5); - t5 = t4._as(t1.call$2(9, 235)); - t2.call$3(t5, _s77_, 11); - t2.call$3(t5, _s1_, 16); - t2.call$3(t5, _s2_, 234); - t2.call$3(t5, _s1_3, 172); - t2.call$3(t5, _s1_4, 205); - t5 = t4._as(t1.call$2(16, 235)); - t2.call$3(t5, _s77_, 11); - t2.call$3(t5, _s1_, 17); - t2.call$3(t5, _s2_, 234); - t2.call$3(t5, _s1_3, 172); - t2.call$3(t5, _s1_4, 205); - t5 = t4._as(t1.call$2(17, 235)); - t2.call$3(t5, _s77_, 11); - t2.call$3(t5, _s1_1, 9); - t2.call$3(t5, _s1_2, 233); - t2.call$3(t5, _s1_3, 172); - t2.call$3(t5, _s1_4, 205); - t5 = t4._as(t1.call$2(10, 235)); - t2.call$3(t5, _s77_, 11); - t2.call$3(t5, _s1_, 18); - t2.call$3(t5, _s1_1, 10); - t2.call$3(t5, _s1_2, 234); - t2.call$3(t5, _s1_3, 172); - t2.call$3(t5, _s1_4, 205); - t5 = t4._as(t1.call$2(18, 235)); - t2.call$3(t5, _s77_, 11); - t2.call$3(t5, _s1_, 19); - t2.call$3(t5, _s2_, 234); - t2.call$3(t5, _s1_3, 172); - t2.call$3(t5, _s1_4, 205); - t5 = t4._as(t1.call$2(19, 235)); - t2.call$3(t5, _s77_, 11); - t2.call$3(t5, _s2_, 234); - t2.call$3(t5, _s1_3, 172); - t2.call$3(t5, _s1_4, 205); - t5 = t4._as(t1.call$2(11, 235)); - t2.call$3(t5, _s77_, 11); - t2.call$3(t5, _s1_1, 10); - t2.call$3(t5, _s1_2, 234); - t2.call$3(t5, _s1_3, 172); - t2.call$3(t5, _s1_4, 205); - t5 = t4._as(t1.call$2(12, 236)); - t2.call$3(t5, _s77_, 12); - t2.call$3(t5, _s1_3, 12); - t2.call$3(t5, _s1_4, 205); - t5 = t4._as(t1.call$2(13, 237)); - t2.call$3(t5, _s77_, 13); - t2.call$3(t5, _s1_3, 13); - t3.call$3(t4._as(t1.call$2(20, 245)), "az", 21); - t1 = t4._as(t1.call$2(21, 245)); - t3.call$3(t1, "az", 21); - t3.call$3(t1, "09", 21); - t2.call$3(t1, "+-.", 21); + b = t1.call$2(0, 225); + t2.call$3(b, _s77_, 1); + t2.call$3(b, _s1_, 14); + t2.call$3(b, _s1_0, 34); + t2.call$3(b, _s1_1, 3); + t2.call$3(b, _s1_2, 227); + t2.call$3(b, _s1_3, 172); + t2.call$3(b, _s1_4, 205); + b = t1.call$2(14, 225); + t2.call$3(b, _s77_, 1); + t2.call$3(b, _s1_, 15); + t2.call$3(b, _s1_0, 34); + t2.call$3(b, _s2_, 234); + t2.call$3(b, _s1_3, 172); + t2.call$3(b, _s1_4, 205); + b = t1.call$2(15, 225); + t2.call$3(b, _s77_, 1); + t2.call$3(b, "%", 225); + t2.call$3(b, _s1_0, 34); + t2.call$3(b, _s1_1, 9); + t2.call$3(b, _s1_2, 233); + t2.call$3(b, _s1_3, 172); + t2.call$3(b, _s1_4, 205); + b = t1.call$2(1, 225); + t2.call$3(b, _s77_, 1); + t2.call$3(b, _s1_0, 34); + t2.call$3(b, _s1_1, 10); + t2.call$3(b, _s1_2, 234); + t2.call$3(b, _s1_3, 172); + t2.call$3(b, _s1_4, 205); + b = t1.call$2(2, 235); + t2.call$3(b, _s77_, 139); + t2.call$3(b, _s1_1, 131); + t2.call$3(b, _s1_2, 131); + t2.call$3(b, _s1_, 146); + t2.call$3(b, _s1_3, 172); + t2.call$3(b, _s1_4, 205); + b = t1.call$2(3, 235); + t2.call$3(b, _s77_, 11); + t2.call$3(b, _s1_1, 68); + t2.call$3(b, _s1_2, 68); + t2.call$3(b, _s1_, 18); + t2.call$3(b, _s1_3, 172); + t2.call$3(b, _s1_4, 205); + b = t1.call$2(4, 229); + t2.call$3(b, _s77_, 5); + t3.call$3(b, "AZ", 229); + t2.call$3(b, _s1_0, 102); + t2.call$3(b, "@", 68); + t2.call$3(b, "[", 232); + t2.call$3(b, _s1_1, 138); + t2.call$3(b, _s1_2, 138); + t2.call$3(b, _s1_3, 172); + t2.call$3(b, _s1_4, 205); + b = t1.call$2(5, 229); + t2.call$3(b, _s77_, 5); + t3.call$3(b, "AZ", 229); + t2.call$3(b, _s1_0, 102); + t2.call$3(b, "@", 68); + t2.call$3(b, _s1_1, 138); + t2.call$3(b, _s1_2, 138); + t2.call$3(b, _s1_3, 172); + t2.call$3(b, _s1_4, 205); + b = t1.call$2(6, 231); + t3.call$3(b, "19", 7); + t2.call$3(b, "@", 68); + t2.call$3(b, _s1_1, 138); + t2.call$3(b, _s1_2, 138); + t2.call$3(b, _s1_3, 172); + t2.call$3(b, _s1_4, 205); + b = t1.call$2(7, 231); + t3.call$3(b, "09", 7); + t2.call$3(b, "@", 68); + t2.call$3(b, _s1_1, 138); + t2.call$3(b, _s1_2, 138); + t2.call$3(b, _s1_3, 172); + t2.call$3(b, _s1_4, 205); + t2.call$3(t1.call$2(8, 8), "]", 5); + b = t1.call$2(9, 235); + t2.call$3(b, _s77_, 11); + t2.call$3(b, _s1_, 16); + t2.call$3(b, _s2_, 234); + t2.call$3(b, _s1_3, 172); + t2.call$3(b, _s1_4, 205); + b = t1.call$2(16, 235); + t2.call$3(b, _s77_, 11); + t2.call$3(b, _s1_, 17); + t2.call$3(b, _s2_, 234); + t2.call$3(b, _s1_3, 172); + t2.call$3(b, _s1_4, 205); + b = t1.call$2(17, 235); + t2.call$3(b, _s77_, 11); + t2.call$3(b, _s1_1, 9); + t2.call$3(b, _s1_2, 233); + t2.call$3(b, _s1_3, 172); + t2.call$3(b, _s1_4, 205); + b = t1.call$2(10, 235); + t2.call$3(b, _s77_, 11); + t2.call$3(b, _s1_, 18); + t2.call$3(b, _s1_1, 10); + t2.call$3(b, _s1_2, 234); + t2.call$3(b, _s1_3, 172); + t2.call$3(b, _s1_4, 205); + b = t1.call$2(18, 235); + t2.call$3(b, _s77_, 11); + t2.call$3(b, _s1_, 19); + t2.call$3(b, _s2_, 234); + t2.call$3(b, _s1_3, 172); + t2.call$3(b, _s1_4, 205); + b = t1.call$2(19, 235); + t2.call$3(b, _s77_, 11); + t2.call$3(b, _s2_, 234); + t2.call$3(b, _s1_3, 172); + t2.call$3(b, _s1_4, 205); + b = t1.call$2(11, 235); + t2.call$3(b, _s77_, 11); + t2.call$3(b, _s1_1, 10); + t2.call$3(b, _s1_2, 234); + t2.call$3(b, _s1_3, 172); + t2.call$3(b, _s1_4, 205); + b = t1.call$2(12, 236); + t2.call$3(b, _s77_, 12); + t2.call$3(b, _s1_3, 12); + t2.call$3(b, _s1_4, 205); + b = t1.call$2(13, 237); + t2.call$3(b, _s77_, 13); + t2.call$3(b, _s1_3, 13); + t3.call$3(t1.call$2(20, 245), "az", 21); + b = t1.call$2(21, 245); + t3.call$3(b, "az", 21); + t3.call$3(b, "09", 21); + t2.call$3(b, "+-.", 21); return tables; }, _scan(uri, start, end, state, indices) { @@ -5800,7 +5796,7 @@ main$body(args) { var $async$goto = 0, $async$completer = A._makeAsyncAwaitCompleter(type$.dynamic), - $async$returnValue, $async$handler = 2, $async$currentError, sdk, flavor, raw, os, architecture, version, channel, url, toolName, sdkPath, archivePath, extractedFolder, pubCache, e, t1, t2, exception, t3, t4, versionFilePath, $async$exception, $async$exception1; + $async$handler = 1, $async$currentError, flavor, channel, raw, os, architecture, version, exception, url, toolName, sdkPath, t3, archivePath, extractedFolder, t4, pubCache, versionFilePath, t1, t2, sdk, $async$exception, $async$temp1; var $async$main = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) { if ($async$errorCode === 1) { $async$currentError = $async$result; @@ -5810,161 +5806,150 @@ switch ($async$goto) { case 0: // Function start - $async$handler = 4; t1 = self; t2 = type$.JSObject; sdk = A._asString(t2._as(t1.core).getInput("sdk")); - if (J.get$length$asx(sdk) === 0) + if (sdk.length === 0) sdk = "stable"; - if (A.Primitives_parseInt(sdk, null) != null && !J.contains$1$asx(sdk, ".")) - sdk = A.S(sdk) + ".0"; flavor = A._asString(t2._as(t1.core).getInput("flavor")); if (J.get$length$asx(flavor) === 0) - flavor = J.$eq$(sdk, "main") ? "raw" : "release"; - else if (!J.$eq$(flavor, "raw") && !J.$eq$(flavor, "release")) { + flavor = sdk === "main" ? "raw" : "release"; + else if (!J.$eq$(flavor, "raw") && !J.$eq$(flavor, "release")) A._fail("Unrecognized build flavor '" + A.S(flavor) + "'."); - // goto return - $async$goto = 1; - break; - } raw = J.$eq$(flavor, "raw"); os = A.getPlatform(); architecture = A._asString(t2._as(t1.core).getInput("architecture")); - if (J.get$length$asx(architecture) === 0) + if (architecture.length === 0) architecture = B.JSArray_methods.contains$1(B.List_x64_ia32_arm_arm64, A._asString(t2._as(t1.os).arch())) ? A._asString(t2._as(t1.os).arch()) : "x64"; - version = null; channel = null; - $async$goto = J.split$1$s(sdk, ".").length === 2 ? 7 : 9; + $async$goto = sdk.split(".").length === 2 ? 2 : 4; break; - case 7: + case 2: // then channel = "stable"; - $async$goto = 10; + $async$goto = 5; return A._asyncAwait(A.findLatestSdkForRelease(sdk), $async$main); - case 10: + case 5: // returning from await. version = $async$result; // goto join - $async$goto = 8; + $async$goto = 3; break; - case 9: + case 4: // else - $async$goto = J.$eq$(sdk, "stable") || J.$eq$(sdk, "beta") || J.$eq$(sdk, "dev") ? 11 : 13; + $async$goto = sdk === "stable" || sdk === "beta" || sdk === "dev" ? 6 : 8; break; - case 11: + case 6: // then channel = sdk; - $async$goto = A.boolConversionCheck(raw) ? 14 : 16; + $async$goto = raw ? 9 : 11; break; - case 14: + case 9: // then $async$result = "latest"; // goto join - $async$goto = 15; + $async$goto = 10; break; - case 16: + case 11: // else - $async$goto = 17; + $async$goto = 12; return A._asyncAwait(A.latestPublishedVersion(channel, flavor), $async$main); - case 17: + case 12: // returning from await. - case 15: + case 10: // join version = $async$result; // goto join - $async$goto = 12; + $async$goto = 7; break; - case 13: + case 8: // else - $async$goto = J.$eq$(sdk, "main") ? 18 : 20; + $async$goto = sdk === "main" ? 13 : 15; break; - case 18: + case 13: // then - $async$handler = 22; + $async$handler = 17; channel = "main"; - $async$goto = 25; + $async$goto = 20; return A._asyncAwait(A.latestPublishedVersion(channel, flavor), $async$main); - case 25: + case 20: // returning from await. - $async$handler = 4; + $async$handler = 1; // goto after finally - $async$goto = 24; + $async$goto = 19; break; - case 22: + case 17: // catch - $async$handler = 21; + $async$handler = 16; $async$exception = $async$currentError; channel = "be"; // goto after finally - $async$goto = 24; + $async$goto = 19; break; - case 21: + case 16: // uncaught - // goto catch - $async$goto = 4; + // goto rethrow + $async$goto = 1; break; - case 24: + case 19: // after finally version = "latest"; // goto join - $async$goto = 19; + $async$goto = 14; break; - case 20: + case 15: // else - version = sdk; - if (J.contains$1$asx(sdk, "dev")) + if (B.JSString_methods.contains$1(sdk, "dev")) channel = "dev"; - else if (J.contains$1$asx(sdk, "beta")) + else if (B.JSString_methods.contains$1(sdk, "beta")) channel = "beta"; - else if (J.contains$1$asx(sdk, "main")) { + else if (B.JSString_methods.contains$1(sdk, "main")) A._fail("Versions cannot be specified for main channel builds."); - // goto return - $async$goto = 1; - break; - } else + else channel = "stable"; - case 19: + version = sdk; + case 14: // join - case 12: + case 7: // join - case 8: + case 3: // join - t2._as(t1.core).info("Installing the " + A.S(os) + "-" + A.S(architecture) + " Dart SDK version " + A.S(version) + " from the " + A.S(channel) + " (" + A.S(flavor) + ") channel."); - url = string$.https_ + A.S(channel) + "/" + A.S(flavor) + "/" + A.S(version) + "/sdk/dartsdk-" + A.S(os) + "-" + A.S(architecture) + "-release.zip"; - toolName = A.boolConversionCheck(raw) ? "dart_raw" : "dart"; - sdkPath = !A.boolConversionCheck(raw) ? A._asString(t2._as(t1.toolCache).find(toolName, version, architecture)) : ""; - $async$goto = J.get$length$asx(sdkPath) !== 0 ? 26 : 28; + t2._as(t1.core).info("Installing the " + os + "-" + architecture + " Dart SDK version " + version + " from the " + A.S(channel) + " (" + A.S(flavor) + ") channel."); + url = string$.https_ + A.S(channel) + "/" + A.S(flavor) + "/" + version + "/sdk/dartsdk-" + os + "-" + architecture + "-release.zip"; + toolName = raw ? "dart_raw" : "dart"; + sdkPath = !raw ? A._asString(t2._as(t1.toolCache).find(toolName, version, architecture)) : ""; + $async$goto = sdkPath.length !== 0 ? 21 : 23; break; - case 26: + case 21: // then - t2._as(t1.core).info("Using cached sdk from " + A.S(sdkPath) + "."); + t2._as(t1.core).info("Using cached sdk from " + sdkPath + "."); // goto join - $async$goto = 27; + $async$goto = 22; break; - case 28: + case 23: // else - t2._as(t1.core).info(A.S(url) + " ..."); + t2._as(t1.core).info(url + " ..."); t3 = type$.String; - $async$goto = 29; + $async$goto = 24; return A._asyncAwait(A.promiseToFuture(t2._as(t2._as(t1.toolCache).downloadTool(url)), t3), $async$main); - case 29: + case 24: // returning from await. archivePath = $async$result; - $async$goto = 30; + $async$temp1 = A; + $async$goto = 25; return A._asyncAwait(A.promiseToFuture(t2._as(t2._as(t1.toolCache).extractZip(archivePath)), t3), $async$main); - case 30: + case 25: // returning from await. - extractedFolder = $async$result; - extractedFolder = A.join(extractedFolder, "dart-sdk"); - $async$goto = 31; + extractedFolder = $async$temp1.join($async$result, "dart-sdk"); + $async$goto = 26; return A._asyncAwait(A.promiseToFuture(t2._as(t2._as(t1.toolCache).cacheDir(extractedFolder, toolName, version, architecture)), t3), $async$main); - case 31: + case 26: // returning from await. sdkPath = $async$result; - case 27: + case 22: // join t3 = t2._as(t1.process); - t4 = J.$eq$(os, "windows") ? "USERPROFILE" : "HOME"; + t4 = os === "windows" ? "USERPROFILE" : "HOME"; t4 = A._asStringQ(t2._as(t3.env)[t4]); t4.toString; pubCache = A.join(t4, ".pub-cache"); @@ -5972,41 +5957,20 @@ t2._as(t1.core).addPath(A.join(sdkPath, "bin")); t2._as(t1.core).exportVariable("PUB_CACHE", pubCache); t2._as(t1.core).addPath(A.join(pubCache, "bin")); - $async$goto = 32; + $async$goto = 27; return A._asyncAwait(A.createPubOIDCToken(), $async$main); - case 32: + case 27: // returning from await. t4 = t2._as(t1.core); versionFilePath = A.join(sdkPath, "version"); t4.setOutput("dart-version", B.JSString_methods.trim$0(A._asString(t2._as(t1.fs).readFileSync(versionFilePath, "utf8")))); - $async$goto = 33; + $async$goto = 28; return A._asyncAwait(A.promiseToFuture(t2._as(t2._as(t1.exec).exec("dart", A._setArrayType(["--version"], type$.JSArray_String))), type$.void), $async$main); - case 33: + case 28: // returning from await. - $async$handler = 2; - // goto after finally - $async$goto = 6; - break; - case 4: - // catch - $async$handler = 3; - $async$exception1 = $async$currentError; - e = A.unwrapException($async$exception1); - A._fail(A.S(e)); - // goto after finally - $async$goto = 6; - break; - case 3: - // uncaught - // goto rethrow - $async$goto = 2; - break; - case 6: - // after finally + // implicit return + return A._asyncReturn(null, $async$completer); case 1: - // return - return A._asyncReturn($async$returnValue, $async$completer); - case 2: // rethrow return A._asyncRethrow($async$currentError, $async$completer); } @@ -6138,8 +6102,9 @@ _fail(message) { var t1 = self, t2 = type$.JSObject; - t2._as(t1.process).exitCode = 1; t2._as(t1.core).error(message); + t2._as(t1.process).exitCode = 1; + throw A.wrapException(message); }, findLatestSdkForRelease_closure: function findLatestSdkForRelease_closure() { }, @@ -6541,10 +6506,6 @@ return false; return other === this.substring$1(receiver, t1 - otherLength); }, - split$1(receiver, pattern) { - var t1 = A._setArrayType(receiver.split(pattern), type$.JSArray_String); - return t1; - }, replaceRange$3(receiver, start, end, replacement) { var e = A.RangeError_checkValidRange(start, end, receiver.length); return receiver.substring(0, start) + replacement + receiver.substring(e); @@ -6710,10 +6671,10 @@ }; A.CodeUnits.prototype = { get$length(_) { - return this.__internal$_string.length; + return this._string.length; }, $index(_, i) { - var t1 = this.__internal$_string; + var t1 = this._string; if (!(i >= 0 && i < t1.length)) return A.ioore(t1, i); return t1.charCodeAt(i); @@ -7212,7 +7173,7 @@ A._MatchImplementation.prototype = {$isMatch: 1, $isRegExpMatch: 1}; A._AllMatchesIterable.prototype = { get$iterator(_) { - return new A._AllMatchesIterator(this._re, this._string, this.__js_helper$_start); + return new A._AllMatchesIterator(this._re, this.__js_helper$_string, this.__js_helper$_start); } }; A._AllMatchesIterator.prototype = { @@ -7222,7 +7183,7 @@ }, moveNext$0() { var t1, t2, t3, match, t4, nextIndex, _this = this, - string = _this._string; + string = _this.__js_helper$_string; if (string == null) return false; t1 = _this._nextIndex; @@ -7260,7 +7221,7 @@ return true; } } - _this._string = _this.__js_helper$_current = null; + _this.__js_helper$_string = _this.__js_helper$_current = null; return false; }, $isIterator: 1 diff --git a/dist/sig.txt b/dist/sig.txt index 86f61f1..b7b7e59 100644 --- a/dist/sig.txt +++ b/dist/sig.txt @@ -1 +1 @@ -58C0A01999C04DC2B0696ED4A130EC97 +19DB620BA3796296A1B50AD46A0FBEF4 diff --git a/lib/main.dart b/lib/main.dart index 7d7b544..3c08be9 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -17,127 +17,123 @@ import 'node/os.dart'; import 'node/process.dart'; void main(List args) async { - try { - // sdk - var sdk = core.getInput('sdk'); - if (sdk.isEmpty) { - sdk = 'stable'; - } - // Work around an issue where a `3.0` in a workflow file reaches us as a `3` - // here. - if (int.tryParse(sdk) != null && !sdk.contains('.')) { - // Convert a '3' to a '3.0'. - sdk = '$sdk.0'; - } - - // flavor - var flavor = core.getInput('flavor'); - if (flavor.isEmpty) { - flavor = sdk == 'main' ? 'raw' : 'release'; - } else if (flavor != 'raw' && flavor != 'release') { - _fail("Unrecognized build flavor '$flavor'."); - return; - } - final raw = flavor == 'raw'; - - // os - final os = getPlatform(); + // sdk + var sdk = core.getInput('sdk'); + if (sdk.isEmpty) { + sdk = 'stable'; + } + // todo: temp temp - testing + // // Work around an issue where a `3.0` in a workflow file reaches us as a `3` + // // here. + // if (int.tryParse(sdk) != null && !sdk.contains('.')) { + // // Convert a '3' to a '3.0'. + // sdk = '$sdk.0'; + // } - // architecture - var architecture = core.getInput('architecture'); - if (architecture.isEmpty) { - architecture = getArch(); - } + // flavor + var flavor = core.getInput('flavor'); + if (flavor.isEmpty) { + flavor = sdk == 'main' ? 'raw' : 'release'; + } else if (flavor != 'raw' && flavor != 'release') { + _fail("Unrecognized build flavor '$flavor'."); + // return; + } + final raw = flavor == 'raw'; - // calculate version and channel - String version; - String channel; + // os + final os = getPlatform(); - if (sdk.split('.').length == 2) { - // Handle the wildcard (`2.19`, `3.1`, ...) format. - channel = 'stable'; + // architecture + var architecture = core.getInput('architecture'); + if (architecture.isEmpty) { + architecture = getArch(); + } - // Find the latest version for the given sdk release. - version = await findLatestSdkForRelease(sdk); - } else if (sdk == 'stable' || sdk == 'beta' || sdk == 'dev') { - channel = sdk; - version = - raw ? 'latest' : (await latestPublishedVersion(channel, flavor)); - } else if (sdk == 'main') { - // Check for `main` first and fall back to `be`. This handles the channel - // rename from `be` to `main` (also tracked as b/299435467). - try { - channel = 'main'; - await latestPublishedVersion(channel, flavor); - } catch (_) { - channel = 'be'; - } - version = 'latest'; - } else { - version = sdk; - - // Derive the channel from the version string. - if (sdk.contains('dev')) { - channel = 'dev'; - } else if (sdk.contains('beta')) { - channel = 'beta'; - } else if (sdk.contains('main')) { - _fail('Versions cannot be specified for main channel builds.'); - return; - } else { - channel = 'stable'; - } + // calculate version and channel + String version; + String channel; + + if (sdk.split('.').length == 2) { + // Handle the wildcard (`2.19`, `3.1`, ...) format. + channel = 'stable'; + + // Find the latest version for the given sdk release. + version = await findLatestSdkForRelease(sdk); + } else if (sdk == 'stable' || sdk == 'beta' || sdk == 'dev') { + channel = sdk; + version = raw ? 'latest' : (await latestPublishedVersion(channel, flavor)); + } else if (sdk == 'main') { + // Check for `main` first and fall back to `be`. This handles the channel + // rename from `be` to `main` (also tracked as b/299435467). + try { + channel = 'main'; + await latestPublishedVersion(channel, flavor); + } catch (_) { + channel = 'be'; } - - core.info('Installing the $os-$architecture Dart SDK version $version from ' - 'the $channel ($flavor) channel.'); - - // Calculate url based on https://dart.dev/tools/sdk/archive#download-urls. - final url = 'https://storage.googleapis.com/dart-archive/' - 'channels/$channel/$flavor/$version/sdk/' - 'dartsdk-$os-$architecture-release.zip'; - - // Use a cached sdk or download and cache the sdk; using a 'raw' sdk flavor - // disables caching. - final toolName = raw ? 'dart_raw' : 'dart'; - var sdkPath = !raw ? toolCache.find(toolName, version, architecture) : ''; - if (sdkPath.isNotEmpty) { - core.info('Using cached sdk from $sdkPath.'); + version = 'latest'; + } else { + version = sdk; + + // Derive the channel from the version string. + if (sdk.contains('dev')) { + channel = 'dev'; + } else if (sdk.contains('beta')) { + channel = 'beta'; + } else if (sdk.contains('main')) { + _fail('Versions cannot be specified for main channel builds.'); + // return; } else { - core.info('$url ...'); - - final archivePath = - await promiseToFuture(toolCache.downloadTool(url)); - var extractedFolder = - await promiseToFuture(toolCache.extractZip(archivePath)); - extractedFolder = path.join(extractedFolder, 'dart-sdk'); - - sdkPath = await promiseToFuture( - toolCache.cacheDir(extractedFolder, toolName, version, architecture)); + channel = 'stable'; } + } - final pubCache = path.join( - process.env(os == 'windows' ? 'USERPROFILE' : 'HOME')!, '.pub-cache'); + core.info('Installing the $os-$architecture Dart SDK version $version from ' + 'the $channel ($flavor) channel.'); + + // Calculate url based on https://dart.dev/tools/sdk/archive#download-urls. + final url = 'https://storage.googleapis.com/dart-archive/' + 'channels/$channel/$flavor/$version/sdk/' + 'dartsdk-$os-$architecture-release.zip'; + + // Use a cached sdk or download and cache the sdk; using a 'raw' sdk flavor + // disables caching. + final toolName = raw ? 'dart_raw' : 'dart'; + var sdkPath = !raw ? toolCache.find(toolName, version, architecture) : ''; + if (sdkPath.isNotEmpty) { + core.info('Using cached sdk from $sdkPath.'); + } else { + core.info('$url ...'); + + final archivePath = + await promiseToFuture(toolCache.downloadTool(url)); + var extractedFolder = + await promiseToFuture(toolCache.extractZip(archivePath)); + extractedFolder = path.join(extractedFolder, 'dart-sdk'); + + sdkPath = await promiseToFuture( + toolCache.cacheDir(extractedFolder, toolName, version, architecture)); + } - core.exportVariable('DART_HOME', sdkPath); - core.addPath(path.join(sdkPath, 'bin')); - core.exportVariable('PUB_CACHE', pubCache); - core.addPath(path.join(pubCache, 'bin')); + final pubCache = path.join( + process.env(os == 'windows' ? 'USERPROFILE' : 'HOME')!, '.pub-cache'); - // Create the OIDC token used for pub.dev publishing. - await createPubOIDCToken(); + core.exportVariable('DART_HOME', sdkPath); + core.addPath(path.join(sdkPath, 'bin')); + core.exportVariable('PUB_CACHE', pubCache); + core.addPath(path.join(pubCache, 'bin')); - // Configure the outputs. - core.setOutput('dart-version', getVersionFromSdk(sdkPath)); + // Create the OIDC token used for pub.dev publishing. + await createPubOIDCToken(); - // Report success; print version. - await promiseToFuture(exec.exec( - 'dart', - ['--version'.toJS].toJS, - )); - } catch (e) { - _fail('$e'); - } + // Configure the outputs. + core.setOutput('dart-version', getVersionFromSdk(sdkPath)); + + // Report success; print version. + await promiseToFuture(exec.exec( + 'dart', + ['--version'.toJS].toJS, + )); } String getVersionFromSdk(String sdkPath) { @@ -257,11 +253,17 @@ Future findLatestSdkForRelease(String sdkRelease) async { return semvers.last.toString(); } -void _fail(String message) { +Never _fail(String message) { // 'core.setFailed' throws when we call it; see #107. // core.setFailed(message); + core.error(message); + // TODO: This line is not properly setting the exit code. process.exitCode = 1; - core.error(message); + + // TODO(devoncarew): Throwing here is a workaround for not being able to set + // the process exit code. + // ignore: only_throw_errors + throw message; } diff --git a/pubspec.yaml b/pubspec.yaml index 2fe441f..9a9437a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ description: The setup-dart GitHub Action - download and setup the Dart SDK. publish_to: none environment: - sdk: ^3.2.0-0 + sdk: ^3.3.0-0 dependencies: path: ^1.8.0 From 0db74b2a05ff50aa79a43edb62934e98722c474b Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Sat, 7 Oct 2023 11:39:47 -0600 Subject: [PATCH 06/12] restore int => double promotion code --- dist/main.cjs | 2 ++ dist/sig.txt | 2 +- lib/main.dart | 13 ++++++------- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/dist/main.cjs b/dist/main.cjs index ec69149..1db0764 100644 --- a/dist/main.cjs +++ b/dist/main.cjs @@ -5811,6 +5811,8 @@ sdk = A._asString(t2._as(t1.core).getInput("sdk")); if (sdk.length === 0) sdk = "stable"; + if (A.Primitives_parseInt(sdk, null) != null && !B.JSString_methods.contains$1(sdk, ".")) + sdk += ".0"; flavor = A._asString(t2._as(t1.core).getInput("flavor")); if (J.get$length$asx(flavor) === 0) flavor = sdk === "main" ? "raw" : "release"; diff --git a/dist/sig.txt b/dist/sig.txt index b7b7e59..737f4e1 100644 --- a/dist/sig.txt +++ b/dist/sig.txt @@ -1 +1 @@ -19DB620BA3796296A1B50AD46A0FBEF4 +9CBA5F743ADEF9959A3E4BF100392986 diff --git a/lib/main.dart b/lib/main.dart index 3c08be9..f545993 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -22,13 +22,12 @@ void main(List args) async { if (sdk.isEmpty) { sdk = 'stable'; } - // todo: temp temp - testing - // // Work around an issue where a `3.0` in a workflow file reaches us as a `3` - // // here. - // if (int.tryParse(sdk) != null && !sdk.contains('.')) { - // // Convert a '3' to a '3.0'. - // sdk = '$sdk.0'; - // } + // A `3.0` in a workflow file reaches us as a `3` here; promote any int value + // back to a double. + if (int.tryParse(sdk) != null && !sdk.contains('.')) { + // Convert a '3' to a '3.0'. + sdk = '$sdk.0'; + } // flavor var flavor = core.getInput('flavor'); From 27c76430051953c85ea259bd38ab644e2d24de39 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Tue, 10 Oct 2023 08:32:26 -0700 Subject: [PATCH 07/12] review comments --- .github/workflows/dart.yml | 8 +- README.md | 2 +- dist/index.mjs | 223 ++++++++++++++++++++----------------- dist/main.cjs | 2 +- dist/sig.txt | 2 +- 5 files changed, 128 insertions(+), 109 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 304aaa2..44bbdb4 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - sdk: ['2.12.4', 'stable', 'beta', 'dev'] + sdk: [2.12.4, stable, beta, dev] fail-fast: false steps: - uses: actions/checkout@v3 @@ -42,7 +42,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - sdk: ['dev', 'main'] + sdk: [dev, main] flavor: [raw] fail-fast: false steps: @@ -75,7 +75,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - sdk: ['2.12.0-29.10.beta'] + sdk: [2.12.0-29.10.beta] fail-fast: false steps: - uses: actions/checkout@v3 @@ -94,7 +94,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - sdk: ['2.19', 3.0, '3.1'] + sdk: [2.19, 3.0, 3.1] fail-fast: false steps: - uses: actions/checkout@v3 diff --git a/README.md b/README.md index 6e99ded..8b070d8 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - sdk: ['3.1', 'stable', 'beta'] + sdk: [3.1, stable, beta] steps: - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@v1 diff --git a/dist/index.mjs b/dist/index.mjs index 34f9727..2cb76e0 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -1,7 +1,7 @@ import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module"; /******/ var __webpack_modules__ = ({ -/***/ 3551: +/***/ 2690: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -27,7 +27,7 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.issue = exports.issueCommand = void 0; const os = __importStar(__nccwpck_require__(2037)); -const utils_1 = __nccwpck_require__(2139); +const utils_1 = __nccwpck_require__(353); /** * Commands * @@ -99,7 +99,7 @@ function escapeProperty(s) { /***/ }), -/***/ 2606: +/***/ 9935: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -133,12 +133,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0; -const command_1 = __nccwpck_require__(3551); -const file_command_1 = __nccwpck_require__(3682); -const utils_1 = __nccwpck_require__(2139); +const command_1 = __nccwpck_require__(2690); +const file_command_1 = __nccwpck_require__(5898); +const utils_1 = __nccwpck_require__(353); const os = __importStar(__nccwpck_require__(2037)); const path = __importStar(__nccwpck_require__(1017)); -const oidc_utils_1 = __nccwpck_require__(7539); +const oidc_utils_1 = __nccwpck_require__(7901); /** * The code to exit an action */ @@ -423,17 +423,17 @@ exports.getIDToken = getIDToken; /** * Summary exports */ -var summary_1 = __nccwpck_require__(2586); +var summary_1 = __nccwpck_require__(9050); Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } })); /** * @deprecated use core.summary */ -var summary_2 = __nccwpck_require__(2586); +var summary_2 = __nccwpck_require__(9050); Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } })); /** * Path exports */ -var path_utils_1 = __nccwpck_require__(5228); +var path_utils_1 = __nccwpck_require__(1341); Object.defineProperty(exports, "toPosixPath", ({ enumerable: true, get: function () { return path_utils_1.toPosixPath; } })); Object.defineProperty(exports, "toWin32Path", ({ enumerable: true, get: function () { return path_utils_1.toWin32Path; } })); Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: function () { return path_utils_1.toPlatformPath; } })); @@ -441,7 +441,7 @@ Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: funct /***/ }), -/***/ 3682: +/***/ 5898: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -471,8 +471,8 @@ exports.prepareKeyValueMessage = exports.issueFileCommand = void 0; /* eslint-disable @typescript-eslint/no-explicit-any */ const fs = __importStar(__nccwpck_require__(7147)); const os = __importStar(__nccwpck_require__(2037)); -const uuid_1 = __nccwpck_require__(5941); -const utils_1 = __nccwpck_require__(2139); +const uuid_1 = __nccwpck_require__(1368); +const utils_1 = __nccwpck_require__(353); function issueFileCommand(command, message) { const filePath = process.env[`GITHUB_${command}`]; if (!filePath) { @@ -505,7 +505,7 @@ exports.prepareKeyValueMessage = prepareKeyValueMessage; /***/ }), -/***/ 7539: +/***/ 7901: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -520,9 +520,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.OidcClient = void 0; -const http_client_1 = __nccwpck_require__(4215); -const auth_1 = __nccwpck_require__(885); -const core_1 = __nccwpck_require__(2606); +const http_client_1 = __nccwpck_require__(3658); +const auth_1 = __nccwpck_require__(2660); +const core_1 = __nccwpck_require__(9935); class OidcClient { static createHttpClient(allowRetry = true, maxRetry = 10) { const requestOptions = { @@ -554,7 +554,7 @@ class OidcClient { .catch(error => { throw new Error(`Failed to get ID Token. \n Error Code : ${error.statusCode}\n - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -588,7 +588,7 @@ exports.OidcClient = OidcClient; /***/ }), -/***/ 5228: +/***/ 1341: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -652,7 +652,7 @@ exports.toPlatformPath = toPlatformPath; /***/ }), -/***/ 2586: +/***/ 9050: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -941,7 +941,7 @@ exports.summary = _summary; /***/ }), -/***/ 2139: +/***/ 353: /***/ ((__unused_webpack_module, exports) => { @@ -987,7 +987,7 @@ exports.toCommandProperties = toCommandProperties; /***/ }), -/***/ 69: +/***/ 3409: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -1022,7 +1022,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getExecOutput = exports.exec = void 0; const string_decoder_1 = __nccwpck_require__(1576); -const tr = __importStar(__nccwpck_require__(5029)); +const tr = __importStar(__nccwpck_require__(1139)); /** * Exec a command. * Output will be streamed to the live console. @@ -1096,7 +1096,7 @@ exports.getExecOutput = getExecOutput; /***/ }), -/***/ 5029: +/***/ 1139: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -1134,8 +1134,8 @@ const os = __importStar(__nccwpck_require__(2037)); const events = __importStar(__nccwpck_require__(2361)); const child = __importStar(__nccwpck_require__(2081)); const path = __importStar(__nccwpck_require__(1017)); -const io = __importStar(__nccwpck_require__(96)); -const ioUtil = __importStar(__nccwpck_require__(375)); +const io = __importStar(__nccwpck_require__(2725)); +const ioUtil = __importStar(__nccwpck_require__(573)); const timers_1 = __nccwpck_require__(9512); /* eslint-disable @typescript-eslint/unbound-method */ const IS_WINDOWS = process.platform === 'win32'; @@ -1720,7 +1720,7 @@ class ExecState extends events.EventEmitter { /***/ }), -/***/ 885: +/***/ 2660: /***/ (function(__unused_webpack_module, exports) { @@ -1807,7 +1807,7 @@ exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHand /***/ }), -/***/ 4215: +/***/ 3658: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -1844,8 +1844,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0; const http = __importStar(__nccwpck_require__(3685)); const https = __importStar(__nccwpck_require__(5687)); -const pm = __importStar(__nccwpck_require__(6695)); -const tunnel = __importStar(__nccwpck_require__(5306)); +const pm = __importStar(__nccwpck_require__(9697)); +const tunnel = __importStar(__nccwpck_require__(7477)); var HttpCodes; (function (HttpCodes) { HttpCodes[HttpCodes["OK"] = 200] = "OK"; @@ -1935,6 +1935,19 @@ class HttpClientResponse { })); }); } + readBodyBuffer() { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () { + const chunks = []; + this.message.on('data', (chunk) => { + chunks.push(chunk); + }); + this.message.on('end', () => { + resolve(Buffer.concat(chunks)); + }); + })); + }); + } } exports.HttpClientResponse = HttpClientResponse; function isHttps(requestUrl) { @@ -2418,7 +2431,7 @@ const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCa /***/ }), -/***/ 6695: +/***/ 9697: /***/ ((__unused_webpack_module, exports) => { @@ -2438,7 +2451,13 @@ function getProxyUrl(reqUrl) { } })(); if (proxyVar) { - return new URL(proxyVar); + try { + return new URL(proxyVar); + } + catch (_a) { + if (!proxyVar.startsWith('http://') && !proxyVar.startsWith('https://')) + return new URL(`http://${proxyVar}`); + } } else { return undefined; @@ -2500,7 +2519,7 @@ function isLoopbackAddress(host) { /***/ }), -/***/ 375: +/***/ 573: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -2689,7 +2708,7 @@ exports.getCmdPath = getCmdPath; /***/ }), -/***/ 96: +/***/ 2725: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -2725,7 +2744,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0; const assert_1 = __nccwpck_require__(9491); const path = __importStar(__nccwpck_require__(1017)); -const ioUtil = __importStar(__nccwpck_require__(375)); +const ioUtil = __importStar(__nccwpck_require__(573)); /** * Copies a file or folder. * Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js @@ -2994,7 +3013,7 @@ function copyFile(srcFile, destFile, force) { /***/ }), -/***/ 2033: +/***/ 7936: /***/ (function(module, exports, __nccwpck_require__) { @@ -3028,8 +3047,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports._readLinuxVersionFile = exports._getOsVersion = exports._findMatch = void 0; -const semver = __importStar(__nccwpck_require__(537)); -const core_1 = __nccwpck_require__(2606); +const semver = __importStar(__nccwpck_require__(7163)); +const core_1 = __nccwpck_require__(9935); // needs to be require for core node modules to be mocked /* eslint @typescript-eslint/no-require-imports: 0 */ const os = __nccwpck_require__(2037); @@ -3128,7 +3147,7 @@ exports._readLinuxVersionFile = _readLinuxVersionFile; /***/ }), -/***/ 2182: +/***/ 721: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -3162,7 +3181,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.RetryHelper = void 0; -const core = __importStar(__nccwpck_require__(2606)); +const core = __importStar(__nccwpck_require__(9935)); /** * Internal class for retries */ @@ -3217,7 +3236,7 @@ exports.RetryHelper = RetryHelper; /***/ }), -/***/ 1994: +/***/ 2275: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -3254,20 +3273,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.evaluateVersions = exports.isExplicitVersion = exports.findFromManifest = exports.getManifestFromRepo = exports.findAllVersions = exports.find = exports.cacheFile = exports.cacheDir = exports.extractZip = exports.extractXar = exports.extractTar = exports.extract7z = exports.downloadTool = exports.HTTPError = void 0; -const core = __importStar(__nccwpck_require__(2606)); -const io = __importStar(__nccwpck_require__(96)); +const core = __importStar(__nccwpck_require__(9935)); +const io = __importStar(__nccwpck_require__(2725)); const fs = __importStar(__nccwpck_require__(7147)); -const mm = __importStar(__nccwpck_require__(2033)); +const mm = __importStar(__nccwpck_require__(7936)); const os = __importStar(__nccwpck_require__(2037)); const path = __importStar(__nccwpck_require__(1017)); -const httpm = __importStar(__nccwpck_require__(4215)); -const semver = __importStar(__nccwpck_require__(537)); +const httpm = __importStar(__nccwpck_require__(3658)); +const semver = __importStar(__nccwpck_require__(7163)); const stream = __importStar(__nccwpck_require__(2781)); const util = __importStar(__nccwpck_require__(3837)); const assert_1 = __nccwpck_require__(9491); -const v4_1 = __importDefault(__nccwpck_require__(6651)); -const exec_1 = __nccwpck_require__(69); -const retry_helper_1 = __nccwpck_require__(2182); +const v4_1 = __importDefault(__nccwpck_require__(4559)); +const exec_1 = __nccwpck_require__(3409); +const retry_helper_1 = __nccwpck_require__(721); class HTTPError extends Error { constructor(httpStatusCode) { super(`Unexpected HTTP response: ${httpStatusCode}`); @@ -3888,7 +3907,7 @@ function _unique(values) { /***/ }), -/***/ 5792: +/***/ 6993: /***/ ((module) => { /** @@ -3921,7 +3940,7 @@ module.exports = bytesToUuid; /***/ }), -/***/ 7553: +/***/ 3480: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { // Unique ID creation requires a high quality random # generator. In node.js @@ -3936,11 +3955,11 @@ module.exports = function nodeRNG() { /***/ }), -/***/ 6651: +/***/ 4559: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var rng = __nccwpck_require__(7553); -var bytesToUuid = __nccwpck_require__(5792); +var rng = __nccwpck_require__(3480); +var bytesToUuid = __nccwpck_require__(6993); function v4(options, buf, offset) { var i = buf && offset || 0; @@ -3972,7 +3991,7 @@ module.exports = v4; /***/ }), -/***/ 537: +/***/ 7163: /***/ ((module, exports) => { exports = module.exports = SemVer @@ -5622,15 +5641,15 @@ function coerce (version, options) { /***/ }), -/***/ 5306: +/***/ 7477: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = __nccwpck_require__(1998); +module.exports = __nccwpck_require__(8162); /***/ }), -/***/ 1998: +/***/ 8162: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -5901,7 +5920,7 @@ exports.debug = debug; // for test /***/ }), -/***/ 5941: +/***/ 1368: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -5964,29 +5983,29 @@ Object.defineProperty(exports, "parse", ({ } })); -var _v = _interopRequireDefault(__nccwpck_require__(7174)); +var _v = _interopRequireDefault(__nccwpck_require__(3258)); -var _v2 = _interopRequireDefault(__nccwpck_require__(5714)); +var _v2 = _interopRequireDefault(__nccwpck_require__(2559)); -var _v3 = _interopRequireDefault(__nccwpck_require__(6142)); +var _v3 = _interopRequireDefault(__nccwpck_require__(2872)); -var _v4 = _interopRequireDefault(__nccwpck_require__(3946)); +var _v4 = _interopRequireDefault(__nccwpck_require__(5034)); -var _nil = _interopRequireDefault(__nccwpck_require__(9687)); +var _nil = _interopRequireDefault(__nccwpck_require__(6051)); -var _version = _interopRequireDefault(__nccwpck_require__(4312)); +var _version = _interopRequireDefault(__nccwpck_require__(6630)); -var _validate = _interopRequireDefault(__nccwpck_require__(2644)); +var _validate = _interopRequireDefault(__nccwpck_require__(6879)); -var _stringify = _interopRequireDefault(__nccwpck_require__(8551)); +var _stringify = _interopRequireDefault(__nccwpck_require__(2992)); -var _parse = _interopRequireDefault(__nccwpck_require__(1728)); +var _parse = _interopRequireDefault(__nccwpck_require__(3783)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /***/ }), -/***/ 7802: +/***/ 1102: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6015,7 +6034,7 @@ exports["default"] = _default; /***/ }), -/***/ 9687: +/***/ 6051: /***/ ((__unused_webpack_module, exports) => { @@ -6029,7 +6048,7 @@ exports["default"] = _default; /***/ }), -/***/ 1728: +/***/ 3783: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6039,7 +6058,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(2644)); +var _validate = _interopRequireDefault(__nccwpck_require__(6879)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6080,7 +6099,7 @@ exports["default"] = _default; /***/ }), -/***/ 808: +/***/ 4557: /***/ ((__unused_webpack_module, exports) => { @@ -6094,7 +6113,7 @@ exports["default"] = _default; /***/ }), -/***/ 406: +/***/ 160: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6124,7 +6143,7 @@ function rng() { /***/ }), -/***/ 2683: +/***/ 4850: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6153,7 +6172,7 @@ exports["default"] = _default; /***/ }), -/***/ 8551: +/***/ 2992: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6163,7 +6182,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(2644)); +var _validate = _interopRequireDefault(__nccwpck_require__(6879)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6198,7 +6217,7 @@ exports["default"] = _default; /***/ }), -/***/ 7174: +/***/ 3258: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6208,9 +6227,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _rng = _interopRequireDefault(__nccwpck_require__(406)); +var _rng = _interopRequireDefault(__nccwpck_require__(160)); -var _stringify = _interopRequireDefault(__nccwpck_require__(8551)); +var _stringify = _interopRequireDefault(__nccwpck_require__(2992)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6311,7 +6330,7 @@ exports["default"] = _default; /***/ }), -/***/ 5714: +/***/ 2559: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6321,9 +6340,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _v = _interopRequireDefault(__nccwpck_require__(1130)); +var _v = _interopRequireDefault(__nccwpck_require__(810)); -var _md = _interopRequireDefault(__nccwpck_require__(7802)); +var _md = _interopRequireDefault(__nccwpck_require__(1102)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6333,7 +6352,7 @@ exports["default"] = _default; /***/ }), -/***/ 1130: +/***/ 810: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6344,9 +6363,9 @@ Object.defineProperty(exports, "__esModule", ({ exports["default"] = _default; exports.URL = exports.DNS = void 0; -var _stringify = _interopRequireDefault(__nccwpck_require__(8551)); +var _stringify = _interopRequireDefault(__nccwpck_require__(2992)); -var _parse = _interopRequireDefault(__nccwpck_require__(1728)); +var _parse = _interopRequireDefault(__nccwpck_require__(3783)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6417,7 +6436,7 @@ function _default(name, version, hashfunc) { /***/ }), -/***/ 6142: +/***/ 2872: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6427,9 +6446,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _rng = _interopRequireDefault(__nccwpck_require__(406)); +var _rng = _interopRequireDefault(__nccwpck_require__(160)); -var _stringify = _interopRequireDefault(__nccwpck_require__(8551)); +var _stringify = _interopRequireDefault(__nccwpck_require__(2992)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6460,7 +6479,7 @@ exports["default"] = _default; /***/ }), -/***/ 3946: +/***/ 5034: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6470,9 +6489,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _v = _interopRequireDefault(__nccwpck_require__(1130)); +var _v = _interopRequireDefault(__nccwpck_require__(810)); -var _sha = _interopRequireDefault(__nccwpck_require__(2683)); +var _sha = _interopRequireDefault(__nccwpck_require__(4850)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6482,7 +6501,7 @@ exports["default"] = _default; /***/ }), -/***/ 2644: +/***/ 6879: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6492,7 +6511,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _regex = _interopRequireDefault(__nccwpck_require__(808)); +var _regex = _interopRequireDefault(__nccwpck_require__(4557)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6505,7 +6524,7 @@ exports["default"] = _default; /***/ }), -/***/ 4312: +/***/ 6630: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -6515,7 +6534,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(2644)); +var _validate = _interopRequireDefault(__nccwpck_require__(6879)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6651,7 +6670,7 @@ module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("util"); /***/ }), -/***/ 3247: +/***/ 8405: /***/ ((__webpack_module__, __unused_webpack___webpack_exports__, __nccwpck_require__) => { var _actions_core__WEBPACK_IMPORTED_MODULE_0___namespace_cache; @@ -6661,10 +6680,10 @@ var fs__WEBPACK_IMPORTED_MODULE_4___namespace_cache; var os__WEBPACK_IMPORTED_MODULE_6___namespace_cache; var process__WEBPACK_IMPORTED_MODULE_7___namespace_cache; __nccwpck_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try { -/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(2606); -/* harmony import */ var _actions_exec__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(69); -/* harmony import */ var _actions_http_client__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(4215); -/* harmony import */ var _actions_tool_cache__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(1994); +/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(9935); +/* harmony import */ var _actions_exec__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(3409); +/* harmony import */ var _actions_http_client__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(3658); +/* harmony import */ var _actions_tool_cache__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(2275); /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_4__ = __nccwpck_require__(7147); /* harmony import */ var module__WEBPACK_IMPORTED_MODULE_5__ = __nccwpck_require__(8188); /* harmony import */ var os__WEBPACK_IMPORTED_MODULE_6__ = __nccwpck_require__(2037); @@ -6885,6 +6904,6 @@ __webpack_async_result__(); /******/ // startup /******/ // Load entry module and return exports /******/ // This entry module used 'module' so it can't be inlined -/******/ var __webpack_exports__ = __nccwpck_require__(3247); +/******/ var __webpack_exports__ = __nccwpck_require__(8405); /******/ __webpack_exports__ = await __webpack_exports__; /******/ diff --git a/dist/main.cjs b/dist/main.cjs index 1db0764..a0c0fe9 100644 --- a/dist/main.cjs +++ b/dist/main.cjs @@ -1,4 +1,4 @@ -// Generated by dart2js (NullSafetyMode.sound, csp, intern-composite-values), the Dart to JavaScript compiler version: 3.3.0-0.0.dev. +// Generated by dart2js (NullSafetyMode.sound, csp, intern-composite-values), the Dart to JavaScript compiler version: 3.3.0-5.0.dev. // The code supports the following hooks: // dartPrint(message): // if this function is defined it is called instead of the Dart [print] diff --git a/dist/sig.txt b/dist/sig.txt index 737f4e1..a273709 100644 --- a/dist/sig.txt +++ b/dist/sig.txt @@ -1 +1 @@ -9CBA5F743ADEF9959A3E4BF100392986 +18795C134842C8690848B22615860C0E From b6470d418f5d8e67774a46d5d89483bd1baaf3fb Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Tue, 10 Oct 2023 08:32:36 -0700 Subject: [PATCH 08/12] comments --- lib/main.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index f545993..143167e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -35,7 +35,6 @@ void main(List args) async { flavor = sdk == 'main' ? 'raw' : 'release'; } else if (flavor != 'raw' && flavor != 'release') { _fail("Unrecognized build flavor '$flavor'."); - // return; } final raw = flavor == 'raw'; @@ -81,7 +80,6 @@ void main(List args) async { channel = 'beta'; } else if (sdk.contains('main')) { _fail('Versions cannot be specified for main channel builds.'); - // return; } else { channel = 'stable'; } From 0a3598599eda1e1605143a38611dbe8a90e54157 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Tue, 10 Oct 2023 11:59:01 -0700 Subject: [PATCH 09/12] set the process.exitCode value --- dist/index.mjs | 3 +- dist/main.cjs | 203 ++++++++++++++++++++++++++------------------- dist/sig.txt | 2 +- lib/main.dart | 221 +++++++++++++++++++++++++------------------------ lib/main.mjs | 2 +- 5 files changed, 234 insertions(+), 197 deletions(-) diff --git a/dist/index.mjs b/dist/index.mjs index 2cb76e0..ddcecd2 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -6678,7 +6678,6 @@ var _actions_exec__WEBPACK_IMPORTED_MODULE_1___namespace_cache; var _actions_tool_cache__WEBPACK_IMPORTED_MODULE_3___namespace_cache; var fs__WEBPACK_IMPORTED_MODULE_4___namespace_cache; var os__WEBPACK_IMPORTED_MODULE_6___namespace_cache; -var process__WEBPACK_IMPORTED_MODULE_7___namespace_cache; __nccwpck_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try { /* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(9935); /* harmony import */ var _actions_exec__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(3409); @@ -6712,7 +6711,7 @@ globalThis.HttpClient = _actions_http_client__WEBPACK_IMPORTED_MODULE_2__.HttpCl globalThis.toolCache = /*#__PURE__*/ (_actions_tool_cache__WEBPACK_IMPORTED_MODULE_3___namespace_cache || (_actions_tool_cache__WEBPACK_IMPORTED_MODULE_3___namespace_cache = __nccwpck_require__.t(_actions_tool_cache__WEBPACK_IMPORTED_MODULE_3__, 2))); globalThis.fs = /*#__PURE__*/ (fs__WEBPACK_IMPORTED_MODULE_4___namespace_cache || (fs__WEBPACK_IMPORTED_MODULE_4___namespace_cache = __nccwpck_require__.t(fs__WEBPACK_IMPORTED_MODULE_4__, 2))); globalThis.os = /*#__PURE__*/ (os__WEBPACK_IMPORTED_MODULE_6___namespace_cache || (os__WEBPACK_IMPORTED_MODULE_6___namespace_cache = __nccwpck_require__.t(os__WEBPACK_IMPORTED_MODULE_6__, 2))); -globalThis.process = /*#__PURE__*/ (process__WEBPACK_IMPORTED_MODULE_7___namespace_cache || (process__WEBPACK_IMPORTED_MODULE_7___namespace_cache = __nccwpck_require__.t(process__WEBPACK_IMPORTED_MODULE_7__, 2))); +globalThis.process = process__WEBPACK_IMPORTED_MODULE_7__; globalThis.location = { href: `file://${process__WEBPACK_IMPORTED_MODULE_7__.cwd()}/`} globalThis.dartMainRunner = async function(main, args) { diff --git a/dist/main.cjs b/dist/main.cjs index a0c0fe9..6a5f7db 100644 --- a/dist/main.cjs +++ b/dist/main.cjs @@ -507,6 +507,9 @@ map$1$1$ax(receiver, a0, $T1) { return J.getInterceptor$ax(receiver).map$1$1(receiver, a0, $T1); }, + split$1$s(receiver, a0) { + return J.getInterceptor$s(receiver).split$1(receiver, a0); + }, toString$0$(receiver) { return J.getInterceptor$(receiver).toString$0(receiver); }, @@ -621,7 +624,7 @@ this.__internal$_message = t0; }, CodeUnits: function CodeUnits(t0) { - this._string = t0; + this.__internal$_string = t0; }, EfficientLengthIterable: function EfficientLengthIterable() { }, @@ -1640,13 +1643,13 @@ }, _AllMatchesIterable: function _AllMatchesIterable(t0, t1, t2) { this._re = t0; - this.__js_helper$_string = t1; + this._string = t1; this.__js_helper$_start = t2; }, _AllMatchesIterator: function _AllMatchesIterator(t0, t1, t2) { var _ = this; _._regExp = t0; - _.__js_helper$_string = t1; + _._string = t1; _._nextIndex = t2; _.__js_helper$_current = null; }, @@ -5796,7 +5799,7 @@ main$body(args) { var $async$goto = 0, $async$completer = A._makeAsyncAwaitCompleter(type$.dynamic), - $async$handler = 1, $async$currentError, flavor, channel, raw, os, architecture, version, exception, url, toolName, sdkPath, t3, archivePath, extractedFolder, t4, pubCache, versionFilePath, t1, t2, sdk, $async$exception, $async$temp1; + $async$returnValue, $async$handler = 2, $async$currentError, sdk, flavor, raw, os, architecture, version, channel, url, toolName, sdkPath, archivePath, extractedFolder, pubCache, e, t1, t2, exception, t3, t4, versionFilePath, $async$exception, $async$exception1; var $async$main = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) { if ($async$errorCode === 1) { $async$currentError = $async$result; @@ -5806,152 +5809,159 @@ switch ($async$goto) { case 0: // Function start + $async$handler = 4; t1 = self; t2 = type$.JSObject; sdk = A._asString(t2._as(t1.core).getInput("sdk")); - if (sdk.length === 0) + if (J.get$length$asx(sdk) === 0) sdk = "stable"; - if (A.Primitives_parseInt(sdk, null) != null && !B.JSString_methods.contains$1(sdk, ".")) - sdk += ".0"; flavor = A._asString(t2._as(t1.core).getInput("flavor")); if (J.get$length$asx(flavor) === 0) - flavor = sdk === "main" ? "raw" : "release"; - else if (!J.$eq$(flavor, "raw") && !J.$eq$(flavor, "release")) + flavor = J.$eq$(sdk, "main") ? "raw" : "release"; + else if (!J.$eq$(flavor, "raw") && !J.$eq$(flavor, "release")) { A._fail("Unrecognized build flavor '" + A.S(flavor) + "'."); + // goto return + $async$goto = 1; + break; + } raw = J.$eq$(flavor, "raw"); os = A.getPlatform(); architecture = A._asString(t2._as(t1.core).getInput("architecture")); - if (architecture.length === 0) + if (J.get$length$asx(architecture) === 0) architecture = B.JSArray_methods.contains$1(B.List_x64_ia32_arm_arm64, A._asString(t2._as(t1.os).arch())) ? A._asString(t2._as(t1.os).arch()) : "x64"; + version = null; channel = null; - $async$goto = sdk.split(".").length === 2 ? 2 : 4; + $async$goto = J.split$1$s(sdk, ".").length === 2 ? 7 : 9; break; - case 2: + case 7: // then channel = "stable"; - $async$goto = 5; + $async$goto = 10; return A._asyncAwait(A.findLatestSdkForRelease(sdk), $async$main); - case 5: + case 10: // returning from await. version = $async$result; // goto join - $async$goto = 3; + $async$goto = 8; break; - case 4: + case 9: // else - $async$goto = sdk === "stable" || sdk === "beta" || sdk === "dev" ? 6 : 8; + $async$goto = J.$eq$(sdk, "stable") || J.$eq$(sdk, "beta") || J.$eq$(sdk, "dev") ? 11 : 13; break; - case 6: + case 11: // then channel = sdk; - $async$goto = raw ? 9 : 11; + $async$goto = A.boolConversionCheck(raw) ? 14 : 16; break; - case 9: + case 14: // then $async$result = "latest"; // goto join - $async$goto = 10; + $async$goto = 15; break; - case 11: + case 16: // else - $async$goto = 12; + $async$goto = 17; return A._asyncAwait(A.latestPublishedVersion(channel, flavor), $async$main); - case 12: + case 17: // returning from await. - case 10: + case 15: // join version = $async$result; // goto join - $async$goto = 7; + $async$goto = 12; break; - case 8: + case 13: // else - $async$goto = sdk === "main" ? 13 : 15; + $async$goto = J.$eq$(sdk, "main") ? 18 : 20; break; - case 13: + case 18: // then - $async$handler = 17; + $async$handler = 22; channel = "main"; - $async$goto = 20; + $async$goto = 25; return A._asyncAwait(A.latestPublishedVersion(channel, flavor), $async$main); - case 20: + case 25: // returning from await. - $async$handler = 1; + $async$handler = 4; // goto after finally - $async$goto = 19; + $async$goto = 24; break; - case 17: + case 22: // catch - $async$handler = 16; + $async$handler = 21; $async$exception = $async$currentError; channel = "be"; // goto after finally - $async$goto = 19; + $async$goto = 24; break; - case 16: + case 21: // uncaught - // goto rethrow - $async$goto = 1; + // goto catch + $async$goto = 4; break; - case 19: + case 24: // after finally version = "latest"; // goto join - $async$goto = 14; + $async$goto = 19; break; - case 15: + case 20: // else - if (B.JSString_methods.contains$1(sdk, "dev")) + version = sdk; + if (J.contains$1$asx(sdk, "dev")) channel = "dev"; - else if (B.JSString_methods.contains$1(sdk, "beta")) + else if (J.contains$1$asx(sdk, "beta")) channel = "beta"; - else if (B.JSString_methods.contains$1(sdk, "main")) + else if (J.contains$1$asx(sdk, "main")) { A._fail("Versions cannot be specified for main channel builds."); - else + // goto return + $async$goto = 1; + break; + } else channel = "stable"; - version = sdk; - case 14: + case 19: // join - case 7: + case 12: // join - case 3: + case 8: // join - t2._as(t1.core).info("Installing the " + os + "-" + architecture + " Dart SDK version " + version + " from the " + A.S(channel) + " (" + A.S(flavor) + ") channel."); - url = string$.https_ + A.S(channel) + "/" + A.S(flavor) + "/" + version + "/sdk/dartsdk-" + os + "-" + architecture + "-release.zip"; - toolName = raw ? "dart_raw" : "dart"; - sdkPath = !raw ? A._asString(t2._as(t1.toolCache).find(toolName, version, architecture)) : ""; - $async$goto = sdkPath.length !== 0 ? 21 : 23; + t2._as(t1.core).info("Installing the " + A.S(os) + "-" + A.S(architecture) + " Dart SDK version " + A.S(version) + " from the " + A.S(channel) + " (" + A.S(flavor) + ") channel."); + url = string$.https_ + A.S(channel) + "/" + A.S(flavor) + "/" + A.S(version) + "/sdk/dartsdk-" + A.S(os) + "-" + A.S(architecture) + "-release.zip"; + toolName = A.boolConversionCheck(raw) ? "dart_raw" : "dart"; + sdkPath = !A.boolConversionCheck(raw) ? A._asString(t2._as(t1.toolCache).find(toolName, version, architecture)) : ""; + $async$goto = J.get$length$asx(sdkPath) !== 0 ? 26 : 28; break; - case 21: + case 26: // then - t2._as(t1.core).info("Using cached sdk from " + sdkPath + "."); + t2._as(t1.core).info("Using cached sdk from " + A.S(sdkPath) + "."); // goto join - $async$goto = 22; + $async$goto = 27; break; - case 23: + case 28: // else - t2._as(t1.core).info(url + " ..."); + t2._as(t1.core).info(A.S(url) + " ..."); t3 = type$.String; - $async$goto = 24; + $async$goto = 29; return A._asyncAwait(A.promiseToFuture(t2._as(t2._as(t1.toolCache).downloadTool(url)), t3), $async$main); - case 24: + case 29: // returning from await. archivePath = $async$result; - $async$temp1 = A; - $async$goto = 25; + $async$goto = 30; return A._asyncAwait(A.promiseToFuture(t2._as(t2._as(t1.toolCache).extractZip(archivePath)), t3), $async$main); - case 25: + case 30: // returning from await. - extractedFolder = $async$temp1.join($async$result, "dart-sdk"); - $async$goto = 26; + extractedFolder = $async$result; + extractedFolder = A.join(extractedFolder, "dart-sdk"); + $async$goto = 31; return A._asyncAwait(A.promiseToFuture(t2._as(t2._as(t1.toolCache).cacheDir(extractedFolder, toolName, version, architecture)), t3), $async$main); - case 26: + case 31: // returning from await. sdkPath = $async$result; - case 22: + case 27: // join t3 = t2._as(t1.process); - t4 = os === "windows" ? "USERPROFILE" : "HOME"; + t4 = J.$eq$(os, "windows") ? "USERPROFILE" : "HOME"; t4 = A._asStringQ(t2._as(t3.env)[t4]); t4.toString; pubCache = A.join(t4, ".pub-cache"); @@ -5959,20 +5969,44 @@ t2._as(t1.core).addPath(A.join(sdkPath, "bin")); t2._as(t1.core).exportVariable("PUB_CACHE", pubCache); t2._as(t1.core).addPath(A.join(pubCache, "bin")); - $async$goto = 27; + $async$goto = 32; return A._asyncAwait(A.createPubOIDCToken(), $async$main); - case 27: + case 32: // returning from await. t4 = t2._as(t1.core); versionFilePath = A.join(sdkPath, "version"); t4.setOutput("dart-version", B.JSString_methods.trim$0(A._asString(t2._as(t1.fs).readFileSync(versionFilePath, "utf8")))); - $async$goto = 28; + $async$goto = 33; return A._asyncAwait(A.promiseToFuture(t2._as(t2._as(t1.exec).exec("dart", A._setArrayType(["--version"], type$.JSArray_String))), type$.void), $async$main); - case 28: + case 33: // returning from await. - // implicit return - return A._asyncReturn(null, $async$completer); + $async$handler = 2; + // goto after finally + $async$goto = 6; + break; + case 4: + // catch + $async$handler = 3; + $async$exception1 = $async$currentError; + e = A.unwrapException($async$exception1); + A._fail(A.S(e)); + // goto return + $async$goto = 1; + break; + // goto after finally + $async$goto = 6; + break; + case 3: + // uncaught + // goto rethrow + $async$goto = 2; + break; + case 6: + // after finally case 1: + // return + return A._asyncReturn($async$returnValue, $async$completer); + case 2: // rethrow return A._asyncRethrow($async$currentError, $async$completer); } @@ -6106,7 +6140,6 @@ t2 = type$.JSObject; t2._as(t1.core).error(message); t2._as(t1.process).exitCode = 1; - throw A.wrapException(message); }, findLatestSdkForRelease_closure: function findLatestSdkForRelease_closure() { }, @@ -6508,6 +6541,10 @@ return false; return other === this.substring$1(receiver, t1 - otherLength); }, + split$1(receiver, pattern) { + var t1 = A._setArrayType(receiver.split(pattern), type$.JSArray_String); + return t1; + }, replaceRange$3(receiver, start, end, replacement) { var e = A.RangeError_checkValidRange(start, end, receiver.length); return receiver.substring(0, start) + replacement + receiver.substring(e); @@ -6673,10 +6710,10 @@ }; A.CodeUnits.prototype = { get$length(_) { - return this._string.length; + return this.__internal$_string.length; }, $index(_, i) { - var t1 = this._string; + var t1 = this.__internal$_string; if (!(i >= 0 && i < t1.length)) return A.ioore(t1, i); return t1.charCodeAt(i); @@ -7175,7 +7212,7 @@ A._MatchImplementation.prototype = {$isMatch: 1, $isRegExpMatch: 1}; A._AllMatchesIterable.prototype = { get$iterator(_) { - return new A._AllMatchesIterator(this._re, this.__js_helper$_string, this.__js_helper$_start); + return new A._AllMatchesIterator(this._re, this._string, this.__js_helper$_start); } }; A._AllMatchesIterator.prototype = { @@ -7185,7 +7222,7 @@ }, moveNext$0() { var t1, t2, t3, match, t4, nextIndex, _this = this, - string = _this.__js_helper$_string; + string = _this._string; if (string == null) return false; t1 = _this._nextIndex; @@ -7223,7 +7260,7 @@ return true; } } - _this.__js_helper$_string = _this.__js_helper$_current = null; + _this._string = _this.__js_helper$_current = null; return false; }, $isIterator: 1 diff --git a/dist/sig.txt b/dist/sig.txt index a273709..14c537a 100644 --- a/dist/sig.txt +++ b/dist/sig.txt @@ -1 +1 @@ -18795C134842C8690848B22615860C0E +671706994AC726DAE2E22EA8F5676315 diff --git a/lib/main.dart b/lib/main.dart index 143167e..e7300be 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -17,120 +17,128 @@ import 'node/os.dart'; import 'node/process.dart'; void main(List args) async { - // sdk - var sdk = core.getInput('sdk'); - if (sdk.isEmpty) { - sdk = 'stable'; - } - // A `3.0` in a workflow file reaches us as a `3` here; promote any int value - // back to a double. - if (int.tryParse(sdk) != null && !sdk.contains('.')) { - // Convert a '3' to a '3.0'. - sdk = '$sdk.0'; - } + try { + // sdk + var sdk = core.getInput('sdk'); + if (sdk.isEmpty) { + sdk = 'stable'; + } + // // A `3.0` in a workflow file reaches us as a `3` here; to work around that, + // // we promote any int value back to a double. + // if (int.tryParse(sdk) != null && !sdk.contains('.')) { + // // Convert a '3' to a '3.0'. + // sdk = '$sdk.0'; + // } + + // flavor + var flavor = core.getInput('flavor'); + if (flavor.isEmpty) { + flavor = sdk == 'main' ? 'raw' : 'release'; + } else if (flavor != 'raw' && flavor != 'release') { + _fail("Unrecognized build flavor '$flavor'."); + return; + } + final raw = flavor == 'raw'; - // flavor - var flavor = core.getInput('flavor'); - if (flavor.isEmpty) { - flavor = sdk == 'main' ? 'raw' : 'release'; - } else if (flavor != 'raw' && flavor != 'release') { - _fail("Unrecognized build flavor '$flavor'."); - } - final raw = flavor == 'raw'; + // os + final os = getPlatform(); - // os - final os = getPlatform(); + // architecture + var architecture = core.getInput('architecture'); + if (architecture.isEmpty) { + architecture = getArch(); + } - // architecture - var architecture = core.getInput('architecture'); - if (architecture.isEmpty) { - architecture = getArch(); - } + // calculate version and channel + String version; + String channel; - // calculate version and channel - String version; - String channel; - - if (sdk.split('.').length == 2) { - // Handle the wildcard (`2.19`, `3.1`, ...) format. - channel = 'stable'; - - // Find the latest version for the given sdk release. - version = await findLatestSdkForRelease(sdk); - } else if (sdk == 'stable' || sdk == 'beta' || sdk == 'dev') { - channel = sdk; - version = raw ? 'latest' : (await latestPublishedVersion(channel, flavor)); - } else if (sdk == 'main') { - // Check for `main` first and fall back to `be`. This handles the channel - // rename from `be` to `main` (also tracked as b/299435467). - try { - channel = 'main'; - await latestPublishedVersion(channel, flavor); - } catch (_) { - channel = 'be'; - } - version = 'latest'; - } else { - version = sdk; - - // Derive the channel from the version string. - if (sdk.contains('dev')) { - channel = 'dev'; - } else if (sdk.contains('beta')) { - channel = 'beta'; - } else if (sdk.contains('main')) { - _fail('Versions cannot be specified for main channel builds.'); - } else { + if (sdk.split('.').length == 2) { + // Handle the wildcard (`2.19`, `3.1`, ...) format. channel = 'stable'; + + // Find the latest version for the given sdk release. + version = await findLatestSdkForRelease(sdk); + } else if (sdk == 'stable' || sdk == 'beta' || sdk == 'dev') { + channel = sdk; + version = + raw ? 'latest' : (await latestPublishedVersion(channel, flavor)); + } else if (sdk == 'main') { + // Check for `main` first and fall back to `be`. This handles the channel + // rename from `be` to `main` (also tracked as b/299435467). + try { + channel = 'main'; + await latestPublishedVersion(channel, flavor); + } catch (_) { + channel = 'be'; + } + version = 'latest'; + } else { + version = sdk; + + // Derive the channel from the version string. + if (sdk.contains('dev')) { + channel = 'dev'; + } else if (sdk.contains('beta')) { + channel = 'beta'; + } else if (sdk.contains('main')) { + _fail('Versions cannot be specified for main channel builds.'); + return; + } else { + channel = 'stable'; + } } - } - core.info('Installing the $os-$architecture Dart SDK version $version from ' - 'the $channel ($flavor) channel.'); - - // Calculate url based on https://dart.dev/tools/sdk/archive#download-urls. - final url = 'https://storage.googleapis.com/dart-archive/' - 'channels/$channel/$flavor/$version/sdk/' - 'dartsdk-$os-$architecture-release.zip'; - - // Use a cached sdk or download and cache the sdk; using a 'raw' sdk flavor - // disables caching. - final toolName = raw ? 'dart_raw' : 'dart'; - var sdkPath = !raw ? toolCache.find(toolName, version, architecture) : ''; - if (sdkPath.isNotEmpty) { - core.info('Using cached sdk from $sdkPath.'); - } else { - core.info('$url ...'); - - final archivePath = - await promiseToFuture(toolCache.downloadTool(url)); - var extractedFolder = - await promiseToFuture(toolCache.extractZip(archivePath)); - extractedFolder = path.join(extractedFolder, 'dart-sdk'); - - sdkPath = await promiseToFuture( - toolCache.cacheDir(extractedFolder, toolName, version, architecture)); - } + core.info('Installing the $os-$architecture Dart SDK version $version from ' + 'the $channel ($flavor) channel.'); - final pubCache = path.join( - process.env(os == 'windows' ? 'USERPROFILE' : 'HOME')!, '.pub-cache'); + // Calculate url based on https://dart.dev/tools/sdk/archive#download-urls. + final url = 'https://storage.googleapis.com/dart-archive/' + 'channels/$channel/$flavor/$version/sdk/' + 'dartsdk-$os-$architecture-release.zip'; - core.exportVariable('DART_HOME', sdkPath); - core.addPath(path.join(sdkPath, 'bin')); - core.exportVariable('PUB_CACHE', pubCache); - core.addPath(path.join(pubCache, 'bin')); + // Use a cached sdk or download and cache the sdk; using a 'raw' sdk flavor + // disables caching. + final toolName = raw ? 'dart_raw' : 'dart'; + var sdkPath = !raw ? toolCache.find(toolName, version, architecture) : ''; + if (sdkPath.isNotEmpty) { + core.info('Using cached sdk from $sdkPath.'); + } else { + core.info('$url ...'); - // Create the OIDC token used for pub.dev publishing. - await createPubOIDCToken(); + final archivePath = + await promiseToFuture(toolCache.downloadTool(url)); + var extractedFolder = + await promiseToFuture(toolCache.extractZip(archivePath)); + extractedFolder = path.join(extractedFolder, 'dart-sdk'); - // Configure the outputs. - core.setOutput('dart-version', getVersionFromSdk(sdkPath)); + sdkPath = await promiseToFuture( + toolCache.cacheDir(extractedFolder, toolName, version, architecture)); + } - // Report success; print version. - await promiseToFuture(exec.exec( - 'dart', - ['--version'.toJS].toJS, - )); + final pubCache = path.join( + process.env(os == 'windows' ? 'USERPROFILE' : 'HOME')!, '.pub-cache'); + + core.exportVariable('DART_HOME', sdkPath); + core.addPath(path.join(sdkPath, 'bin')); + core.exportVariable('PUB_CACHE', pubCache); + core.addPath(path.join(pubCache, 'bin')); + + // Create the OIDC token used for pub.dev publishing. + await createPubOIDCToken(); + + // Configure the outputs. + core.setOutput('dart-version', getVersionFromSdk(sdkPath)); + + // Report success; print version. + await promiseToFuture(exec.exec( + 'dart', + ['--version'.toJS].toJS, + )); + } catch (e) { + _fail('$e'); + return; + } } String getVersionFromSdk(String sdkPath) { @@ -250,17 +258,10 @@ Future findLatestSdkForRelease(String sdkRelease) async { return semvers.last.toString(); } -Never _fail(String message) { +void _fail(String message) { // 'core.setFailed' throws when we call it; see #107. // core.setFailed(message); core.error(message); - - // TODO: This line is not properly setting the exit code. process.exitCode = 1; - - // TODO(devoncarew): Throwing here is a workaround for not being able to set - // the process exit code. - // ignore: only_throw_errors - throw message; } diff --git a/lib/main.mjs b/lib/main.mjs index c158205..6194fdf 100644 --- a/lib/main.mjs +++ b/lib/main.mjs @@ -9,7 +9,7 @@ import * as toolCache from '@actions/tool-cache'; import * as fs from 'fs'; import * as module from 'module'; import * as os from 'os'; -import * as process from 'process'; +import process from 'process'; const require = module.createRequire(import.meta.url); From 0946d393fe9998237365c30eb80e9501ae64944d Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Tue, 10 Oct 2023 12:04:04 -0700 Subject: [PATCH 10/12] re-test process.exitCode --- dist/main.cjs | 255 +++++++++++++++++++++++++++----------------------- dist/sig.txt | 2 +- lib/main.dart | 220 ++++++++++++++++++++++--------------------- 3 files changed, 252 insertions(+), 225 deletions(-) diff --git a/dist/main.cjs b/dist/main.cjs index 6a5f7db..fe5dd07 100644 --- a/dist/main.cjs +++ b/dist/main.cjs @@ -507,9 +507,6 @@ map$1$1$ax(receiver, a0, $T1) { return J.getInterceptor$ax(receiver).map$1$1(receiver, a0, $T1); }, - split$1$s(receiver, a0) { - return J.getInterceptor$s(receiver).split$1(receiver, a0); - }, toString$0$(receiver) { return J.getInterceptor$(receiver).toString$0(receiver); }, @@ -624,7 +621,7 @@ this.__internal$_message = t0; }, CodeUnits: function CodeUnits(t0) { - this.__internal$_string = t0; + this._string = t0; }, EfficientLengthIterable: function EfficientLengthIterable() { }, @@ -1643,13 +1640,13 @@ }, _AllMatchesIterable: function _AllMatchesIterable(t0, t1, t2) { this._re = t0; - this._string = t1; + this.__js_helper$_string = t1; this.__js_helper$_start = t2; }, _AllMatchesIterator: function _AllMatchesIterator(t0, t1, t2) { var _ = this; _._regExp = t0; - _._string = t1; + _.__js_helper$_string = t1; _._nextIndex = t2; _.__js_helper$_current = null; }, @@ -5799,7 +5796,7 @@ main$body(args) { var $async$goto = 0, $async$completer = A._makeAsyncAwaitCompleter(type$.dynamic), - $async$returnValue, $async$handler = 2, $async$currentError, sdk, flavor, raw, os, architecture, version, channel, url, toolName, sdkPath, archivePath, extractedFolder, pubCache, e, t1, t2, exception, t3, t4, versionFilePath, $async$exception, $async$exception1; + $async$handler = 1, $async$currentError, e, exception, $async$exception; var $async$main = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) { if ($async$errorCode === 1) { $async$currentError = $async$result; @@ -5809,15 +5806,67 @@ switch ($async$goto) { case 0: // Function start - $async$handler = 4; + $async$handler = 3; + $async$goto = 6; + return A._asyncAwait(A._impl(args), $async$main); + case 6: + // returning from await. + $async$handler = 1; + // goto after finally + $async$goto = 5; + break; + case 3: + // catch + $async$handler = 2; + $async$exception = $async$currentError; + e = A.unwrapException($async$exception); + A._fail(A.S(e)); + // goto after finally + $async$goto = 5; + break; + case 2: + // uncaught + // goto rethrow + $async$goto = 1; + break; + case 5: + // after finally + // implicit return + return A._asyncReturn(null, $async$completer); + case 1: + // rethrow + return A._asyncRethrow($async$currentError, $async$completer); + } + }); + return A._asyncStartSync($async$main, $async$completer); + }, + _impl(args) { + var $async$goto = 0, + $async$completer = A._makeAsyncAwaitCompleter(type$.void), + $async$returnValue, $async$handler = 2, $async$currentError, flavor, channel, raw, os, architecture, version, exception, url, toolName, sdkPath, t3, archivePath, extractedFolder, t4, pubCache, versionFilePath, t1, t2, sdk, $async$exception, $async$temp1; + var $async$_impl = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) { + if ($async$errorCode === 1) { + $async$currentError = $async$result; + $async$goto = $async$handler; + } + while (true) + switch ($async$goto) { + case 0: + // Function start t1 = self; t2 = type$.JSObject; sdk = A._asString(t2._as(t1.core).getInput("sdk")); - if (J.get$length$asx(sdk) === 0) + if (sdk.length === 0) sdk = "stable"; + if (A.Primitives_parseInt(sdk, null) != null && !B.JSString_methods.contains$1(sdk, ".")) { + A._fail("fo bar baz: " + (sdk + ".0")); + // goto return + $async$goto = 1; + break; + } flavor = A._asString(t2._as(t1.core).getInput("flavor")); if (J.get$length$asx(flavor) === 0) - flavor = J.$eq$(sdk, "main") ? "raw" : "release"; + flavor = sdk === "main" ? "raw" : "release"; else if (!J.$eq$(flavor, "raw") && !J.$eq$(flavor, "release")) { A._fail("Unrecognized build flavor '" + A.S(flavor) + "'."); // goto return @@ -5827,141 +5876,140 @@ raw = J.$eq$(flavor, "raw"); os = A.getPlatform(); architecture = A._asString(t2._as(t1.core).getInput("architecture")); - if (J.get$length$asx(architecture) === 0) + if (architecture.length === 0) architecture = B.JSArray_methods.contains$1(B.List_x64_ia32_arm_arm64, A._asString(t2._as(t1.os).arch())) ? A._asString(t2._as(t1.os).arch()) : "x64"; - version = null; channel = null; - $async$goto = J.split$1$s(sdk, ".").length === 2 ? 7 : 9; + $async$goto = sdk.split(".").length === 2 ? 3 : 5; break; - case 7: + case 3: // then channel = "stable"; - $async$goto = 10; - return A._asyncAwait(A.findLatestSdkForRelease(sdk), $async$main); - case 10: + $async$goto = 6; + return A._asyncAwait(A.findLatestSdkForRelease(sdk), $async$_impl); + case 6: // returning from await. version = $async$result; // goto join - $async$goto = 8; + $async$goto = 4; break; - case 9: + case 5: // else - $async$goto = J.$eq$(sdk, "stable") || J.$eq$(sdk, "beta") || J.$eq$(sdk, "dev") ? 11 : 13; + $async$goto = sdk === "stable" || sdk === "beta" || sdk === "dev" ? 7 : 9; break; - case 11: + case 7: // then channel = sdk; - $async$goto = A.boolConversionCheck(raw) ? 14 : 16; + $async$goto = raw ? 10 : 12; break; - case 14: + case 10: // then $async$result = "latest"; // goto join - $async$goto = 15; + $async$goto = 11; break; - case 16: + case 12: // else - $async$goto = 17; - return A._asyncAwait(A.latestPublishedVersion(channel, flavor), $async$main); - case 17: + $async$goto = 13; + return A._asyncAwait(A.latestPublishedVersion(channel, flavor), $async$_impl); + case 13: // returning from await. - case 15: + case 11: // join version = $async$result; // goto join - $async$goto = 12; + $async$goto = 8; break; - case 13: + case 9: // else - $async$goto = J.$eq$(sdk, "main") ? 18 : 20; + $async$goto = sdk === "main" ? 14 : 16; break; - case 18: + case 14: // then - $async$handler = 22; + $async$handler = 18; channel = "main"; - $async$goto = 25; - return A._asyncAwait(A.latestPublishedVersion(channel, flavor), $async$main); - case 25: + $async$goto = 21; + return A._asyncAwait(A.latestPublishedVersion(channel, flavor), $async$_impl); + case 21: // returning from await. - $async$handler = 4; + $async$handler = 2; // goto after finally - $async$goto = 24; + $async$goto = 20; break; - case 22: + case 18: // catch - $async$handler = 21; + $async$handler = 17; $async$exception = $async$currentError; channel = "be"; // goto after finally - $async$goto = 24; + $async$goto = 20; break; - case 21: + case 17: // uncaught - // goto catch - $async$goto = 4; + // goto rethrow + $async$goto = 2; break; - case 24: + case 20: // after finally version = "latest"; // goto join - $async$goto = 19; + $async$goto = 15; break; - case 20: + case 16: // else - version = sdk; - if (J.contains$1$asx(sdk, "dev")) + if (B.JSString_methods.contains$1(sdk, "dev")) channel = "dev"; - else if (J.contains$1$asx(sdk, "beta")) + else if (B.JSString_methods.contains$1(sdk, "beta")) channel = "beta"; - else if (J.contains$1$asx(sdk, "main")) { + else if (B.JSString_methods.contains$1(sdk, "main")) { A._fail("Versions cannot be specified for main channel builds."); // goto return $async$goto = 1; break; } else channel = "stable"; - case 19: - // join - case 12: + version = sdk; + case 15: // join case 8: // join - t2._as(t1.core).info("Installing the " + A.S(os) + "-" + A.S(architecture) + " Dart SDK version " + A.S(version) + " from the " + A.S(channel) + " (" + A.S(flavor) + ") channel."); - url = string$.https_ + A.S(channel) + "/" + A.S(flavor) + "/" + A.S(version) + "/sdk/dartsdk-" + A.S(os) + "-" + A.S(architecture) + "-release.zip"; - toolName = A.boolConversionCheck(raw) ? "dart_raw" : "dart"; - sdkPath = !A.boolConversionCheck(raw) ? A._asString(t2._as(t1.toolCache).find(toolName, version, architecture)) : ""; - $async$goto = J.get$length$asx(sdkPath) !== 0 ? 26 : 28; + case 4: + // join + t2._as(t1.core).info("Installing the " + os + "-" + architecture + " Dart SDK version " + version + " from the " + A.S(channel) + " (" + A.S(flavor) + ") channel."); + url = string$.https_ + A.S(channel) + "/" + A.S(flavor) + "/" + version + "/sdk/dartsdk-" + os + "-" + architecture + "-release.zip"; + toolName = raw ? "dart_raw" : "dart"; + sdkPath = !raw ? A._asString(t2._as(t1.toolCache).find(toolName, version, architecture)) : ""; + $async$goto = sdkPath.length !== 0 ? 22 : 24; break; - case 26: + case 22: // then - t2._as(t1.core).info("Using cached sdk from " + A.S(sdkPath) + "."); + t2._as(t1.core).info("Using cached sdk from " + sdkPath + "."); // goto join - $async$goto = 27; + $async$goto = 23; break; - case 28: + case 24: // else - t2._as(t1.core).info(A.S(url) + " ..."); + t2._as(t1.core).info(url + " ..."); t3 = type$.String; - $async$goto = 29; - return A._asyncAwait(A.promiseToFuture(t2._as(t2._as(t1.toolCache).downloadTool(url)), t3), $async$main); - case 29: + $async$goto = 25; + return A._asyncAwait(A.promiseToFuture(t2._as(t2._as(t1.toolCache).downloadTool(url)), t3), $async$_impl); + case 25: // returning from await. archivePath = $async$result; - $async$goto = 30; - return A._asyncAwait(A.promiseToFuture(t2._as(t2._as(t1.toolCache).extractZip(archivePath)), t3), $async$main); - case 30: + $async$temp1 = A; + $async$goto = 26; + return A._asyncAwait(A.promiseToFuture(t2._as(t2._as(t1.toolCache).extractZip(archivePath)), t3), $async$_impl); + case 26: // returning from await. - extractedFolder = $async$result; - extractedFolder = A.join(extractedFolder, "dart-sdk"); - $async$goto = 31; - return A._asyncAwait(A.promiseToFuture(t2._as(t2._as(t1.toolCache).cacheDir(extractedFolder, toolName, version, architecture)), t3), $async$main); - case 31: + extractedFolder = $async$temp1.join($async$result, "dart-sdk"); + $async$goto = 27; + return A._asyncAwait(A.promiseToFuture(t2._as(t2._as(t1.toolCache).cacheDir(extractedFolder, toolName, version, architecture)), t3), $async$_impl); + case 27: // returning from await. sdkPath = $async$result; - case 27: + case 23: // join t3 = t2._as(t1.process); - t4 = J.$eq$(os, "windows") ? "USERPROFILE" : "HOME"; + t4 = os === "windows" ? "USERPROFILE" : "HOME"; t4 = A._asStringQ(t2._as(t3.env)[t4]); t4.toString; pubCache = A.join(t4, ".pub-cache"); @@ -5969,40 +6017,17 @@ t2._as(t1.core).addPath(A.join(sdkPath, "bin")); t2._as(t1.core).exportVariable("PUB_CACHE", pubCache); t2._as(t1.core).addPath(A.join(pubCache, "bin")); - $async$goto = 32; - return A._asyncAwait(A.createPubOIDCToken(), $async$main); - case 32: + $async$goto = 28; + return A._asyncAwait(A.createPubOIDCToken(), $async$_impl); + case 28: // returning from await. t4 = t2._as(t1.core); versionFilePath = A.join(sdkPath, "version"); t4.setOutput("dart-version", B.JSString_methods.trim$0(A._asString(t2._as(t1.fs).readFileSync(versionFilePath, "utf8")))); - $async$goto = 33; - return A._asyncAwait(A.promiseToFuture(t2._as(t2._as(t1.exec).exec("dart", A._setArrayType(["--version"], type$.JSArray_String))), type$.void), $async$main); - case 33: + $async$goto = 29; + return A._asyncAwait(A.promiseToFuture(t2._as(t2._as(t1.exec).exec("dart", A._setArrayType(["--version"], type$.JSArray_String))), type$.void), $async$_impl); + case 29: // returning from await. - $async$handler = 2; - // goto after finally - $async$goto = 6; - break; - case 4: - // catch - $async$handler = 3; - $async$exception1 = $async$currentError; - e = A.unwrapException($async$exception1); - A._fail(A.S(e)); - // goto return - $async$goto = 1; - break; - // goto after finally - $async$goto = 6; - break; - case 3: - // uncaught - // goto rethrow - $async$goto = 2; - break; - case 6: - // after finally case 1: // return return A._asyncReturn($async$returnValue, $async$completer); @@ -6011,7 +6036,7 @@ return A._asyncRethrow($async$currentError, $async$completer); } }); - return A._asyncStartSync($async$main, $async$completer); + return A._asyncStartSync($async$_impl, $async$completer); }, getPlatform() { var t1, @@ -6541,10 +6566,6 @@ return false; return other === this.substring$1(receiver, t1 - otherLength); }, - split$1(receiver, pattern) { - var t1 = A._setArrayType(receiver.split(pattern), type$.JSArray_String); - return t1; - }, replaceRange$3(receiver, start, end, replacement) { var e = A.RangeError_checkValidRange(start, end, receiver.length); return receiver.substring(0, start) + replacement + receiver.substring(e); @@ -6710,10 +6731,10 @@ }; A.CodeUnits.prototype = { get$length(_) { - return this.__internal$_string.length; + return this._string.length; }, $index(_, i) { - var t1 = this.__internal$_string; + var t1 = this._string; if (!(i >= 0 && i < t1.length)) return A.ioore(t1, i); return t1.charCodeAt(i); @@ -7212,7 +7233,7 @@ A._MatchImplementation.prototype = {$isMatch: 1, $isRegExpMatch: 1}; A._AllMatchesIterable.prototype = { get$iterator(_) { - return new A._AllMatchesIterator(this._re, this._string, this.__js_helper$_start); + return new A._AllMatchesIterator(this._re, this.__js_helper$_string, this.__js_helper$_start); } }; A._AllMatchesIterator.prototype = { @@ -7222,7 +7243,7 @@ }, moveNext$0() { var t1, t2, t3, match, t4, nextIndex, _this = this, - string = _this._string; + string = _this.__js_helper$_string; if (string == null) return false; t1 = _this._nextIndex; @@ -7260,7 +7281,7 @@ return true; } } - _this._string = _this.__js_helper$_current = null; + _this.__js_helper$_string = _this.__js_helper$_current = null; return false; }, $isIterator: 1 diff --git a/dist/sig.txt b/dist/sig.txt index 14c537a..376deeb 100644 --- a/dist/sig.txt +++ b/dist/sig.txt @@ -1 +1 @@ -671706994AC726DAE2E22EA8F5676315 +97F971113B5257BF285C81615F64EA4C diff --git a/lib/main.dart b/lib/main.dart index e7300be..6ed59aa 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -18,127 +18,133 @@ import 'node/process.dart'; void main(List args) async { try { - // sdk - var sdk = core.getInput('sdk'); - if (sdk.isEmpty) { - sdk = 'stable'; - } - // // A `3.0` in a workflow file reaches us as a `3` here; to work around that, - // // we promote any int value back to a double. - // if (int.tryParse(sdk) != null && !sdk.contains('.')) { - // // Convert a '3' to a '3.0'. - // sdk = '$sdk.0'; - // } - - // flavor - var flavor = core.getInput('flavor'); - if (flavor.isEmpty) { - flavor = sdk == 'main' ? 'raw' : 'release'; - } else if (flavor != 'raw' && flavor != 'release') { - _fail("Unrecognized build flavor '$flavor'."); - return; - } - final raw = flavor == 'raw'; - - // os - final os = getPlatform(); + await _impl(args); + } catch (e) { + _fail('$e'); + } +} - // architecture - var architecture = core.getInput('architecture'); - if (architecture.isEmpty) { - architecture = getArch(); - } +Future _impl(List args) async { + // sdk + var sdk = core.getInput('sdk'); + if (sdk.isEmpty) { + sdk = 'stable'; + } - // calculate version and channel - String version; - String channel; + // A `3.0` in a workflow file reaches us as a `3` here; to work around that, + // we promote any int value back to a double. + if (int.tryParse(sdk) != null && !sdk.contains('.')) { + // Convert a '3' to a '3.0'. + sdk = '$sdk.0'; - if (sdk.split('.').length == 2) { - // Handle the wildcard (`2.19`, `3.1`, ...) format. - channel = 'stable'; + _fail('fo bar baz: $sdk'); + return; + } - // Find the latest version for the given sdk release. - version = await findLatestSdkForRelease(sdk); - } else if (sdk == 'stable' || sdk == 'beta' || sdk == 'dev') { - channel = sdk; - version = - raw ? 'latest' : (await latestPublishedVersion(channel, flavor)); - } else if (sdk == 'main') { - // Check for `main` first and fall back to `be`. This handles the channel - // rename from `be` to `main` (also tracked as b/299435467). - try { - channel = 'main'; - await latestPublishedVersion(channel, flavor); - } catch (_) { - channel = 'be'; - } - version = 'latest'; - } else { - version = sdk; - - // Derive the channel from the version string. - if (sdk.contains('dev')) { - channel = 'dev'; - } else if (sdk.contains('beta')) { - channel = 'beta'; - } else if (sdk.contains('main')) { - _fail('Versions cannot be specified for main channel builds.'); - return; - } else { - channel = 'stable'; - } - } + // flavor + var flavor = core.getInput('flavor'); + if (flavor.isEmpty) { + flavor = sdk == 'main' ? 'raw' : 'release'; + } else if (flavor != 'raw' && flavor != 'release') { + _fail("Unrecognized build flavor '$flavor'."); + return; + } + final raw = flavor == 'raw'; - core.info('Installing the $os-$architecture Dart SDK version $version from ' - 'the $channel ($flavor) channel.'); + // os + final os = getPlatform(); - // Calculate url based on https://dart.dev/tools/sdk/archive#download-urls. - final url = 'https://storage.googleapis.com/dart-archive/' - 'channels/$channel/$flavor/$version/sdk/' - 'dartsdk-$os-$architecture-release.zip'; + // architecture + var architecture = core.getInput('architecture'); + if (architecture.isEmpty) { + architecture = getArch(); + } - // Use a cached sdk or download and cache the sdk; using a 'raw' sdk flavor - // disables caching. - final toolName = raw ? 'dart_raw' : 'dart'; - var sdkPath = !raw ? toolCache.find(toolName, version, architecture) : ''; - if (sdkPath.isNotEmpty) { - core.info('Using cached sdk from $sdkPath.'); + // calculate version and channel + String version; + String channel; + + if (sdk.split('.').length == 2) { + // Handle the wildcard (`2.19`, `3.1`, ...) format. + channel = 'stable'; + + // Find the latest version for the given sdk release. + version = await findLatestSdkForRelease(sdk); + } else if (sdk == 'stable' || sdk == 'beta' || sdk == 'dev') { + channel = sdk; + version = raw ? 'latest' : (await latestPublishedVersion(channel, flavor)); + } else if (sdk == 'main') { + // Check for `main` first and fall back to `be`. This handles the channel + // rename from `be` to `main` (also tracked as b/299435467). + try { + channel = 'main'; + await latestPublishedVersion(channel, flavor); + } catch (_) { + channel = 'be'; + } + version = 'latest'; + } else { + version = sdk; + + // Derive the channel from the version string. + if (sdk.contains('dev')) { + channel = 'dev'; + } else if (sdk.contains('beta')) { + channel = 'beta'; + } else if (sdk.contains('main')) { + _fail('Versions cannot be specified for main channel builds.'); + return; } else { - core.info('$url ...'); - - final archivePath = - await promiseToFuture(toolCache.downloadTool(url)); - var extractedFolder = - await promiseToFuture(toolCache.extractZip(archivePath)); - extractedFolder = path.join(extractedFolder, 'dart-sdk'); - - sdkPath = await promiseToFuture( - toolCache.cacheDir(extractedFolder, toolName, version, architecture)); + channel = 'stable'; } + } + + core.info('Installing the $os-$architecture Dart SDK version $version from ' + 'the $channel ($flavor) channel.'); + + // Calculate url based on https://dart.dev/tools/sdk/archive#download-urls. + final url = 'https://storage.googleapis.com/dart-archive/' + 'channels/$channel/$flavor/$version/sdk/' + 'dartsdk-$os-$architecture-release.zip'; + + // Use a cached sdk or download and cache the sdk; using a 'raw' sdk flavor + // disables caching. + final toolName = raw ? 'dart_raw' : 'dart'; + var sdkPath = !raw ? toolCache.find(toolName, version, architecture) : ''; + if (sdkPath.isNotEmpty) { + core.info('Using cached sdk from $sdkPath.'); + } else { + core.info('$url ...'); + + final archivePath = + await promiseToFuture(toolCache.downloadTool(url)); + var extractedFolder = + await promiseToFuture(toolCache.extractZip(archivePath)); + extractedFolder = path.join(extractedFolder, 'dart-sdk'); + + sdkPath = await promiseToFuture( + toolCache.cacheDir(extractedFolder, toolName, version, architecture)); + } - final pubCache = path.join( - process.env(os == 'windows' ? 'USERPROFILE' : 'HOME')!, '.pub-cache'); + final pubCache = path.join( + process.env(os == 'windows' ? 'USERPROFILE' : 'HOME')!, '.pub-cache'); - core.exportVariable('DART_HOME', sdkPath); - core.addPath(path.join(sdkPath, 'bin')); - core.exportVariable('PUB_CACHE', pubCache); - core.addPath(path.join(pubCache, 'bin')); + core.exportVariable('DART_HOME', sdkPath); + core.addPath(path.join(sdkPath, 'bin')); + core.exportVariable('PUB_CACHE', pubCache); + core.addPath(path.join(pubCache, 'bin')); - // Create the OIDC token used for pub.dev publishing. - await createPubOIDCToken(); + // Create the OIDC token used for pub.dev publishing. + await createPubOIDCToken(); - // Configure the outputs. - core.setOutput('dart-version', getVersionFromSdk(sdkPath)); + // Configure the outputs. + core.setOutput('dart-version', getVersionFromSdk(sdkPath)); - // Report success; print version. - await promiseToFuture(exec.exec( - 'dart', - ['--version'.toJS].toJS, - )); - } catch (e) { - _fail('$e'); - return; - } + // Report success; print version. + await promiseToFuture(exec.exec( + 'dart', + ['--version'.toJS].toJS, + )); } String getVersionFromSdk(String sdkPath) { From cfcd30ea2d5b951301c9e8ab579fcdc97f5a7593 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Tue, 10 Oct 2023 12:06:59 -0700 Subject: [PATCH 11/12] remove temporary test --- dist/main.cjs | 8 ++------ dist/sig.txt | 2 +- lib/main.dart | 3 --- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/dist/main.cjs b/dist/main.cjs index fe5dd07..5d205e3 100644 --- a/dist/main.cjs +++ b/dist/main.cjs @@ -5858,12 +5858,8 @@ sdk = A._asString(t2._as(t1.core).getInput("sdk")); if (sdk.length === 0) sdk = "stable"; - if (A.Primitives_parseInt(sdk, null) != null && !B.JSString_methods.contains$1(sdk, ".")) { - A._fail("fo bar baz: " + (sdk + ".0")); - // goto return - $async$goto = 1; - break; - } + if (A.Primitives_parseInt(sdk, null) != null && !B.JSString_methods.contains$1(sdk, ".")) + sdk += ".0"; flavor = A._asString(t2._as(t1.core).getInput("flavor")); if (J.get$length$asx(flavor) === 0) flavor = sdk === "main" ? "raw" : "release"; diff --git a/dist/sig.txt b/dist/sig.txt index 376deeb..898731d 100644 --- a/dist/sig.txt +++ b/dist/sig.txt @@ -1 +1 @@ -97F971113B5257BF285C81615F64EA4C +753FFE376D98E81DAB70B208671C19C2 diff --git a/lib/main.dart b/lib/main.dart index 6ed59aa..23dc299 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -36,9 +36,6 @@ Future _impl(List args) async { if (int.tryParse(sdk) != null && !sdk.contains('.')) { // Convert a '3' to a '3.0'. sdk = '$sdk.0'; - - _fail('fo bar baz: $sdk'); - return; } // flavor From 40451ff07bbc12fa162d6c36f7a485b856622a50 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 11 Oct 2023 02:43:12 -0700 Subject: [PATCH 12/12] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3309c25..d14b4d9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v3 - uses: ./ with: - sdk: 'dev' + sdk: dev - run: dart pub get - run: dart analyze --fatal-infos - run: dart tool/sig.dart --verify