From a19e51d6323cb79a52dfdac36fed9b935374db47 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Mon, 18 Apr 2016 21:59:20 -0700 Subject: [PATCH] Revert "Support combining multiple small directories into one compilation unit but don't turn it on yet." This reverts commit 82cf0c594fa5b89e67e4ed60b2b0b61b41970ce3. --- Makefile | 21 +++++++++++---------- tools/globalize.js | 12 +++++------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 68f453977..e8b3e4879 100644 --- a/Makefile +++ b/Makefile @@ -35,15 +35,16 @@ distBranch := $(call pkg,meta.distBranch) awsBucket := $(call pkg,meta.awsBucket) version = $(shell node -p "JSON.parse(require('fs').readFileSync('version.json')).version") +capitalized = $(filter-out a,$(foreach x,$1,$(subst a $(x),,$(sort a $(x))))) + parts := \ - globals config css platform classes Archive Filtering General Images Linkification Menu Miscellaneous Monitoring Posting Quotelinks main + globals config css platform classes \ + $(sort $(call capitalized, \ + $(subst src/,,$(wildcard src/*)) \ + )) \ + main -lang = $(if $(filter globals css,$(subst -, ,$1)),js,coffee) - -map = \ - $(foreach x, \ - $(subst -, ,$2) \ - ,$(call $1,$(x))) +lang = $(if $(filter globals css,$1),js,coffee) # remove extension when sorting so X.coffee comes before X.Y.coffee sources_lang = \ @@ -126,8 +127,8 @@ tmp/declaration.js : .events/declare $(if $(wildcard $@),,node tools/declare.js && echo -> $^) define concatenate -tmp/$1.jst : $$(call map,sources,$1) $(cat_deps) | tmp - $(cat) $$(subst $$$$,$$(ESC_DOLLAR),$$(call map,sources,$1)) $$@ +tmp/$1.jst : $$(call sources,$1) $(cat_deps) | tmp + $(cat) $$(subst $$$$,$$(ESC_DOLLAR),$$(call sources,$1)) $$@ endef $(foreach p, \ @@ -136,7 +137,7 @@ $(foreach p, \ ) define interpolate -tmp/$1.$$(call lang,$1) : tmp/$1.jst $$(call map,imports,$1) $(template_deps) +tmp/$1.$$(call lang,$1) : tmp/$1.jst $$(call imports,$1) $(template_deps) $(template) $$< $$@ endef diff --git a/tools/globalize.js b/tools/globalize.js index 781664854..566835576 100644 --- a/tools/globalize.js +++ b/tools/globalize.js @@ -1,18 +1,16 @@ var fs = require('fs'); var filename = `tmp/${process.argv[2]}.js`; +var basename = process.argv[2].split('_')[0]; // e.g. template_crx -> template +var sources = fs.readdirSync(`src/${basename}`); // Extract variables to be made global from source file list // e.g. ImageExpand from src/Images/ImageExpand.coffee // but not QR.post or eventPage var names = []; -for (var word of process.argv[2].split('-')) { - var base = word.split('_')[0]; // e.g. template_crx -> template - var sources = fs.readdirSync(`src/${base}`); - for (var f of sources) { - var m = f.match(/^([$A-Z][$\w]*)\.coffee$/); - if (m) names.push(m[1]); - } +for (var f of sources) { + var m = f.match(/^([$A-Z][$\w]*)\.coffee$/); + if (m) names.push(m[1]); } var script = fs.readFileSync(filename, 'utf8').replace(/\r\n/g, '\n');