Files
gerrit/lib/codemirror/BUCK
Edwin Kempin 2f5e968b00 Revert "Update CodeMirror to 5.11"
This reverts commit 7c504473b0.

We need to revert this CodeMirror upgrade because it broke displaying
the file diff for certain files as reported by issue 3927 [1].

[1] https://code.google.com/p/gerrit/issues/detail?id=3927

Bug: issue 3927
Change-Id: Id6ee70e3a8e9b5e5e31cde9bddc09106088ff31d
2016-02-19 16:02:56 +01:00

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,
)