-
Notifications
You must be signed in to change notification settings - Fork 1
Providing toolchain compatibility #289
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,31 +9,52 @@ import org.junit.jupiter.api.Test | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| class SettingsGradleTest { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fun `does not include plugins block when additionalSettingsPlugins is empty and develocity is false`() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val versions = Versions(additionalSettingsPlugins = emptyList()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val result = SettingsGradle().get(versions, develocity = false, projectName = "testProject") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fun `includes default settings plugins when using default versions`() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val result = SettingsGradle().get(Versions(), develocity = false, projectName = "testProject") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assertFalse( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assertTrue( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| result.contains("plugins {"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "settings.gradle.kts should not contain plugins block when additionalSettingsPlugins is empty and develocity is false" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "settings.gradle.kts should contain a plugins block when default settings plugins are configured" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assertFalse( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| result.contains("spotlight") || result.contains("com.fueledbycaffeine.spotlight"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "settings.gradle.kts should not contain Spotlight when additionalSettingsPlugins is empty" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assertTrue( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| result.contains("org.gradle.toolchains.foojay-resolver-convention"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "settings.gradle.kts should include the Foojay toolchain resolver plugin by default" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assertTrue( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| result.contains("com.fueledbycaffeine.spotlight"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "settings.gradle.kts should include Spotlight by default" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fun `includes settings plugins when additionalSettingsPlugins is provided`() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val versions = Versions( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| additionalSettingsPlugins = listOf( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AdditionalPlugin("org.gradle.toolchains.foojay-resolver-convention", "1.0.0"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AdditionalPlugin("com.fueledbycaffeine.spotlight", "1.4.1") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val result = SettingsGradle().get(versions, develocity = false, projectName = "testProject") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assertTrue(result.contains("plugins {")) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assertTrue(result.contains("org.gradle.toolchains.foojay-resolver-convention")) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assertTrue(result.contains("com.fueledbycaffeine.spotlight")) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assertTrue(result.contains("1.4.1")) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fun `does not include foojay or spotlight when additionalSettingsPlugins is empty`() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val versions = Versions(additionalSettingsPlugins = emptyList()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val result = SettingsGradle().get(versions, develocity = false, projectName = "testProject") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assertFalse( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| result.contains("org.gradle.toolchains.foojay-resolver-convention"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "settings.gradle.kts should not contain Foojay when additionalSettingsPlugins is empty" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assertFalse( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| result.contains("spotlight") || result.contains("com.fueledbycaffeine.spotlight"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "settings.gradle.kts should not contain Spotlight when additionalSettingsPlugins is empty" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+46
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This is also directly contradicted by the new assertion added in The test name and assertions need to be reconciled with the actual production behavior. The test should either:
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
Because
SettingsGradle.ktnow hardcodes foojay unconditionally (line 9), and this test also adds foojay toadditionalSettingsPlugins, the generatedplugins {}block will contain two declarations for the same plugin:Gradle does not allow duplicate plugin declarations in a
plugins {}block and will throw a build error. The foojay entry should be removed fromadditionalSettingsPluginshere since it is already injected by the implementation: