Merge pull request #123 from ethereum/self-contained

Self contained Travis build - work without Internet connection
pull/1/head
chriseth 8 years ago committed by GitHub
commit c9f60da623
  1. 4
      .travis.yml
  2. 1
      package.json
  3. 24
      src/app.js
  4. 7
      src/app/compiler.js

@ -2,7 +2,7 @@ language: node_js
node_js: node_js:
- stable - stable
script: 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 - ./ci/browser_tests.sh
deploy: deploy:
provider: script provider: script
@ -16,7 +16,7 @@ env:
- COMMIT_AUTHOR_EMAIL="chris@ethereum.org" - COMMIT_AUTHOR_EMAIL="chris@ethereum.org"
- COMMIT_AUTHOR="Travis CI" - COMMIT_AUTHOR="Travis CI"
- PUSH_REPO="git@github.com:ethereum/browser-solidity.git" - 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: cache:
directories: directories:
- node_modules - node_modules

@ -10,6 +10,7 @@
"browser-test-remote-chrome": "nightwatch --config nightwatch.js --env chrome", "browser-test-remote-chrome": "nightwatch --config nightwatch.js --env chrome",
"browser-test-remote-safari": "nightwatch --config nightwatch.js --env safari", "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; 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", "lint": "semistandard",
"serve": "http-server ." "serve": "http-server ."
}, },

@ -330,12 +330,18 @@ var run = function () {
// var soljsonSources is provided by bin/list.js // var soljsonSources is provided by bin/list.js
$('option', '#versionSelector').remove(); $('option', '#versionSelector').remove();
$.each(soljsonSources, function (i, file) { if (window.soljsonSources !== undefined) {
if (file) { $.each(soljsonSources, function (i, file) {
var version = file.replace(/soljson-(.*).js/, '$1'); if (file) {
$('#versionSelector').append(new Option(version, 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 () { $('#versionSelector').change(function () {
queryParams.update({ version: $('#versionSelector').val() }); queryParams.update({ version: $('#versionSelector').val() });
loadVersion($('#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 () { document.querySelector('#optimize').addEventListener('change', function () {
queryParams.update({ optimize: document.querySelector('#optimize').checked }); queryParams.update({ optimize: document.querySelector('#optimize').checked });

@ -118,7 +118,12 @@ function Compiler (editor, renderer, queryParams, handleGithubCall, outputField,
} }
this.loadVersion = function (usingWorker, version, setVersionText) { 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')); console.log('Loading ' + url + ' ' + (usingWorker ? 'with worker' : 'without worker'));
if (usingWorker) { if (usingWorker) {

Loading…
Cancel
Save