| include_defs('//lib/maven.defs') |
| include_defs('//lib/codemirror/cm3.defs') |
| |
| VERSION = 'deac75cfc7' |
| SHA1 = 'e6133142cb9feaa7ee1dac8bbc35debde9d4a305' |
| URL = GERRIT + 'net/codemirror/codemirror-%s.zip' % VERSION |
| |
| ZIP = 'codemirror-%s.zip' % VERSION |
| TOP = 'codemirror-%s' % VERSION |
| |
| genrule( |
| name = 'css', |
| cmd = ';'.join([ |
| ':>$OUT', |
| "echo '/** @license' >>$OUT", |
| 'unzip -p $SRCDIR/%s %s/LICENSE >>$OUT' % (ZIP, TOP), |
| "echo '*/' >>$OUT", |
| ] + |
| ['unzip -p $SRCDIR/%s %s/%s >>$OUT' % (ZIP, TOP, n) |
| for n in CM3_CSS] |
| ), |
| srcs = [genfile(ZIP)], |
| deps = [':download'], |
| out = 'cm3.css', |
| ) |
| |
| # TODO(sop) Minify with Closure JavaScript compiler. |
| genrule( |
| name = 'js', |
| cmd = ';'.join([ |
| ':>$OUT', |
| "echo '/** @license' >>$OUT", |
| 'unzip -p $SRCDIR/%s %s/LICENSE >>$OUT' % (ZIP, TOP), |
| "echo '*/' >>$OUT", |
| ] + |
| ['unzip -p $SRCDIR/%s %s/%s >>$OUT' % (ZIP, TOP, n) |
| for n in CM3_JS] |
| ), |
| srcs = [genfile(ZIP)], |
| deps = [':download'], |
| out = 'cm3.js', |
| ) |
| |
| prebuilt_jar( |
| name = 'codemirror', |
| binary_jar = genfile('codemirror.jar'), |
| deps = [ |
| ':jar', |
| '//lib:LICENSE-codemirror', |
| ], |
| visibility = ['PUBLIC'], |
| ) |
| |
| genrule( |
| name = 'jar', |
| cmd = ';'.join([ |
| 'cd $TMP', |
| 'unzip -q $SRCDIR/%s %s' % ( |
| ZIP, |
| ' '.join(['%s/mode/%s' % (TOP, n) for n in CM3_MODES])), |
| 'mkdir net', |
| 'mv %s net/codemirror' % TOP, |
| 'mkdir net/codemirror/lib', |
| 'mv $SRCDIR/cm3.css net/codemirror/lib', |
| 'mv $SRCDIR/cm3.js net/codemirror/lib', |
| 'zip -qr $OUT *' |
| ]), |
| srcs = [ |
| genfile(ZIP), |
| genfile('cm3.css'), |
| genfile('cm3.js'), |
| ], |
| deps = [ |
| ':download', |
| ':css', |
| ':js', |
| ], |
| out = 'codemirror.jar', |
| ) |
| |
| genrule( |
| name = 'download', |
| cmd = '$(exe //tools:download_file)' + |
| ' -o $OUT' + |
| ' -u ' + URL + |
| ' -v ' + SHA1, |
| deps = ['//tools:download_file'], |
| out = 'codemirror-' + VERSION + '.zip', |
| ) |