This commit is contained in:
Erik C. Thauvin 2025-12-27 20:29:17 +00:00 committed by GitHub
commit 0a18a69937
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 102 additions and 4 deletions

View file

@ -10,10 +10,7 @@ import rife.bld.operations.exceptions.OperationOptionException;
import rife.tools.exceptions.FileUtilsErrorException;
import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
/**
@ -233,6 +230,18 @@ public abstract class AbstractProcessOperation<T extends AbstractProcessOperatio
return (T) this;
}
/**
* Provides classpath entries to use for the operation.
*
* @param classpath classpath entries for the operation
* @return this operation instance
* @since 2.3.1
*
*/
public T classpath(File... classpath) {
return classpath(List.of(classpath));
}
/**
* Provides a list of classpath entries to use for the operation.
* <p>
@ -247,6 +256,20 @@ public abstract class AbstractProcessOperation<T extends AbstractProcessOperatio
return (T) this;
}
/**
* Provides a list of classpath entries to use for the operation.
* <p>
* A copy will be created to allow this list to be independently modifiable.
*
* @param classpath a list of classpath entries for the operation
* @return this operation instance
* @since 2.3.1
*/
public T classpath(Collection<File> classpath) {
classpath_.addAll(classpath.stream().map(File::getAbsolutePath).toList());
return (T) this;
}
/**
* Provides module path entries to use for the operation.
*
@ -259,6 +282,17 @@ public abstract class AbstractProcessOperation<T extends AbstractProcessOperatio
return (T) this;
}
/**
* Provides module path entries to use for the operation.
*
* @param modulePath module path entries for the operation
* @return this operation instance
* @since 2.3.1
*/
public T modulePath(File... modulePath) {
return modulePath(List.of(modulePath));
}
/**
* Provides a list of module path entries to use for the operation.
* <p>
@ -273,6 +307,20 @@ public abstract class AbstractProcessOperation<T extends AbstractProcessOperatio
return (T) this;
}
/**
* Provides a list of module path entries to use for the operation.
* <p>
* A copy will be created to allow this list to be independently modifiable.
*
* @param modulePath a list of module path entries for the operation
* @return this operation instance
* @since 2.3.1
*/
public T modulePath(Collection<File> modulePath) {
modulePath_.addAll(modulePath.stream().map(File::getAbsolutePath).toList());
return (T) this;
}
/**
* Provides the main class to launch with the java tool.
*

View file

@ -46,6 +46,32 @@ public class JavacOptions extends ArrayList<String> {
return this;
}
/**
* Specifies a package to be considered as exported from its defining
* module to additional modules or to all unnamed modules when the value
* of other-module is ALL-UNNAMED.
*
* @return this list of options
* @since 2.3.1
*/
public JavacOptions addExports(String... modules) {
return addExports(Arrays.asList(modules));
}
/**
* Specifies a package to be considered as exported from its defining
* module to additional modules or to all unnamed modules when the value
* of other-module is ALL-UNNAMED.
*
* @return this list of options
* @since 2.3.1
*/
public JavacOptions addExports(List<String> modules) {
add("--add-exports");
add(StringUtils.join(modules, ","));
return this;
}
/**
* Root modules to resolve in addition to the initial modules,
* or all modules on the module path if a module is
@ -253,6 +279,30 @@ public class JavacOptions extends ArrayList<String> {
return this;
}
/**
* Provide source compatibility with the specified Java SE release.
*
* @return this list of options
* @since 2.3.1
*/
public JavacOptions source(int version) {
add("--source");
add(Convert.toString(version));
return this;
}
/**
* Generate class files suitable for the specified Java SE release.
*
* @return this list of options
* @since 2.3.1
*/
public JavacOptions target(int version) {
add("--target");
add(Convert.toString(version));
return this;
}
/**
* Generate debugging info
*