1
0
Fork 0

Added mkexterns for internal externs (see comments within file for information as to why this is necessary)

perfodd
Mike Gerwitz 2011-12-10 16:45:10 -05:00
parent d1b1d2691a
commit 3922d6874e
2 changed files with 33 additions and 4 deletions

View File

@ -19,7 +19,7 @@ path_doc := ./doc
combine := $(path_tools)/combine combine := $(path_tools)/combine
compiler := $(path_tools)/compiler.jar compiler := $(path_tools)/compiler.jar
path_externs_internal := $(path_build)/externs-internal.js
.PHONY: combine min doc test test-combine clean distclean .PHONY: combine min doc test test-combine clean distclean
@ -56,17 +56,23 @@ perf: default $(perf_tests)
perf-%.js: default perf-%.js: default
@node $@ @node $@
# minificatino process uses Google Closure compiler # externs for compilation process
$(path_externs_internal): | mkbuild
$(path_tools)/mkexterns > $@
# minification process uses Google Closure compiler
min: build/ease.min.js build/ease-full.min.js $(path_build)/browser-test-min.html \ min: build/ease.min.js build/ease-full.min.js $(path_build)/browser-test-min.html \
$(path_tools)/externs-global.js | combine | combine
$(compiler): $(compiler):
wget -O- http://closure-compiler.googlecode.com/files/compiler-latest.tar.gz \ wget -O- http://closure-compiler.googlecode.com/files/compiler-latest.tar.gz \
| tar -C $(path_tools) -xzv compiler.jar | tar -C $(path_tools) -xzv compiler.jar
build/%.min.js: build/%.js $(compiler) build/%.min.js: build/%.js $(path_tools)/externs-global.js $(path_externs_internal) \
$(compiler)
cat $(path_tools)/license.tpl > $@ cat $(path_tools)/license.tpl > $@
java -jar $(compiler) \ java -jar $(compiler) \
--warning_level VERBOSE \ --warning_level VERBOSE \
--externs $(path_tools)/externs-global.js \ --externs $(path_tools)/externs-global.js \
--externs $(path_build)/externs-internal.js \
--js $< >> $@ || rm $@ --js $< >> $@ || rm $@
install: doc-info install: doc-info

23
tools/mkexterns 100755
View File

@ -0,0 +1,23 @@
#!/bin/bash
#
# Because this project consists of a bunch of CommonJS modules, the constructors
# have restricted scope. This means that they cannot be used as types in other
# modules. Therefore, to permit this, we must generate an extern file containing
# basic definitions of each.
#
# This is used only for compilation and is otherwise completely unnecessary. As
# such, to reduce maintenance overhead, the creation of this file is automated.
# #
# all CamelCase modules are likely to be ctors
modules=$( ls lib/ \
| sed 's/lib\/\|\.js//' \
| grep -vP '^[a-z]'
)
# simple definition for now (we'll worry about members later)
for module in $modules; do
echo "/** @constructor */"
echo "function $module() {};"
echo
done