Remove deprecated code

See gh-24806
This commit is contained in:
Stephane Nicoll
2021-01-15 09:53:45 +01:00
parent a18f01addf
commit 2c2c160579
48 changed files with 89 additions and 1149 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -128,26 +128,4 @@ public interface BootArchive extends Task {
*/
void setClasspath(FileCollection classpath);
/**
* Returns {@code true} if the Devtools jar should be excluded, otherwise
* {@code false}.
* @return {@code true} if the Devtools jar should be excluded, or {@code false} if
* not
* @deprecated since 2.3.0 in favour of configuring a classpath that does not include
* development-only dependencies
*/
@Input
@Deprecated
boolean isExcludeDevtools();
/**
* Sets whether or not the Devtools jar should be excluded.
* @param excludeDevtools {@code true} if the Devtools jar should be excluded, or
* {@code false} if not
* @deprecated since 2.3.0 in favour of configuring a classpath that does not include
* development-only dependencies
*/
@Deprecated
void setExcludeDevtools(boolean excludeDevtools);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -76,15 +76,12 @@ class BootArchiveSupport {
private LaunchScriptConfiguration launchScript;
private boolean excludeDevtools = false;
BootArchiveSupport(String loaderMainClass, Spec<FileCopyDetails> librarySpec,
Function<FileCopyDetails, ZipCompression> compressionResolver) {
this.loaderMainClass = loaderMainClass;
this.librarySpec = librarySpec;
this.compressionResolver = compressionResolver;
this.requiresUnpack.include(Specs.satisfyNone());
configureExclusions();
}
void configureManifest(Manifest manifest, String mainClass, String classes, String lib, String classPathIndex,
@@ -149,15 +146,6 @@ class BootArchiveSupport {
this.requiresUnpack.include(spec);
}
boolean isExcludeDevtools() {
return this.excludeDevtools;
}
void setExcludeDevtools(boolean excludeDevtools) {
this.excludeDevtools = excludeDevtools;
configureExclusions();
}
void excludeNonZipLibraryFiles(FileCopyDetails details) {
if (this.librarySpec.isSatisfiedBy(details)) {
excludeNonZipFiles(details);
@@ -190,14 +178,6 @@ class BootArchiveSupport {
return true;
}
private void configureExclusions() {
Set<String> excludes = new HashSet<>();
if (this.excludeDevtools) {
excludes.add("**/spring-boot-devtools-*.jar");
}
this.exclusions.setExcludes(excludes);
}
void moveModuleInfoToRoot(CopySpec spec) {
spec.filesMatching("module-info.class", BootArchiveSupport::moveToRoot);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -22,8 +22,6 @@ import java.util.concurrent.Callable;
import java.util.function.Function;
import org.gradle.api.Action;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.ResolvableDependencies;
import org.gradle.api.file.CopySpec;
import org.gradle.api.file.FileCollection;
@@ -128,18 +126,6 @@ public class BootJar extends Jar implements BootArchive {
return this.support.createCopyAction(this);
}
/**
* Returns the {@link Configuration Configurations} of the project associated with
* this task.
* @return the configurations
* @deprecated since 2.3.5 in favor of {@link Project#getConfigurations}
*/
@Internal
@Deprecated
protected Iterable<Configuration> getConfigurations() {
return getProject().getConfigurations();
}
@Override
public Property<String> getMainClass() {
return this.mainClass;
@@ -232,18 +218,6 @@ public class BootJar extends Jar implements BootArchive {
this.classpath = getProject().files(classpath);
}
@Override
@Deprecated
public boolean isExcludeDevtools() {
return this.support.isExcludeDevtools();
}
@Override
@Deprecated
public void setExcludeDevtools(boolean excludeDevtools) {
this.support.setExcludeDevtools(excludeDevtools);
}
/**
* Returns a {@code CopySpec} that can be used to add content to the {@code BOOT-INF}
* directory of the jar.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -169,18 +169,6 @@ public class BootWar extends War implements BootArchive {
this.providedClasspath = getProject().files(classpath);
}
@Override
@Deprecated
public boolean isExcludeDevtools() {
return this.support.isExcludeDevtools();
}
@Override
@Deprecated
public void setExcludeDevtools(boolean excludeDevtools) {
this.support.setExcludeDevtools(excludeDevtools);
}
/**
* Return the {@link ZipCompression} that should be used when adding the file
* represented by the given {@code details} to the jar. By default, any

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -369,19 +369,6 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
}
}
@Test
@Deprecated
void devtoolsJarCanBeIncluded() throws IOException {
this.task.getMainClass().set("com.example.Main");
this.task.classpath(jarFile("spring-boot-devtools-0.1.2.jar"));
this.task.setExcludeDevtools(false);
executeTask();
assertThat(this.task.getArchiveFile().get().getAsFile()).exists();
try (JarFile jarFile = new JarFile(this.task.getArchiveFile().get().getAsFile())) {
assertThat(jarFile.getEntry(this.libPath + "spring-boot-devtools-0.1.2.jar")).isNotNull();
}
}
@Test
void allEntriesUseUnixPlatformAndUtf8NameEncoding() throws IOException {
this.task.getMainClass().set("com.example.Main");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -80,18 +80,6 @@ class BootWarTests extends AbstractBootArchiveTests<BootWar> {
}
}
@Test
@Deprecated
void devtoolsJarCanBeIncludedWhenItsOnTheProvidedClasspath() throws IOException {
getTask().getMainClass().set("com.example.Main");
getTask().providedClasspath(jarFile("spring-boot-devtools-0.1.2.jar"));
getTask().setExcludeDevtools(false);
executeTask();
try (JarFile jarFile = new JarFile(getTask().getArchiveFile().get().getAsFile())) {
assertThat(jarFile.getEntry("WEB-INF/lib-provided/spring-boot-devtools-0.1.2.jar")).isNotNull();
}
}
@Test
void webappResourcesInDirectoriesThatOverlapWithLoaderCanBePackaged() throws IOException {
File webappDirectory = new File(this.temp, "src/main/webapp");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -42,20 +42,7 @@ public interface Layout {
* @return the location of the library relative to the root of the archive (should end
* with '/') or {@code null} if the library should not be included.
*/
default String getLibraryLocation(String libraryName, LibraryScope scope) {
return getLibraryDestination(libraryName, scope);
}
/**
* Returns the destination path for a given library.
* @param libraryName the name of the library (excluding any path)
* @param scope the scope of the library
* @return the destination relative to the root of the archive (should end with '/')
* or {@code null} if the library should not be included.
* @deprecated since 2.3.0 in favor of {@link #getLibraryLocation}
*/
@Deprecated
String getLibraryDestination(String libraryName, LibraryScope scope);
String getLibraryLocation(String libraryName, LibraryScope scope);
/**
* Returns the location of classes within the archive.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -73,12 +73,6 @@ public final class Layouts {
return "BOOT-INF/lib/";
}
@Deprecated
@Override
public String getLibraryDestination(String libraryName, LibraryScope scope) {
return "BOOT-INF/lib/";
}
@Override
public String getClassesLocation() {
return "";
@@ -161,12 +155,6 @@ public final class Layouts {
return SCOPE_LOCATION.get(scope);
}
@Deprecated
@Override
public String getLibraryDestination(String libraryName, LibraryScope scope) {
return SCOPE_LOCATION.get(scope);
}
@Override
public String getClassesLocation() {
return "WEB-INF/classes/";

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -175,16 +175,6 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
@Parameter(property = "spring-boot.run.main-class")
private String mainClass;
/**
* Additional directories besides the classes directory that should be added to the
* classpath.
* @since 1.0.0
* @deprecated since 2.3.0 in favor of {@code directories}
*/
@Deprecated
@Parameter(property = "spring-boot.run.folders")
private String[] folders;
/**
* Additional directories besides the classes directory that should be added to the
* classpath.
@@ -462,11 +452,6 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
}
private void addUserDefinedDirectories(List<URL> urls) throws MalformedURLException {
if (this.folders != null) {
for (String folder : this.folders) {
urls.add(new File(folder).toURI().toURL());
}
}
if (this.directories != null) {
for (String directory : this.directories) {
urls.add(new File(directory).toURI().toURL());