Skip to content

Commit

Permalink
Fix up configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphw committed Oct 4, 2023
1 parent d597723 commit fe96422
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions byte-buddy/src/main/resources/ByteBuddyAndroidPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -667,9 +667,28 @@ public RegularFileProperty invoke(ByteBuddyLocalClassesEnhancerTask task) {
protected enum ByteBuddyViewConfiguration implements Action<ArtifactView.ViewConfiguration> {

/**
* The singleton instance.
* A view configuration for classes.
*/
INSTANCE;
FOR_CLASSES(BYTE_BUDDY_CLASSES_TYPE),

/**
* A view configuration for resources.
*/
FOR_RESOURCES(BYTE_BUDDY_RESOURCES_TYPE);

/**
* The type of the configuration attribute.
*/
private final String type;

/**
* Creates a new view configuration.
*
* @param type The type of the configuration attribute.
*/
ByteBuddyViewConfiguration(String type) {
this.type = type;
}

/**
* For external dependencies, it provides their JAR files. For local project's dependencies, it provides their local
Expand All @@ -678,16 +697,16 @@ protected enum ByteBuddyViewConfiguration implements Action<ArtifactView.ViewCon
*/
protected static FileCollection toClassPath(Project project, Configuration configuration) {
return project.files(
configuration.getIncoming().artifactView(INSTANCE).getFiles(),
configuration.getIncoming().artifactView(INSTANCE).getFiles());
configuration.getIncoming().artifactView(FOR_CLASSES).getFiles(),
configuration.getIncoming().artifactView(FOR_RESOURCES).getFiles());
}

/**
* {@inheritDoc}
*/
public void execute(ArtifactView.ViewConfiguration configuration) {
configuration.lenient(false);
configuration.getAttributes().attribute(ARTIFACT_TYPE_ATTRIBUTE, BYTE_BUDDY_RESOURCES_TYPE);
configuration.getAttributes().attribute(ARTIFACT_TYPE_ATTRIBUTE, type);
}
}
}

0 comments on commit fe96422

Please sign in to comment.