Skip to content

RUM-14050: Improve Gradle usage in Gitlab#3583

Merged
abrooksv merged 1 commit into
developfrom
abrooks/gradle-gitlab-optimizations
Jun 30, 2026
Merged

RUM-14050: Improve Gradle usage in Gitlab#3583
abrooksv merged 1 commit into
developfrom
abrooks/gradle-gitlab-optimizations

Conversation

@abrooksv

@abrooksv abrooksv commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

  • Add setup-gradle snippet that centralizes all Gradle config by appending to gradle.properties at job setup time, replacing per-job GRADLE_OPTS boilerplate across all jobs
  • Unify JVM memory to -Xmx4096m for all jobs (was inconsistently 3072m or 4096m per-job)
  • Remove get_secret gradle.properties injection from publishing/sample jobs
  • Remove --build-cache flags (redundant with org.gradle.caching=true in gradle.properties)
  • Remove rm -rf ~/.gradle/daemon/ from all jobs since we don't cache it and each job gets a new container
  • Fix cache cleanup to only run on test:kover (the only cache-push job) via GRADLE_CACHE_CLEANUP variable, disabled on all pull-only jobs
  • Fix unzipAarForDetekt task to declare its dependency on bundleReleaseAar using provider-based wiring instead of a hardcoded output path
  • Drop kotlin.incremental=true due to it is already the default
  • Enable parallel mode, disable it for jobs that invoke tasks that can't run in parallel mode

Motivation

Standardize the Gradle usage a bit

@abrooksv
abrooksv force-pushed the abrooks/gradle-gitlab-optimizations branch 3 times, most recently from 33f5a09 to 96a96dd Compare June 26, 2026 18:05
@codecov-commenter

codecov-commenter commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.78%. Comparing base (7c4778b) to head (5b9b127).
⚠️ Report is 7 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3583      +/-   ##
===========================================
- Coverage    72.78%   72.78%   -0.00%     
===========================================
  Files          974      974              
  Lines        35225    35232       +7     
  Branches      5968     5966       -2     
===========================================
+ Hits         25636    25641       +5     
+ Misses        7919     7915       -4     
- Partials      1670     1676       +6     

see 48 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@abrooksv
abrooksv force-pushed the abrooks/gradle-gitlab-optimizations branch 4 times, most recently from 7613bcc to 0654a53 Compare June 26, 2026 22:33
@abrooksv abrooksv changed the title Improve Gradle usage in Gitlab RUM-14050: Improve Gradle usage in Gitlab Jun 26, 2026
@abrooksv
abrooksv force-pushed the abrooks/gradle-gitlab-optimizations branch 2 times, most recently from 1a67f98 to 649e5c3 Compare June 26, 2026 22:36
@abrooksv
abrooksv marked this pull request as ready for review June 26, 2026 23:13
@abrooksv
abrooksv requested review from a team as code owners June 26, 2026 23:13
@abrooksv
abrooksv requested a review from hamorillo June 26, 2026 23:14

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 649e5c3efd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ci/pipelines/default-pipeline.yml
@abrooksv
abrooksv force-pushed the abrooks/gradle-gitlab-optimizations branch 2 times, most recently from 1e82be8 to 841bcde Compare June 27, 2026 00:52

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 841bcde19b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread gradle.properties
Comment thread ci/pipelines/default-pipeline.yml
@abrooksv
abrooksv force-pushed the abrooks/gradle-gitlab-optimizations branch from 841bcde to 6929cda Compare June 27, 2026 02:36
@abrooksv
abrooksv marked this pull request as draft June 27, 2026 02:43

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6929cdad1b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread gradle.properties

@hamorillo hamorillo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice changes!

We are dropping DD_ANDROID_SECRET__GRADLE_PROPERTIES and moving almost all the config to the repo files, which looks good to me. Just a couple of questions:

❓ Should we remove DD_ANDROID_SECRET__GRADLE_PROPERTIES when the PR is merged? Maybe it is still used in other places, though.

❓ What about kotlin.incremental=true and kotlin.compiler.execution.strategy=in-process? They were in the previous gradle.properties, but we are not mentioning anything about them in the PR.

@abrooksv

abrooksv commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

DD_ANDROID_SECRET__GRADLE_PROPERTIES

@hamorillo I think we can safely delete it
GitHub search does not showit being used outside our repo
https://github.com/search?q=org%3ADataDog+DD_ANDROID_SECRET__GRADLE_PROPERTIES&type=code

we should probably keep it till we publish a release and make sure we don't need to revert

kotlin.compiler.execution.strategy

The default is daemon so I guess we should bring this one back

kotlin.incremental

This looks to be the default of true since 1.1.1 so I think its safe to remove it 😄

@abrooksv
abrooksv force-pushed the abrooks/gradle-gitlab-optimizations branch 5 times, most recently from 7e234ea to 6867456 Compare June 29, 2026 16:46
@abrooksv
abrooksv marked this pull request as ready for review June 29, 2026 17:34
@abrooksv
abrooksv requested a review from hamorillo June 29, 2026 17:48
hamorillo
hamorillo previously approved these changes Jun 30, 2026

@hamorillo hamorillo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we should probably keep it till we publish a release and make sure we don't need to revert

Sounds good!

Comment thread local_ci.sh Outdated
# Assemble is required to get generated classes type resolution
echo "------ Assemble Libraries & Build Detekt custom rules"
./gradlew assembleLibrariesDebug printSdkDebugRuntimeClasspath :tools:detekt:jar
./gradlew assembleLibrariesDebug printSdkDebugRuntimeClasspath :tools:detekt:jar --no-parallel

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need --no-parallel here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok, I got it now, it is needed for printSdkDebugRuntimeClasspath. But we should be able to run assembleLibrariesDebug in parallel I think.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are correct. I'll need to split the gradllew into two invokes but that is probably fine

@hamorillo hamorillo Jun 30, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good catch @aleksandr-gringauz.

but that is probably fine

Agree.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment thread ci/pipelines/default-pipeline.yml
Comment thread ci/pipelines/default-pipeline.yml Outdated
- !reference [.snippets, set-publishing-credentials]
- ./gradlew publishToSonatype closeSonatypeStagingRepository --stacktrace --no-daemon
- !reference [.snippets, setup-gradle]
- ./gradlew publishToSonatype closeSonatypeStagingRepository

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

very very nit:

Just to be extra careful I would probably add --no-build-cache to this gradle command so that cache is 100% not used in the build of our release.

Yes, I understand that it will not be used because we don't attach the cache artifacts to this job, but still.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added

Comment thread local_ci.sh Outdated
# Assemble is required to get generated classes type resolution
echo "------ Assemble Libraries & Build Detekt custom rules"
./gradlew assembleLibrariesDebug printSdkDebugRuntimeClasspath :tools:detekt:jar
./gradlew assembleLibrariesDebug printSdkDebugRuntimeClasspath :tools:detekt:jar --no-parallel

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok, I got it now, it is needed for printSdkDebugRuntimeClasspath. But we should be able to run assembleLibrariesDebug in parallel I think.

- Add setup-gradle snippet that centralizes all Gradle config by appending to gradle.properties at job setup time, replacing per-job GRADLE_OPTS boilerplate across all jobs
- Unify JVM memory to -Xmx4096m for all jobs (was inconsistently 3072m or 4096m per-job)
- Remove get_secret gradle.properties injection from publishing/sample jobs
- Remove --build-cache flags (redundant with org.gradle.caching=true in gradle.properties)
- Remove rm -rf ~/.gradle/daemon/ from all jobs since jobs get a new container and we don't cache it
- Fix cache cleanup to only run on test:kover (the only cache-push job) via GRADLE_CACHE_CLEANUP variable, disabled on all pull-only jobs
- Fix unzipAarForDetekt task to declare its dependency on bundleReleaseAar using provider-based wiring instead of a hardcoded output path
- Drop `kotlin.incremental=true` due to it is already the default
- Enable parallel mode, disable it for jobs that invoke tasks that can't run in parallel mode
@abrooksv
abrooksv force-pushed the abrooks/gradle-gitlab-optimizations branch from 6867456 to 5b9b127 Compare June 30, 2026 14:03
@abrooksv
abrooksv merged commit 93ad35e into develop Jun 30, 2026
27 checks passed
@abrooksv
abrooksv deleted the abrooks/gradle-gitlab-optimizations branch June 30, 2026 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants