Try something really dirty

This commit is contained in:
Osspial 2019-12-04 01:01:39 -05:00
parent 95a77582bb
commit 69d806023a
7 changed files with 79 additions and 17 deletions

View File

@ -1,10 +1,9 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};

View File

@ -1,10 +1,9 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
@ -22,7 +21,9 @@ const toolCache = __importStar(require("@actions/tool-cache"));
const path = __importStar(require("path"));
const os = __importStar(require("os"));
const fs_1 = require("fs");
const util_1 = require("util");
let tempDirectory = process.env['RUNNER_TEMPDIRECTORY'] || '';
const renameAsync = util_1.promisify(fs_1.rename);
function install() {
return __awaiter(this, void 0, void 0, function* () {
// `rustup` is already installed on Linux and Windows platforms
@ -36,9 +37,38 @@ function install() {
// to leverage newer features like "latest latest compatible nightly"
yield exec.exec('rustup', ['self', 'update']);
yield exec.exec('rustup', ['set', 'profile', 'minimal']);
// Github's default Windows install comes with rustup pre-installed with stable, including
// rust-docs. This removes the default stable install so that it doesn't update rust-docs.
yield exec.exec('rustup', ['toolchain', 'uninstall', 'stable']);
if (os.platform() == 'win32') {
let rustDocsInstalled = false;
{
let installedComponents = '';
const options = {
listeners: {
stdout: (data) => {
installedComponents += data.toString();
}
}
};
yield exec.exec('rustup', ['component', 'list'], options);
rustDocsInstalled = installedComponents.match(/rust-docs.+\(installed\)/) != null;
}
if (rustDocsInstalled) {
let cargoPath = '';
{
const options = {
listeners: {
stdout: (data) => {
cargoPath += data.toString();
}
}
};
yield exec.exec('where', ['rustup.exe'], options);
}
let rustupPath = cargoPath.split('\\').slice(0, -3).concat([".rustup"]).join("\\");
// Github's default Windows install comes with rustup pre-installed with stable, including
// rust-docs. This removes the default stable install so that it doesn't update rust-docs.
yield renameAsync(`${rustupPath}\\toolchains`, `${rustupPath}\\_toolchains`);
}
}
}
});
}

2
node_modules/.bin/uuid generated vendored
View File

@ -1 +1 @@
../uuid/bin/uuid
../uuid/bin/uuid

2
node_modules/.bin/which generated vendored
View File

@ -1 +1 @@
../which/bin/which
../which/bin/which

6
package-lock.json generated
View File

@ -633,9 +633,9 @@
"dev": true
},
"@types/node": {
"version": "12.6.9",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.6.9.tgz",
"integrity": "sha512-+YB9FtyxXGyD54p8rXwWaN1EWEyar5L58GlGWgtH2I9rGmLGBQcw63+0jw+ujqVavNuO47S1ByAjm9zdHMnskw==",
"version": "12.12.14",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.14.tgz",
"integrity": "sha512-u/SJDyXwuihpwjXy7hOOghagLEV1KdAST6syfnOk6QZAMzZuWZqXy5aYYZbh8Jdpd4escVFP0MvftHNDb9pruA==",
"dev": true
},
"@types/semver": {

View File

@ -30,7 +30,7 @@
},
"devDependencies": {
"@types/jest": "^24.0.13",
"@types/node": "^12.0.4",
"@types/node": "^12.12.14",
"@types/semver": "^6.0.0",
"jest": "^24.8.0",
"jest-circus": "^24.7.1",

View File

@ -3,9 +3,11 @@ import * as exec from '@actions/exec';
import * as toolCache from '@actions/tool-cache';
import * as path from 'path';
import * as os from 'os';
import {chmodSync} from 'fs';
import {chmodSync, rename} from 'fs';
import {promisify} from 'util';
let tempDirectory = process.env['RUNNER_TEMPDIRECTORY'] || '';
const renameAsync = promisify(rename);
export async function install() {
// `rustup` is already installed on Linux and Windows platforms
@ -20,9 +22,40 @@ export async function install() {
await exec.exec('rustup', ['self', 'update']);
await exec.exec('rustup', ['set', 'profile', 'minimal']);
// Github's default Windows install comes with rustup pre-installed with stable, including
// rust-docs. This removes the default stable install so that it doesn't update rust-docs.
await exec.exec('rustup', ['toolchain', 'uninstall', 'stable']);
if (os.platform() == 'win32') {
let rustDocsInstalled = false;
{
let installedComponents = '';
const options = {
listeners: {
stdout: (data: Buffer) => {
installedComponents += data.toString();
}
}
};
await exec.exec('rustup', ['component', 'list'], options);
rustDocsInstalled = installedComponents.match(/rust-docs.+\(installed\)/) != null;
}
if (rustDocsInstalled) {
let cargoPath = '';
{
const options = {
listeners: {
stdout: (data: Buffer) => {
cargoPath += data.toString();
}
}
};
await exec.exec('where', ['rustup.exe'], options);
}
let rustupPath = cargoPath.split('\\').slice(0, -3).concat([".rustup"]).join("\\");
// Github's default Windows install comes with rustup pre-installed with stable, including
// rust-docs. This removes the default stable install so that it doesn't update rust-docs.
await renameAsync(`${rustupPath}\\toolchains`, `${rustupPath}\\_toolchains`);
}
}
}
}