kriegaex commented on pull request #100:
URL: 
https://github.com/apache/maven-shade-plugin/pull/100#issuecomment-876058443


   Sorry for the late feedback. I just checked out this PR and ran it against 
my shading configuration is AspectJ, then diffed the shaded source archives 
before and after the patch. I found a regression, the functionality I 
implemented before is broken: Shading `org.objectweb.asm` to 
`aj.org.objectweb.asm` is not working anymore in package declarations. I added 
a simple test case in a quick & dirty way to 
`SimpleRelocatorTest.testRelocateSourceWithMultipleRelocators`. Just apply the 
patch and run that test. Of course, the change breaks 
`testRelocateSourceWithExcludes` for now because I simply hacked another 
package declaration into the test strings, but it should be enough for you to 
inspect the problem and fix your PR.
   
   ```patch
   
b/src/test/java/org/apache/maven/plugins/shade/relocation/SimpleRelocatorTest.java
   --- 
a/src/test/java/org/apache/maven/plugins/shade/relocation/SimpleRelocatorTest.java
       (revision Staged)
   +++ 
b/src/test/java/org/apache/maven/plugins/shade/relocation/SimpleRelocatorTest.java
       (date 1625708927654)
   @@ -191,6 +191,7 @@
    
        private static final String sourceFile =
                "package org.apache.maven.hello;\n" +
   +            "package org.objectweb.asm;\n" +
                "\n" +
                "import foo.bar.Bar;\n" +
                "import zot.baz.Baz;\n" +
   @@ -218,6 +219,7 @@
    
        private static final String relocatedFile =
                "package com.acme.maven.hello;\n" +
   +            "package aj.org.objectweb.asm;\n" +
                "\n" +
                "import foo.bar.Bar;\n" +
                "import zot.baz.Baz;\n" +
   @@ -270,6 +272,14 @@
                    Arrays.asList( "irrelevant.exclude", 
"org.apache.maven.exclude1", "org.apache.maven.sub.exclude2" ) );
    
            SimpleRelocator relocatorPackage = new SimpleRelocator( "io", 
"shaded.io", null, null);
   -        assertEquals( relocatedFile,  
relocatorPackage.applyToSourceContent( relocator.applyToSourceContent( 
sourceFile ) ) );
   +        SimpleRelocator asmPackage = new SimpleRelocator( 
"org.objectweb.asm", "aj.org.objectweb.asm", null, null);
   +        assertEquals(
   +          relocatedFile,
   +          asmPackage.applyToSourceContent(
   +            relocatorPackage.applyToSourceContent(
   +              relocator.applyToSourceContent( sourceFile )
   +            ) 
   +          ) 
   +        );
        }
    }
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to