-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Motivation:
The icu4j dependency is quite large (14MB jar).
icu4j is currently declared as a dependency of the antlr tool (at tool runtime, not just build time), according to https://mvnrepository.com/artifact/org.antlr/antlr4/4.13.2
Due do a potential issue with the gradle antlr plugin, this dependency even leaks into the runtime classpath of projects that use the antlr tool to generate a parser and then ship this generated parser (I believe in this case, antlr-tool should not even be a runtime dependency, but just the antlr runtime + the generated parser; but this is an issue in the gradle antlr plugin gradle/gradle#820, not antlr itself).
So icu4j by default ends up in the runtime classpath of projects that are consumers of such generated parsers.
Preliminary Analysis:
It looks like it is a bug that icu4j even is a runtime dependency of the published antlr artifacts, so it could probably simply be excluded (this would also fix #4877 for users):
The only use of icu in the antlr repo I could find this this one https://github.com/antlr/antlr4/blob/dev/tool/src/org/antlr/v4/unicode/UnicodeDataTemplateController.java#L26 which explicitly mentions the intend to exclude it.
When UnicodeDataTemplateController was later moved from tool-codegen to tool in 2c0ef55, an exclusion was added to prevent the runtime dependency: cf422bb
Such an exclusion is still present today https://github.com/antlr/antlr4/blob/dev/tool/pom.xml#L119, but it does not seem to work, since e.g. https://mvnrepository.com/artifact/org.antlr/antlr4/4.13.2 lists icu4j as an dependency of the tool