Permalink
Browse files

Safer build: copy src/node to build/node.

Add traceur-build that runs out of build/ and thus uses build/node/*.js.
Copy current src/node to build/node-save, restore last-good src/node,
copy to build/node, restore src/node. This reduces ways that src/node
changes can be lost by build shenanigans.

TBR=johnjbarton

Review URL: #607

Closes #607.
  • Loading branch information...
1 parent 077812c commit 64befb496ce5af6363df262c75b242de885fc7a3 @johnjbarton johnjbarton committed Dec 28, 2013
Showing with 21 additions and 20 deletions.
  1. +15 −17 Makefile
  2. +3 −3 build/makedep.js
  3. +3 −0 traceur-build
View
@@ -57,8 +57,8 @@ ugly: bin/traceur.ugly.js
test-runtime: bin/traceur-runtime.js $(RUNTIME_TESTS)
@echo 'Open test/runtime.html to test runtime only'
-test: test/test-list.js bin/traceur.js bin/traceur-runtime.js \
- wiki test/amd-compiled test/commonjs-compiled $(COMPILE_BEFORE_TEST)
+test: test/test-list.js bin/traceur.js $(COMPILE_BEFORE_TEST) bin/traceur-runtime.js \
+ wiki test/amd-compiled test/commonjs-compiled
node_modules/.bin/mocha $(MOCHA_OPTIONS) $(TESTS)
test/unit: bin/traceur.js bin/traceur-runtime.js
@@ -92,6 +92,7 @@ boot: clean build
clean: wikiclean
@rm -f build/compiled-by-previous-traceur.js
+ @rm -f build/previous-commit-traceur.js
@rm -f build/dep.mk
@rm -f $(GENSRC) $(TPL_GENSRC_DEPS)
@rm -f $(COMPILE_BEFORE_TEST)
@@ -100,7 +101,6 @@ clean: wikiclean
@rm -rf test/amd-compiled/*
@rm -f bin/*
@git checkout -- bin/
- @mv bin/traceur.js build/previous-commit-traceur.js
initbench:
rm -rf test/bench/esprima
@@ -123,19 +123,21 @@ concat: bin/traceur-runtime.js bin/traceur-bare.js
bin/traceur.js: build/compiled-by-previous-traceur.js
@cp $< $@; touch -t 197001010000.00 bin/traceur.js
./traceur --out bin/traceur.js $(TFLAGS) $(SRC)
+ @rm -rf build/node
# Use last-known-good compiler to compile current source
build/compiled-by-previous-traceur.js: build/previous-commit-traceur.js $(SRC) | $(GENSRC) node_modules
@cp build/previous-commit-traceur.js bin/traceur.js
- mkdir -p build/node
- cp src/node/* build/node # Save in case of src diffs.
- git checkout -- src/node # Over-write with last-good node compiler front.
node build/makedep.js --depTarget build/compiled-by-previous-traceur.js $(TFLAGS) $(SRC) > build/dep.mk
- ./traceur --debug --out $@ $(TFLAGS) $(SRC) # Build with last-good node compiler front.
- mv build/node/* src/node # Restore possible src diffs.
- rmdir build/node # Clean up.
+ ./traceur-build --debug --out $@ $(TFLAGS) $(SRC) # Build with last-good node compiler front.
build/previous-commit-traceur.js:
+ mkdir -p build/node-save build/node
+ cp src/node/* build/node-save # Save in case of src diffs.
+ git checkout -- src/node # Over-write with last-good node compiler front.
+ cp src/node/* build/node # Store for traceur-build
+ mv build/node-save/* src/node # restore
+ rmdir build/node-save
mv bin/traceur.js build/traceur.js
git checkout -- bin/traceur.js
mv bin/traceur.js build/previous-commit-traceur.js
@@ -144,15 +146,11 @@ build/previous-commit-traceur.js:
debug: build/compiled-by-previous-traceur.js $(SRC)
./traceur --debug --out bin/traceur.js --sourcemap $(TFLAGS) $(SRC)
-self: force
- mkdir -p build/node
- cp src/node/* build/node # Save in case of src diffs.
- git checkout -- src/node # Over-write with last-good node compiler front.
- -make debug # Build with last-good node compiler front.
- mv build/node/* src/node # Restore possible src diffs.
- rmdir build/node # Clean up.
+self: build/previous-commit-traceur.js force
+ ./traceur-build --debug --out bin/traceur.js $(TFLAGS) $(SRC)
-build/dep.mk: ; # Do not rebuild dep.mk before including it.
+# Do not rebuild dep.mk before including it.
+build/dep.mk: ;
$(TPL_GENSRC_DEPS): | node_modules
View
@@ -24,7 +24,7 @@
var fs = require('fs');
var path = require('path');
-var normalizePath = require('../src/node/file-util.js').normalizePath;
+var normalizePath = require('../build/node/file-util.js').normalizePath;
var flags;
var cmdName = path.basename(process.argv[1]);
@@ -37,7 +37,7 @@ try {
}
flags.setMaxListeners(100);
-var traceur = require('../src/node/traceur.js');
+var traceur = require('../build/node/traceur.js');
flags.option('--depTarget <FILE>', 'path to the dependency target');
@@ -64,7 +64,7 @@ var resolvedIncludes = includes.map(function(include) {
var reporter = new ErrorReporter();
-var inlineAndCompile = require('../src/node/inline-module.js').inlineAndCompile;
+var inlineAndCompile = require('../build/node/inline-module.js').inlineAndCompile;
inlineAndCompile(resolvedIncludes, flags, reporter, function(tree) {
process.exit(0);
View
@@ -0,0 +1,3 @@
+#!/usr/bin/env node
+
+require('./build/node/command.js');

0 comments on commit 64befb4

Please sign in to comment.