From b3dbdd33573b2871b5a9f58ba862b6fd24050326 Mon Sep 17 00:00:00 2001 From: Ben Liblit Date: Tue, 19 Dec 2017 12:04:00 -0600 Subject: [PATCH] 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. --- com.ibm.wala.util/build.gradle | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/com.ibm.wala.util/build.gradle b/com.ibm.wala.util/build.gradle index 1a33ef200..ce0d1cd1d 100644 --- a/com.ibm.wala.util/build.gradle +++ b/com.ibm.wala.util/build.gradle @@ -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')) + } +}