Merge branch '2.5.x' into 2.6.x
Closes gh-29679
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* 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.
|
||||
@@ -20,6 +20,7 @@ import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import org.gradle.api.Action;
|
||||
import org.gradle.api.Plugin;
|
||||
@@ -105,7 +106,7 @@ final class JavaPluginAction implements PluginApplicationAction {
|
||||
.getByName(SpringBootPlugin.DEVELOPMENT_ONLY_CONFIGURATION_NAME);
|
||||
Configuration productionRuntimeClasspath = project.getConfigurations()
|
||||
.getByName(SpringBootPlugin.PRODUCTION_RUNTIME_CLASSPATH_CONFIGURATION_NAME);
|
||||
FileCollection classpath = mainSourceSet.getRuntimeClasspath()
|
||||
Callable<FileCollection> classpath = () -> mainSourceSet.getRuntimeClasspath()
|
||||
.minus((developmentOnly.minus(productionRuntimeClasspath))).filter(new JarTypeFileSpec());
|
||||
TaskProvider<ResolveMainClassName> resolveMainClassName = ResolveMainClassName
|
||||
.registerForTask(SpringBootPlugin.BOOT_JAR_TASK_NAME, project, classpath);
|
||||
@@ -137,7 +138,7 @@ final class JavaPluginAction implements PluginApplicationAction {
|
||||
}
|
||||
|
||||
private void configureBootRunTask(Project project) {
|
||||
FileCollection classpath = javaPluginConvention(project).getSourceSets()
|
||||
Callable<FileCollection> classpath = () -> javaPluginConvention(project).getSourceSets()
|
||||
.findByName(SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath().filter(new JarTypeFileSpec());
|
||||
TaskProvider<ResolveMainClassName> resolveProvider = ResolveMainClassName.registerForTask("bootRun", project,
|
||||
classpath);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* 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.
|
||||
@@ -23,6 +23,7 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import org.gradle.api.DefaultTask;
|
||||
import org.gradle.api.InvalidUserDataException;
|
||||
@@ -86,7 +87,17 @@ public class ResolveMainClassName extends DefaultTask {
|
||||
* @param classpath the classpath
|
||||
*/
|
||||
public void setClasspath(FileCollection classpath) {
|
||||
this.classpath = classpath;
|
||||
setClasspath((Object) classpath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the classpath to include in the archive. The given {@code classpath} is
|
||||
* evaluated as per {@link Project#files(Object...)}.
|
||||
* @param classpath the classpath
|
||||
* @since 2.5.9
|
||||
*/
|
||||
public void setClasspath(Object classpath) {
|
||||
this.classpath = getProject().files(classpath);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,7 +153,7 @@ public class ResolveMainClassName extends DefaultTask {
|
||||
}
|
||||
|
||||
static TaskProvider<ResolveMainClassName> registerForTask(String taskName, Project project,
|
||||
FileCollection classpath) {
|
||||
Callable<FileCollection> classpath) {
|
||||
TaskProvider<ResolveMainClassName> resolveMainClassNameProvider = project.getTasks()
|
||||
.register(taskName + "MainClassName", ResolveMainClassName.class, (resolveMainClassName) -> {
|
||||
Convention convention = project.getConvention();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* 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.
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.boot.gradle.plugin;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import org.gradle.api.Action;
|
||||
import org.gradle.api.Plugin;
|
||||
import org.gradle.api.Project;
|
||||
@@ -71,7 +73,7 @@ class WarPluginAction implements PluginApplicationAction {
|
||||
.getByName(SpringBootPlugin.DEVELOPMENT_ONLY_CONFIGURATION_NAME);
|
||||
Configuration productionRuntimeClasspath = project.getConfigurations()
|
||||
.getByName(SpringBootPlugin.PRODUCTION_RUNTIME_CLASSPATH_CONFIGURATION_NAME);
|
||||
FileCollection classpath = project.getConvention().getByType(SourceSetContainer.class)
|
||||
Callable<FileCollection> classpath = () -> project.getConvention().getByType(SourceSetContainer.class)
|
||||
.getByName(SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath()
|
||||
.minus(providedRuntimeConfiguration(project)).minus((developmentOnly.minus(productionRuntimeClasspath)))
|
||||
.filter(new JarTypeFileSpec());
|
||||
|
||||
Reference in New Issue
Block a user