Skip to content

Commit

Permalink
[Gradle] Add runtime dependencies to Javadocs classpath to fix failure
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 448966435
  • Loading branch information
dsn5ft committed May 16, 2022
1 parent 65e7506 commit 188ea55
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/build.gradle
Expand Up @@ -217,6 +217,7 @@ task generateJdiffReport(type: Javadoc) {
}

def R_CLASS_PATH = "build/generated/not_namespaced_r_class_sources/releaseUnitTest/processReleaseUnitTestResources/r/com/google/android/material/R.java"
Attribute<String> ARTIFACT_TYPE = Attribute.of("artifactType", String.class)
afterEvaluate {
[generateJavadocs, generateApiXml].forEach { task ->
task.dependsOn(':lib:processReleaseUnitTestResources')
Expand All @@ -226,6 +227,13 @@ afterEvaluate {
if (releaseVariant == null) {
return
}

// Add transitive runtime dependencies to classpath
task.classpath += releaseVariant.runtimeConfiguration.incoming.artifactView { aView ->
aView.attributes.attribute(ARTIFACT_TYPE, "android-classes")
}.files

// Add project and compile dependencies to classpath
releaseVariant.javaCompileProvider.configure { javaCompileProvider ->
task.classpath += releaseVariant.getCompileClasspath(null)
task.classpath += task.project.files(javaCompileProvider.destinationDir)
Expand Down

0 comments on commit 188ea55

Please sign in to comment.