mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 03:57:51 +02:00
Fix javadoc problems with SoyInfo and subprojects (#1326)
* Fix javadoc problems with SoyInfo and subprojects The *SoyInfo.java files generated by the soy compiler contain deprecation warnings with links to files that are not imported. This causes a javadoc warning. Temporarily fix this by replacing the link tags with "LINK". This also allows us to remove the exclusion of these files, which is a bit nicer. Also disable javadoc tasks from subprojects. These just break because they don't have access to the legacy javadoc classes in the root.
This commit is contained in:
parent
92b83a9d7a
commit
0afef0fb82
2 changed files with 28 additions and 2 deletions
14
build.gradle
14
build.gradle
|
@ -457,8 +457,6 @@ task javaIncrementalFormatApply {
|
||||||
task javadoc(type: Javadoc) {
|
task javadoc(type: Javadoc) {
|
||||||
source javadocSource
|
source javadocSource
|
||||||
classpath = files(javadocClasspath)
|
classpath = files(javadocClasspath)
|
||||||
// Exclude the misbehaving generated-by-Soy Java files
|
|
||||||
exclude "**/*SoyInfo.java"
|
|
||||||
destinationDir = file("${buildDir}/docs/javadoc")
|
destinationDir = file("${buildDir}/docs/javadoc")
|
||||||
options.encoding = "UTF-8"
|
options.encoding = "UTF-8"
|
||||||
// In a lot of places we don't write @return so suppress warnings about that.
|
// In a lot of places we don't write @return so suppress warnings about that.
|
||||||
|
@ -483,3 +481,15 @@ task coreDev {
|
||||||
}
|
}
|
||||||
|
|
||||||
javadocDependentTasks.each { tasks.javadoc.dependsOn(it) }
|
javadocDependentTasks.each { tasks.javadoc.dependsOn(it) }
|
||||||
|
|
||||||
|
// disable javadoc in subprojects, these will break because they don't have
|
||||||
|
// the correct classpath (see above).
|
||||||
|
gradle.taskGraph.whenReady { graph ->
|
||||||
|
graph.getAllTasks().each { task ->
|
||||||
|
def subprojectJavadoc = (task.path =~ /:.+:javadoc/)
|
||||||
|
if (subprojectJavadoc) {
|
||||||
|
println "Skipping ${task.path} for javadoc (only root javadoc works)"
|
||||||
|
task.enabled = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -457,6 +457,22 @@ task soyToJava {
|
||||||
"--srcs", "${soyFiles.join(',')}",
|
"--srcs", "${soyFiles.join(',')}",
|
||||||
"--compileTimeGlobalsFile", "${resourcesSourceDir}/google/registry/ui/globals.txt"
|
"--compileTimeGlobalsFile", "${resourcesSourceDir}/google/registry/ui/globals.txt"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Replace the "@link" tags after the "@deprecated" tags in the generated
|
||||||
|
// files. The soy compiler doesn't generate imports for these, causing
|
||||||
|
// us to get warnings when we generate javadocs.
|
||||||
|
// TODO(b/200296387): To be fair, the deprecations are accurate: we're
|
||||||
|
// using the old "SoyInfo" classes instead of the new "Templates" files.
|
||||||
|
// When we convert to the new classes, this hack can go away.
|
||||||
|
def outputs = fileTree(outputDirectory) {
|
||||||
|
include '**/*.java'
|
||||||
|
}
|
||||||
|
|
||||||
|
outputs.each { file ->
|
||||||
|
exec {
|
||||||
|
commandLine 'sed', '-i', 's/@link/LINK/g', file.getCanonicalPath()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
|
|
Loading…
Add table
Reference in a new issue