mirror of
https://github.com/corda/corda.git
synced 2025-01-29 23:54:07 +00:00
Annotate Gradle task inputs correctly. (#1752)
This commit is contained in:
parent
f36ca78f88
commit
4d4027947b
@ -48,7 +48,7 @@ public class GenerateApi extends DefaultTask {
|
||||
@TaskAction
|
||||
public void generate() {
|
||||
FileCollection apiFiles = getSources();
|
||||
if (!apiFiles.isEmpty() && (outputDir.isDirectory() || outputDir.mkdirs())) {
|
||||
if (!apiFiles.isEmpty()) {
|
||||
try (OutputStream output = new BufferedOutputStream(new FileOutputStream(getTarget()))) {
|
||||
for (File apiFile : apiFiles) {
|
||||
Files.copy(apiFile.toPath(), output);
|
||||
|
@ -8,7 +8,9 @@ import io.github.lukehutch.fastclasspathscanner.scanner.ScanResult;
|
||||
import org.gradle.api.DefaultTask;
|
||||
import org.gradle.api.file.ConfigurableFileCollection;
|
||||
import org.gradle.api.file.FileCollection;
|
||||
import org.gradle.api.tasks.CompileClasspath;
|
||||
import org.gradle.api.tasks.Input;
|
||||
import org.gradle.api.tasks.InputFiles;
|
||||
import org.gradle.api.tasks.OutputFiles;
|
||||
import org.gradle.api.tasks.TaskAction;
|
||||
|
||||
@ -55,7 +57,7 @@ public class ScanApi extends DefaultTask {
|
||||
outputDir = new File(getProject().getBuildDir(), "api");
|
||||
}
|
||||
|
||||
@Input
|
||||
@InputFiles
|
||||
public FileCollection getSources() {
|
||||
return sources;
|
||||
}
|
||||
@ -64,7 +66,8 @@ public class ScanApi extends DefaultTask {
|
||||
this.sources.setFrom(sources);
|
||||
}
|
||||
|
||||
@Input
|
||||
@CompileClasspath
|
||||
@InputFiles
|
||||
public FileCollection getClasspath() {
|
||||
return classpath;
|
||||
}
|
||||
@ -106,16 +109,12 @@ public class ScanApi extends DefaultTask {
|
||||
|
||||
@TaskAction
|
||||
public void scan() {
|
||||
if (outputDir.isDirectory() || outputDir.mkdirs()) {
|
||||
try (Scanner scanner = new Scanner(classpath)) {
|
||||
for (File source : sources) {
|
||||
scanner.scan(source);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
getLogger().error("Failed to write API file", e);
|
||||
try (Scanner scanner = new Scanner(classpath)) {
|
||||
for (File source : sources) {
|
||||
scanner.scan(source);
|
||||
}
|
||||
} else {
|
||||
getLogger().error("Cannot create directory '{}'", outputDir.getAbsolutePath());
|
||||
} catch (IOException e) {
|
||||
getLogger().error("Failed to write API file", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user