Skip to content

Commit

Permalink
Support GraalJS v23+ native standalone binary (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeszekSwirski authored Dec 4, 2024
1 parent 0efaad5 commit 87a1527
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion engines/graaljs/extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ const extract = ({ filePath, binary, alias, os }) => {
case 'linux64': {
const directoryName = fs.readdirSync(tmpPath).find(file => file.startsWith('graaljs'));
const executableName = `${directoryName}/bin/js`;
installer.installBinary({ [executableName]: binary });
installer.installBinary(executableName, { symlink: false });
installer.installLibraryGlob(`${directoryName}/lib/*.so`);
installer.installLibraryGlob(`${directoryName}/modules/*.jar`);
installer.installBinarySymlink({ [executableName]: binary });
break;
}
case 'win64': {
Expand Down
2 changes: 1 addition & 1 deletion engines/graaljs/get-latest-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const getLatestVersion = async () => {
json: true,
});
const data = response.body;
const version = data.tag_name.slice(3); // Strip `vm-` prefix.
const version = data.tag_name.replace(/^(vm-|graal-)/, ''); // Strip prefix.
return version;
};

Expand Down
4 changes: 3 additions & 1 deletion engines/graaljs/predict-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ const predictFileName = (os) => {
const predictUrl = (version, os) => {
const fileName = predictFileName(os);
const ext = os.startsWith('win') ? 'zip' : 'tar.gz';
const url = `https://github.com/oracle/graaljs/releases/download/vm-${version}/graaljs-${version}-${fileName}-amd64.${ext}`;
const majorVersion = parseInt(version.split('.')[0]);
const prefix = majorVersion >= 23 ? 'graal-' : 'vm-';
const url = `https://github.com/oracle/graaljs/releases/download/${prefix}${version}/graaljs-${version}-${fileName}-amd64.${ext}`;
return url;
};

Expand Down

0 comments on commit 87a1527

Please sign in to comment.