| include_defs('//lib/maven.defs') |
| include_defs('//lib/codemirror/cm3.defs') |
| include_defs('//lib/codemirror/closure.defs') |
| |
| VERSION = '57e7ed7177' |
| SHA1 = 'd78bc5518707960647d0b8b85d9f1ac011b785d5' |
| URL = GERRIT + 'net/codemirror/codemirror-%s.zip' % VERSION |
| |
| ZIP = 'codemirror-%s.zip' % VERSION |
| TOP = 'codemirror-%s' % VERSION |
| |
| CLOSURE_VERSION = 'v20141120' |
| |
| CLOSURE_COMPILER_ARGS = [ |
| '--compilation_level SIMPLE_OPTIMIZATIONS', |
| '--warning_level QUIET' |
| ] |
| |
| genrule( |
| name = 'css', |
| cmd = ';'.join([ |
| ':>$OUT', |
| "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 CM3_CSS + CM3_THEMES] |
| ), |
| deps = [':zip'], |
| out = 'cm3.css', |
| ) |
| |
| genrule( |
| name = 'cm3-verbose', |
| cmd = ';'.join([ |
| ':>$OUT', |
| "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 CM3_JS] |
| ), |
| deps = [':zip'], |
| out = 'cm3-verbose.js', |
| ) |
| |
| js_minify( |
| name = 'js', |
| generated = [':cm3-verbose'], |
| compiler_args = CLOSURE_COMPILER_ARGS, |
| out = 'cm3.js' |
| ) |
| |
| prebuilt_jar( |
| name = 'codemirror', |
| binary_jar = ':jar', |
| deps = ['//lib:LICENSE-codemirror'], |
| visibility = ['PUBLIC'], |
| ) |
| |
| genrule( |
| name = 'jar', |
| cmd = ';'.join([ |
| 'cd $TMP', |
| 'unzip -q $(location :zip) %s' % |
| ' '.join(['%s/mode/%s' % (TOP, n) for n in CM3_MODES]), |
| ';'.join(['$(exe :js_minifier) ' + |
| ' '.join(CLOSURE_COMPILER_ARGS) + |
| ' --js_output_file %s/mode/%s.min --js %s/mode/%s' |
| % (TOP, n, TOP, n) for n in CM3_MODES]), |
| ';'.join(['mv %s/mode/%s.min %s/mode/%s' % (TOP, n, TOP, n) for n in CM3_MODES]), |
| 'mkdir net', |
| 'mv %s net/codemirror' % TOP, |
| 'mkdir net/codemirror/lib', |
| 'cp $(location :css) net/codemirror/lib', |
| 'cp $(location :js) net/codemirror/lib', |
| 'zip -qr $OUT *' |
| ]), |
| 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 = [], |
| ) |