Skip to content

Use configureEach on tasks.withType - #9868

Open
FletchMcKee wants to merge 1 commit into
lysine-dev:mainfrom
FletchMcKee:configure-tasks-lazily
Open

FletchMcKee wants to merge 1 commit into
lysine-dev:mainfrom
FletchMcKee:configure-tasks-lazily

Conversation

@FletchMcKee

Copy link
Copy Markdown

See Gradle's Avoiding Unnecessary Task Configuration guide for more information.

The tasks.withType<JavaCompile> in okhttp.jvm-conventions.gradle.kts has to remain eager for now. Making it lazy results in this failure:

* What went wrong:
Execution failed for task ':okhttp:jvmJar' (registered in build file 'okhttp/build.gradle.kts').
> Cannot query the value of this property because it has no value available.

I can look into this if desired, but this is a start.

Comment thread okhttp/build.gradle.kts
Comment on lines -266 to -268
// Work around robolectric requirements and limitations
// https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:build-system/gradle-core/src/main/java/com/android/build/gradle/tasks/factory/AndroidUnitTest.java;l=339
allJvmArgs = allJvmArgs.filter { !it.startsWith("--add-opens") }

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It looks like this was bumped to 17 in AndroidUnitTest which is why I removed the < 9 logic. If this is wrong I can add that back.

okhttp.testing-conventions.gradle.kts sets the javaLauncher to this testJavaVersion so we shouldn't need to resolve the javaLauncher to find the version.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants