Skip to content

Commit

Permalink
Make build work again.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphw committed Aug 21, 2024
1 parent 7e87eca commit 98bb6cd
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@

import groovy.lang.Closure;
import net.bytebuddy.build.EntryPoint;
import net.bytebuddy.utility.nullability.MaybeNull;
import org.gradle.api.Action;
import org.gradle.api.Project;
import org.gradle.api.file.FileCollection;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -81,6 +83,12 @@ public class ByteBuddyAndroidTaskExtension {
*/
private int threads;

/**
* A set of classes that is used for discovery of plugins.
*/
@MaybeNull
private FileCollection discoverySet;

/**
* Creates a new abstract Byte Buddy task extension.
*
Expand Down Expand Up @@ -270,6 +278,25 @@ public void setThreads(int threads) {
this.threads = threads;
}

/**
* Returns the source set to resolve plugin names from or {@code null} if no such source set is used.
*
* @return The source set to resolve plugin names from or {@code null} if no such source set is used.
*/
@MaybeNull
public FileCollection getDiscoverySet() {
return discoverySet;
}

/**
* Defines the source set to resolve plugin names from or {@code null} if no such source set is used.
*
* @param discoverySet The source set to resolve plugin names from or {@code null} if no such source set is used.
*/
public void setDiscoverySet(@MaybeNull FileCollection discoverySet) {
this.discoverySet = discoverySet;
}

/**
* Applies this extension's properties.
*
Expand All @@ -285,5 +312,6 @@ protected void configure(ByteBuddyLocalClassesEnhancerTask task) {
task.getExtendedParsing().convention(isExtendedParsing());
task.getDiscovery().convention(getDiscovery());
task.getThreads().convention(getThreads());
task.getDiscoverySet().setFrom(getDiscoverySet());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.gradle.api.provider.ListProperty;
import org.gradle.api.provider.Property;
import org.gradle.api.tasks.*;
import org.gradle.api.tasks.Optional;

import java.io.*;
import java.lang.reflect.InvocationTargetException;
Expand Down Expand Up @@ -167,6 +168,16 @@ public abstract class ByteBuddyLocalClassesEnhancerTask extends DefaultTask {
@Input
public abstract Property<Boolean> getExtendedParsing();

/**
* Returns the source set to resolve plugin names from or {@code null} if no such source set is used.
*
* @return The source set to resolve plugin names from or {@code null} if no such source set is used.
*/
@MaybeNull
@InputFiles
@Optional
public abstract ConfigurableFileCollection getDiscoverySet();

/**
* Translates a collection of files to {@link URL}s.
*
Expand Down Expand Up @@ -239,7 +250,7 @@ public void execute() throws IOException {
discovery.getMethod("valueOf", String.class).invoke(null, getDiscovery().get().name()),
ClassFileLocator.ForClassLoader.of(ByteBuddy.class.getClassLoader()),
getAndroidBootClasspath().plus(getByteBuddyClasspath()).getFiles(),
Collections.emptyList(), // TODO
getDiscoverySet().getFiles(),
getEntryPoint().get(),
classFileVersion,
Plugin.Factory.UsingReflection.ArgumentResolver.ForType.of(AndroidDescriptor.class, androidDescriptor),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ public static void apply(Logger logger,
Discovery discovery,
ClassFileLocator rootLocator,
Iterable<File> artifacts,
Iterable<File> discoveries,
@MaybeNull Iterable<File> discoveries,
EntryPoint entryPoint,
ClassFileVersion classFileVersion,
Plugin.Factory.UsingReflection.ArgumentResolver rootLocationResolver,
Expand All @@ -429,8 +429,8 @@ public static void apply(Logger logger,
boolean warnOnEmptyTypeSet,
Plugin.Engine.Source source,
Plugin.Engine.Target target) throws IOException {
ClassLoader classLoader = ByteBuddySkippingUrlClassLoader.of(rootLoader, discoveries);
Plugin.Engine.Summary summary;
ClassLoader classLoader = ByteBuddySkippingUrlClassLoader.of(rootLoader, discoveries);
try {
if (discovery.isDiscover(transformations)) {
Set<String> undiscoverable = new HashSet<String>();
Expand Down

0 comments on commit 98bb6cd

Please sign in to comment.