Merge "Improve documentation of diff-match-patch build"

This commit is contained in:
David Ostrovsky
2016-12-20 06:53:41 +00:00
committed by Gerrit Code Review
4 changed files with 13 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
workspace(name = "gerrit") workspace(name = "gerrit")
load("//tools/bzl:maven_jar.bzl", "maven_jar", "GERRIT", "MAVEN_LOCAL") load("//tools/bzl:maven_jar.bzl", "maven_jar", "GERRIT", "MAVEN_LOCAL")
load("//lib/codemirror:cm.bzl", "DIFF_MATCH_PATCH_VERSION")
ANTLR_VERS = "3.5.2" ANTLR_VERS = "3.5.2"
@@ -865,7 +866,7 @@ maven_jar(
maven_jar( maven_jar(
name = "diff_match_patch", name = "diff_match_patch",
artifact = "org.webjars:google-diff-match-patch:20121119-1", artifact = "org.webjars:google-diff-match-patch:" + DIFF_MATCH_PATCH_VERSION,
attach_source = False, attach_source = False,
sha1 = "0cf1782dbcb8359d95070da9176059a5a9d37709", sha1 = "0cf1782dbcb8359d95070da9176059a5a9d37709",
) )

View File

@@ -23,7 +23,6 @@ maven_jar(
visibility = [], visibility = [],
) )
DIFF_MATCH_PATCH_VERSION = '20121119-1'
DIFF_MATCH_PATCH_TOP = ('META-INF/resources/webjars/google-diff-match-patch/%s' DIFF_MATCH_PATCH_TOP = ('META-INF/resources/webjars/google-diff-match-patch/%s'
% DIFF_MATCH_PATCH_VERSION) % DIFF_MATCH_PATCH_VERSION)
@@ -95,12 +94,12 @@ for archive, suffix, top in [('codemirror-original', '', TOP), ('codemirror-mini
# Merge Addon bundled with diff-match-patch # Merge Addon bundled with diff-match-patch
genrule( genrule(
name = 'addon_merge%s' % suffix, name = 'addon_merge_with_diff_match_patch%s' % suffix,
cmd = ';'.join([ cmd = ';'.join([
"echo '/** @license' >$OUT", "echo '/** @license' >$OUT",
'unzip -p $(location :%s) %s/LICENSE >>$OUT' % (archive, top), 'unzip -p $(location :%s) %s/LICENSE >>$OUT' % (archive, top),
"echo '*/\n' >>$OUT", "echo '*/\n' >>$OUT",
"echo '// The google-diff-match-patch library is from https://google-diff-match-patch.googlecode.com/svn-history/r106/trunk/javascript/diff_match_patch.js\n' >> $OUT", "echo '// The google-diff-match-patch library is from https://repo1.maven.org/maven2/org/webjars/google-diff-match-patch/%s/google-diff-match-patch-%s.jar\n' >> $OUT" % (DIFF_MATCH_PATCH_VERSION, DIFF_MATCH_PATCH_VERSION),
"echo '/** @license' >>$OUT", "echo '/** @license' >>$OUT",
'cat $(location //lib:LICENSE-Apache2.0) >>$OUT', 'cat $(location //lib:LICENSE-Apache2.0) >>$OUT',
"echo '*/' >>$OUT", "echo '*/' >>$OUT",
@@ -109,7 +108,7 @@ for archive, suffix, top in [('codemirror-original', '', TOP), ('codemirror-mini
'unzip -p $(location :%s) %s/addon/merge/merge.js >>$OUT' % (archive, top) 'unzip -p $(location :%s) %s/addon/merge/merge.js >>$OUT' % (archive, top)
] ]
), ),
out = 'addon_merge%s.js' % suffix, out = 'addon_merge_with_diff_match_patch%s.js' % suffix,
) )
# Jar packaging # Jar packaging
@@ -124,7 +123,7 @@ for archive, suffix, top in [('codemirror-original', '', TOP), ('codemirror-mini
for n in CM_MODES] for n in CM_MODES]
+ ['cp $(location :theme_%s%s) net/codemirror/theme/%s.css' % (n, suffix, n) + ['cp $(location :theme_%s%s) net/codemirror/theme/%s.css' % (n, suffix, n)
for n in CM_THEMES] for n in CM_THEMES]
+ ['cp $(location :addon_merge%s) net/codemirror/addon/merge_bundled.js' % suffix] + ['cp $(location :addon_merge_with_diff_match_patch%s) net/codemirror/addon/merge_bundled.js' % suffix]
+ ['zip -qr $OUT net/codemirror/{addon,lib,mode,theme}']), + ['zip -qr $OUT net/codemirror/{addon,lib,mode,theme}']),
out = 'codemirror%s.jar' % suffix, out = 'codemirror%s.jar' % suffix,
) )

View File

@@ -295,12 +295,12 @@ def pkg_cm():
# Merge Addon bundled with diff-match-patch # Merge Addon bundled with diff-match-patch
genrule2( genrule2(
name = 'addon_merge%s' % suffix, name = 'addon_merge_with_diff_match_patch%s' % suffix,
cmd = ' && '.join([ cmd = ' && '.join([
"echo '/** @license' >$@", "echo '/** @license' >$@",
'unzip -p $(location %s) %s/LICENSE >>$@' % (archive, top), 'unzip -p $(location %s) %s/LICENSE >>$@' % (archive, top),
"echo '*/\n' >>$@", "echo '*/\n' >>$@",
"echo '// The google-diff-match-patch library is from https://google-diff-match-patch.googlecode.com/svn-history/r106/trunk/javascript/diff_match_patch.js\n' >> $@", "echo '// The google-diff-match-patch library is from https://repo1.maven.org/maven2/org/webjars/google-diff-match-patch/%s/google-diff-match-patch-%s.jar\n' >> $@" % (DIFF_MATCH_PATCH_VERSION, DIFF_MATCH_PATCH_VERSION),
"echo '/** @license' >>$@", "echo '/** @license' >>$@",
"echo 'LICENSE-Apache2.0' >>$@", "echo 'LICENSE-Apache2.0' >>$@",
"echo '*/' >>$@", "echo '*/' >>$@",
@@ -314,7 +314,7 @@ def pkg_cm():
archive, archive,
"//lib:LICENSE-Apache2.0", "//lib:LICENSE-Apache2.0",
], ],
outs = ['addon_merge%s.js' % suffix], outs = ['addon_merge_with_diff_match_patch%s.js' % suffix],
) )
# Jar packaging # Jar packaging
@@ -329,10 +329,10 @@ def pkg_cm():
for n in CM_MODES] for n in CM_MODES]
+ ['cp $$ROOT/$(location :theme_%s%s) net/codemirror/theme/%s.css' % (n, suffix, n) + ['cp $$ROOT/$(location :theme_%s%s) net/codemirror/theme/%s.css' % (n, suffix, n)
for n in CM_THEMES] for n in CM_THEMES]
+ ['cp $$ROOT/$(location :addon_merge%s) net/codemirror/addon/merge_bundled.js' % suffix] + ['cp $$ROOT/$(location :addon_merge_with_diff_match_patch%s) net/codemirror/addon/merge_bundled.js' % suffix]
+ ['zip -qr $$ROOT/$@ net/codemirror/{addon,lib,mode,theme}']), + ['zip -qr $$ROOT/$@ net/codemirror/{addon,lib,mode,theme}']),
tools = [ tools = [
':addon_merge%s' % suffix, ':addon_merge_with_diff_match_patch%s' % suffix,
':cm%s' % suffix, ':cm%s' % suffix,
':css%s' % suffix, ':css%s' % suffix,
] + [ ] + [

View File

@@ -209,3 +209,5 @@ CM_MODES = [
'yaml', 'yaml',
'z80', 'z80',
] ]
DIFF_MATCH_PATCH_VERSION = "20121119-1"