![Michael Zhou](/assets/img/avatar_default.png)
The closure-compiler jar now incudes its Java dependencies. closure-compiler-externs no longer publishes a sources jar. Change parse_graph() in Documentation/gen_licenses.py to always exclude the edge from //lib/codemirror:js to //lib/codemirror:js_minifier. Change-Id: I6a9160ffdb02347202a2b64c226f00c13cc0e19c
148 lines
3.6 KiB
Python
148 lines
3.6 KiB
Python
include_defs('//lib/maven.defs')
|
|
include_defs('//lib/codemirror/cm.defs')
|
|
include_defs('//lib/codemirror/closure.defs')
|
|
|
|
REPO = MAVEN_CENTRAL
|
|
VERSION = '5.8'
|
|
SHA1 = '1cbe267adf1da9659dae49253305649dae2391e9'
|
|
|
|
if REPO == MAVEN_CENTRAL:
|
|
URL = REPO + 'org/webjars/codemirror/%s/codemirror-%s.jar' % (VERSION, VERSION)
|
|
TOP = 'META-INF/resources/webjars/codemirror/%s' % VERSION
|
|
ZIP = 'codemirror-%s.jar' % VERSION
|
|
else:
|
|
URL = REPO + 'net/codemirror/codemirror-%s.zip' % VERSION
|
|
TOP = 'codemirror-%s' % VERSION
|
|
ZIP = 'codemirror-%s.zip' % VERSION
|
|
|
|
|
|
CLOSURE_VERSION = 'v20151216'
|
|
|
|
CLOSURE_COMPILER_ARGS = [
|
|
'--compilation_level SIMPLE_OPTIMIZATIONS',
|
|
'--warning_level QUIET'
|
|
]
|
|
|
|
genrule(
|
|
name = 'css',
|
|
cmd = ';'.join([
|
|
"echo '/** @license' >$OUT",
|
|
'unzip -p $(location :zip) %s/LICENSE >>$OUT' % TOP,
|
|
"echo '*/' >>$OUT",
|
|
] +
|
|
['unzip -p $(location :zip) %s/%s >>$OUT' % (TOP, n)
|
|
for n in CM_CSS]
|
|
),
|
|
out = 'cm.css',
|
|
)
|
|
|
|
for n in CM_THEMES:
|
|
genrule(
|
|
name = 'theme_%s' % n,
|
|
cmd = ';'.join([
|
|
"echo '/** @license' >$OUT",
|
|
'unzip -p $(location :zip) %s/LICENSE >>$OUT' % TOP,
|
|
"echo '*/' >>$OUT",
|
|
'unzip -p $(location :zip) %s/theme/%s.css >>$OUT' % (TOP, n)
|
|
]
|
|
),
|
|
out = 'theme_%s.css' % n,
|
|
)
|
|
|
|
genrule(
|
|
name = 'cm-verbose',
|
|
cmd = ';'.join([
|
|
"echo '/** @license' >$OUT",
|
|
'unzip -p $(location :zip) %s/LICENSE >>$OUT' % TOP,
|
|
"echo '*/' >>$OUT",
|
|
] +
|
|
['unzip -p $(location :zip) %s/%s >>$OUT' % (TOP, n) for n in CM_JS] +
|
|
['unzip -p $(location :zip) %s/addon/%s >>$OUT' % (TOP, n)
|
|
for n in CM_ADDONS]
|
|
),
|
|
out = 'cm-verbose.js',
|
|
)
|
|
|
|
js_minify(
|
|
name = 'js',
|
|
generated = [':cm-verbose'],
|
|
compiler_args = CLOSURE_COMPILER_ARGS,
|
|
out = 'cm.js'
|
|
)
|
|
|
|
for n in CM_MODES:
|
|
genrule (
|
|
name = 'mode_%s_src' % n,
|
|
cmd = ';'.join([
|
|
"echo '/** @license' >$OUT",
|
|
'unzip -p $(location :zip) %s/LICENSE >>$OUT' % TOP,
|
|
"echo '*/' >>$OUT",
|
|
'unzip -p $(location :zip) %s/mode/%s/%s.js >>$OUT' % (TOP, n, n),
|
|
]),
|
|
out = 'mode_%s_src.js' %n,
|
|
)
|
|
js_minify(
|
|
name = 'mode_%s_js' % n,
|
|
generated = [':mode_%s_src' % n],
|
|
compiler_args = CLOSURE_COMPILER_ARGS,
|
|
out = 'mode_%s.js' % n,
|
|
)
|
|
|
|
prebuilt_jar(
|
|
name = 'codemirror',
|
|
binary_jar = ':jar',
|
|
deps = [
|
|
':jar',
|
|
'//lib:LICENSE-codemirror',
|
|
],
|
|
visibility = ['PUBLIC'],
|
|
)
|
|
|
|
genrule(
|
|
name = 'jar',
|
|
cmd = ';'.join([
|
|
'cd $TMP',
|
|
'mkdir -p net/codemirror/{lib,mode,theme}',
|
|
'cp $(location :css) net/codemirror/lib',
|
|
'cp $(location :js) net/codemirror/lib']
|
|
+ ['cp $(location :mode_%s_js) net/codemirror/mode/%s.js' % (n, n)
|
|
for n in CM_MODES]
|
|
+ ['cp $(location :theme_%s) net/codemirror/theme/%s.css' % (n, n)
|
|
for n in CM_THEMES]
|
|
+ ['zip -qr $OUT net/codemirror/{lib,mode,theme}']),
|
|
out = 'codemirror.jar',
|
|
)
|
|
|
|
genrule(
|
|
name = 'zip',
|
|
cmd = '$(exe //tools:download_file)' +
|
|
' -o $OUT' +
|
|
' -u ' + URL +
|
|
' -v ' + SHA1,
|
|
out = ZIP,
|
|
)
|
|
|
|
java_binary(
|
|
name = 'js_minifier',
|
|
main_class = 'com.google.javascript.jscomp.CommandLineRunner',
|
|
deps = [':compiler-jar']
|
|
)
|
|
|
|
maven_jar(
|
|
name = 'compiler-jar',
|
|
id = 'com.google.javascript:closure-compiler:' + CLOSURE_VERSION,
|
|
sha1 = 'b5cd14a356cd9079791ba10b6d9623ef4ae4df6e',
|
|
license = 'DO_NOT_DISTRIBUTE',
|
|
deps = [':closure-compiler-externs'],
|
|
visibility = [],
|
|
)
|
|
|
|
maven_jar(
|
|
name = 'closure-compiler-externs',
|
|
id = 'com.google.javascript:closure-compiler-externs:' + CLOSURE_VERSION,
|
|
sha1 = 'c2787d9927cb0825e8389e83fd3e1a798aae09cc',
|
|
license = 'Apache2.0',
|
|
visibility = [],
|
|
attach_source = False,
|
|
)
|