From 2401e9539cc7ea460a08e6c60f690a590474ea15 Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Mon, 27 May 2024 14:18:43 +0200 Subject: [PATCH] Remove superfluous Gradle DSL classes for GraalVM Gradle and Kotlin DSL did the same thing, this condenses it down to only one class. --- .../graalvm/GraalVmGradleBuildCustomizer.java | 6 --- ...GraalVmGroovyDslGradleBuildCustomizer.java | 37 ------------------- ...GraalVmKotlinDslGradleBuildCustomizer.java | 30 --------------- ...GraalVmProjectGenerationConfiguration.java | 12 ++---- .../GraalVmGradleBuildCustomizerTests.java | 6 +-- ...VmGroovyDslGradleBuildCustomizerTests.java | 31 ---------------- ...VmKotlinDslGradleBuildCustomizerTests.java | 31 ---------------- 7 files changed, 5 insertions(+), 148 deletions(-) delete mode 100644 start-site/src/main/java/io/spring/start/site/extension/dependency/graalvm/GraalVmGroovyDslGradleBuildCustomizer.java delete mode 100644 start-site/src/main/java/io/spring/start/site/extension/dependency/graalvm/GraalVmKotlinDslGradleBuildCustomizer.java delete mode 100644 start-site/src/test/java/io/spring/start/site/extension/dependency/graalvm/GraalVmGroovyDslGradleBuildCustomizerTests.java delete mode 100644 start-site/src/test/java/io/spring/start/site/extension/dependency/graalvm/GraalVmKotlinDslGradleBuildCustomizerTests.java diff --git a/start-site/src/main/java/io/spring/start/site/extension/dependency/graalvm/GraalVmGradleBuildCustomizer.java b/start-site/src/main/java/io/spring/start/site/extension/dependency/graalvm/GraalVmGradleBuildCustomizer.java index 377a1d7272..9041b1f01c 100644 --- a/start-site/src/main/java/io/spring/start/site/extension/dependency/graalvm/GraalVmGradleBuildCustomizer.java +++ b/start-site/src/main/java/io/spring/start/site/extension/dependency/graalvm/GraalVmGradleBuildCustomizer.java @@ -37,12 +37,6 @@ public final void customize(GradleBuild build) { if (this.nbtVersion != null) { build.plugins().add("org.graalvm.buildtools.native", (plugin) -> plugin.setVersion(this.nbtVersion)); } - // Spring Boot plugin - customizeSpringBootPlugin(build); - } - - protected void customizeSpringBootPlugin(GradleBuild build) { - } } diff --git a/start-site/src/main/java/io/spring/start/site/extension/dependency/graalvm/GraalVmGroovyDslGradleBuildCustomizer.java b/start-site/src/main/java/io/spring/start/site/extension/dependency/graalvm/GraalVmGroovyDslGradleBuildCustomizer.java deleted file mode 100644 index a5b4a7379c..0000000000 --- a/start-site/src/main/java/io/spring/start/site/extension/dependency/graalvm/GraalVmGroovyDslGradleBuildCustomizer.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012-2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.spring.start.site.extension.dependency.graalvm; - -import io.spring.initializr.generator.buildsystem.gradle.GradleBuild; - -/** - * {@link GraalVmGradleBuildCustomizer} implementations for projects using the Groovy DSL. - * - * @author Stephane Nicoll - */ -class GraalVmGroovyDslGradleBuildCustomizer extends GraalVmGradleBuildCustomizer { - - GraalVmGroovyDslGradleBuildCustomizer(String nbtVersion) { - super(nbtVersion); - } - - @Override - protected void customizeSpringBootPlugin(GradleBuild build) { - - } - -} diff --git a/start-site/src/main/java/io/spring/start/site/extension/dependency/graalvm/GraalVmKotlinDslGradleBuildCustomizer.java b/start-site/src/main/java/io/spring/start/site/extension/dependency/graalvm/GraalVmKotlinDslGradleBuildCustomizer.java deleted file mode 100644 index c5d4e48eb6..0000000000 --- a/start-site/src/main/java/io/spring/start/site/extension/dependency/graalvm/GraalVmKotlinDslGradleBuildCustomizer.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2012-2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.spring.start.site.extension.dependency.graalvm; - -/** - * {@link GraalVmGradleBuildCustomizer} implementations for projects using the Kotlin DSL. - * - * @author Stephane Nicoll - */ -class GraalVmKotlinDslGradleBuildCustomizer extends GraalVmGradleBuildCustomizer { - - GraalVmKotlinDslGradleBuildCustomizer(String nbtVersion) { - super(nbtVersion); - } - -} diff --git a/start-site/src/main/java/io/spring/start/site/extension/dependency/graalvm/GraalVmProjectGenerationConfiguration.java b/start-site/src/main/java/io/spring/start/site/extension/dependency/graalvm/GraalVmProjectGenerationConfiguration.java index 8711533bf9..ce41dda872 100644 --- a/start-site/src/main/java/io/spring/start/site/extension/dependency/graalvm/GraalVmProjectGenerationConfiguration.java +++ b/start-site/src/main/java/io/spring/start/site/extension/dependency/graalvm/GraalVmProjectGenerationConfiguration.java @@ -69,15 +69,9 @@ GraalVmMavenBuildCustomizer graalVmMavenBuildCustomizer() { } @Bean - @ConditionalOnBuildSystem(value = GradleBuildSystem.ID, dialect = GradleBuildSystem.DIALECT_GROOVY) - GraalVmGroovyDslGradleBuildCustomizer graalVmGroovyDslGradleBuildCustomizer() { - return new GraalVmGroovyDslGradleBuildCustomizer(this.nbtVersion.get()); - } - - @Bean - @ConditionalOnBuildSystem(value = GradleBuildSystem.ID, dialect = GradleBuildSystem.DIALECT_KOTLIN) - GraalVmKotlinDslGradleBuildCustomizer graalVmKotlinDslGradleBuildCustomizer() { - return new GraalVmKotlinDslGradleBuildCustomizer(this.nbtVersion.get()); + @ConditionalOnBuildSystem(GradleBuildSystem.ID) + GraalVmGradleBuildCustomizer graalVmGradleBuildCustomizer() { + return new GraalVmGradleBuildCustomizer(this.nbtVersion.get()); } @Bean diff --git a/start-site/src/test/java/io/spring/start/site/extension/dependency/graalvm/GraalVmGradleBuildCustomizerTests.java b/start-site/src/test/java/io/spring/start/site/extension/dependency/graalvm/GraalVmGradleBuildCustomizerTests.java index ad1180bece..c7509f43cd 100644 --- a/start-site/src/test/java/io/spring/start/site/extension/dependency/graalvm/GraalVmGradleBuildCustomizerTests.java +++ b/start-site/src/test/java/io/spring/start/site/extension/dependency/graalvm/GraalVmGradleBuildCustomizerTests.java @@ -30,13 +30,11 @@ * * @author Stephane Nicoll */ -abstract class GraalVmGradleBuildCustomizerTests { - - protected abstract GraalVmGradleBuildCustomizer createCustomizer(String nbtVersion); +class GraalVmGradleBuildCustomizerTests { @Test void gradleBuildConfigureNativeBuildToolsPlugin() { - GraalVmGradleBuildCustomizer customizer = createCustomizer("1.0.0"); + GraalVmGradleBuildCustomizer customizer = new GraalVmGradleBuildCustomizer("1.0.0"); GradleBuild build = createBuild(); customizer.customize(build); GradlePlugin nbtPlugin = build.plugins() diff --git a/start-site/src/test/java/io/spring/start/site/extension/dependency/graalvm/GraalVmGroovyDslGradleBuildCustomizerTests.java b/start-site/src/test/java/io/spring/start/site/extension/dependency/graalvm/GraalVmGroovyDslGradleBuildCustomizerTests.java deleted file mode 100644 index 4cea3d6694..0000000000 --- a/start-site/src/test/java/io/spring/start/site/extension/dependency/graalvm/GraalVmGroovyDslGradleBuildCustomizerTests.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2012-2022 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.spring.start.site.extension.dependency.graalvm; - -/** - * Tests for {@link GraalVmGroovyDslGradleBuildCustomizer}. - * - * @author Stephane Nicoll - */ -class GraalVmGroovyDslGradleBuildCustomizerTests extends GraalVmGradleBuildCustomizerTests { - - @Override - protected GraalVmGroovyDslGradleBuildCustomizer createCustomizer(String nbtVersion) { - return new GraalVmGroovyDslGradleBuildCustomizer(nbtVersion); - } - -} diff --git a/start-site/src/test/java/io/spring/start/site/extension/dependency/graalvm/GraalVmKotlinDslGradleBuildCustomizerTests.java b/start-site/src/test/java/io/spring/start/site/extension/dependency/graalvm/GraalVmKotlinDslGradleBuildCustomizerTests.java deleted file mode 100644 index 523d37c730..0000000000 --- a/start-site/src/test/java/io/spring/start/site/extension/dependency/graalvm/GraalVmKotlinDslGradleBuildCustomizerTests.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2012-2022 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.spring.start.site.extension.dependency.graalvm; - -/** - * Tests for {@link GraalVmKotlinDslGradleBuildCustomizer}. - * - * @author Stephane Nicoll - */ -class GraalVmKotlinDslGradleBuildCustomizerTests extends GraalVmGradleBuildCustomizerTests { - - @Override - protected GraalVmKotlinDslGradleBuildCustomizer createCustomizer(String nbtVersion) { - return new GraalVmKotlinDslGradleBuildCustomizer(nbtVersion); - } - -}