-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
KTOR-8344 Enable build cache for settings plugins #4745
Conversation
WalkthroughThe pull request integrates and configures the Develocity plugin in the Gradle build settings. It adds a new plugin dependency with a specified version, sets a hardcoded server URL in the Develocity configuration, and introduces an Changes
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
build-settings-logic/settings.gradle.kts
(2 hunks)build-settings-logic/src/main/kotlin/customization.kt
(0 hunks)build-settings-logic/src/main/kotlin/execute.kt
(0 hunks)build-settings-logic/src/main/kotlin/ktorbuild.develocity.settings.gradle.kts
(3 hunks)build-settings-logic/src/main/kotlin/params.kt
(0 hunks)gradle.properties
(0 hunks)settings.gradle.kts
(1 hunks)
💤 Files with no reviewable changes (4)
- gradle.properties
- build-settings-logic/src/main/kotlin/execute.kt
- build-settings-logic/src/main/kotlin/params.kt
- build-settings-logic/src/main/kotlin/customization.kt
🔇 Additional comments (8)
settings.gradle.kts (1)
10-12
: Plugin ID Update: Replacing Deprecated Plugin
The plugin declaration on line 12 has been updated from the oldconventions-develocity
toktorbuild.develocity
. This change appears intentional for aligning with the new build cache strategy. Please double-check that all downstream configurations now reference the new plugin ID.build-settings-logic/settings.gradle.kts (3)
5-7
: New Develocity Plugin Dependency Added
A new plugin dependency (com.gradle.develocity
version3.17.6
) has been introduced. This is aligned with the PR objective to use the develocity plugin for build caching. Everything looks good—just confirm that the version is validated against your CI requirements.
19-24
: Consistent Develocity Configuration
Thedevelocity
block sets the server URL explicitly to"https://ge.jetbrains.com"
, with an inline comment noting that this should be in sync with the configuration inktorbuild.develocity.settings.gradle.kts
. This consistency is key; please ensure that any future changes in one of these files are mirrored in the other.
25-37
: Build Cache Configuration Based on CI Environment
The introduction of theisCIRun
variable—by checking forTEAMCITY_VERSION
—and the conditional build cache settings are well implemented. Disabling the local cache on CI (lines 27-31) and enabling remote caching (lines 33-36) aligns with the goal of optimizing build times.build-settings-logic/src/main/kotlin/ktorbuild.develocity.settings.gradle.kts (4)
2-3
: Copyright Update
The copyright year has been updated from 2024 to 2025 on line 2. This is a standard update reflecting the current year.
12-13
: CI Environment Variable Setup
The new variableisCIRun
is introduced to determine if the build is running in a CI environment. Its usage here is consistent with the configuration inbuild-settings-logic/settings.gradle.kts
.
18-20
: Develocity Server Configuration Alignment
Thedevelocity
block now sets the server URL explicitly to"https://ge.jetbrains.com"
(lines 18–19), maintaining consistency with the root settings file. This clarity helps prevent misconfigurations across environments.
45-56
: Consistent Remote Build Cache Configuration
The build cache configuration in lines 45–56 mirrors the pattern established in the parent settings file. Disabling the local cache when running in a CI environment and setting remote cache properties accordingly is consistent and should provide the desired performance benefits.
build-settings-logic/src/main/kotlin/ktorbuild.develocity.settings.gradle.kts
Outdated
Show resolved
Hide resolved
import com.gradle.develocity.agent.gradle.DevelocityConfiguration | ||
import org.gradle.api.initialization.Settings | ||
|
||
fun Settings.enrichTeamCityData() { |
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.
Why did you remove all this?
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.
as they're already done in common-custom-user-data-gradle-plugin.
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
build-settings-logic/src/main/kotlin/ktorbuild.develocity.settings.gradle.kts (1)
14-20
: Server Configuration and Initialization
In this segment, the develocity block sets up necessary parameters such asstartParameter
andscanJournal
and defines a hardcoded server URL ("https://ge.jetbrains.com"
). While this meets the current requirements, consider externalizing the server URL in the future if environmental flexibility is needed.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
build-settings-logic/src/main/kotlin/ktorbuild.develocity.settings.gradle.kts
(1 hunks)gradle.properties
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- gradle.properties
🔇 Additional comments (8)
build-settings-logic/src/main/kotlin/ktorbuild.develocity.settings.gradle.kts (8)
7-10
: Plugins Declaration: Well-Defined and Targeted
The plugins declared (com.gradle.develocity
andcom.gradle.common-custom-user-data-gradle-plugin
) are appropriate for enabling the shared build cache and build scan functionalities as per the PR objectives.
12-12
: CI Run Detection is Correctly Implemented
The variableisCIRun
correctly detects the presence of theTEAMCITY_VERSION
environment variable, enabling CI-specific logic throughout the configuration.
21-23
: Build Scan Upload Behavior Based on CI Environment
SettinguploadInBackground
to!isCIRun
ensures that in CI environments, the build scan upload is handled synchronously. This aligns well with the intended CI behavior where immediate feedback is often preferable.
24-43
: Obfuscation Logic for User Information
The obfuscation block uses a clearwhen
clause to conditionally mask user details based on whether the build is running in CI or if overridden properties are provided. The logic is readable and correctly leverages Kotlin's null-safe functions.
45-48
: File Fingerprint Capture Enabled
Enabling file fingerprint capture throughfileFingerprints = true
is a sound decision to enhance the integrity and traceability of the build scans.
49-51
: Build Scan Publication Logging
Appending detailed scan information (including a timestamp, scan URI, and the start parameters) to a log file is an effective way to audit the build process. This will be beneficial for debugging and historical reference.
53-57
: Conditional Publishing Control for Build Scans
The configuration forskipBuildScans
uses the Gradle property"ktor.develocity.skipBuildScans"
and converts it via.toBoolean()
. Given Kotlin's null-safe extension forString?.toBoolean()
, this approach is safe and concise. The subsequentpublishing.onlyIf { !skipBuildScans }
correctly applies this condition.
61-72
: Build Cache Configuration for CI Optimization
ThebuildCache
block is well structured: it disables local caching in CI by checkingisCIRun
and enables remote caching with push permissions accordingly. This directly supports the PR objective of reducing CI configuration times.
Subsystem
Infrastructure
Motivation
KTOR-8344 Enable shared build cache for build-settings-logic
Solution
Enabled build cache for
build-settings-logic
.This should reduce configuration times on CI by ~20 seconds (2 + 13 + 4) for all builds.
Also:
common-custom-user-data-gradle-plugin
.