Files
gerrit/lib/codemirror/BUCK
David Ostrovsky 3c08d56e23 Upgrade Codemirror to version 5.7
This version added new modes, improvements and bug fixes. One of
interesting new features is "Replace all" command that was added
to search addon and can now be used in inline editor. To invoke
this command from default mode:

  replaceAll:  Shift-Ctrl-R (PC), Shift-Cmd-Alt-F (Mac)

Change-Id: Ie7ed3d6139394424a9d682fdb1dba6003d490ef2
2015-10-16 04:41:02 +00:00

153 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.7'
SHA1 = '839a48a6c8d6b36193832a822911198ccba96bfe'
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 = 'v20141120'
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 = '369618bf5a96f73e32655dc48919c0f97558d3b1',
license = 'Apache2.0',
deps = [
':closure-compiler-externs',
'//lib:args4j',
'//lib:gson',
'//lib:guava',
'//lib:protobuf',
],
visibility = [],
)
maven_jar(
name = 'closure-compiler-externs',
id = 'com.google.javascript:closure-compiler-externs:' + CLOSURE_VERSION,
sha1 = '247eff337e2737de43c8d963aaaef15bd8cda132',
license = 'Apache2.0',
visibility = [],
)