From 4079822f5df8000aa7c585a6b91470d7edf2480f Mon Sep 17 00:00:00 2001 From: Chris Bono Date: Wed, 25 Jan 2023 10:17:47 -0600 Subject: [PATCH] Remove repo.spring.io/release --- buildSrc/build.gradle | 2 - .../RepositoryConventionPlugin.groovy | 14 +- .../gradle/AsciidoctorConventionsPlugin.java | 163 ------------------ .../AsciidoctorConventionsPlugin.java | 5 +- settings.gradle | 4 +- 5 files changed, 6 insertions(+), 182 deletions(-) delete mode 100644 buildSrc/src/main/java/org/springframework/boot/gradle/AsciidoctorConventionsPlugin.java diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 89fed1b1..2b61d450 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -7,8 +7,6 @@ plugins { repositories { gradlePluginPortal() mavenCentral() - maven { url 'https://repo.spring.io/plugins-release' } - maven { url 'https://repo.spring.io/release' } maven { url 'https://repo.spring.io/milestone' } if (version.endsWith('SNAPSHOT')) { maven { url 'https://repo.spring.io/snapshot' } diff --git a/buildSrc/src/main/groovy/io/spring/gradle/convention/RepositoryConventionPlugin.groovy b/buildSrc/src/main/groovy/io/spring/gradle/convention/RepositoryConventionPlugin.groovy index 67eb897b..14dc476c 100644 --- a/buildSrc/src/main/groovy/io/spring/gradle/convention/RepositoryConventionPlugin.groovy +++ b/buildSrc/src/main/groovy/io/spring/gradle/convention/RepositoryConventionPlugin.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2016-2022 the original author or authors. + * Copyright 2016-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 @@ -14,7 +14,7 @@ * the License. */ -package io.spring.gradle.convention; +package io.spring.gradle.convention import org.gradle.api.Plugin import org.gradle.api.Project @@ -64,16 +64,6 @@ class RepositoryConventionPlugin implements Plugin { url = 'https://repo.spring.io/milestone/' } } - maven { - name = 'artifactory-release' - if (project.hasProperty('artifactoryUsername')) { - credentials { - username project.artifactoryUsername - password project.artifactoryPassword - } - } - url = 'https://repo.spring.io/release/' - } } } diff --git a/buildSrc/src/main/java/org/springframework/boot/gradle/AsciidoctorConventionsPlugin.java b/buildSrc/src/main/java/org/springframework/boot/gradle/AsciidoctorConventionsPlugin.java deleted file mode 100644 index 25c5b9f1..00000000 --- a/buildSrc/src/main/java/org/springframework/boot/gradle/AsciidoctorConventionsPlugin.java +++ /dev/null @@ -1,163 +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 org.springframework.boot.gradle; - -import java.io.File; -import java.net.URI; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.asciidoctor.gradle.jvm.AbstractAsciidoctorTask; -import org.asciidoctor.gradle.jvm.AsciidoctorJExtension; -import org.asciidoctor.gradle.jvm.AsciidoctorJPlugin; -import org.asciidoctor.gradle.jvm.AsciidoctorTask; -import org.gradle.api.Plugin; -import org.gradle.api.Project; -import org.gradle.api.tasks.PathSensitivity; -import org.gradle.api.tasks.Sync; - -import org.springframework.boot.gradle.classpath.artifactory.ArtifactoryRepository; -import org.springframework.util.StringUtils; - -/** - * Conventions that are applied in the presence of the {@link AsciidoctorJPlugin}. When - * the plugin is applied: - * - * - * - * @author Andy Wilkinson - */ -public class AsciidoctorConventionsPlugin implements Plugin { - - private static final String ASCIIDOCTORJ_VERSION = "2.4.3"; - - private static final String EXTENSIONS_CONFIGURATION_NAME = "asciidoctorExtensions"; - - @Override - public void apply(Project project) { - project.getPlugins().withType(AsciidoctorJPlugin.class, (asciidoctorPlugin) -> { - configureDocumentationDependenciesRepository(project); - makeAllWarningsFatal(project); - upgradeAsciidoctorJVersion(project); - createAsciidoctorExtensionsConfiguration(project); - project.getTasks().withType(AbstractAsciidoctorTask.class, - (asciidoctorTask) -> configureAsciidoctorTask(project, asciidoctorTask)); - }); - } - - private void configureDocumentationDependenciesRepository(Project project) { - project.getRepositories().maven((mavenRepo) -> { - mavenRepo.setUrl(URI.create("https://repo.spring.io/release")); - mavenRepo.mavenContent((mavenContent) -> { - mavenContent.includeGroup("io.spring.asciidoctor"); - mavenContent.includeGroup("io.spring.asciidoctor.backends"); - mavenContent.includeGroup("io.spring.docresources"); - }); - }); - } - - private void makeAllWarningsFatal(Project project) { - project.getExtensions().getByType(AsciidoctorJExtension.class).fatalWarnings(".*"); - } - - private void upgradeAsciidoctorJVersion(Project project) { - project.getExtensions().getByType(AsciidoctorJExtension.class).setVersion(ASCIIDOCTORJ_VERSION); - } - - private void createAsciidoctorExtensionsConfiguration(Project project) { - project.getConfigurations().create(EXTENSIONS_CONFIGURATION_NAME, (configuration) -> { - project.getConfigurations().matching((candidate) -> "dependencyManagement".equals(candidate.getName())) - .all(configuration::extendsFrom); - configuration.getDependencies().add(project.getDependencies() - .create("io.spring.asciidoctor.backends:spring-asciidoctor-backends:0.0.4")); - configuration.getDependencies() - .add(project.getDependencies().create("org.asciidoctor:asciidoctorj-pdf:1.5.3")); - }); - } - - private void configureAsciidoctorTask(Project project, AbstractAsciidoctorTask asciidoctorTask) { - asciidoctorTask.configurations(EXTENSIONS_CONFIGURATION_NAME); - configureCommonAttributes(project, asciidoctorTask); - configureOptions(asciidoctorTask); - asciidoctorTask.baseDirFollowsSourceDir(); - createSyncDocumentationSourceTask(project, asciidoctorTask); - if (asciidoctorTask instanceof AsciidoctorTask task) { - boolean pdf = task.getName().toLowerCase().contains("pdf"); - String backend = (!pdf) ? "spring-html" : "spring-pdf"; - task.outputOptions((outputOptions) -> outputOptions.backends(backend)); - } - } - - private void configureCommonAttributes(Project project, AbstractAsciidoctorTask asciidoctorTask) { - Map attributes = new HashMap<>(); - attributes.put("attribute-missing", "warn"); - attributes.put("github-tag", determineGitHubTag(project)); - attributes.put("spring-boot-artifactory-repo", ArtifactoryRepository.forProject(project)); - attributes.put("revnumber", null); - asciidoctorTask.attributes(attributes); - } - - private String determineGitHubTag(Project project) { - String version = "v" + project.getVersion(); - return (version.endsWith("-SNAPSHOT")) ? "main" : version; - } - - private void configureOptions(AbstractAsciidoctorTask asciidoctorTask) { - asciidoctorTask.options(Collections.singletonMap("doctype", "book")); - } - - private Sync createSyncDocumentationSourceTask(Project project, AbstractAsciidoctorTask asciidoctorTask) { - Sync syncDocumentationSource = project.getTasks() - .create("syncDocumentationSourceFor" + StringUtils.capitalize(asciidoctorTask.getName()), Sync.class); - File syncedSource = new File(project.getBuildDir(), "docs/src/" + asciidoctorTask.getName()); - syncDocumentationSource.setDestinationDir(syncedSource); - syncDocumentationSource.from("src/docs/"); - asciidoctorTask.dependsOn(syncDocumentationSource); - asciidoctorTask.getInputs().dir(syncedSource).withPathSensitivity(PathSensitivity.RELATIVE) - .withPropertyName("synced source"); - asciidoctorTask.setSourceDir(project.relativePath(new File(syncedSource, "asciidoc/"))); - return syncDocumentationSource; - } - -} diff --git a/buildSrc/src/main/java/org/springframework/pulsar/gradle/docs/asciidoc/AsciidoctorConventionsPlugin.java b/buildSrc/src/main/java/org/springframework/pulsar/gradle/docs/asciidoc/AsciidoctorConventionsPlugin.java index 42c93fc6..2bc7f349 100644 --- a/buildSrc/src/main/java/org/springframework/pulsar/gradle/docs/asciidoc/AsciidoctorConventionsPlugin.java +++ b/buildSrc/src/main/java/org/springframework/pulsar/gradle/docs/asciidoc/AsciidoctorConventionsPlugin.java @@ -38,8 +38,7 @@ import org.springframework.util.StringUtils; * the plugin is applied: * *
    - *
  • The {@code https://repo.spring.io/release} Maven repository is configured and - * limited to dependencies in the following groups: + *
  • The Maven Central repository is configured and limited to dependencies in the following groups: *
      *
    • {@code io.spring.asciidoctor} *
    • {@code io.spring.asciidoctor.backends} @@ -87,7 +86,7 @@ public class AsciidoctorConventionsPlugin implements Plugin { private void configureDocumentationDependenciesRepository(Project project) { project.getRepositories().maven((mavenRepo) -> { - mavenRepo.setUrl(URI.create("https://repo.spring.io/release")); + mavenRepo.setUrl(URI.create("https://repo.maven.apache.org/maven2")); mavenRepo.mavenContent((mavenContent) -> { mavenContent.includeGroup("io.spring.asciidoctor"); mavenContent.includeGroup("io.spring.asciidoctor.backends"); diff --git a/settings.gradle b/settings.gradle index e711bac0..fc134f47 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,8 +2,8 @@ pluginManagement { repositories { gradlePluginPortal() mavenCentral() - maven { url 'https://repo.spring.io/milestone' } - maven { url 'https://repo.spring.io/snapshot' } + maven { url 'https://repo.spring.io/plugins-milestone' } + maven { url 'https://repo.spring.io/plugins-snapshot' } jcenter() } }