Skip to content

Commit

Permalink
Android OSS: Solve some Javadoc warning due to missing dependencies
Browse files Browse the repository at this point in the history
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 facebook#30417

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D25041164

fbshipit-source-id: 2ee8b268c2d38e3ecbf622c05c3c56123b7a15a6
  • Loading branch information
fkgozali authored and hsource committed Apr 15, 2022
1 parent a22a5de commit eb2fa0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ReactAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ android {
configurations {
extractHeaders
extractJNI
javadocDeps.extendsFrom api
}
}

Expand All @@ -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}")
Expand Down
3 changes: 2 additions & 1 deletion ReactAndroid/release.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down

0 comments on commit eb2fa0e

Please sign in to comment.