-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Error with duplicate classes on truetime android library (#222)
* Using gradle shadow to merge embedded dependencies * Creating shadowJar extension * Setting truetime shadow relocation * Updated changelog
- Loading branch information
1 parent
5199095
commit 3f825ce
Showing
7 changed files
with
86 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...ools/src/main/java/co/elastic/apm/compile/tools/embedding/extensions/ShadowExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package co.elastic.apm.compile.tools.embedding.extensions; | ||
|
||
import org.gradle.api.model.ObjectFactory; | ||
import org.gradle.api.provider.Property; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import javax.inject.Inject; | ||
|
||
public class ShadowExtension { | ||
private final ObjectFactory objectFactory; | ||
|
||
private final List<Relocation> relocations = new ArrayList<>(); | ||
|
||
@Inject | ||
public ShadowExtension(ObjectFactory objectFactory) { | ||
this.objectFactory = objectFactory; | ||
} | ||
|
||
public List<Relocation> getRelocations() { | ||
return relocations; | ||
} | ||
|
||
public void relocate(String pattern, String destination) { | ||
Relocation relocation = objectFactory.newInstance(Relocation.class); | ||
relocation.getPattern().set(pattern); | ||
relocation.getDestination().set(destination); | ||
relocations.add(relocation); | ||
} | ||
|
||
public interface Relocation { | ||
Property<String> getPattern(); | ||
|
||
Property<String> getDestination(); | ||
} | ||
} |
33 changes: 0 additions & 33 deletions
33
...c/main/java/co/elastic/apm/compile/tools/embedding/tasks/EmbeddedClassesGathererTask.java
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
...src/main/java/co/elastic/apm/compile/tools/embedding/tasks/EmbeddedClassesMergerTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package co.elastic.apm.compile.tools.embedding.tasks; | ||
|
||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar; | ||
|
||
import org.gradle.api.file.Directory; | ||
import org.gradle.api.file.RegularFile; | ||
import org.gradle.api.file.RegularFileProperty; | ||
import org.gradle.api.provider.ListProperty; | ||
import org.gradle.api.tasks.InputFiles; | ||
import org.gradle.api.tasks.Internal; | ||
|
||
public abstract class EmbeddedClassesMergerTask extends ShadowJar { | ||
|
||
@InputFiles | ||
public abstract ListProperty<RegularFile> getInputJars(); | ||
|
||
@InputFiles | ||
public abstract ListProperty<Directory> getLocalClassesDirs(); | ||
|
||
@Internal | ||
public RegularFileProperty getOutputFile() { | ||
return (RegularFileProperty) getArchiveFile(); | ||
} | ||
} |