Merge pull request #11 from Osspial/windows-uninstall-default-stable
Remove default stable install on Windows
This commit is contained in:
commit
a6bcfcc41f
@ -35,6 +35,27 @@ function install() {
|
|||||||
// to leverage newer features like "latest latest compatible nightly"
|
// to leverage newer features like "latest latest compatible nightly"
|
||||||
yield exec.exec('rustup', ['self', 'update']);
|
yield exec.exec('rustup', ['self', 'update']);
|
||||||
yield exec.exec('rustup', ['set', 'profile', 'minimal']);
|
yield exec.exec('rustup', ['set', 'profile', 'minimal']);
|
||||||
|
if (os.platform() == 'win32') {
|
||||||
|
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("\\");
|
||||||
|
let defaultClearedFilePath = `${rustupPath}\\default_cleared`;
|
||||||
|
if (!fs_1.existsSync(defaultClearedFilePath)) {
|
||||||
|
// 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.
|
||||||
|
fs_1.renameSync(`${rustupPath}\\toolchains`, `${rustupPath}\\_toolchains`);
|
||||||
|
fs_1.appendFileSync(defaultClearedFilePath, '');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
6
package-lock.json
generated
6
package-lock.json
generated
@ -633,9 +633,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "12.6.9",
|
"version": "12.12.14",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.6.9.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.14.tgz",
|
||||||
"integrity": "sha512-+YB9FtyxXGyD54p8rXwWaN1EWEyar5L58GlGWgtH2I9rGmLGBQcw63+0jw+ujqVavNuO47S1ByAjm9zdHMnskw==",
|
"integrity": "sha512-u/SJDyXwuihpwjXy7hOOghagLEV1KdAST6syfnOk6QZAMzZuWZqXy5aYYZbh8Jdpd4escVFP0MvftHNDb9pruA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/semver": {
|
"@types/semver": {
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^24.0.13",
|
"@types/jest": "^24.0.13",
|
||||||
"@types/node": "^12.0.4",
|
"@types/node": "^12.12.14",
|
||||||
"@types/semver": "^6.0.0",
|
"@types/semver": "^6.0.0",
|
||||||
"jest": "^24.8.0",
|
"jest": "^24.8.0",
|
||||||
"jest-circus": "^24.7.1",
|
"jest-circus": "^24.7.1",
|
||||||
|
@ -3,7 +3,7 @@ import * as exec from '@actions/exec';
|
|||||||
import * as toolCache from '@actions/tool-cache';
|
import * as toolCache from '@actions/tool-cache';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import {chmodSync} from 'fs';
|
import {chmodSync, renameSync, existsSync, appendFileSync} from 'fs';
|
||||||
|
|
||||||
let tempDirectory = process.env['RUNNER_TEMPDIRECTORY'] || '';
|
let tempDirectory = process.env['RUNNER_TEMPDIRECTORY'] || '';
|
||||||
|
|
||||||
@ -20,6 +20,29 @@ export async function install() {
|
|||||||
await exec.exec('rustup', ['self', 'update']);
|
await exec.exec('rustup', ['self', 'update']);
|
||||||
|
|
||||||
await exec.exec('rustup', ['set', 'profile', 'minimal']);
|
await exec.exec('rustup', ['set', 'profile', 'minimal']);
|
||||||
|
|
||||||
|
if (os.platform() == 'win32') {
|
||||||
|
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("\\");
|
||||||
|
let defaultClearedFilePath = `${rustupPath}\\default_cleared`;
|
||||||
|
|
||||||
|
if (!existsSync(defaultClearedFilePath)) {
|
||||||
|
// 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.
|
||||||
|
renameSync(`${rustupPath}\\toolchains`, `${rustupPath}\\_toolchains`);
|
||||||
|
appendFileSync(defaultClearedFilePath, '');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user