From eb2fa0e5f937626b3de8e5cf282282ca895a01db Mon Sep 17 00:00:00 2001 From: Kevin Gozali Date: Tue, 17 Nov 2020 18:26:00 -0800 Subject: [PATCH] Android OSS: Solve some Javadoc warning due to missing dependencies Summary: A bunch of deps were missing when generating Javadoc, producing warnings. One issue was: ``` project.getConfigurations().getByName("compile").asList() ``` Seems to be deprecated (?), so this list is always empty. The mitigation is to create a new configuration that just inherits from `api()` dependencies, so that we can add them in Javadoc task. The other problem (not solved in this commit), is that some deps are .aar files, which require some manual unpacking before they can be processed: https://stackoverflow.com/questions/35853906/how-to-generate-javadoc-for-android-library-when-it-has-dependencies-which-are-a Note that this is separate fix from https://github.com/facebook/react-native/pull/30417 Changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D25041164 fbshipit-source-id: 2ee8b268c2d38e3ecbf622c05c3c56123b7a15a6 --- ReactAndroid/build.gradle | 3 +++ ReactAndroid/release.gradle | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index 870e98c3b3eb63..de23560176ca54 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -447,6 +447,7 @@ android { configurations { extractHeaders extractJNI + javadocDeps.extendsFrom api } } @@ -467,6 +468,8 @@ dependencies { extractHeaders("com.facebook.fbjni:fbjni:0.0.2:headers") extractJNI("com.facebook.fbjni:fbjni:0.0.2") + javadocDeps("com.squareup:javapoet:1.13.0") + testImplementation("junit:junit:${JUNIT_VERSION}") testImplementation("org.powermock:powermock-api-mockito2:${POWERMOCK_VERSION}") testImplementation("org.powermock:powermock-module-junit4-rule:${POWERMOCK_VERSION}") diff --git a/ReactAndroid/release.gradle b/ReactAndroid/release.gradle index 8650a2088cec33..13727752d19690 100644 --- a/ReactAndroid/release.gradle +++ b/ReactAndroid/release.gradle @@ -76,8 +76,9 @@ afterEvaluate { project -> task androidJavadoc(type: Javadoc, dependsOn: generateReleaseBuildConfig) { source = android.sourceSets.main.java.srcDirs classpath += files(android.bootClasspath) - classpath += files(project.getConfigurations().getByName("compile").asList()) classpath += files("$buildDir/generated/source/buildConfig/release") + // Note: this doesn't handle .aar files, only .jar. + classpath += configurations.javadocDeps include("**/*.java") }