Use a dumber offlineLinks map but expose more structured information to gradle.

This commit is contained in:
Dawid Weiss 2021-11-01 21:58:16 +01:00
parent dab6e8454a
commit d14ee2d01e
1 changed files with 30 additions and 6 deletions

View File

@ -1,7 +1,5 @@
import org.gradle.internal.jvm.Jvm
import javax.annotation.Nullable
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -261,8 +259,26 @@ configure(project(':lucene:luke')) {
project.tasks.matching { it.name == 'renderSiteJavadoc' }.configureEach { it.enabled = false }
}
class OfflineLink implements Serializable {
@Input
String url
@InputDirectory
@PathSensitive(PathSensitivity.RELATIVE)
@IgnoreEmptyDirectories
File location
OfflineLink(String url, File location) {
this.url = url
this.location = location
}
}
@CacheableTask
class RenderJavadocTask extends DefaultTask {
@InputFiles
@PathSensitive(PathSensitivity.RELATIVE)
@IgnoreEmptyDirectories
@SkipWhenEmpty
SourceDirectorySet srcDirSet;
@ -284,8 +300,14 @@ class RenderJavadocTask extends DefaultTask {
@Input
boolean relativeProjectLinks = false
@Input
def offlineLinks = [:]
@Internal
Map<String, File> offlineLinks = [:]
// Computes cacheable inputs from the map in offlineLinks.
@Nested
List<OfflineLink> getCacheableOfflineLinks() {
return offlineLinks.collect { url, location -> new OfflineLink(url, location) }
}
@Input
@Optional
@ -312,8 +334,10 @@ class RenderJavadocTask extends DefaultTask {
final Property<String> executable = project.objects.property(String).convention(
project.provider { Jvm.current().javadocExecutable.toString() })
@Input
def taskResources
@InputDirectory
@PathSensitive(PathSensitivity.RELATIVE)
@IgnoreEmptyDirectories
File taskResources
/** Utility method to recursively collect all tasks with same name like this one that we depend on */
private Set findRenderTasksInDependencies() {