commit
ff431b45cb
|
@ -16,8 +16,11 @@
|
||||||
|
|
||||||
package org.springframework.boot.build;
|
package org.springframework.boot.build;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.gradle.api.DefaultTask;
|
import org.gradle.api.DefaultTask;
|
||||||
import org.gradle.api.file.DirectoryProperty;
|
import org.gradle.api.file.DirectoryProperty;
|
||||||
|
import org.gradle.api.file.FileSystemOperations;
|
||||||
import org.gradle.api.provider.Property;
|
import org.gradle.api.provider.Property;
|
||||||
import org.gradle.api.tasks.Input;
|
import org.gradle.api.tasks.Input;
|
||||||
import org.gradle.api.tasks.InputDirectory;
|
import org.gradle.api.tasks.InputDirectory;
|
||||||
|
@ -32,8 +35,12 @@ import org.gradle.api.tasks.TaskAction;
|
||||||
*/
|
*/
|
||||||
public abstract class SyncAppSource extends DefaultTask {
|
public abstract class SyncAppSource extends DefaultTask {
|
||||||
|
|
||||||
public SyncAppSource() {
|
private final FileSystemOperations fileSystemOperations;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public SyncAppSource(FileSystemOperations fileSystemOperations) {
|
||||||
getPluginVersion().convention(getProject().provider(() -> getProject().getVersion().toString()));
|
getPluginVersion().convention(getProject().provider(() -> getProject().getVersion().toString()));
|
||||||
|
this.fileSystemOperations = fileSystemOperations;
|
||||||
}
|
}
|
||||||
|
|
||||||
@InputDirectory
|
@InputDirectory
|
||||||
|
@ -47,11 +54,11 @@ public abstract class SyncAppSource extends DefaultTask {
|
||||||
|
|
||||||
@TaskAction
|
@TaskAction
|
||||||
void syncAppSources() {
|
void syncAppSources() {
|
||||||
getProject().sync((copySpec) -> {
|
this.fileSystemOperations.sync((copySpec) -> {
|
||||||
copySpec.from(getSourceDirectory());
|
copySpec.from(getSourceDirectory());
|
||||||
copySpec.into(getDestinationDirectory());
|
copySpec.into(getDestinationDirectory());
|
||||||
copySpec.filter((line) -> line.replace("id \"org.springframework.boot\"",
|
copySpec.filter((line) -> line.replace("id \"org.springframework.boot\"",
|
||||||
"id \"org.springframework.boot\" version \"" + getProject().getVersion() + "\""));
|
"id \"org.springframework.boot\" version \"" + getPluginVersion().get() + "\""));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,11 +19,14 @@ package org.springframework.boot.build.cli;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
import org.gradle.api.DefaultTask;
|
import org.gradle.api.DefaultTask;
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
import org.gradle.api.Task;
|
import org.gradle.api.Task;
|
||||||
import org.gradle.api.file.DirectoryProperty;
|
import org.gradle.api.file.DirectoryProperty;
|
||||||
|
import org.gradle.api.file.FileSystemOperations;
|
||||||
import org.gradle.api.file.RegularFileProperty;
|
import org.gradle.api.file.RegularFileProperty;
|
||||||
import org.gradle.api.provider.MapProperty;
|
import org.gradle.api.provider.MapProperty;
|
||||||
import org.gradle.api.tasks.Input;
|
import org.gradle.api.tasks.Input;
|
||||||
|
@ -43,12 +46,16 @@ import org.springframework.boot.build.artifacts.ArtifactRelease;
|
||||||
*/
|
*/
|
||||||
public abstract class HomebrewFormula extends DefaultTask {
|
public abstract class HomebrewFormula extends DefaultTask {
|
||||||
|
|
||||||
public HomebrewFormula() {
|
private final FileSystemOperations fileSystemOperations;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public HomebrewFormula(FileSystemOperations fileSystemOperations) {
|
||||||
Project project = getProject();
|
Project project = getProject();
|
||||||
MapProperty<String, Object> properties = getProperties();
|
MapProperty<String, Object> properties = getProperties();
|
||||||
properties.put("hash", getArchive().map((archive) -> sha256(archive.getAsFile())));
|
properties.put("hash", getArchive().map((archive) -> sha256(archive.getAsFile())));
|
||||||
getProperties().put("repo", ArtifactRelease.forProject(project).getDownloadRepo());
|
getProperties().put("repo", ArtifactRelease.forProject(project).getDownloadRepo());
|
||||||
getProperties().put("version", project.getVersion().toString());
|
getProperties().put("version", project.getVersion().toString());
|
||||||
|
this.fileSystemOperations = fileSystemOperations;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String sha256(File file) {
|
private String sha256(File file) {
|
||||||
|
@ -77,7 +84,7 @@ public abstract class HomebrewFormula extends DefaultTask {
|
||||||
|
|
||||||
@TaskAction
|
@TaskAction
|
||||||
void createFormula() {
|
void createFormula() {
|
||||||
getProject().copy((copy) -> {
|
this.fileSystemOperations.copy((copy) -> {
|
||||||
copy.from(getTemplate());
|
copy.from(getTemplate());
|
||||||
copy.into(getOutputDir());
|
copy.into(getOutputDir());
|
||||||
copy.expand(getProperties().get());
|
copy.expand(getProperties().get());
|
||||||
|
|
|
@ -16,10 +16,13 @@
|
||||||
|
|
||||||
package org.springframework.boot.build.mavenplugin;
|
package org.springframework.boot.build.mavenplugin;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.gradle.api.DefaultTask;
|
import org.gradle.api.DefaultTask;
|
||||||
import org.gradle.api.Task;
|
import org.gradle.api.Task;
|
||||||
import org.gradle.api.artifacts.Configuration;
|
import org.gradle.api.artifacts.Configuration;
|
||||||
import org.gradle.api.file.DirectoryProperty;
|
import org.gradle.api.file.DirectoryProperty;
|
||||||
|
import org.gradle.api.file.FileSystemOperations;
|
||||||
import org.gradle.api.provider.SetProperty;
|
import org.gradle.api.provider.SetProperty;
|
||||||
import org.gradle.api.tasks.Input;
|
import org.gradle.api.tasks.Input;
|
||||||
import org.gradle.api.tasks.OutputDirectory;
|
import org.gradle.api.tasks.OutputDirectory;
|
||||||
|
@ -32,6 +35,13 @@ import org.gradle.api.tasks.TaskAction;
|
||||||
*/
|
*/
|
||||||
public abstract class PrepareMavenBinaries extends DefaultTask {
|
public abstract class PrepareMavenBinaries extends DefaultTask {
|
||||||
|
|
||||||
|
private final FileSystemOperations fileSystemOperations;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public PrepareMavenBinaries(FileSystemOperations fileSystemOperations) {
|
||||||
|
this.fileSystemOperations = fileSystemOperations;
|
||||||
|
}
|
||||||
|
|
||||||
@OutputDirectory
|
@OutputDirectory
|
||||||
public abstract DirectoryProperty getOutputDir();
|
public abstract DirectoryProperty getOutputDir();
|
||||||
|
|
||||||
|
@ -40,7 +50,7 @@ public abstract class PrepareMavenBinaries extends DefaultTask {
|
||||||
|
|
||||||
@TaskAction
|
@TaskAction
|
||||||
public void prepareBinaries() {
|
public void prepareBinaries() {
|
||||||
getProject().sync((sync) -> {
|
this.fileSystemOperations.sync((sync) -> {
|
||||||
sync.into(getOutputDir());
|
sync.into(getOutputDir());
|
||||||
for (String version : getVersions().get()) {
|
for (String version : getVersions().get()) {
|
||||||
Configuration configuration = getProject().getConfigurations()
|
Configuration configuration = getProject().getConfigurations()
|
||||||
|
|
Loading…
Reference in New Issue