For this uber jar, the goal is for it to go hog wild and relocate
everything except what is in the exclude(s).  It seems like a bug that
non-classnames such as string constants are also being sent to the
relocator.  Given every string literal is being relocated, I can't imagine
a pattern to exclude those.

Perhaps it's best include the packages that should be relocated, rather
than exclude the ones that should not be.

It seems like the following code could be the problem, where it should be
passing the type of the 'name'.

Matcher m = classPattern.matcher( name );
if ( m.matches() )
{
  prefix = m.group( 1 ) + "L";
  suffix = ";";
  name = m.group( 2 );
}

for ( Relocator r : relocators )
{
  if ( r.canRelocateClass( name ) )
  {
    value = prefix + r.relocateClass( name ) + suffix;
    break;
  }
  else if ( r.canRelocatePath( name ) )
  {
    value = prefix + r.relocatePath( name ) + suffix;
    break;
  }
}

On Mon, Jul 23, 2012 at 12:01 PM, Benson Margulies <[email protected]>wrote:

> Hmm.
>
> You don't have a <pattern> element, so shade is going hog-wild. I
> appreciate that you're asking a specific question about controlling
> its behavior for string constants, but is it possible that you could
> come up with a pattern that wouldn't hit things like 'os.name'?
>
>
>
>
>
> On Mon, Jul 23, 2012 at 10:37 AM, Jason Rutherglen
> <[email protected]> wrote:
> > Hi Benson, This is the xml for the transform:
> >
> > http://pastebin.com/9nx18WiN
> >
> > Thanks!
> >
> > On Mon, Jul 23, 2012 at 10:21 AM, Benson Margulies <
> [email protected]>wrote:
> >
> >> On Mon, Jul 23, 2012 at 12:16 AM, Jason Rutherglen
> >> <[email protected]> wrote:
> >> > I'm shade transforming Apache Solr, which has several dependencies and
> >> > seems to work.
> >> >
> >> > However the internal class strings are being transformed, eg
> >> > 'System.getProperty("os.name");' where 'os.name' is being transformed
> >> to '
> >> > shade.package.os.name'.  Other than excluding every internal string,
> how
> >> > can I turn off the transformation of internal class strings?
> >>
> >> What were your transformation rules?
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [email protected]
> >> For additional commands, e-mail: [email protected]
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to