Reduce full build time by combining coffee shell commands.
This commit is contained in:
parent
a19e51d632
commit
44c9fc6f0e
21
Makefile
21
Makefile
@ -149,16 +149,19 @@ $(foreach p, \
|
|||||||
tmp/platform_%.coffee : tmp/platform.jst $(call imports,platform) $(template_deps)
|
tmp/platform_%.coffee : tmp/platform.jst $(call imports,platform) $(template_deps)
|
||||||
$(template) $< $@ type=$*
|
$(template) $< $@ type=$*
|
||||||
|
|
||||||
|
to_compile := $(filter-out globals css platform,$(parts)) platform_crx platform_userscript
|
||||||
|
|
||||||
define compile
|
define compile
|
||||||
tmp/$1.js : tmp/$1.coffee $(coffee_deps) tools/globalize.js
|
tmp/$1.js : tmp/$1.coffee $(coffee_deps) tools/globalize.js
|
||||||
$(coffee) $$<
|
$(RM) $$@
|
||||||
node tools/globalize.js $1
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(foreach p, \
|
$(foreach p, $(to_compile), $(eval $(call compile,$(p))))
|
||||||
$(filter-out globals css platform,$(parts)) platform_crx platform_userscript, \
|
|
||||||
$(eval $(call compile,$(p))) \
|
.events/compile : $(foreach p, $(to_compile), tmp/$(p).js) | .events
|
||||||
)
|
$(coffee) $(subst .js,.coffee,$?)
|
||||||
|
node tools/globalize.js $(subst tmp/,,$(subst .js,,$?))
|
||||||
|
echo -> $@
|
||||||
|
|
||||||
tmp/eventPage.js : src/meta/eventPage.coffee $(coffee_deps) | tmp
|
tmp/eventPage.js : src/meta/eventPage.coffee $(coffee_deps) | tmp
|
||||||
$(coffee) -o tmp src/meta/eventPage.coffee
|
$(coffee) -o tmp src/meta/eventPage.coffee
|
||||||
@ -168,7 +171,7 @@ define rules_channel
|
|||||||
testbuilds/crx$1 :
|
testbuilds/crx$1 :
|
||||||
$$(MKDIR)
|
$$(MKDIR)
|
||||||
|
|
||||||
testbuilds/crx$1/script.js : $(call intermediate,crx) $(cat_deps) | testbuilds/crx$1
|
testbuilds/crx$1/script.js : $(call intermediate,crx) $(cat_deps) | testbuilds/crx$1 .events/compile
|
||||||
$(cat) $(call intermediate,crx) $$@
|
$(cat) $(call intermediate,crx) $$@
|
||||||
|
|
||||||
testbuilds/crx$1/eventPage.js : tmp/eventPage.js | testbuilds/crx$1
|
testbuilds/crx$1/eventPage.js : tmp/eventPage.js | testbuilds/crx$1
|
||||||
@ -194,7 +197,7 @@ testbuilds/$(name)$1.crx : testbuilds/$(name)$1.crx.zip package.json tools/sign.
|
|||||||
testbuilds/$(name)$1.meta.js : src/meta/metadata.js src/meta/icon48.png version.json $(template_deps) | testbuilds
|
testbuilds/$(name)$1.meta.js : src/meta/metadata.js src/meta/icon48.png version.json $(template_deps) | testbuilds
|
||||||
$(template) $$< $$@ type=userscript channel=$1
|
$(template) $$< $$@ type=userscript channel=$1
|
||||||
|
|
||||||
testbuilds/$(name)$1.user.js : testbuilds/$(name)$1.meta.js $(call intermediate,userscript) $(cat_deps)
|
testbuilds/$(name)$1.user.js : testbuilds/$(name)$1.meta.js $(call intermediate,userscript) $(cat_deps) | .events/compile
|
||||||
$(cat) testbuilds/$(name)$1.meta.js $(call intermediate,userscript) $$@
|
$(cat) testbuilds/$(name)$1.meta.js $(call intermediate,userscript) $$@
|
||||||
|
|
||||||
endef
|
endef
|
||||||
@ -218,7 +221,7 @@ index.html : test.html
|
|||||||
tmp/.jshintrc : src/meta/jshint.json tmp/declaration.js tmp/globals.js $(template_deps) | tmp
|
tmp/.jshintrc : src/meta/jshint.json tmp/declaration.js tmp/globals.js $(template_deps) | tmp
|
||||||
$(template) $< $@
|
$(template) $< $@
|
||||||
|
|
||||||
.events/jshint.% : tmp/%.js tmp/.jshintrc node_modules/jshint/package.json | .events
|
.events/jshint.% : tmp/%.js tmp/.jshintrc node_modules/jshint/package.json | .events/compile
|
||||||
$(BIN)jshint $<
|
$(BIN)jshint $<
|
||||||
echo -> $@
|
echo -> $@
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
|
||||||
var filename = `tmp/${process.argv[2]}.js`;
|
for (var arg of process.argv.slice(2)) {
|
||||||
var basename = process.argv[2].split('_')[0]; // e.g. template_crx -> template
|
var filename = `tmp/${arg}.js`;
|
||||||
|
var basename = arg.split('_')[0]; // e.g. template_crx -> template
|
||||||
var sources = fs.readdirSync(`src/${basename}`);
|
var sources = fs.readdirSync(`src/${basename}`);
|
||||||
|
|
||||||
// Extract variables to be made global from source file list
|
// Extract variables to be made global from source file list
|
||||||
@ -36,3 +37,4 @@ if (replaced !== 1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fs.writeFileSync(filename, script);
|
fs.writeFileSync(filename, script);
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user