From b96df79c593e843e2bf3b643b07a307d35b433ba Mon Sep 17 00:00:00 2001 From: emizzle Date: Wed, 13 Jun 2018 23:16:54 +1000 Subject: [PATCH] Finally fixed the solc loading issue. Moved the instantiation of the live-plugin-manager in to the child solc process. This allowed us to use the live-plugin-manager to require the installed solc file. If the module is the same version as used by embark, the module is still loading using the normal require (from node_modules), as before. --- lib/modules/solidity/solcP.js | 2 +- lib/modules/solidity/solcW.js | 2 ++ lib/versions/library_manager.js | 2 +- package-lock.json | 25 +++++++------------------ 4 files changed, 11 insertions(+), 20 deletions(-) diff --git a/lib/modules/solidity/solcP.js b/lib/modules/solidity/solcP.js index 060c9ae1..07ee017e 100644 --- a/lib/modules/solidity/solcP.js +++ b/lib/modules/solidity/solcP.js @@ -68,7 +68,7 @@ let solcProcess; process.on('message', (msg) => { if (msg.action === "init") { solcProcess = new SolcProcess(msg.options); - return process.send({result: "initiated"}); + return this.send({result: "initiated"}); } else if (msg.action === 'loadCompiler') { diff --git a/lib/modules/solidity/solcW.js b/lib/modules/solidity/solcW.js index bc5df52e..e180844d 100644 --- a/lib/modules/solidity/solcW.js +++ b/lib/modules/solidity/solcW.js @@ -62,6 +62,8 @@ class SolcW { }); this.solcProcess.send({action: "init", options: {logger: self.logger}}); + this.solcProcess.send({action: "init", options: {}}); + if (this.ipc.isServer()) { this.ipc.on('compile', self.compile.bind(this)); } diff --git a/lib/versions/library_manager.js b/lib/versions/library_manager.js index b5cc3d8a..d65d5e26 100644 --- a/lib/versions/library_manager.js +++ b/lib/versions/library_manager.js @@ -64,8 +64,8 @@ class LibraryManager { } listenToCommandsToGetLibrary() { - let npm = new Npm({logger: this.embark.logger}); this.embark.events.setCommandHandler('version:getPackageLocation', (libName, version, cb) => { + let npm = new Npm({logger: this.embark.logger, packageName: libName, version:version}); npm.getPackageVersion(libName, version, cb); }); this.embark.events.setCommandHandler('version:getPackagePath', (libName, version, cb) => { diff --git a/package-lock.json b/package-lock.json index 6a239f2b..a7633e66 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,6 +40,7 @@ "samsam": "1.3.0" } }, +<<<<<<< develop "@types/debug": { "version": "0.0.30", "resolved": "https://registry.npmjs.org/@types/debug/-/debug-0.0.30.tgz", @@ -107,6 +108,8 @@ "resolved": "https://registry.npmjs.org/@types/url-join/-/url-join-0.8.2.tgz", "integrity": "sha1-EYHsvh2XtwNODqHjXmLobMJrQi0=" }, +======= +>>>>>>> Finally fixed the solc loading issue. "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -4609,6 +4612,7 @@ "version": "1.2.5", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.5.tgz", "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", + "optional": true, "requires": { "minipass": "2.3.3" } @@ -7483,6 +7487,7 @@ } } }, +<<<<<<< develop "live-plugin-manager-git-fix": { <<<<<<< refs/remotes/origin/bug_fix/solc-loading-issue <<<<<<< refs/remotes/origin/bug_fix/solc-loading-issue @@ -7563,6 +7568,8 @@ } } }, +======= +>>>>>>> Finally fixed the solc loading issue. "load-json-file": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", @@ -7605,14 +7612,6 @@ "path-exists": "3.0.0" } }, - "lockfile": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/lockfile/-/lockfile-1.0.4.tgz", - "integrity": "sha512-cvbTwETRfsFh4nHsL1eGWapU1XFi5Ot9E85sWAwia7Y7EgB7vfqcZhTKZ+l7hCGxSPoushMv5GKhT5PdLv03WA==", - "requires": { - "signal-exit": "3.0.2" - } - }, "lodash": { "version": "4.17.10", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", @@ -12640,11 +12639,6 @@ "resolved": "https://registry.npmjs.org/uniqs/-/uniqs-2.0.0.tgz", "integrity": "sha1-/+3ks2slKQaW5uFl1KWe25mOawI=" }, - "universalify": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz", - "integrity": "sha1-+nG63UQ3r0wUiEHjs7Fl+enlkLc=" - }, "unorm": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/unorm/-/unorm-1.4.1.tgz", @@ -12736,11 +12730,6 @@ } } }, - "url-join": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.0.tgz", - "integrity": "sha1-TTNA6AfTdzvamZH4MFrNzCpmXSo=" - }, "url-loader": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/url-loader/-/url-loader-0.6.2.tgz",