Skip to content

Commit

Permalink
declare task output
Browse files Browse the repository at this point in the history
  • Loading branch information
paullatzelsperger committed Nov 19, 2024
1 parent c40e3f7 commit 846ad20
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import org.gradle.api.DefaultTask;
import org.gradle.api.artifacts.Dependency;
import org.gradle.api.tasks.Internal;
import org.gradle.api.tasks.OutputDirectory;
import org.gradle.api.tasks.OutputFile;
import org.gradle.api.tasks.TaskAction;
import org.gradle.api.tasks.options.Option;

Expand Down Expand Up @@ -76,6 +78,11 @@ public void setOutput(String output) {
this.outputDirectoryOverride = new File(output);
}

@OutputDirectory
public File getOutputFile() {
return downloadDirectory.toFile();
}

/**
* Whether to consider a particular dependency for manifest resolution.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ public String type() {
return type;
}

@Override
public int hashCode() {
return Objects.hash(dependency, uri, classifier, type);
}

/**
* Opens an input stream to the file located at {@link DependencySource#uri()}. It is highly recommended to check {@link DependencySource#exists()}
* beforehand.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
import org.gradle.api.artifacts.ProjectDependency;
import org.gradle.api.artifacts.repositories.MavenArtifactRepository;
import org.gradle.api.internal.artifacts.dependencies.DefaultProjectDependency;
import org.gradle.api.tasks.OutputFile;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
Expand Down Expand Up @@ -48,7 +50,6 @@ protected InputStream resolveManifest(DependencySource autodocManifest) {
getLogger().warn("Could not obtain {}", autodocManifest.dependency());
return null;
}

return inputStream;
}

Expand Down Expand Up @@ -122,6 +123,4 @@ private boolean isLocalFileValid(Dependency dep) {
throw new RuntimeException(e);
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;

/**
* A dependency that is represented in the local file system, e.g. the local Maven cache
Expand All @@ -24,7 +26,7 @@ public FileSource(Dependency dependency, URI uri, String classifier, String type

@Override
public boolean exists() {
return new File(uri()).exists();
return Files.exists(Path.of(uri()));
}

@Override
Expand Down

0 comments on commit 846ad20

Please sign in to comment.