diff --git a/.travis.yml b/.travis.yml index 2be23f4d9e..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 @@ -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..a1a9522fd0 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "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", + "downloadsolc": "rm soljson.js; wget https://ethereum.github.io/solc-bin/soljson.js", "lint": "semistandard", "serve": "http-server ." }, 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) {