VERSION = '3.13' SHA1 = '7a83ae686d75afd30bb152d7683f2dc27e59ea82' URL = 'http://codemirror.net/codemirror-%s.zip' % VERSION prebuilt_jar( name = 'codemirror', binary_jar = genfile('codemirror.jar'), deps = [ ':jar', '//lib:LICENSE-codemirror', ], visibility = ['PUBLIC'], ) # TODO(sop) Repackage by license boundaries. # TODO(sop) Minify with Closure JS compiler. genrule( name = 'jar', cmd = ';'.join([ 'cd $TMP', 'mkdir net META-INF', 'unzip -d net $SRCS', 'mv net/codemirror-%s net/codemirror' % VERSION, 'echo "Manifest-Version: 1.0" >META-INF/MANIFEST.MF', 'zip -r $OUT *' ]), srcs = [genfile('codemirror-' + VERSION + '.zip')], deps = [':download'], out = 'codemirror.jar', ) genrule( name = 'download', cmd = '${//tools:download_file}' + ' -o $OUT' + ' -u ' + URL + ' -v ' + SHA1, srcs = [], deps = ['//tools:download_file'], out = 'codemirror-' + VERSION + '.zip', )