diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/dsl/SpringBootExtension.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/dsl/SpringBootExtension.java index 0f86ea2f45f..fba2f3c1b10 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/dsl/SpringBootExtension.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/dsl/SpringBootExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -106,9 +106,9 @@ public class SpringBootExtension { properties.setArtifact(determineArtifactBaseName()); } }); - bootBuildInfo.setDestinationDir(this.project - .provider(() -> new File(determineMainSourceSetResourcesOutputDir(), - "META-INF"))); + bootBuildInfo.getConventionMapping().map("destinationDir", + () -> new File(determineMainSourceSetResourcesOutputDir(), + "META-INF")); }); if (configurer != null) { configurer.execute(bootBuildInfo); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/ApplicationPluginAction.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/ApplicationPluginAction.java index 6bc46602664..6ea22479f79 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/ApplicationPluginAction.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/ApplicationPluginAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -68,10 +68,10 @@ final class ApplicationPluginAction implements PluginApplicationAction { bootStartScripts.setClasspath(configuration.getArtifacts().getFiles()); } }); - bootStartScripts.setOutputDir( - project.provider(() -> new File(project.getBuildDir(), "bootScripts"))); - bootStartScripts.setApplicationName( - project.provider(() -> applicationConvention.getApplicationName())); + bootStartScripts.getConventionMapping().map("outputDir", + () -> new File(project.getBuildDir(), "bootScripts")); + bootStartScripts.getConventionMapping().map("applicationName", + () -> applicationConvention.getApplicationName()); CopySpec binCopySpec = project.copySpec().into("bin").from(bootStartScripts); binCopySpec.setFileMode(0x755); distribution.getContents().with(binCopySpec); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/application/CreateBootStartScripts.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/application/CreateBootStartScripts.java index d6fbc6ab0be..20740261657 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/application/CreateBootStartScripts.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/application/CreateBootStartScripts.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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,13 +16,7 @@ package org.springframework.boot.gradle.tasks.application; -import java.io.File; - -import org.gradle.api.provider.PropertyState; -import org.gradle.api.provider.Provider; -import org.gradle.api.tasks.Input; import org.gradle.api.tasks.Optional; -import org.gradle.api.tasks.OutputDirectory; import org.gradle.jvm.application.tasks.CreateStartScripts; /** @@ -33,54 +27,10 @@ import org.gradle.jvm.application.tasks.CreateStartScripts; */ public class CreateBootStartScripts extends CreateStartScripts { - private final PropertyState outputDir = getProject().property(File.class); - - private final PropertyState applicationName = getProject() - .property(String.class); - @Override @Optional public String getMainClassName() { return super.getMainClassName(); } - @Input - @Override - public String getApplicationName() { - return this.applicationName.getOrNull(); - } - - @Override - public void setApplicationName(String applicationName) { - this.applicationName.set(applicationName); - } - - /** - * Sets the application name to the value from the given - * {@code applicationNameProvider}. - * @param applicationNameProvider the provider of the application name - */ - public void setApplicationName(Provider applicationNameProvider) { - this.applicationName.set(applicationNameProvider); - } - - @Override - @OutputDirectory - public File getOutputDir() { - return this.outputDir.getOrNull(); - } - - @Override - public void setOutputDir(File outputDir) { - this.outputDir.set(outputDir); - } - - /** - * Sets the output directory to the value from the given {@code outputDirProvider}. - * @param outputDirProvider the provider of the output directory - */ - public void setOutputDir(Provider outputDirProvider) { - this.outputDir.set(outputDirProvider); - } - } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfo.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfo.java index af526b4f003..57b402af210 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -26,8 +26,6 @@ import org.gradle.api.Action; import org.gradle.api.Project; import org.gradle.api.Task; import org.gradle.api.internal.ConventionTask; -import org.gradle.api.provider.PropertyState; -import org.gradle.api.provider.Provider; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.OutputDirectory; import org.gradle.api.tasks.TaskAction; @@ -46,7 +44,7 @@ public class BuildInfo extends ConventionTask { private final BuildInfoProperties properties = new BuildInfoProperties(getProject()); - private PropertyState destinationDir = getProject().property(File.class); + private File destinationDir; /** * Generates the {@code build-info.properties} file in the configured @@ -78,7 +76,7 @@ public class BuildInfo extends ConventionTask { */ @OutputDirectory public File getDestinationDir() { - return this.destinationDir.isPresent() ? this.destinationDir.get() + return this.destinationDir != null ? this.destinationDir : getProject().getBuildDir(); } @@ -87,16 +85,7 @@ public class BuildInfo extends ConventionTask { * @param destinationDir the destination directory */ public void setDestinationDir(File destinationDir) { - this.destinationDir.set(destinationDir); - } - - /** - * Sets the directory to which the {@code build-info.properties} file will be written - * to the value from the given {@code destinationDirProvider}. - * @param destinationDirProvider the provider of the destination directory - */ - public void setDestinationDir(Provider destinationDirProvider) { - this.destinationDir.set(destinationDirProvider); + this.destinationDir = destinationDir; } /**