8
8
9
9
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
12
16
}) : (function(o, m, k, k2) {
13
17
if (k2 === undefined) k2 = k;
14
18
o[k2] = m[k];
@@ -21,7 +25,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
21
25
var __importStar = (this && this.__importStar) || function (mod) {
22
26
if (mod && mod.__esModule) return mod;
23
27
var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype. hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
29
__setModuleDefault(result, mod);
26
30
return result;
27
31
};
@@ -152,7 +156,11 @@ function writeFeedToFile(feedUrl, existingFileLocation, tempFileLocation) {
152
156
153
157
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
154
158
if (k2 === undefined) k2 = k;
155
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
159
+ var desc = Object.getOwnPropertyDescriptor(m, k);
160
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
161
+ desc = { enumerable: true, get: function() { return m[k]; } };
162
+ }
163
+ Object.defineProperty(o, k2, desc);
156
164
}) : (function(o, m, k, k2) {
157
165
if (k2 === undefined) k2 = k;
158
166
o[k2] = m[k];
@@ -165,7 +173,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
165
173
var __importStar = (this && this.__importStar) || function (mod) {
166
174
if (mod && mod.__esModule) return mod;
167
175
var result = {};
168
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
176
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype. hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
169
177
__setModuleDefault(result, mod);
170
178
return result;
171
179
};
@@ -181,6 +189,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
181
189
var __importDefault = (this && this.__importDefault) || function (mod) {
182
190
return (mod && mod.__esModule) ? mod : { "default": mod };
183
191
};
192
+ var _a;
184
193
Object.defineProperty(exports, "__esModule", ({ value: true }));
185
194
exports.DotnetCoreInstaller = exports.DotnetVersionResolver = void 0;
186
195
// Load tempDirectory before it gets wiped by tool-cache
@@ -191,6 +200,7 @@ const hc = __importStar(__nccwpck_require__(6255));
191
200
const fs_1 = __nccwpck_require__(7147);
192
201
const promises_1 = __nccwpck_require__(3292);
193
202
const path_1 = __importDefault(__nccwpck_require__(1017));
203
+ const os_1 = __importDefault(__nccwpck_require__(2037));
194
204
const semver_1 = __importDefault(__nccwpck_require__(5911));
195
205
const utils_1 = __nccwpck_require__(918);
196
206
class DotnetVersionResolver {
@@ -269,26 +279,21 @@ class DotnetCoreInstaller {
269
279
this.version = version;
270
280
this.quality = quality;
271
281
}
272
- static addToPath( ) {
273
- if (process.env['DOTNET_INSTALL_DIR']) {
274
- core.addPath(process.env['DOTNET_INSTALL_DIR']);
275
- core.exportVariable('DOTNET_ROOT', process.env['DOTNET_INSTALL_DIR']) ;
282
+ static convertInstallPathToAbsolute(installDir ) {
283
+ let transformedPath;
284
+ if (path_1.default.isAbsolute(installDir)) {
285
+ transformedPath = installDir ;
276
286
}
277
287
else {
278
- if (utils_1.IS_WINDOWS) {
279
- core.addPath(DotnetCoreInstaller.installationDirectoryWindows);
280
- core.exportVariable('DOTNET_ROOT', DotnetCoreInstaller.installationDirectoryWindows);
281
- }
282
- else if (utils_1.IS_LINUX) {
283
- core.addPath(DotnetCoreInstaller.installationDirectoryLinux);
284
- core.exportVariable('DOTNET_ROOT', DotnetCoreInstaller.installationDirectoryLinux);
285
- }
286
- else {
287
- // This is the default set in install-dotnet.sh
288
- core.addPath(DotnetCoreInstaller.installationDirectoryMac);
289
- core.exportVariable('DOTNET_ROOT', DotnetCoreInstaller.installationDirectoryMac);
290
- }
288
+ transformedPath = installDir.startsWith('~')
289
+ ? path_1.default.join(os_1.default.homedir(), installDir.slice(1))
290
+ : (transformedPath = path_1.default.join(process.cwd(), installDir));
291
291
}
292
+ return path_1.default.normalize(transformedPath);
293
+ }
294
+ static addToPath() {
295
+ core.addPath(process.env['DOTNET_INSTALL_DIR']);
296
+ core.exportVariable('DOTNET_ROOT', process.env['DOTNET_INSTALL_DIR']);
292
297
}
293
298
setQuality(dotnetVersion, scriptArguments) {
294
299
const option = utils_1.IS_WINDOWS ? '-Quality' : '--quality';
@@ -333,16 +338,12 @@ class DotnetCoreInstaller {
333
338
if (process.env['no_proxy'] != null) {
334
339
scriptArguments.push(`-ProxyBypassList ${process.env['no_proxy']}`);
335
340
}
336
- if (!process.env['DOTNET_INSTALL_DIR']) {
337
- process.env['DOTNET_INSTALL_DIR'] =
338
- DotnetCoreInstaller.installationDirectoryWindows;
339
- }
340
341
scriptPath =
341
342
(yield io.which('pwsh', false)) || (yield io.which('powershell', true));
342
343
scriptArguments = windowsDefaultOptions.concat(scriptArguments);
343
344
}
344
345
else {
345
- fs_1.chmodSync(escapedScript, '777');
346
+ (0, fs_1.chmodSync) (escapedScript, '777');
346
347
scriptPath = yield io.which(escapedScript, true);
347
348
scriptArguments = [];
348
349
if (dotnetVersion.type) {
@@ -351,11 +352,6 @@ class DotnetCoreInstaller {
351
352
if (this.quality) {
352
353
this.setQuality(dotnetVersion, scriptArguments);
353
354
}
354
- if (!process.env['DOTNET_INSTALL_DIR']) {
355
- process.env['DOTNET_INSTALL_DIR'] = utils_1.IS_LINUX
356
- ? DotnetCoreInstaller.installationDirectoryLinux
357
- : DotnetCoreInstaller.installationDirectoryMac;
358
- }
359
355
}
360
356
// process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used
361
357
const getExecOutputOptions = {
@@ -366,12 +362,13 @@ class DotnetCoreInstaller {
366
362
if (exitCode) {
367
363
throw new Error(`Failed to install dotnet ${exitCode}. ${stdout}`);
368
364
}
369
- return this.outputDotnetVersion(dotnetVersion.value, process.env['DOTNET_INSTALL_DIR'] );
365
+ return this.outputDotnetVersion(dotnetVersion.value);
370
366
});
371
367
}
372
- outputDotnetVersion(version, installationPath ) {
368
+ outputDotnetVersion(version) {
373
369
return __awaiter(this, void 0, void 0, function* () {
374
- let versionsOnRunner = yield promises_1.readdir(path_1.default.join(installationPath.replace(/'/g, ''), 'sdk'));
370
+ const installationPath = process.env['DOTNET_INSTALL_DIR'];
371
+ let versionsOnRunner = yield (0, promises_1.readdir)(path_1.default.join(installationPath.replace(/'/g, ''), 'sdk'));
375
372
let installedVersion = semver_1.default.maxSatisfying(versionsOnRunner, version, {
376
373
includePrerelease: true
377
374
});
@@ -380,9 +377,27 @@ class DotnetCoreInstaller {
380
377
}
381
378
}
382
379
exports.DotnetCoreInstaller = DotnetCoreInstaller;
383
- DotnetCoreInstaller.installationDirectoryWindows = path_1.default.join(process.env['PROGRAMFILES'] + '', 'dotnet');
384
- DotnetCoreInstaller.installationDirectoryLinux = '/usr/share/dotnet';
385
- DotnetCoreInstaller.installationDirectoryMac = path_1.default.join(process.env['HOME'] + '', '.dotnet');
380
+ _a = DotnetCoreInstaller;
381
+ (() => {
382
+ const installationDirectoryWindows = path_1.default.join(process.env['PROGRAMFILES'] + '', 'dotnet');
383
+ const installationDirectoryLinux = '/usr/share/dotnet';
384
+ const installationDirectoryMac = path_1.default.join(process.env['HOME'] + '', '.dotnet');
385
+ const dotnetInstallDir = process.env['DOTNET_INSTALL_DIR'];
386
+ if (dotnetInstallDir) {
387
+ process.env['DOTNET_INSTALL_DIR'] =
388
+ _a.convertInstallPathToAbsolute(dotnetInstallDir);
389
+ }
390
+ else {
391
+ if (utils_1.IS_WINDOWS) {
392
+ process.env['DOTNET_INSTALL_DIR'] = installationDirectoryWindows;
393
+ }
394
+ else {
395
+ process.env['DOTNET_INSTALL_DIR'] = utils_1.IS_LINUX
396
+ ? installationDirectoryLinux
397
+ : installationDirectoryMac;
398
+ }
399
+ }
400
+ })();
386
401
387
402
388
403
/***/ }),
@@ -394,7 +409,11 @@ DotnetCoreInstaller.installationDirectoryMac = path_1.default.join(process.env['
394
409
395
410
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
396
411
if (k2 === undefined) k2 = k;
397
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
412
+ var desc = Object.getOwnPropertyDescriptor(m, k);
413
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
414
+ desc = { enumerable: true, get: function() { return m[k]; } };
415
+ }
416
+ Object.defineProperty(o, k2, desc);
398
417
}) : (function(o, m, k, k2) {
399
418
if (k2 === undefined) k2 = k;
400
419
o[k2] = m[k];
@@ -407,7 +426,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
407
426
var __importStar = (this && this.__importStar) || function (mod) {
408
427
if (mod && mod.__esModule) return mod;
409
428
var result = {};
410
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
429
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype. hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
411
430
__setModuleDefault(result, mod);
412
431
return result;
413
432
};
0 commit comments