From 77c46373c36d0a0f7ddf5d88064b41985326b578 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 24 Aug 2013 22:39:35 -0400 Subject: [PATCH] compile javascript files with the closure compiler --- .gitignore | 1 + Makefile | 13 +++++++++++++ makedist.sh | 8 +++++++- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index c4c4ffc..731a8fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.zip +*.js.min diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..70ee24a --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +CLOSURE = closure-compiler --language_in ECMASCRIPT5 + +all: + +%.js.min: %.js + $(CLOSURE) $< > $@ + +JS_FILES = $(shell grep '[.]js$$' manifest.files) +js-min: $(JS_FILES:=.min) + +check: js-min + +.PHONY: all clean check js-min diff --git a/makedist.sh b/makedist.sh index 76be818..661f9f7 100755 --- a/makedist.sh +++ b/makedist.sh @@ -30,7 +30,13 @@ while read line ; do [[ ${line} == */* ]] && mkdir -p "${P}/${line%/*}" ln "${line}" "${P}/${line}" done < <(sed 's:#.*::' manifest.files) -cp manifest.json "${P}/" +cp Makefile manifest.files manifest.json "${P}/" + +make -C "${P}" -j js-min +while read line ; do + mv "${line}.min" "${line}" +done < <(find "${P}" -name '*.js') +rm "${P}"/{manifest.files,Makefile} sed -i \ -e '/"version"/s:"[^"]*",:"'${PVR}'",:' \ -- 2.39.5