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

Run build-logic Kotlin compilation out of process on CI #5162

Merged
merged 1 commit into from Aug 1, 2022

Conversation

3flex
Copy link
Member

@3flex 3flex commented Jul 31, 2022

Kotlin uses a compilation daemon by default. This is the fastest execution mode and usually preferred, because the Kotlin compilation environment can be setup once and reused.

However, it leaves the compilation daemon running for the lifetime of the Gradle daemon. Again, usually what we want, but in the case of the build-logic project which depends on kotlin-dsl, it will launch a Kotlin 1.6.21 daemon (matching Gradle's embedded Kotlin version) if the build-logic:compileKotlin task has to run, which cannot be reused by other compilation tasks (which use Kotlin 1.7.10). The 1.6.21 compilation daemon then remains in memory, unused.

This PR changes the compilation strategy to be out of process when running on CI. This means the 1.6.21 compilation environment is terminated as soon as the build-logic:compileKotlin task completes, which will free that memory for the remainder of the build.

I actually think this is a good trade off for all builds, not just on CI, but happy to hear thoughts on this.

@3flex
Copy link
Member Author

3flex commented Aug 1, 2022

Also note that this is an @Internal property so changes in its value are not considered for up to date checks or build caching - having a different setting for CI will not affect remote cache hits.

@cortinico cortinico added this to the 1.22.0 milestone Aug 1, 2022
@3flex 3flex merged commit 982d90b into detekt:main Aug 1, 2022
@3flex 3flex deleted the outofprocess branch August 1, 2022 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants