mirror of
https://github.com/ethauvin/bld.git
synced 2025-04-25 16:27:11 -07:00
Added JavacOptions, JavadocOptions and JavaOptions File argument alternatives with Path and String.
Relaxed the requirement to specify mainClass in a project and added support for module.
This commit is contained in:
parent
126daecd21
commit
9f9e8a95db
9 changed files with 861 additions and 47 deletions
|
@ -61,6 +61,13 @@ public class BaseProject extends BuildExecutor {
|
|||
* @since 1.5
|
||||
*/
|
||||
protected String mainClass = null;
|
||||
/**
|
||||
* The project's module.
|
||||
*
|
||||
* @see #module()
|
||||
* @since 2.1
|
||||
*/
|
||||
protected String module = null;
|
||||
|
||||
/**
|
||||
* The project's repositories for dependency resolution.
|
||||
|
@ -1399,12 +1406,18 @@ public class BaseProject extends BuildExecutor {
|
|||
* @since 1.5
|
||||
*/
|
||||
public String mainClass() {
|
||||
if (mainClass == null) {
|
||||
throw new IllegalStateException("The mainClass variable has to be set.");
|
||||
}
|
||||
return mainClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the project's module.
|
||||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
public String module() {
|
||||
return module;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of repositories for this project.
|
||||
* <p>
|
||||
|
@ -1520,7 +1533,14 @@ public class BaseProject extends BuildExecutor {
|
|||
* @since 1.5
|
||||
*/
|
||||
public String uberJarMainClass() {
|
||||
return Objects.requireNonNullElseGet(uberJarMainClass, this::mainClass);
|
||||
if (uberJarMainClass != null) {
|
||||
return uberJarMainClass;
|
||||
}
|
||||
if (mainClass() != null) {
|
||||
return mainClass();
|
||||
}
|
||||
|
||||
throw new IllegalStateException("The mainClass variable has to be set.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,6 +29,7 @@ public abstract class AbstractProcessOperation<T extends AbstractProcessOperatio
|
|||
protected final List<String> classpath_ = new ArrayList<>();
|
||||
protected final List<String> modulePath_ = new ArrayList<>();
|
||||
protected String mainClass_;
|
||||
protected String module_;
|
||||
protected Function<String, Boolean> outputProcessor_;
|
||||
protected Function<String, Boolean> errorProcessor_;
|
||||
protected Process process_;
|
||||
|
@ -252,6 +253,18 @@ public abstract class AbstractProcessOperation<T extends AbstractProcessOperatio
|
|||
return (T) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the module to launch with the java tool.
|
||||
*
|
||||
* @param name the module to launch
|
||||
* @return this operation instance
|
||||
* @since 2.1
|
||||
*/
|
||||
public T module(String name) {
|
||||
module_ = name;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the processor that will be used to handle the process output.
|
||||
* <p>
|
||||
|
@ -346,6 +359,16 @@ public abstract class AbstractProcessOperation<T extends AbstractProcessOperatio
|
|||
return mainClass_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the module to launch with the java tool.
|
||||
*
|
||||
* @return the module to launch
|
||||
* @since 2.1
|
||||
*/
|
||||
public String module() {
|
||||
return module_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the processor that is used to handle the process output.
|
||||
*
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
*/
|
||||
package rife.bld.operations;
|
||||
|
||||
import rife.tools.FileUtils;
|
||||
import rife.tools.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -38,8 +40,8 @@ public class JavaOptions extends ArrayList<String> {
|
|||
* @return this list of options
|
||||
* @since 1.5.18
|
||||
*/
|
||||
public JavaOptions modulePath(File... modules) {
|
||||
return modulePath(List.of(modules));
|
||||
public JavaOptions modulePath(File... paths) {
|
||||
return modulePath(List.of(paths));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,9 +50,49 @@ public class JavaOptions extends ArrayList<String> {
|
|||
* @return this list of options
|
||||
* @since 1.5.18
|
||||
*/
|
||||
public JavaOptions modulePath(List<File> modules) {
|
||||
public JavaOptions modulePath(List<File> paths) {
|
||||
return modulePathStrings(paths.stream().map(File::getAbsolutePath).toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of directories, each directory is a directory of modules.
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions modulePath(Path... paths) {
|
||||
return modulePathPaths(List.of(paths));
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of directories, each directory is a directory of modules.
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions modulePathPaths(List<Path> paths) {
|
||||
return modulePath(paths.stream().map(Path::toFile).toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of directories, each directory is a directory of modules.
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions modulePath(String... paths) {
|
||||
return modulePathStrings(List.of(paths));
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of directories, each directory is a directory of modules.
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions modulePathStrings(List<String> paths) {
|
||||
add("--module-path");
|
||||
add(StringUtils.join(modules, ":"));
|
||||
add(FileUtils.joinPaths(paths));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -61,8 +103,8 @@ public class JavaOptions extends ArrayList<String> {
|
|||
* @return this list of options
|
||||
* @since 1.5.18
|
||||
*/
|
||||
public JavaOptions upgradeModulePath(File... modulePath) {
|
||||
return upgradeModulePath(List.of(modulePath));
|
||||
public JavaOptions upgradeModulePath(File... paths) {
|
||||
return upgradeModulePath(List.of(paths));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,9 +114,53 @@ public class JavaOptions extends ArrayList<String> {
|
|||
* @return this list of options
|
||||
* @since 1.5.18
|
||||
*/
|
||||
public JavaOptions upgradeModulePath(List<File> modulePath) {
|
||||
public JavaOptions upgradeModulePath(List<File> paths) {
|
||||
return upgradeModulePathStrings(paths.stream().map(File::getAbsolutePath).toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* List of directories, each directory is a directory of modules
|
||||
* that replace upgradeable modules in the runtime image
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions upgradeModulePath(Path... paths) {
|
||||
return upgradeModulePathPaths(List.of(paths));
|
||||
}
|
||||
|
||||
/**
|
||||
* List of directories, each directory is a directory of modules
|
||||
* that replace upgradeable modules in the runtime image
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions upgradeModulePathPaths(List<Path> paths) {
|
||||
return upgradeModulePath(paths.stream().map(Path::toFile).toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* List of directories, each directory is a directory of modules
|
||||
* that replace upgradeable modules in the runtime image
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions upgradeModulePath(String... paths) {
|
||||
return upgradeModulePathStrings(List.of(paths));
|
||||
}
|
||||
|
||||
/**
|
||||
* List of directories, each directory is a directory of modules
|
||||
* that replace upgradeable modules in the runtime image
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions upgradeModulePathStrings(List<String> paths) {
|
||||
add("--upgrade-module-path");
|
||||
add(StringUtils.join(modulePath, ":"));
|
||||
add(FileUtils.joinPaths(paths));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -256,7 +342,7 @@ public class JavaOptions extends ArrayList<String> {
|
|||
* @since 1.5.18
|
||||
*/
|
||||
public JavaOptions agentPath(File pathName) {
|
||||
return agentPath(pathName, (String)null);
|
||||
return agentPath(pathName.getAbsolutePath(), (String)null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -266,8 +352,7 @@ public class JavaOptions extends ArrayList<String> {
|
|||
* @since 1.5.18
|
||||
*/
|
||||
public JavaOptions agentPath(File pathName, String options) {
|
||||
add("-agentpath:" + pathName + (options == null ? "" : "=" + options));
|
||||
return this;
|
||||
return agentPath(pathName.getAbsolutePath(), options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -277,7 +362,7 @@ public class JavaOptions extends ArrayList<String> {
|
|||
* @since 1.7.1
|
||||
*/
|
||||
public JavaOptions agentPath(File pathName, String... options) {
|
||||
return agentPath(pathName, List.of(options));
|
||||
return agentPath(pathName.getAbsolutePath(), List.of(options));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -287,6 +372,87 @@ public class JavaOptions extends ArrayList<String> {
|
|||
* @since 1.7.1
|
||||
*/
|
||||
public JavaOptions agentPath(File pathName, List<String> options) {
|
||||
return agentPath(pathName.getAbsolutePath(), options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load native agent library by full pathname.
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions agentPath(Path pathName) {
|
||||
return agentPath(pathName.toFile(), (String)null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load native agent library by full pathname.
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions agentPath(Path pathName, String options) {
|
||||
return agentPath(pathName.toFile(), options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load native agent library by full pathname.
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions agentPath(Path pathName, String... options) {
|
||||
return agentPath(pathName.toFile(), List.of(options));
|
||||
}
|
||||
|
||||
/**
|
||||
* Load native agent library by full pathname.
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions agentPath(Path pathName, List<String> options) {
|
||||
return agentPath(pathName.toFile(), options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load native agent library by full pathname.
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions agentPath(String pathName) {
|
||||
return agentPath(pathName, (String)null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load native agent library by full pathname.
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions agentPath(String pathName, String options) {
|
||||
add("-agentpath:" + pathName + (options == null ? "" : "=" + options));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load native agent library by full pathname.
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions agentPath(String pathName, String... options) {
|
||||
return agentPath(pathName, List.of(options));
|
||||
}
|
||||
|
||||
/**
|
||||
* Load native agent library by full pathname.
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions agentPath(String pathName, List<String> options) {
|
||||
add("-agentpath:" + pathName + (options == null || options.isEmpty() ? "" : "=" + StringUtils.join(options, ",")));
|
||||
return this;
|
||||
}
|
||||
|
@ -298,7 +464,7 @@ public class JavaOptions extends ArrayList<String> {
|
|||
* @since 1.5.18
|
||||
*/
|
||||
public JavaOptions javaAgent(File jarPath) {
|
||||
return javaAgent(jarPath, (String)null);
|
||||
return javaAgent(jarPath.getAbsolutePath(), (String)null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -308,8 +474,7 @@ public class JavaOptions extends ArrayList<String> {
|
|||
* @since 1.5.18
|
||||
*/
|
||||
public JavaOptions javaAgent(File jarPath, String options) {
|
||||
add("-javaagent:" + jarPath + (options == null ? "" : "=" + options));
|
||||
return this;
|
||||
return javaAgent(jarPath.getAbsolutePath(), options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -319,7 +484,7 @@ public class JavaOptions extends ArrayList<String> {
|
|||
* @since 1.7.1
|
||||
*/
|
||||
public JavaOptions javaAgent(File jarPath, String... options) {
|
||||
return javaAgent(jarPath, List.of(options));
|
||||
return javaAgent(jarPath.getAbsolutePath(), List.of(options));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -329,6 +494,87 @@ public class JavaOptions extends ArrayList<String> {
|
|||
* @since 1.7.1
|
||||
*/
|
||||
public JavaOptions javaAgent(File jarPath, List<String> options) {
|
||||
return javaAgent(jarPath.getAbsolutePath(), options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Java programming language agent.
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions javaAgent(Path jarPath) {
|
||||
return javaAgent(jarPath.toFile(), (String)null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Java programming language agent.
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions javaAgent(Path jarPath, String options) {
|
||||
return javaAgent(jarPath.toFile(), options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Java programming language agent.
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions javaAgent(Path jarPath, String... options) {
|
||||
return javaAgent(jarPath.toFile(), List.of(options));
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Java programming language agent.
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions javaAgent(Path jarPath, List<String> options) {
|
||||
return javaAgent(jarPath.toFile(), options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Java programming language agent.
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions javaAgent(String jarPath) {
|
||||
return javaAgent(jarPath, (String)null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Java programming language agent.
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions javaAgent(String jarPath, String options) {
|
||||
add("-javaagent:" + jarPath + (options == null ? "" : "=" + options));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Java programming language agent.
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions javaAgent(String jarPath, String... options) {
|
||||
return javaAgent(jarPath, List.of(options));
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Java programming language agent.
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavaOptions javaAgent(String jarPath, List<String> options) {
|
||||
add("-javaagent:" + jarPath + (options == null || options.isEmpty() ? "" : "=" + StringUtils.join(options, ",")));
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -9,10 +9,10 @@ import rife.tools.FileUtils;
|
|||
import rife.tools.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Options for the standard javac tool.
|
||||
|
@ -121,8 +121,48 @@ public class JavacOptions extends ArrayList<String> {
|
|||
* @since 1.5.18
|
||||
*/
|
||||
public JavacOptions endorsedDirs(List<File> dirs) {
|
||||
return endorsedDirsStrings(dirs.stream().map(File::getAbsolutePath).toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Override location of endorsed standards path
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavacOptions endorsedDirs(Path... dirs) {
|
||||
return endorsedDirsPaths(Arrays.asList(dirs));
|
||||
}
|
||||
|
||||
/**
|
||||
* Override location of endorsed standards path
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavacOptions endorsedDirsPaths(List<Path> dirs) {
|
||||
return endorsedDirs(dirs.stream().map(Path::toFile).toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Override location of endorsed standards path
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavacOptions endorsedDirs(String... dirs) {
|
||||
return endorsedDirsStrings(Arrays.asList(dirs));
|
||||
}
|
||||
|
||||
/**
|
||||
* Override location of endorsed standards path
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavacOptions endorsedDirsStrings(List<String> dirs) {
|
||||
add("-endorseddirs");
|
||||
add(dirs.stream().map(File::getAbsolutePath).collect(Collectors.joining(",")));
|
||||
add(String.join(",", dirs));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -143,8 +183,48 @@ public class JavacOptions extends ArrayList<String> {
|
|||
* @since 1.5.18
|
||||
*/
|
||||
public JavacOptions extDirs(List<File> dirs) {
|
||||
return extDirsStrings(dirs.stream().map(File::getAbsolutePath).toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Override location of installed extensions
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavacOptions extDirs(Path... dirs) {
|
||||
return extDirsPaths(Arrays.asList(dirs));
|
||||
}
|
||||
|
||||
/**
|
||||
* Override location of installed extensions
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavacOptions extDirsPaths(List<Path> dirs) {
|
||||
return extDirs(dirs.stream().map(Path::toFile).toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Override location of installed extensions
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavacOptions extDirs(String... dirs) {
|
||||
return extDirsStrings(Arrays.asList(dirs));
|
||||
}
|
||||
|
||||
/**
|
||||
* Override location of installed extensions
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavacOptions extDirsStrings(List<String> dirs) {
|
||||
add("-extdirs");
|
||||
add(dirs.stream().map(File::getAbsolutePath).collect(Collectors.joining(",")));
|
||||
add(String.join(",", dirs));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -193,8 +273,28 @@ public class JavacOptions extends ArrayList<String> {
|
|||
* @since 1.5.18
|
||||
*/
|
||||
public JavacOptions nativeHeaders(File path) {
|
||||
return nativeHeaders(path.getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify where to place generated native header files
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavacOptions nativeHeaders(Path path) {
|
||||
return nativeHeaders(path.toFile());
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify where to place generated native header files
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavacOptions nativeHeaders(String path) {
|
||||
add("-h");
|
||||
add(path.getAbsolutePath());
|
||||
add(path);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -270,8 +370,48 @@ public class JavacOptions extends ArrayList<String> {
|
|||
* @since 1.6.2
|
||||
*/
|
||||
public JavacOptions modulePath(List<File> paths) {
|
||||
return modulePathStrings(paths.stream().map(File::getAbsolutePath).toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify where to find application modules
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavacOptions modulePath(Path... paths) {
|
||||
return modulePathPaths(Arrays.asList(paths));
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify where to find application modules
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavacOptions modulePathPaths(List<Path> paths) {
|
||||
return modulePath(paths.stream().map(Path::toFile).toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify where to find application modules
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavacOptions modulePath(String... paths) {
|
||||
return modulePathStrings(Arrays.asList(paths));
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify where to find application modules
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavacOptions modulePathStrings(List<String> paths) {
|
||||
add("--module-path");
|
||||
add(FileUtils.joinPaths(paths.stream().map(File::getAbsolutePath).toList()));
|
||||
add(FileUtils.joinPaths(paths));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -282,8 +422,28 @@ public class JavacOptions extends ArrayList<String> {
|
|||
* @since 1.5.18
|
||||
*/
|
||||
public JavacOptions moduleSourcePath(File path) {
|
||||
return moduleSourcePath(path.getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify where to find input source files for multiple modules
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavacOptions moduleSourcePath(Path path) {
|
||||
return moduleSourcePath(path.toFile());
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify where to find input source files for multiple modules
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavacOptions moduleSourcePath(String path) {
|
||||
add("--module-source-path");
|
||||
add(path.getAbsolutePath());
|
||||
add(path);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -361,8 +521,28 @@ public class JavacOptions extends ArrayList<String> {
|
|||
* @since 1.5.18
|
||||
*/
|
||||
public JavacOptions processorModulePath(File path) {
|
||||
return processorModulePath(path.getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify a module path where to find annotation processors
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavacOptions processorModulePath(Path path) {
|
||||
return processorModulePath(path.toFile());
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify a module path where to find annotation processors
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavacOptions processorModulePath(String path) {
|
||||
add("--processor-module-path");
|
||||
add(path.getAbsolutePath());
|
||||
add(path);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -373,8 +553,28 @@ public class JavacOptions extends ArrayList<String> {
|
|||
* @since 1.5.18
|
||||
*/
|
||||
public JavacOptions processorPath(File path) {
|
||||
return processorPath(path.getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify where to find annotation processors
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavacOptions processorPath(Path path) {
|
||||
return processorPath(path.toFile());
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify where to find annotation processors
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavacOptions processorPath(String path) {
|
||||
add("--processor-path");
|
||||
add(path.getAbsolutePath());
|
||||
add(path);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -409,8 +609,28 @@ public class JavacOptions extends ArrayList<String> {
|
|||
* @since 1.5.18
|
||||
*/
|
||||
public JavacOptions upgradeModulePath(File path) {
|
||||
return upgradeModulePath(path.getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Override location of upgradeable modules
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavacOptions upgradeModulePath(Path path) {
|
||||
return upgradeModulePath(path.toFile());
|
||||
}
|
||||
|
||||
/**
|
||||
* Override location of upgradeable modules
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavacOptions upgradeModulePath(String path) {
|
||||
add("--upgrade-module-path");
|
||||
add(path.getAbsolutePath());
|
||||
add(path);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@ import rife.tools.FileUtils;
|
|||
import rife.tools.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Options for the standard javadoc tool.
|
||||
|
@ -178,8 +178,48 @@ public class JavadocOptions extends ArrayList<String> {
|
|||
* @since 1.5.18
|
||||
*/
|
||||
public JavadocOptions extDirs(List<File> dirs) {
|
||||
return extDirsStrings(dirs.stream().map(File::getAbsolutePath).toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Override location of installed extensions
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavadocOptions extDirs(Path... dirs) {
|
||||
return extDirsPaths(Arrays.asList(dirs));
|
||||
}
|
||||
|
||||
/**
|
||||
* Override location of installed extensions
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavadocOptions extDirsPaths(List<Path> dirs) {
|
||||
return extDirs(dirs.stream().map(Path::toFile).toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Override location of installed extensions
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavadocOptions extDirs(String... dirs) {
|
||||
return extDirsStrings(Arrays.asList(dirs));
|
||||
}
|
||||
|
||||
/**
|
||||
* Override location of installed extensions
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavadocOptions extDirsStrings(List<String> dirs) {
|
||||
add("-extdirs");
|
||||
add(dirs.stream().map(File::getAbsolutePath).collect(Collectors.joining(",")));
|
||||
add(String.join(",", dirs));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -256,8 +296,48 @@ public class JavadocOptions extends ArrayList<String> {
|
|||
* @since 1.6.3
|
||||
*/
|
||||
public JavadocOptions modulePath(List<File> paths) {
|
||||
return modulePathStrings(paths.stream().map(File::getAbsolutePath).toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify where to find application modules
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavadocOptions modulePath(Path... paths) {
|
||||
return modulePathPaths(Arrays.asList(paths));
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify where to find application modules
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavadocOptions modulePathPaths(List<Path> paths) {
|
||||
return modulePath(paths.stream().map(Path::toFile).toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify where to find application modules
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavadocOptions modulePath(String... paths) {
|
||||
return modulePathStrings(Arrays.asList(paths));
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify where to find application modules
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavadocOptions modulePathStrings(List<String> paths) {
|
||||
add("--module-path");
|
||||
add(FileUtils.joinPaths(paths.stream().map(File::getAbsolutePath).toList()));
|
||||
add(FileUtils.joinPaths(paths));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -268,8 +348,28 @@ public class JavadocOptions extends ArrayList<String> {
|
|||
* @since 1.6.3
|
||||
*/
|
||||
public JavadocOptions moduleSourcePath(File path) {
|
||||
return moduleSourcePath(path.getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify where to find input source files for multiple modules
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavadocOptions moduleSourcePath(Path path) {
|
||||
return moduleSourcePath(path.toFile());
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify where to find input source files for multiple modules
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavadocOptions moduleSourcePath(String path) {
|
||||
add("--module-source-path");
|
||||
add(path.getAbsolutePath());
|
||||
add(path);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -425,9 +525,29 @@ public class JavadocOptions extends ArrayList<String> {
|
|||
* @return this list of options
|
||||
* @since 1.5.12
|
||||
*/
|
||||
public JavadocOptions addScript(File file) {
|
||||
public JavadocOptions addScript(File path) {
|
||||
return addScript(path.getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a script file to the generated documentation
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavadocOptions addScript(Path path) {
|
||||
return addScript(path.toFile());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a script file to the generated documentation
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavadocOptions addScript(String path) {
|
||||
add("--add-script");
|
||||
add(file.getAbsolutePath());
|
||||
add(path);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -437,9 +557,29 @@ public class JavadocOptions extends ArrayList<String> {
|
|||
* @return this list of options
|
||||
* @since 1.5.12
|
||||
*/
|
||||
public JavadocOptions addStylesheet(File file) {
|
||||
public JavadocOptions addStylesheet(File path) {
|
||||
return addStylesheet(path.getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a stylesheet file to the generated documentation
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavadocOptions addStylesheet(Path path) {
|
||||
return addStylesheet(path.toFile());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a stylesheet file to the generated documentation
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavadocOptions addStylesheet(String path) {
|
||||
add("--add-stylesheet");
|
||||
add(file.getAbsolutePath());
|
||||
add(path);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -578,9 +718,29 @@ public class JavadocOptions extends ArrayList<String> {
|
|||
* @return this list of options
|
||||
* @since 1.5.12
|
||||
*/
|
||||
public JavadocOptions stylesheet(File file) {
|
||||
public JavadocOptions stylesheet(File path) {
|
||||
return stylesheet(path.getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
* File to change style of the generated documentation
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavadocOptions stylesheet(Path path) {
|
||||
return stylesheet(path.toFile());
|
||||
}
|
||||
|
||||
/**
|
||||
* File to change style of the generated documentation
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavadocOptions stylesheet(String path) {
|
||||
add("--main-stylesheet");
|
||||
add(file.getAbsolutePath());
|
||||
add(path);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -735,9 +895,29 @@ public class JavadocOptions extends ArrayList<String> {
|
|||
* @return this list of options
|
||||
* @since 1.5.18
|
||||
*/
|
||||
public JavadocOptions overview(File htmlFile) {
|
||||
public JavadocOptions overview(File path) {
|
||||
return overview(path.getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Read overview documentation from HTML file
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavadocOptions overview(Path path) {
|
||||
return overview(path.toFile());
|
||||
}
|
||||
|
||||
/**
|
||||
* Read overview documentation from HTML file
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavadocOptions overview(String path) {
|
||||
add("-overview");
|
||||
add(htmlFile.getAbsolutePath());
|
||||
add(path);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -793,8 +973,28 @@ public class JavadocOptions extends ArrayList<String> {
|
|||
* @since 1.5.12
|
||||
*/
|
||||
public JavadocOptions snippetPath(File path) {
|
||||
return snippetPath(path.getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
* The path for external snippets
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavadocOptions snippetPath(Path path) {
|
||||
return snippetPath(path.toFile());
|
||||
}
|
||||
|
||||
/**
|
||||
* The path for external snippets
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavadocOptions snippetPath(String path) {
|
||||
add("--snippet-path");
|
||||
add(path.getAbsolutePath());
|
||||
add(path);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -852,8 +1052,28 @@ public class JavadocOptions extends ArrayList<String> {
|
|||
* @since 1.5.12
|
||||
*/
|
||||
public JavadocOptions tagletPath(File path) {
|
||||
return tagletPath(path.getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
* The path to Taglets
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavadocOptions tagletPath(Path path) {
|
||||
return tagletPath(path.toFile());
|
||||
}
|
||||
|
||||
/**
|
||||
* The path to Taglets
|
||||
*
|
||||
* @return this list of options
|
||||
* @since 2.1
|
||||
*/
|
||||
public JavadocOptions tagletPath(String path) {
|
||||
add("-tagletpath");
|
||||
add(path.getAbsolutePath());
|
||||
add(path);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,16 +31,27 @@ public class RunOperation extends AbstractProcessOperation<RunOperation> {
|
|||
var args = new ArrayList<String>();
|
||||
args.add(javaTool());
|
||||
args.addAll(javaOptions());
|
||||
|
||||
if (!classpath().isEmpty()) {
|
||||
args.add("-cp");
|
||||
args.add(FileUtils.joinPaths(classpath()));
|
||||
}
|
||||
|
||||
if (!modulePath().isEmpty()) {
|
||||
args.add("-p");
|
||||
args.add(FileUtils.joinPaths(modulePath()));
|
||||
}
|
||||
args.add(mainClass());
|
||||
|
||||
if (module() != null && !module().isEmpty()) {
|
||||
args.add("-m");
|
||||
args.add(module());
|
||||
}
|
||||
else if (mainClass() != null && !mainClass().isEmpty()){
|
||||
args.add(mainClass());
|
||||
}
|
||||
|
||||
args.addAll(runOptions());
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
|
@ -55,7 +66,8 @@ public class RunOperation extends AbstractProcessOperation<RunOperation> {
|
|||
.javaTool(project.javaTool())
|
||||
.classpath(project.runClasspath())
|
||||
.modulePath(project.runModulePath())
|
||||
.mainClass(project.mainClass());
|
||||
.mainClass(project.mainClass())
|
||||
.module(project.module());
|
||||
if (project.usesRife2Agent()) {
|
||||
operation.javaOptions().javaAgent(project.getRife2AgentFile());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue