Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Gradle tasks to generate Javadoc #39

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ jobs:
working-directory: divviup/rust
run: cargo clippy
- name: Build and test
run: ./gradlew build
# Note that `connectedCheck` is skipped for now, because setting up an
# emulator is nontrivial.
run: ./gradlew build generateReleaseJavadoc

dependency-review:
if: github.event_name == 'pull_request'
Expand Down
11 changes: 11 additions & 0 deletions divviup/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,14 @@ tasks.withType<Test>().matching { it.name.matches(Regex("test.*UnitTest"))}.conf
val capitalizedHostRustTarget = hostRustTarget.replaceFirstChar { it.uppercase() }
dependsOn(tasks.named("cargoBuild${capitalizedHostRustTarget}"))
}

afterEvaluate {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: why does this need to be in an afterEvaluate block?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is necessary for android.libraryVariants. If we were to run this earlier, that set would be empty, but waiting for after evaluation lets AGP set up the debug and release variants first.

android.libraryVariants.forEach { variant ->
val capitalizedVariantName = variant.name.replaceFirstChar { it.uppercase() }
tasks.register<Javadoc>("generate${capitalizedVariantName}Javadoc") {
source = android.sourceSets["main"].java.getSourceFiles()
classpath += files(android.bootClasspath)
classpath += files(variant.compileConfiguration)
}
}
}
Loading