From 8d94032167889878423164c232d71fea43028aa9 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 12 Jul 2016 02:06:51 +0100 Subject: [PATCH 1/3] Download soljson.js as part of `npm run build` --- .travis.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2be23f4d9e..be10e2d3c5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ env: - COMMIT_AUTHOR_EMAIL="chris@ethereum.org" - COMMIT_AUTHOR="Travis CI" - PUSH_REPO="git@github.com:ethereum/browser-solidity.git" - - FILES_TO_PACKAGE="assets background.js build icon.png index.html manifest.json README.md" + - FILES_TO_PACKAGE="assets background.js build icon.png index.html manifest.json README.md soljson.js" cache: directories: - node_modules diff --git a/package.json b/package.json index ba78ffe8c9..fc6ad14073 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "browser-test-remote-ie": "nightwatch --config nightwatch.js --env ie", "browser-test-remote-chrome": "nightwatch --config nightwatch.js --env chrome", "browser-test-remote-safari": "nightwatch --config nightwatch.js --env safari", - "build": "mkdir -p build; browserify src/index.js -g yo-yoify -o build/app.js", + "build": "mkdir -p build; rm soljson.js; wget https://ethereum.github.io/solc-bin/soljson.js; browserify src/index.js -g yo-yoify -o build/app.js", "lint": "semistandard", "serve": "http-server ." }, From 29ed1bd3dd75996e92a50f231787811defd8a15d Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 12 Jul 2016 02:11:01 +0100 Subject: [PATCH 2/3] Load the local soljson.js if the list (soljsonSources) isn't present --- src/app.js | 24 +++++++++++++++++------- src/app/compiler.js | 7 ++++++- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/app.js b/src/app.js index 3a2b613075..ec0adc90b5 100644 --- a/src/app.js +++ b/src/app.js @@ -330,12 +330,18 @@ var run = function () { // var soljsonSources is provided by bin/list.js $('option', '#versionSelector').remove(); - $.each(soljsonSources, function (i, file) { - if (file) { - var version = file.replace(/soljson-(.*).js/, '$1'); - $('#versionSelector').append(new Option(version, file)); - } - }); + if (window.soljsonSources !== undefined) { + $.each(soljsonSources, function (i, file) { + if (file) { + var version = file.replace(/soljson-(.*).js/, '$1'); + $('#versionSelector').append(new Option(version, file)); + } + }); + } + + // always include the local version + $('#versionSelector').append(new Option('latest local version', 'soljson.js')); + $('#versionSelector').change(function () { queryParams.update({ version: $('#versionSelector').val() }); loadVersion($('#versionSelector').val()); @@ -452,7 +458,11 @@ var run = function () { } }; - loadVersion(queryParams.get().version || 'soljson-latest.js'); + if (window.soljsonSources !== undefined) { + loadVersion(queryParams.get().version || 'soljson-latest.js'); + } else { + loadVersion('soljson.js'); + } document.querySelector('#optimize').addEventListener('change', function () { queryParams.update({ optimize: document.querySelector('#optimize').checked }); diff --git a/src/app/compiler.js b/src/app/compiler.js index c3de62713c..80024e9b6f 100644 --- a/src/app/compiler.js +++ b/src/app/compiler.js @@ -118,7 +118,12 @@ function Compiler (editor, renderer, queryParams, handleGithubCall, outputField, } this.loadVersion = function (usingWorker, version, setVersionText) { - var url = 'https://ethereum.github.io/solc-bin/bin/' + version; + var url; + if (version !== 'soljson.js') { + url = 'https://ethereum.github.io/solc-bin/bin/' + version; + } else { + url = 'soljson.js'; + } console.log('Loading ' + url + ' ' + (usingWorker ? 'with worker' : 'without worker')); if (usingWorker) { From 3f62855030a065defb093e96c634061709208a3c Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Thu, 14 Jul 2016 16:45:45 +0100 Subject: [PATCH 3/3] Move download to `npm run downloadsolc` --- .travis.yml | 2 +- package.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index be10e2d3c5..1e86dfc1c8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: node_js node_js: - stable script: - - npm run lint && npm run test && npm run build + - npm run lint && npm run test && npm run downloadsolc && npm run build - ./ci/browser_tests.sh deploy: provider: script diff --git a/package.json b/package.json index fc6ad14073..a1a9522fd0 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "browser-test-remote-ie": "nightwatch --config nightwatch.js --env ie", "browser-test-remote-chrome": "nightwatch --config nightwatch.js --env chrome", "browser-test-remote-safari": "nightwatch --config nightwatch.js --env safari", - "build": "mkdir -p build; rm soljson.js; wget https://ethereum.github.io/solc-bin/soljson.js; browserify src/index.js -g yo-yoify -o build/app.js", + "build": "mkdir -p build; browserify src/index.js -g yo-yoify -o build/app.js", + "downloadsolc": "rm soljson.js; wget https://ethereum.github.io/solc-bin/soljson.js", "lint": "semistandard", "serve": "http-server ." },