Skip to content

Commit

Permalink
fix graaljs
Browse files Browse the repository at this point in the history
  • Loading branch information
devsnek committed Jun 20, 2022
1 parent bd523e5 commit d6fc0d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/engines/graaljs.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,15 @@ class GraalJSInstaller extends Installer {
async install() {
const root = `graalvm-ce-java11-${this.version}`;
if (platform === 'darwin-x64') {
await this.registerAsset(`${root}/Contents/Home/languages/js/graaljs.jar`);

This comment has been minimized.

Copy link
@iamstolis

iamstolis Jul 7, 2022

Contributor

Why did you add graaljs.jar? It is not needed. esvu is supposed to install native version of graaljs that has all Java classes compiled in the installed binary.

await this.registerAsset(`${root}/Contents/Home/languages/js/lib/libjsvm.dylib`);
this.binPath = await this.registerBinary(`${root}/Contents/Home/languages/js/bin/js`, 'graaljs');
} else if (platform === 'win32-x64') {
await this.registerAsset(`${root}/languages/js/graaljs.jar`);
await this.registerAsset(`${root}/languages/js/lib/jsvm.dll`);
this.binPath = await this.registerBinary(`${root}/languages/js/bin/js.exe`, 'graaljs.exe');
} else {
await this.registerAsset(`${root}/languages/js/graaljs.jar`);
await this.registerAsset(`${root}/languages/js/lib/libjsvm.so`);
this.binPath = await this.registerBinary(`${root}/languages/js/bin/js`, 'graaljs');
}
Expand Down
7 changes: 6 additions & 1 deletion src/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const fetch = require('node-fetch');
const { ESVU_PATH, ensureDirectory, symlink, platform, rmdir } = require('./common');
const Logger = require('./logger');

const DL_FILE_PREFIX = 'esvu-';

function hash(string) {
const h = crypto.createHash('md5');
h.update(string);
Expand Down Expand Up @@ -67,7 +69,7 @@ class EngineInstaller {
throw new Error(`Got ${r.status}`);
}
const rURL = new URL(r.url);
const l = path.join(os.tmpdir(), hash(url) + path.extname(rURL.pathname));
const l = path.join(os.tmpdir(), DL_FILE_PREFIX + hash(url) + path.extname(rURL.pathname));
const sink = fs.createWriteStream(l);
const progress = logger.progress(+r.headers.get('content-length'));
await new Promise((resolve, reject) => {
Expand Down Expand Up @@ -176,6 +178,9 @@ class EngineInstaller {
}
});
});
if (files.length === 0) {
throw new Error(`No files matched ${pattern}`);
}
await Promise.all(files.map((file) =>
this.registerAsset(path.relative(this.extractedPath, file))));
}
Expand Down

0 comments on commit d6fc0d2

Please sign in to comment.