Skip to content

Commit

Permalink
Merge pull request #156 from ethereum/symlink-bin-soljson-latest
Browse files Browse the repository at this point in the history
Use symlink for bin/soljson-latest.js
  • Loading branch information
clonker committed Sep 17, 2024
2 parents a2346e2 + 7ea1449 commit dc53b95
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 146 deletions.
111 changes: 0 additions & 111 deletions bin/soljson-latest.js

This file was deleted.

1 change: 1 addition & 0 deletions bin/soljson-latest.js
36 changes: 1 addition & 35 deletions update.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
readFileSync,
writeFile,
readdir,
stat,
lstat
} from 'fs'

Expand Down Expand Up @@ -70,33 +69,6 @@ function updateSymlinkSync (linkPathRelativeToRoot, targetRelativeToLink) {
}
}

function updateCopy (srcRelativeToRoot, destRelativeToRoot) {
readFileSync(join(__dirname, srcRelativeToRoot), function (err, data) {
if (err) {
throw err
}

const absoluteDest = join(__dirname, destRelativeToRoot)
stat(absoluteDest, function (err, stats) {
if (err && err.code !== 'ENOENT') {
throw err
}

// If the target is a symlink, we want to replace it with a copy rather than overwrite the file it links to
if (!err && stats.isSymbolicLink()) {
unlinkSync(absoluteDest)
}

writeFile(absoluteDest, data, function (err) {
if (err) {
throw err
}
console.log('Updated ' + destRelativeToRoot)
})
})
})
}

function deleteIfExists (filePathRelativeToRoot) {
const absoluteFilePath = join(__dirname, filePathRelativeToRoot)

Expand Down Expand Up @@ -301,8 +273,6 @@ function processDir (dir, options, listCallback) {
})

// Update 'latest' symlink (except for wasm/ where the link is hard-coded to point at the one in bin/).
// bin/ is a special case because we need to keep a copy rather than a symlink. The reason is that
// some tools (in particular solc-js) have hard-coded github download URLs to it and can't handle symlinks.
if (dir !== '/wasm') {
const releaseExtension = binaryExtensions.find(function (extension) { return latestReleaseFile.endsWith(extension) })

Expand All @@ -312,11 +282,7 @@ function processDir (dir, options, listCallback) {
}
})

if (dir === '/bin') {
updateCopy(join(dir, latestReleaseFile), join(dir, binaryPrefix + '-latest' + releaseExtension))
} else {
updateSymlinkSync(join(dir, binaryPrefix + '-latest' + releaseExtension), latestReleaseFile)
}
updateSymlinkSync(join(dir, binaryPrefix + '-latest' + releaseExtension), latestReleaseFile)
}

// Update 'nightly' symlink in bin/ (we don't have nightlies for other platforms)
Expand Down

0 comments on commit dc53b95

Please sign in to comment.