Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
language: node_js
script: npm run lint && npm run test
31 changes: 31 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"private": true,
"name": "solc-bin",
"version": "0.0.0",
"description": "Current and historical (emscripten) binaries for Solidity",
"dependencies": {
"semver": "^5.3.0"
},
"devDependencies": {
"standard": "^8.4.0"
},
"scripts": {
"lint": "standard update",
"update": "./update",
"test": "git checkout -f && npm run update && git diff"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ethereum/solc-bin.git"
},
"keywords": [
"ethereum",
"solidity"
],
"author": "",
"license": "GPL-3.0",
"bugs": {
"url": "https://github.com/ethereum/solc-bin/issues"
},
"homepage": "https://github.com/ethereum/solc-bin#readme"
}
17 changes: 17 additions & 0 deletions update
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

const fs = require('fs')
const path = require('path')
const semver = require('semver')

// This script updates the index files list.js and list.txt in the bin directory,
// as well as the soljson-latest.js files.
Expand All @@ -13,10 +14,26 @@ fs.readdir(path.join(__dirname, '/bin'), function (err, files) {
throw err
}

function buildVersion (build) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to rebuild it again?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually if we rebuild it with MM.DD we don't even need semver to do the comparison.

var version = build.version
if (build.prerelease && build.prerelease.length > 0) {
version += '-' + build.prerelease
}
if (build.build && build.build.length > 0) {
version += '+' + build.build
}
return version
}

// ascending list (oldest version first)
const parsedList = files
.map(function (file) { return file.match(/^soljson-v([0-9.]*)(-([^+]*))?(\+(.*))?.js$/) })
.filter(function (version) { return version })
.map(function (pars) { return { path: pars[0], version: pars[1], prerelease: pars[3], build: pars[5] } })
.sort(function (a, b) {
// NOTE: a vs. b (the order is important), because we want oldest first in the list
return semver.compare(buildVersion(a), buildVersion(b))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could just use the semver module to also parse the version string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, the only downside having semver is that it must be npm installed before running update.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually semver doesn't seem to return the build part (only versions and prerelease).

})

// descending list
const releases = parsedList
Expand Down