Skip to content

Commit

Permalink
Update UnpackJavaSources.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed May 13, 2024
1 parent bdea818 commit a04871c
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@
import org.gradle.api.file.DirectoryProperty;
import org.gradle.api.file.FileTree;
import org.gradle.api.file.RegularFileProperty;
import org.gradle.api.internal.file.FileOperations;
import org.gradle.api.tasks.CacheableTask;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.OutputDirectory;
import org.gradle.api.tasks.PathSensitive;
import org.gradle.api.tasks.PathSensitivity;
import org.gradle.api.tasks.TaskAction;

import javax.inject.Inject;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
Expand Down Expand Up @@ -54,7 +55,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {

final File input = getInputZip().getAsFile().get();

final FileTree source = getProject().zipTree(input);
final FileTree source = getOperations().zipTree(input);
source.visit(fileVisitDetails -> {
if (fileVisitDetails.isDirectory() || !fileVisitDetails.getName().endsWith(".java")) return;
try (final InputStream is = fileVisitDetails.open()) {
Expand Down Expand Up @@ -87,4 +88,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {

@OutputDirectory
public abstract DirectoryProperty getUnpackingTarget();

@Inject
public abstract FileOperations getOperations();
}

0 comments on commit a04871c

Please sign in to comment.