Skip to content

Commit

Permalink
Adjust type conversion.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphw committed Sep 13, 2024
1 parent f3a68e0 commit 0d63a76
Showing 1 changed file with 3 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import java.io.File;
import java.lang.reflect.Method;
import java.util.Arrays;

/**
* Implements a configuration of a Byte Buddy task.
Expand Down Expand Up @@ -59,32 +60,14 @@ public ByteBuddyTaskConfiguration(String name, SourceSet sourceSet, Method getDe
protected void configureDirectories(SourceDirectorySet source, AbstractCompile compileTask, ByteBuddyTask byteBuddyTask) {
try {
DirectoryProperty directory = (DirectoryProperty) getDestinationDirectorySource.invoke(source);
((DirectoryProperty) getDestinationDirectoryTarget.invoke(compileTask)).set((File) directory.dir("../"
((DirectoryProperty) getDestinationDirectoryTarget.invoke(compileTask)).set(directory.dir("../"
+ source.getName()
+ RAW_FOLDER_SUFFIX).map(ToFileMapper.INSTANCE));
+ RAW_FOLDER_SUFFIX));
byteBuddyTask.getSource().set(directory.dir("../" + source.getName() + RAW_FOLDER_SUFFIX));
byteBuddyTask.getTarget().set(directory);
byteBuddyTask.getClassPath().from(compileTask.getClasspath());
} catch (Exception exception) {
throw new GradleException("Could not adjust directories for tasks", exception);
}
}

/**
* Transforms a directory to a file.
*/
protected enum ToFileMapper implements Transformer<File, Directory> {

/**
* The singleton instance.
*/
INSTANCE;

/**
* {@inheritDoc}
*/
public File transform(Directory directory) {
return directory.getAsFile();
}
}
}

0 comments on commit 0d63a76

Please sign in to comment.