Skip to content

Commit

Permalink
[Kotlin|Gradle|NPW] fix: don't register foojay plugin for new depende…
Browse files Browse the repository at this point in the history
…nt Gradle module

The current implementation of settings script builder doesn't allow parsing and merging existed and generated code blocks. Therefore, we should add foojay plugin in an existing Gradle settings script.

## Issues
  * IDEA-366878 An unnecessary additional plugin block is added to the settings.gradle(.kts) when a new Kotlin module is added

## Tests
  * org.jetbrains.kotlin.tools.projectWizard.wizard.GradleKotlinNewProjectWizardTest

GitOrigin-RevId: fd076f0684a2ee2a7d28d116e93350d37d8c4da4
  • Loading branch information
HackerMadCat authored and intellij-monorepo-bot committed Feb 6, 2025
1 parent ee51daf commit 52618a1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ internal class GradleKotlinNewProjectWizard : BuildSystemKotlinNewProjectWizard
}

addOrConfigureSettingsScript {
if (parent.isFoojayPluginSupported || parent.isCreatingDaemonToolchain) {
if (parent.isCreatingNewLinkedProject && parent.isFoojayPluginSupported || parent.isCreatingDaemonToolchain) {
withFoojayPlugin()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ class GradleKotlinNewProjectWizardTest : GradleCreateProjectTestCase(), NewKotli
private fun simpleJavaProject(useKotlinDsl: Boolean) = projectInfo("project", useKotlinDsl) {
withJavaBuildFile()
withSettingsFile {
withFoojayPlugin()
setProjectName("project")
}
}
Expand Down Expand Up @@ -400,6 +401,7 @@ class GradleKotlinNewProjectWizardTest : GradleCreateProjectTestCase(), NewKotli
withKotlinJvmPlugin("1.9.0")
}
withSettingsFile {
withFoojayPlugin()
setProjectName("project")
}
}
Expand Down Expand Up @@ -459,6 +461,7 @@ class GradleKotlinNewProjectWizardTest : GradleCreateProjectTestCase(), NewKotli
}
}
withSettingsFile {
withFoojayPlugin()
setProjectName("project")
include("othermodule")
}
Expand Down Expand Up @@ -517,6 +520,7 @@ class GradleKotlinNewProjectWizardTest : GradleCreateProjectTestCase(), NewKotli
}
}
withSettingsFile {
withFoojayPlugin()
setProjectName("project")
}
withFile(
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version 'FOOJAY_VERSION'
}
rootProject.name = 'project'
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "FOOJAY_VERSION"
}
rootProject.name = "project"

0 comments on commit 52618a1

Please sign in to comment.