Skip to content

Make plugin-management repositories in the init script configurable#59

Merged
andrewparmet merged 4 commits into
open-toast:mainfrom
andrewparmet:plugin-repo
May 21, 2026
Merged

Make plugin-management repositories in the init script configurable#59
andrewparmet merged 4 commits into
open-toast:mainfrom
andrewparmet:plugin-repo

Conversation

@andrewparmet

@andrewparmet andrewparmet commented May 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Today the testkit-injected init script always uses gradlePluginPortal() for plugins not in the on-disk integration repo. Projects can't opt out of hitting the public rate-limiting repos.

This PR adds pluginRepositories to TestkitExtension. When non-empty, the listed Maven URLs replace gradlePluginPortal() in the generated init script. When empty (the default), behavior is unchanged.

testkitTests {
    pluginRepositories.add("https://nexus.example.com/repository/gradle-plugins/")
}

Wired through as a new testkit-plugin-repositories system property on the Test task, consumed by TestProjectExtension when emitting the pluginManagement.repositories block.

aparmet-toast and others added 2 commits May 20, 2026 17:50
Today, the testkit-injected init script always falls back to
gradlePluginPortal() for plugins not in the on-disk integration repo.
Projects with strict policies against the public Plugin Portal — e.g.
those that resolve everything through an internal Maven mirror — can't
opt out without forking testkit.

Add `pluginRepositories` to `TestkitExtension`. When non-empty, the
listed Maven URLs replace gradlePluginPortal() in the generated init
script. When empty (the default), behavior is unchanged.

Wired through as a new `testkit-plugin-repositories` system property
on the Test task, consumed by TestProjectExtension when emitting the
pluginManagement.repositories block.
Removed the comment block explaining the pluginRepositories property.
@andrewparmet andrewparmet marked this pull request as ready for review May 21, 2026 16:37
aparmet-toast and others added 2 commits May 21, 2026 12:44
# Conflicts:
#	junit5/src/main/kotlin/com/toasttab/gradle/testkit/TestProjectExtension.kt
@andrewparmet andrewparmet merged commit 45525c5 into open-toast:main May 21, 2026
1 check passed
@andrewparmet andrewparmet deleted the plugin-repo branch May 21, 2026 17:14
andrewparmet added a commit that referenced this pull request May 25, 2026
…urable (#59) (#63)

Reverts #59.

`extension.pluginRepositories.getOrElse(emptyList())` is read inside the
`tasks.named<Test>(\"test\") { ... }` configuration block. When the test
task gets realized eagerly (e.g. by \`kotlin-dsl\` configuring its test
source set during plugin application), the extension's `ListProperty`
hasn't been mutated by the user's \`configure<TestkitExtension> {
pluginRepositories.add(...) }\` block yet, so we read an empty list,
never set the system property, and the init script falls back to
`gradlePluginPortal()`.

Downstream configured `testkitTests.pluginRepositories` and the
resulting init script still contained `gradlePluginPortal()` instead of
the configured URL.

A correct implementation might defer the read to task execution time
using `jvmArgumentProviders.add { ... }` or `Provider.map { ... }`.
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.

3 participants