Skip to content

Commit

Permalink
build: update mksnapshot for 4-0-x (#13)
Browse files Browse the repository at this point in the history
* build: update mksnapshot for 4-0-x

* Use fs-extra to simplify copying mksnapshot files

This was needed as mksnapshot started to include subfolders as of Electron 4.0.

* Upgrade to 4.0.0
  • Loading branch information
John Kleinschmidt committed May 9, 2019
1 parent ad2f2c0 commit 909e705
Show file tree
Hide file tree
Showing 6 changed files with 406 additions and 408 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Expand Up @@ -7,7 +7,7 @@ jobs:
install-test-linux:
docker:
# specify the version you desire here
- image: circleci/node:9-browsers
- image: circleci/node:10-browsers

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
Expand Down
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

20 changes: 6 additions & 14 deletions mksnapshot.js
@@ -1,23 +1,11 @@
#!/usr/bin/env node

const fs = require('fs')
const fs = require('fs-extra')
const { spawnSync } = require('child_process')
const path = require('path')
const temp = require('temp').track()
const workingDir = temp.mkdirSync('mksnapshot-workdir')

/*
* Copy mksnapshot files to temporary working directory because
* v8_context_snapshot_generator expects to run everything from the same
* directory.
*/
function copyMksnapshotFiles (mksnapshotDir, workingDir) {
const mksnapshotFiles = fs.readdirSync(mksnapshotDir)
mksnapshotFiles.forEach(file => {
fs.copyFileSync(path.join(mksnapshotDir, file), path.join(workingDir, file))
})
}

function getBinaryPath (binary, binaryPath) {
if (process.platform === 'win32') {
return path.join(binaryPath, `${binary}.exe`)
Expand Down Expand Up @@ -58,7 +46,11 @@ if (!mksnapshotArgs.includes('--turbo_instruction_scheduling')) {
}

const mksnapshotDir = path.join(__dirname, 'bin')
copyMksnapshotFiles(mksnapshotDir, workingDir)

// Copy mksnapshot files to temporary working directory because
// v8_context_snapshot_generator expects to run everything from the same
// directory.
fs.copySync(mksnapshotDir, workingDir)

const options = {
cwd: workingDir,
Expand Down

0 comments on commit 909e705

Please sign in to comment.