diff --git a/gradle/plugins/aot-smoke-test-plugin/src/main/java/org/springframework/aot/gradle/AotSmokeTestPlugin.java b/gradle/plugins/aot-smoke-test-plugin/src/main/java/org/springframework/aot/gradle/AotSmokeTestPlugin.java index a68e7c70..44928232 100644 --- a/gradle/plugins/aot-smoke-test-plugin/src/main/java/org/springframework/aot/gradle/AotSmokeTestPlugin.java +++ b/gradle/plugins/aot-smoke-test-plugin/src/main/java/org/springframework/aot/gradle/AotSmokeTestPlugin.java @@ -101,12 +101,6 @@ public class AotSmokeTestPlugin implements Plugin { .mavenLocal( (mavenLocal) -> mavenLocal.content((content) -> includedGroups.forEach(content::includeGroup))); } - if ((!project.hasProperty("forceSnapshots")) - || Boolean.valueOf(project.property("forceSnapshots").toString())) { - ForceSnapshots forceSnapshots = new ForceSnapshots(); - project.getConfigurations() - .all((configuration) -> configuration.getResolutionStrategy().eachDependency(forceSnapshots)); - } if (System.getenv().containsKey("REPO_SPRING_IO_USERNAME") && System.getenv().containsKey("REPO_SPRING_IO_PASSWORD")) { project.getRepositories().maven((repo) -> { diff --git a/gradle/plugins/aot-smoke-test-plugin/src/main/java/org/springframework/aot/gradle/ForceSnapshots.java b/gradle/plugins/aot-smoke-test-plugin/src/main/java/org/springframework/aot/gradle/ForceSnapshots.java deleted file mode 100644 index 7c339f3f..00000000 --- a/gradle/plugins/aot-smoke-test-plugin/src/main/java/org/springframework/aot/gradle/ForceSnapshots.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2022-2024 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 org.springframework.aot.gradle; - -import java.util.Set; - -import org.gradle.api.Action; -import org.gradle.api.artifacts.DependencyResolveDetails; -import org.gradle.api.artifacts.ModuleVersionSelector; -import org.gradle.api.artifacts.ResolutionStrategy; - -/** - * {@link ResolutionStrategy#eachDependency(Action) Resolution strategy action} that - * forces dependencies to use snapshots. The version that is used is derived from a - * dependency's current version: - * - * - * @author Marcus Hert Da Coregio - * @author Andy Wilkinson - */ -final class ForceSnapshots implements Action { - - private static final Set NO_SNAPSHOT = Set.of("org.springframework.boot", "org.springframework.cloud", - "org.springframework.plugin"); - - @Override - public void execute(DependencyResolveDetails dependency) { - ModuleVersionSelector requested = dependency.getRequested(); - String version = requested.getVersion(); - if (version == null || version.isBlank()) { - return; - } - String group = requested.getGroup(); - if (group.startsWith("org.springframework") && !NO_SNAPSHOT.contains(group)) { - dependency.useVersion(snapshotOf(version)); - } - } - - private String snapshotOf(String version) { - if (version.endsWith("-SNAPSHOT")) { - return version; - } - boolean oldVersionFormat = version.matches(".*\\.(((M|RC)\\d+)|RELEASE)$"); - if (oldVersionFormat) { - return buildSnapshotOf(version); - } - boolean isMilestone = version.matches(".*-(M|RC)\\d+$"); - String rawVersion = version.split("-")[0]; - if (isMilestone) { - return rawVersion + "-SNAPSHOT"; - } - String[] parts = rawVersion.split("\\."); - int nextPatchVersion = Integer.parseInt(parts[2]) + 1; - parts[2] = nextPatchVersion + "-SNAPSHOT"; - return String.join(".", parts); - } - - private String buildSnapshotOf(String version) { - boolean isMilestone = !version.endsWith(".RELEASE"); - String rawVersion = version.substring(0, version.lastIndexOf(".")); - if (isMilestone) { - return rawVersion + ".BUILD-SNAPSHOT"; - } - String[] parts = rawVersion.split("\\."); - int nextPatchVersion = Integer.parseInt(parts[2]) + 1; - parts[2] = nextPatchVersion + ".BUILD-SNAPSHOT"; - return String.join(".", parts); - } - -}