Fix a tricky cross-subproject Javadoc dependency

By default, each subproject's Javadoc task depends on the same
subproject's Java compilation task, and uses the same classpath.
Thus, any classes that some Java code uses will also be visible when
building the same Java code's documentation.

In this case, we need to see one of the "com.ibm.wala.core" classes in
order to build the "com.ibm.wala.util" documentation.  However, we
cannot have Java compilation of "com.ibm.wala.util" depend on Java
compilation of "com.ibm.wala.core", because that would create a
dependency cycle.  So we need to add this as a special dependency just
for the "com.ibm.wala.util" documentation task, and add the
appropriate classpath as well.

I'm quite proud of myself for figuring out how to do this properly.
This commit is contained in:
Ben Liblit 2017-12-19 12:04:00 -06:00
parent ad60605fe8
commit b3dbdd3357
1 changed files with 8 additions and 0 deletions

View File

@ -1 +1,9 @@
sourceSets.main.java.srcDir 'src'
tasks.javadoc {
dependsOn ':com.ibm.wala.core:compileJava'
doFirst {
classpath += files(new File(project(':com.ibm.wala.core').buildDir, 'classes/java/main'))
}
}