Skip to content

Commit

Permalink
Adjust plugin to configure implicit source set.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphw committed Jan 3, 2023
1 parent deae823 commit cf84b72
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.gradle.api.JavaVersion;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.file.FileCollection;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -446,6 +447,8 @@ protected void configure(T task) {
doConfigure(task);
}

protected abstract void discoverySet(FileCollection fileCollection);

/**
* Returns the type of the Byte Buddy task.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import net.bytebuddy.utility.nullability.MaybeNull;
import net.bytebuddy.utility.nullability.UnknownNull;
import org.gradle.api.Project;
import org.gradle.api.file.FileCollection;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.Optional;

Expand Down Expand Up @@ -45,16 +46,6 @@ public ByteBuddyJarTaskExtension(@UnknownNull Project project) {
super(project);
}

@Override
protected void doConfigure(ByteBuddyJarTask task) {
task.setDiscoverySet(discoverySet);
}

@Override
protected Class<ByteBuddyJarTask> toType() {
return ByteBuddyJarTask.class;
}

/**
* Returns the source set to resolve plugin names from or {@code null} if no such source set is used.
*
Expand All @@ -75,4 +66,19 @@ public Iterable<File> getDiscoverySet() {
public void setDiscoverySet(@MaybeNull Iterable<File> discoverySet) {
this.discoverySet = discoverySet;
}

@Override
protected void doConfigure(ByteBuddyJarTask task) {
task.setDiscoverySet(discoverySet);
}

@Override
protected Class<ByteBuddyJarTask> toType() {
return ByteBuddyJarTask.class;
}

@Override
protected void discoverySet(FileCollection fileCollection) {
discoverySet = fileCollection;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public void execute(JavaPlugin plugin) {
extension = DISPATCHER.toExtension(project);
}
extension.resolve(configuration.getTargetCompatibility());
extension.discoverySet(project.getConfigurations().create(name));
project.getExtensions().add(name, extension);
project.afterEvaluate(DISPATCHER.toAction(name, sourceSet));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import net.bytebuddy.utility.nullability.MaybeNull;
import net.bytebuddy.utility.nullability.UnknownNull;
import org.gradle.api.Project;
import org.gradle.api.file.FileCollection;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.Optional;

Expand Down Expand Up @@ -45,17 +46,6 @@ public ByteBuddySimpleTaskExtension(@UnknownNull Project project) {
super(project);
}


@Override
protected void doConfigure(ByteBuddySimpleTask task) {
task.setDiscoverySet(discoverySet);
}

@Override
protected Class<ByteBuddySimpleTask> toType() {
return ByteBuddySimpleTask.class;
}

/**
* Returns the source set to resolve plugin names from or {@code null} if no such source set is used.
*
Expand All @@ -76,4 +66,20 @@ public Iterable<File> getDiscoverySet() {
public void setDiscoverySet(@MaybeNull Iterable<File> discoverySet) {
this.discoverySet = discoverySet;
}


@Override
protected void doConfigure(ByteBuddySimpleTask task) {
task.setDiscoverySet(discoverySet);
}

@Override
protected void discoverySet(FileCollection fileCollection) {
discoverySet = fileCollection;
}

@Override
protected Class<ByteBuddySimpleTask> toType() {
return ByteBuddySimpleTask.class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ protected void doConfigure(ByteBuddyTask task) {
task.setDiscoverySet(discoverySet);
}

@Override
protected void discoverySet(FileCollection fileCollection) {
discoverySet = fileCollection;
}

@Override
protected Class<? extends ByteBuddyTask> toType() {
return incrementalClassPath
Expand Down

0 comments on commit cf84b72

Please sign in to comment.