mirror of
https://github.com/ethauvin/rife2.git
synced 2025-05-01 19:08:12 -07:00
Cleanups and javadocs
This commit is contained in:
parent
96f6681639
commit
6c68141898
11 changed files with 40 additions and 31 deletions
|
@ -13,6 +13,12 @@ import rife.tools.exceptions.FileUtilsErrorException;
|
|||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Cleans by deleting a list of directories and all their contents.
|
||||
*
|
||||
* @author Geert Bevin (gbevin[remove] at uwyn dot com)
|
||||
* @since 1.5
|
||||
*/
|
||||
public class CleanOperation {
|
||||
public static class Help implements BuildHelp {
|
||||
public String getDescription() {
|
||||
|
@ -29,15 +35,23 @@ public class CleanOperation {
|
|||
|
||||
private List<File> directories_ = new ArrayList<>();
|
||||
|
||||
public CleanOperation() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform the clean operation.
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public void execute() {
|
||||
for (var directory : directories()) {
|
||||
executeCleanDirectory(directory);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Part of the {@link #execute} operation, cleans an individual directory.
|
||||
*
|
||||
* @param directory the directory to clean.
|
||||
* @since 1.5
|
||||
*/
|
||||
public void executeCleanDirectory(File directory) {
|
||||
try {
|
||||
FileUtils.deleteDirectory(directory);
|
||||
|
@ -46,6 +60,12 @@ public class CleanOperation {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures a clean operation from a {@link Project}.
|
||||
*
|
||||
* @param project the project to configure the clean operation from
|
||||
* @since 1.5
|
||||
*/
|
||||
public CleanOperation fromProject(Project project) {
|
||||
return directories(List.of(
|
||||
project.buildDistDirectory(),
|
||||
|
@ -54,11 +74,28 @@ public class CleanOperation {
|
|||
project.buildTestDirectory()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a list of directories to clean.
|
||||
* <p>
|
||||
* A copy will be created to allow this list to be independently modifiable.
|
||||
*
|
||||
* @param directories the directories to clean
|
||||
* @return this {@code CleanOperation} instance
|
||||
* @since 1.5
|
||||
*/
|
||||
public CleanOperation directories(List<File> directories) {
|
||||
directories_ = new ArrayList<>(directories);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the list of directories to clean.
|
||||
* <p>
|
||||
* This is a modifiable list that can be retrieved and changed.
|
||||
*
|
||||
* @return the list of directories to clean.
|
||||
* @since 1.5
|
||||
*/
|
||||
public List<File> directories() {
|
||||
return directories_;
|
||||
}
|
||||
|
|
|
@ -37,9 +37,6 @@ public class CompileOperation {
|
|||
private List<File> testSourceFiles_ = new ArrayList<>();
|
||||
private List<String> compileOptions_ = new ArrayList<>();
|
||||
|
||||
public CompileOperation() {
|
||||
}
|
||||
|
||||
public void execute()
|
||||
throws Exception {
|
||||
executeCreateBuildDirectories();
|
||||
|
|
|
@ -54,9 +54,6 @@ public class CreateOperation {
|
|||
private File projectPackageDirectory_;
|
||||
private File testPackageDirectory_;
|
||||
|
||||
public CreateOperation() {
|
||||
}
|
||||
|
||||
public void execute()
|
||||
throws Exception {
|
||||
if (packageName() == null || projectName() == null) {
|
||||
|
|
|
@ -33,9 +33,6 @@ public class DownloadOperation {
|
|||
private File libStandaloneDirectory_;
|
||||
private File libTestDirectory_;
|
||||
|
||||
public DownloadOperation() {
|
||||
}
|
||||
|
||||
public void execute() {
|
||||
executeDownloadCompileDependencies();
|
||||
executeDownloadRuntimeDependencies();
|
||||
|
|
|
@ -39,9 +39,6 @@ public class JarOperation {
|
|||
|
||||
private final byte[] buffer_ = new byte[1024];
|
||||
|
||||
public JarOperation() {
|
||||
}
|
||||
|
||||
public void execute()
|
||||
throws Exception {
|
||||
executeCreateDestinationDirectory();
|
||||
|
|
|
@ -32,9 +32,6 @@ public class PrecompileOperation {
|
|||
private File srcMainResourcesTemplatesDirectory_;
|
||||
private File buildTemplatesDirectory_;
|
||||
|
||||
public PrecompileOperation() {
|
||||
}
|
||||
|
||||
public void execute() {
|
||||
executeCreateTemplateDeployer().execute();
|
||||
}
|
||||
|
|
|
@ -30,9 +30,6 @@ public class RunOperation {
|
|||
private List<String> runClasspath_ = new ArrayList<>();
|
||||
private String mainClass_;
|
||||
|
||||
public RunOperation() {
|
||||
}
|
||||
|
||||
public void execute()
|
||||
throws Exception {
|
||||
executeStartProcess().waitFor();
|
||||
|
|
|
@ -35,9 +35,6 @@ public class TestOperation {
|
|||
private Consumer<String> testOutputConsumer_;
|
||||
private Consumer<String> testErrorConsumer_;
|
||||
|
||||
public TestOperation() {
|
||||
}
|
||||
|
||||
public void execute()
|
||||
throws Exception {
|
||||
var process = executeStartProcess();
|
||||
|
|
|
@ -36,9 +36,6 @@ public class UberJarOperation {
|
|||
private String destinationFileName_;
|
||||
private String mainClass_;
|
||||
|
||||
public UberJarOperation() {
|
||||
}
|
||||
|
||||
public void execute()
|
||||
throws Exception {
|
||||
var tmp_dir = Files.createTempDirectory("uberjar").toFile();
|
||||
|
|
|
@ -37,9 +37,6 @@ public class WarOperation {
|
|||
private File destinationDirectory_;
|
||||
private String destinationFileName_;
|
||||
|
||||
public WarOperation() {
|
||||
}
|
||||
|
||||
public void execute()
|
||||
throws Exception {
|
||||
var tmp_dir = Files.createTempDirectory("war").toFile();
|
||||
|
|
|
@ -6,7 +6,6 @@ package rife.bld.operations;
|
|||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import rife.bld.Project;
|
||||
import rife.bld.dependencies.VersionNumber;
|
||||
import rife.tools.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue