From ec37fbfda0f4ff2979a2023e83e4f14bc227d24b Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Thu, 8 Aug 2024 15:13:43 +0200 Subject: [PATCH] Apply consistent ordering to the Kotlin Gradle build customizer Closes gh-1559 --- .../spring/code/kotlin/KotlinGradleBuildCustomizer.java | 8 ++++++++ .../project/gradle/kotlin-java11-build.gradle.gen | 4 ++-- .../project/gradle/kotlin-java11-build.gradle.kts.gen | 4 ++-- .../resources/project/kotlin/standard/build.gradle.gen | 4 ++-- .../project/kotlin/standard/build.gradle.kts.gen | 4 ++-- .../project/kotlin/standard/war-build.gradle.gen | 4 ++-- .../project/kotlin/standard/war-build.gradle.kts.gen | 4 ++-- 7 files changed, 20 insertions(+), 12 deletions(-) diff --git a/initializr-generator-spring/src/main/java/io/spring/initializr/generator/spring/code/kotlin/KotlinGradleBuildCustomizer.java b/initializr-generator-spring/src/main/java/io/spring/initializr/generator/spring/code/kotlin/KotlinGradleBuildCustomizer.java index 5aeb4b1266..6f9787b608 100644 --- a/initializr-generator-spring/src/main/java/io/spring/initializr/generator/spring/code/kotlin/KotlinGradleBuildCustomizer.java +++ b/initializr-generator-spring/src/main/java/io/spring/initializr/generator/spring/code/kotlin/KotlinGradleBuildCustomizer.java @@ -21,6 +21,7 @@ import io.spring.initializr.generator.buildsystem.gradle.GradleBuild; import io.spring.initializr.generator.spring.build.BuildCustomizer; +import org.springframework.core.Ordered; import org.springframework.util.CollectionUtils; /** @@ -61,4 +62,11 @@ private List quote(List compilerArgs) { return compilerArgs.stream().map((element) -> this.quote + element + this.quote).toList(); } + @Override + public int getOrder() { + // See + // io.spring.initializr.generator.spring.build.gradle.GradleProjectGenerationConfiguration.LANGUAGE_PLUGINS_ORDER + return Ordered.HIGHEST_PRECEDENCE + 5; + } + } diff --git a/initializr-generator-spring/src/test/resources/project/gradle/kotlin-java11-build.gradle.gen b/initializr-generator-spring/src/test/resources/project/gradle/kotlin-java11-build.gradle.gen index d79441cafa..a72b0c7a4b 100644 --- a/initializr-generator-spring/src/test/resources/project/gradle/kotlin-java11-build.gradle.gen +++ b/initializr-generator-spring/src/test/resources/project/gradle/kotlin-java11-build.gradle.gen @@ -1,8 +1,8 @@ plugins { - id 'org.springframework.boot' version '2.4.1' - id 'io.spring.dependency-management' version '1.0.6.RELEASE' id 'org.jetbrains.kotlin.jvm' version '1.1.1' id 'org.jetbrains.kotlin.plugin.spring' version '1.1.1' + id 'org.springframework.boot' version '2.4.1' + id 'io.spring.dependency-management' version '1.0.6.RELEASE' } group = 'com.example' diff --git a/initializr-generator-spring/src/test/resources/project/gradle/kotlin-java11-build.gradle.kts.gen b/initializr-generator-spring/src/test/resources/project/gradle/kotlin-java11-build.gradle.kts.gen index 604074ebed..28ed7e680c 100644 --- a/initializr-generator-spring/src/test/resources/project/gradle/kotlin-java11-build.gradle.kts.gen +++ b/initializr-generator-spring/src/test/resources/project/gradle/kotlin-java11-build.gradle.kts.gen @@ -1,8 +1,8 @@ plugins { - id("org.springframework.boot") version "2.4.1" - id("io.spring.dependency-management") version "1.0.6.RELEASE" kotlin("jvm") version "1.1.1" kotlin("plugin.spring") version "1.1.1" + id("org.springframework.boot") version "2.4.1" + id("io.spring.dependency-management") version "1.0.6.RELEASE" } group = "com.example" diff --git a/initializr-generator-spring/src/test/resources/project/kotlin/standard/build.gradle.gen b/initializr-generator-spring/src/test/resources/project/kotlin/standard/build.gradle.gen index fff4ec8a43..e9ee8363fe 100644 --- a/initializr-generator-spring/src/test/resources/project/kotlin/standard/build.gradle.gen +++ b/initializr-generator-spring/src/test/resources/project/kotlin/standard/build.gradle.gen @@ -1,8 +1,8 @@ plugins { - id 'org.springframework.boot' version '2.4.1' - id 'io.spring.dependency-management' version '1.0.6.RELEASE' id 'org.jetbrains.kotlin.jvm' version '1.1.1' id 'org.jetbrains.kotlin.plugin.spring' version '1.1.1' + id 'org.springframework.boot' version '2.4.1' + id 'io.spring.dependency-management' version '1.0.6.RELEASE' } group = 'com.example' diff --git a/initializr-generator-spring/src/test/resources/project/kotlin/standard/build.gradle.kts.gen b/initializr-generator-spring/src/test/resources/project/kotlin/standard/build.gradle.kts.gen index 27e33a9831..e788578baf 100644 --- a/initializr-generator-spring/src/test/resources/project/kotlin/standard/build.gradle.kts.gen +++ b/initializr-generator-spring/src/test/resources/project/kotlin/standard/build.gradle.kts.gen @@ -1,8 +1,8 @@ plugins { - id("org.springframework.boot") version "2.4.1" - id("io.spring.dependency-management") version "1.0.6.RELEASE" kotlin("jvm") version "1.1.1" kotlin("plugin.spring") version "1.1.1" + id("org.springframework.boot") version "2.4.1" + id("io.spring.dependency-management") version "1.0.6.RELEASE" } group = "com.example" diff --git a/initializr-generator-spring/src/test/resources/project/kotlin/standard/war-build.gradle.gen b/initializr-generator-spring/src/test/resources/project/kotlin/standard/war-build.gradle.gen index 2573efc78d..545f43db26 100644 --- a/initializr-generator-spring/src/test/resources/project/kotlin/standard/war-build.gradle.gen +++ b/initializr-generator-spring/src/test/resources/project/kotlin/standard/war-build.gradle.gen @@ -1,9 +1,9 @@ plugins { + id 'org.jetbrains.kotlin.jvm' version '1.1.1' + id 'org.jetbrains.kotlin.plugin.spring' version '1.1.1' id 'war' id 'org.springframework.boot' version '2.4.1' id 'io.spring.dependency-management' version '1.0.6.RELEASE' - id 'org.jetbrains.kotlin.jvm' version '1.1.1' - id 'org.jetbrains.kotlin.plugin.spring' version '1.1.1' } group = 'com.example' diff --git a/initializr-generator-spring/src/test/resources/project/kotlin/standard/war-build.gradle.kts.gen b/initializr-generator-spring/src/test/resources/project/kotlin/standard/war-build.gradle.kts.gen index 9c3d3ae95f..968da6b293 100644 --- a/initializr-generator-spring/src/test/resources/project/kotlin/standard/war-build.gradle.kts.gen +++ b/initializr-generator-spring/src/test/resources/project/kotlin/standard/war-build.gradle.kts.gen @@ -1,9 +1,9 @@ plugins { + kotlin("jvm") version "1.1.1" + kotlin("plugin.spring") version "1.1.1" war id("org.springframework.boot") version "2.4.1" id("io.spring.dependency-management") version "1.0.6.RELEASE" - kotlin("jvm") version "1.1.1" - kotlin("plugin.spring") version "1.1.1" } group = "com.example"