diff --git a/src/main/kotlin/com/goodanser/clj_android/gradle/ClojureCompileTask.kt b/src/main/kotlin/com/goodanser/clj_android/gradle/ClojureCompileTask.kt index 07c32bc..8611269 100755 --- a/src/main/kotlin/com/goodanser/clj_android/gradle/ClojureCompileTask.kt +++ b/src/main/kotlin/com/goodanser/clj_android/gradle/ClojureCompileTask.kt @@ -64,6 +64,16 @@ abstract class ClojureCompileTask @Inject constructor( execOperations.javaexec { mainClass.set("clojure.lang.Compile") + // Prepend the destination directory so that classes generated by + // earlier-compiled namespaces (e.g. gen-class'd classes such as a + // wallpaper Engine or Worker) are resolvable via the classloader + // when a later namespace references them (via :import or a direct + // constructor call) during its own compilation. Without this, the + // output dir is only the *destination* (clojure.compile.path) and + // is not a classpath root, so a sibling namespace's generated + // classes cannot be loaded — producing ClassNotFoundException at + // AOT time. + classpath(destinationDir) classpath(effectiveClasspath) systemProperty("clojure.compile.path", destDir.absolutePath) systemProperty(