Replace vanilla parboiled with grappa library
Grappa library was chosen by Gitiles project to implement markdown rendering. Grappa library includes non-relocated parboiled library that is incompatible with vanilla parboiled library. When Grappa driven gitiles-plugin is deployed in Gerrit, there is a class collision. The only way to make them co-exist is to relocate one of them, using JarJar utility. But doing it can be error prone as this issue has shown: [2]. This change takes another approach and replace parboiled library in Gerrit core with Grappa library. This fixed the deployment problem with gitiles-plugin: markdown files rendering work as expected. [1] https://github.com/fge/grappa [2] https://github.com/sirthias/parboiled/issues/80 Change-Id: I793a84013468bf9fd07e62960bc2e789674ff35c
This commit is contained in:
parent
625479682c
commit
4e69765b9e
@ -34,6 +34,7 @@ java_library(
|
|||||||
'//gerrit-util-ssl:ssl',
|
'//gerrit-util-ssl:ssl',
|
||||||
'//lib:args4j',
|
'//lib:args4j',
|
||||||
'//lib:automaton',
|
'//lib:automaton',
|
||||||
|
'//lib:grappa',
|
||||||
'//lib:gson',
|
'//lib:gson',
|
||||||
'//lib:guava',
|
'//lib:guava',
|
||||||
'//lib:gwtjsonrpc',
|
'//lib:gwtjsonrpc',
|
||||||
@ -41,7 +42,6 @@ java_library(
|
|||||||
'//lib:jsch',
|
'//lib:jsch',
|
||||||
'//lib:juniversalchardet',
|
'//lib:juniversalchardet',
|
||||||
'//lib:mime-util',
|
'//lib:mime-util',
|
||||||
'//lib:parboiled-core',
|
|
||||||
'//lib:pegdown',
|
'//lib:pegdown',
|
||||||
'//lib:protobuf',
|
'//lib:protobuf',
|
||||||
'//lib:velocity',
|
'//lib:velocity',
|
||||||
@ -206,6 +206,7 @@ java_test(
|
|||||||
'//gerrit-reviewdb:server',
|
'//gerrit-reviewdb:server',
|
||||||
'//gerrit-server/src/main/prolog:common',
|
'//gerrit-server/src/main/prolog:common',
|
||||||
'//lib:args4j',
|
'//lib:args4j',
|
||||||
|
'//lib:grappa',
|
||||||
'//lib:guava',
|
'//lib:guava',
|
||||||
'//lib:gwtorm',
|
'//lib:gwtorm',
|
||||||
'//lib:junit',
|
'//lib:junit',
|
||||||
@ -215,8 +216,6 @@ java_test(
|
|||||||
'//lib/jgit:jgit',
|
'//lib/jgit:jgit',
|
||||||
'//lib/jgit:junit',
|
'//lib/jgit:junit',
|
||||||
'//lib/joda:joda-time',
|
'//lib/joda:joda-time',
|
||||||
'//lib:parboiled-core',
|
|
||||||
'//lib:parboiled-java',
|
|
||||||
'//lib/prolog:prolog-cafe',
|
'//lib/prolog:prolog-cafe',
|
||||||
],
|
],
|
||||||
source_under_test = [':server'],
|
source_under_test = [':server'],
|
||||||
|
@ -35,8 +35,8 @@ public class ParboiledTest {
|
|||||||
" [Number] '42'\n" +
|
" [Number] '42'\n" +
|
||||||
" [0..9] '4'\n" +
|
" [0..9] '4'\n" +
|
||||||
" [0..9] '2'\n" +
|
" [0..9] '2'\n" +
|
||||||
" [ZeroOrMore]\n" +
|
" [zeroOrMore]\n" +
|
||||||
" [ZeroOrMore]\n";
|
" [zeroOrMore]\n";
|
||||||
|
|
||||||
private CalculatorParser parser;
|
private CalculatorParser parser;
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ public class ParboiledTest {
|
|||||||
public void test() {
|
public void test() {
|
||||||
ParsingResult<String> result =
|
ParsingResult<String> result =
|
||||||
new ReportingParseRunner<String>(parser.Expression()).run("42");
|
new ReportingParseRunner<String>(parser.Expression()).run("42");
|
||||||
assertThat(result.hasErrors()).isFalse();
|
assertThat(result.isSuccess()).isTrue();
|
||||||
// next test is optional; we could stop here.
|
// next test is optional; we could stop here.
|
||||||
assertThat(ParseTreeUtils.printNodeTree(result)).isEqualTo(EXPECTED);
|
assertThat(ParseTreeUtils.printNodeTree(result)).isEqualTo(EXPECTED);
|
||||||
}
|
}
|
||||||
@ -57,19 +57,19 @@ public class ParboiledTest {
|
|||||||
@BuildParseTree
|
@BuildParseTree
|
||||||
static class CalculatorParser extends BaseParser<Object> {
|
static class CalculatorParser extends BaseParser<Object> {
|
||||||
Rule Expression() {
|
Rule Expression() {
|
||||||
return Sequence(Term(), ZeroOrMore(AnyOf("+-"), Term()));
|
return sequence(Term(), zeroOrMore(anyOf("+-"), Term()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Rule Term() {
|
Rule Term() {
|
||||||
return Sequence(Factor(), ZeroOrMore(AnyOf("*/"), Factor()));
|
return sequence(Factor(), zeroOrMore(anyOf("*/"), Factor()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Rule Factor() {
|
Rule Factor() {
|
||||||
return FirstOf(Number(), Sequence('(', Expression(), ')'));
|
return firstOf(Number(), sequence('(', Expression(), ')'));
|
||||||
}
|
}
|
||||||
|
|
||||||
Rule Number() {
|
Rule Number() {
|
||||||
return OneOrMore(CharRange('0', '9'));
|
return oneOrMore(charRange('0', '9'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
31
lib/BUCK
31
lib/BUCK
@ -120,30 +120,29 @@ maven_jar(
|
|||||||
id = 'org.pegdown:pegdown:1.4.2',
|
id = 'org.pegdown:pegdown:1.4.2',
|
||||||
sha1 = 'd96db502ed832df867ff5d918f05b51ba3879ea7',
|
sha1 = 'd96db502ed832df867ff5d918f05b51ba3879ea7',
|
||||||
license = 'Apache2.0',
|
license = 'Apache2.0',
|
||||||
deps = [':parboiled-java'],
|
deps = [':grappa'],
|
||||||
)
|
)
|
||||||
|
|
||||||
maven_jar(
|
maven_jar(
|
||||||
name = 'parboiled-core',
|
name = 'grappa',
|
||||||
id = 'org.parboiled:parboiled-core:1.1.7',
|
id = 'com.github.parboiled1:grappa:1.0.4',
|
||||||
sha1 = 'a60ff9a54cbeb30ec44c89e16ac4c35913cbad5a',
|
sha1 = 'ad4b44b9c305dad7aa1e680d4b5c8eec9c4fd6f5',
|
||||||
license = 'Apache2.0',
|
|
||||||
attach_source = False,
|
|
||||||
)
|
|
||||||
|
|
||||||
maven_jar(
|
|
||||||
name = 'parboiled-java',
|
|
||||||
id = 'org.parboiled:parboiled-java:1.1.7',
|
|
||||||
sha1 = '2298c64ce8ee8e2fb37e97e16d7be52f0c7cf61f',
|
|
||||||
license = 'Apache2.0',
|
license = 'Apache2.0',
|
||||||
deps = [
|
deps = [
|
||||||
':parboiled-core',
|
':jitescript',
|
||||||
'//lib/ow2:ow2-asm-tree',
|
'//lib/ow2:ow2-asm',
|
||||||
'//lib/ow2:ow2-asm-analysis',
|
'//lib/ow2:ow2-asm-analysis',
|
||||||
|
'//lib/ow2:ow2-asm-tree',
|
||||||
'//lib/ow2:ow2-asm-util',
|
'//lib/ow2:ow2-asm-util',
|
||||||
],
|
],
|
||||||
attach_source = False,
|
)
|
||||||
visibility = ['//gerrit-server:server_tests'],
|
|
||||||
|
maven_jar(
|
||||||
|
name = 'jitescript',
|
||||||
|
id = 'me.qmx.jitescript:jitescript:0.4.0',
|
||||||
|
sha1 = '2e35862b0435c1b027a21f3d6eecbe50e6e08d54',
|
||||||
|
license = 'Apache2.0',
|
||||||
|
visibility = ['//lib:grappa'],
|
||||||
)
|
)
|
||||||
|
|
||||||
maven_jar(
|
maven_jar(
|
||||||
|
Loading…
Reference in New Issue
Block a user