-
-
Notifications
You must be signed in to change notification settings - Fork 452
Aggregate javadoc using build-logic #4457
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
base: main
Are you sure you want to change the base?
Conversation
build.gradle.kts
Outdated
@@ -246,31 +247,6 @@ spotless { | |||
} | |||
} | |||
|
|||
tasks.register("aggregateJavadocs", Javadoc::class.java) { | |||
setDestinationDir(project.layout.buildDirectory.file("docs/javadoc").get().asFile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would previously put all the javadocs from all subprojects in the root which meant a lot of the files were overwritten like index.html
.
f4724d7
to
d4be83a
Compare
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
283a4b4 | 406.41 ms | 475.78 ms | 69.37 ms |
ba39ab5 | 463.60 ms | 488.32 ms | 24.72 ms |
a151608 | 459.64 ms | 525.40 ms | 65.76 ms |
79d6db9 | 389.84 ms | 421.86 ms | 32.02 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
283a4b4 | 1.58 MiB | 2.08 MiB | 510.85 KiB |
ba39ab5 | 1.58 MiB | 2.08 MiB | 510.84 KiB |
a151608 | 1.58 MiB | 2.08 MiB | 510.84 KiB |
79d6db9 | 1.58 MiB | 2.08 MiB | 510.84 KiB |
c2dbb1e
to
2651164
Compare
@@ -237,7 +238,7 @@ spotless { | |||
kotlin { | |||
target("**/*.kt") | |||
ktlint() | |||
targetExclude("**/sentry-native/**") | |||
targetExclude("**/sentry-native/**", "**/build/**") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to add this exclusion otherwise spotless tries to format the generated code in the build
folder. This was causing an issue since the generated accessors have an underscore (_
) in the path name and this is was failing the check.
This PR has a few parts to it: 1. Adds a new `build-logic` module to organize our build logic. 2. Adds two convention plugins. - `sentry.javadoc` publishes the javadoc to a consumable configuration. - `sentry.javadoc.aggregate` consumes the published javadoc and aggregates them in the root build folder. 3. Deletes the `stylesheet.css`. This was causing the javadoc to look unusable. Deleting it fixes this. 4. Each subproject publishes the javadoc to its own subfolder. The previous behavior would overwrite the javadoc with each new project in the same directory which meant some parts of the javadoc were unreachable. The producer/consumer configuration is based on this blog post: https://www.liutikas.net/2024/12/11/Together-In-Isolation.html It should be project isolation compatible.
2651164
to
3414ddc
Compare
fs.copy { | ||
// Get the third to last part (project name) to use as the directory name for the output | ||
val parts = file.path.split('/') | ||
val projectName = parts[parts.size - 4] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be some safety around this in case the parts.size
is < 4?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good point. To be honest, this logic is a bit hacky. The ArtifactView
has this information as the component idenitifer, but I can’t have the ArtifactView as an input to the task since it isn’t serializeable. This was my hack around this.
Since these are fully qualified paths it is nearly impossible for them to be less than 4. If they are then we should fail and investigate. The bigger issue is if these are not the project names but I’m not sure how to check for that.
b2401ba
to
1e77db3
Compare
1e77db3
to
9aecae9
Compare
📜 Description
This PR has a few parts to it:
build-logic
module to organize our build logic.sentry.javadoc
publishes the javadocto a consumable configuration.
sentry.javadoc.aggregate
consumes the published javadoc andaggregates them in the root build folder.
stylesheet.css
. This was causing the javadoc to lookunusable. Deleting it fixes this.
previous behavior would overwrite the javadoc with each new project
in the same directory which meant some parts of the javadoc were
unreachable.
The producer/consumer configuration is based on this blog post: https://www.liutikas.net/2024/12/11/Together-In-Isolation.html
It should be project isolation compatible.
Here is what the javadoc looks like right now: https://getsentry.github.io/sentry-java/

This is what the javadoc will look like without the stylesheet:
💡 Motivation and Context
The previous mechanism for publishing javadoc was broken because it combines the classpath of all subproject dependencies leading to some version conflicts. This is why the publication was disabled here: #4445
💚 How did you test it?
I checked the build folder that the correct javadoc was published but wasn't able to test the github action.
📝 Checklist
sendDefaultPII
is enabled.🔮 Next steps