pantsbuild / jarjar

An export of https://code.google.com/p/jarjar/ @ svn:r142 for pants tool use and further development.
Apache License 2.0
37 stars 27 forks source link

Add support for literals with dash #22

Closed stremlenye closed 6 years ago

stremlenye commented 8 years ago

Motivation

Shading rule rename doesn't support such patterns as "com.typesafe.akka.akka-http-core.*" or "com.typesafe.akka.akka-http-core.**". Also during substitution of String literals in such case

this.Daemonicity = this.config().getBoolean("akka.daemonic");
this.JvmExitOnFatalError = this.config().getBoolean("akka.jvm-exit-on-fatal-error");

some of them substitutes inconsistently and code starts to look like:

this.Daemonicity = this.config().getBoolean("shadeio.akka.daemonic");
this.JvmExitOnFatalError = this.config().getBoolean("akka.jvm-exit-on-fatal-error");

Solution

Add dash as a valid symbol for identifiers.

Disclaimer

I am not pretty sure in that solution (because have no experience in such low-level details) and that pull request is just conscripted to start a discussion. Please be patient and provide your comments. Thank you for your time.

lucastorri commented 6 years ago

Hi,

any chance this could be accepted. I'm also interested on it.

Thanks

stuhood commented 6 years ago

@cheister : Would you be able to review this?

EDIT: ... or I guess replace it, given the merge conflict.

lucastorri commented 6 years ago

Let me know if I can help (I'm not sure what is your contribution process). I can at least fix the compilation issues if needed.

Thank you.

EDIT: here is a rebased version: https://github.com/lucastorri/jarjar/tree/master

cheister commented 6 years ago

This is a superset of the cases fixed in https://github.com/pantsbuild/jarjar/pull/34 so we should be able to remove

if (expr.startsWith("META-INF/")) {
    expr = expr.substring("META-INF/".length(), expr.length());
}

from src/main/java/org/pantsbuild/jarjar/Wildcard.java as well.

cheister commented 6 years ago

Opened https://github.com/pantsbuild/jarjar/pull/35 with a rebase of this change and removal of the META-INF prefix check in Wildcard.java

cheister commented 6 years ago

Closing because https://github.com/pantsbuild/jarjar/pull/35 was merged