feat(plugin): make graphqlGenerateSDL worker JVM args configurable#2182
Open
Norman-Nam wants to merge 2 commits into
Open
feat(plugin): make graphqlGenerateSDL worker JVM args configurable#2182Norman-Nam wants to merge 2 commits into
Norman-Nam wants to merge 2 commits into
Conversation
GraphQLGenerateSDLTask runs SDL generation in a process-isolated worker
whose forkOptions only set the executable, so the worker uses the Gradle
default heap and cannot be tuned. Large schemas exhaust it and fail with
an OutOfMemoryError, with no supported way to raise the heap.
Add an optional jvmArguments property to the task, applied to the worker
forkOptions, and expose it via the `graphql { schema { } }` DSL. Defaults
to an empty list, so existing behavior is unchanged.
Closes ExpediaGroup#2181
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
||
| val generateSchemaTask = project.tasks.named(GENERATE_SDL_TASK_NAME, GraphQLGenerateSDLTask::class.java).get() | ||
| generateSchemaTask.packages.set(supportedPackages) | ||
| generateSchemaTask.jvmArguments.set(extension.schemaExtension.jvmArguments) |
Contributor
There was a problem hiding this comment.
this will reset graphqlGenerateSDL.jvmArguments to [] whenever users configure:
graphql {
schema {
packages = listOf("com.example")
}
}even if they also configure the task directly:
tasks.named<GraphQLGenerateSDLTask>("graphqlGenerateSDL") {
vmArguments.set(listOf("-Xmx4g"))
}…r args Wire the SDL worker jvmArguments from the schema extension via convention() instead of set() so values configured directly on graphqlGenerateSDL are no longer clobbered by the extension default. Log allJvmArgs so managed options such as -Xmx (stored as maxHeapSize, absent from jvmArgs) are visible. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
GraphQLGenerateSDLTaskruns SDL generation in a process-isolated worker (workerExecutor.processIsolation), but the worker'sforkOptionsonly set the executable — there is no way to configure its heap or any other JVM argument. The worker therefore runs with the Gradle default heap, and large schemas exhaust it and fail withjava.lang.OutOfMemoryError: Java heap spacewith no supported workaround.This PR adds an optional
jvmArgumentsproperty toGraphQLGenerateSDLTask, applies it to the worker'sforkOptions, and exposes it through thegraphql { schema { } }DSL (and the--jvm-argsCLI option).graphql { schema { packages = listOf("com.example") jvmArguments = listOf("-Xmx2g") } }It defaults to an empty list, so existing builds are unaffected.
Closes #2181
🔗 Related Issues
Closes #2181
✅ Checklist
GraphQLGenerateSDLTaskTest: default value + DSL → task propagation)gradle-plugin-tasks.mdx,gradle-plugin-usage-sdl.mdx)./gradlew :graphql-kotlin-gradle-plugin:check ktlintCheck detektpass locallyjvmArgumentsis unset)🤖 Generated with Claude Code