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");