Skip to content
Permalink
Browse files
Use rtools40 for R >= 4.0
  • Loading branch information
jeroen authored and jimhester committed Apr 19, 2020
1 parent 3168e24 commit 4d14c61abfebd5ac20887e30b0974698f9f04536
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 13 deletions.
@@ -6,8 +6,8 @@ inputs:
description: 'Version range or exact version of an R version to use.'
default: '3.x'
rtools-version:
description: 'Exact version of Rtools to use.'
default: '35'
description: 'Exact version of Rtools to use. Default uses latest suitable
rtools for the given version of R.'
Ncpus:
description: 'Value to set the R option `Ncpus` to.'
default: '1'
@@ -290,8 +290,10 @@ function acquireRWindows(version) {
}
function acquireRtools(version) {
return __awaiter(this, void 0, void 0, function* () {
let fileName = util.format("Rtools%s.exe", version);
const rtools4 = version.charAt(0) == '4';
let fileName = util.format(rtools4 ? "rtools%s-x86_64.exe" : "Rtools%s.exe", version);
let downloadUrl = util.format("http://cloud.r-project.org/bin/windows/Rtools/%s", fileName);
console.log(`Downloading ${downloadUrl}...`);
let downloadPath = null;
try {
downloadPath = yield tc.downloadTool(downloadUrl);
@@ -311,8 +313,14 @@ function acquireRtools(version) {
core.debug(error);
throw `Failed to install Rtools: ${error}`;
}
core.addPath(`C:\\Rtools\\bin`);
core.addPath(`C:\\Rtools\\mingw_64\\bin`);
if (rtools4) {
core.addPath(`C:\\rtools40\\mingw64\\bin`);
core.addPath(`C:\\rtools40\\usr\\bin`);
}
else {
core.addPath(`C:\\Rtools\\bin`);
core.addPath(`C:\\Rtools\\mingw_64\\bin`);
}
});
}
function acquireQpdfWindows() {
@@ -24,8 +24,7 @@ function run() {
core.debug(`started action`);
let version = core.getInput("r-version");
core.debug(`got version ${version}`);
let rtoolsVersion = core.getInput("rtools-version");
core.debug(`got rtools-version ${rtoolsVersion}`);
let rtoolsVersion = core.getInput("rtools-version") || (version.charAt(0) == '3' ? '35' : '40');
yield installer_1.getR(version, rtoolsVersion);
const matchersPath = path.join(__dirname, "..", ".github");
console.log(`##[add-matcher]${path.join(matchersPath, "rcmdcheck.json")}`);
@@ -275,11 +275,13 @@ async function acquireRWindows(version: string): Promise<string> {
}

async function acquireRtools(version: string) {
let fileName: string = util.format("Rtools%s.exe", version);
const rtools4 = version.charAt(0) == '4';
let fileName: string = util.format(rtools4 ? "rtools%s-x86_64.exe" : "Rtools%s.exe", version);
let downloadUrl: string = util.format(
"http://cloud.r-project.org/bin/windows/Rtools/%s",
fileName
);
console.log(`Downloading ${downloadUrl}...`);
let downloadPath: string | null = null;
try {
downloadPath = await tc.downloadTool(downloadUrl);
@@ -300,9 +302,13 @@ async function acquireRtools(version: string) {

throw `Failed to install Rtools: ${error}`;
}

core.addPath(`C:\\Rtools\\bin`);
core.addPath(`C:\\Rtools\\mingw_64\\bin`);
if(rtools4){
core.addPath(`C:\\rtools40\\usr\\bin`);
core.addPath(`C:\\rtools40\\mingw64\\bin`);
} else {
core.addPath(`C:\\Rtools\\bin`);
core.addPath(`C:\\Rtools\\mingw_64\\bin`);
}
}

async function acquireQpdfWindows() {
@@ -7,8 +7,7 @@ async function run() {
core.debug(`started action`);
let version = core.getInput("r-version");
core.debug(`got version ${version}`);
let rtoolsVersion = core.getInput("rtools-version");
core.debug(`got rtools-version ${rtoolsVersion}`);
let rtoolsVersion = core.getInput("rtools-version") || (version.charAt(0) == '3' ? '35' : '40');

await getR(version, rtoolsVersion);

1 comment on commit 4d14c61

@lcolladotor
Copy link
Contributor

@lcolladotor lcolladotor commented on 4d14c61 Apr 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this commit @jeroen and Jim! ^^

I tried my own version at https://github.com/lcolladotor/actions/tree/support_win_rtools_40 and https://github.com/lcolladotor/actions/tree/support_win_rtools_40_edit_repo_config but failed :P I detailed this at https://community.rstudio.com/t/compiler-support-fo-c-14-features-on-windows/57284/6.

I don't write JS code, I was just trying to hack my way through it. Looking at your code I can see why I failed. Thanks!!!! ^^

Please sign in to comment.