More API cleanups
This commit is contained in:
parent
1b08f43392
commit
61623728ff
4 changed files with 504 additions and 52 deletions
|
@ -27,7 +27,6 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
@ -66,6 +65,16 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
return s != null && !s.isBlank();
|
return s != null && !s.isBlank();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the main build destination directory.
|
||||||
|
*
|
||||||
|
* @param directory the directory to use for the main build destination
|
||||||
|
* @return this operation instance
|
||||||
|
*/
|
||||||
|
public CompileKotlinOperation buildMainDirectory(Path directory) {
|
||||||
|
return buildMainDirectory(directory.toFile());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the main build destination directory.
|
* Provides the main build destination directory.
|
||||||
*
|
*
|
||||||
|
@ -77,6 +86,16 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the main build destination directory.
|
||||||
|
*
|
||||||
|
* @param directory the directory to use for the main build destination
|
||||||
|
* @return this operation instance
|
||||||
|
*/
|
||||||
|
public CompileKotlinOperation buildMainDirectory(String directory) {
|
||||||
|
return buildMainDirectory(new File(directory));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the main build destination directory.
|
* Retrieves the main build destination directory.
|
||||||
*
|
*
|
||||||
|
@ -97,6 +116,26 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the test build destination directory.
|
||||||
|
*
|
||||||
|
* @param directory the directory to use for the test build destination
|
||||||
|
* @return this operation instance
|
||||||
|
*/
|
||||||
|
public CompileKotlinOperation buildTestDirectory(Path directory) {
|
||||||
|
return buildTestDirectory(directory.toFile());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the test build destination directory.
|
||||||
|
*
|
||||||
|
* @param directory the directory to use for the test build destination
|
||||||
|
* @return this operation instance
|
||||||
|
*/
|
||||||
|
public CompileKotlinOperation buildTestDirectory(String directory) {
|
||||||
|
return buildTestDirectory(new File(directory));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the test build destination directory.
|
* Retrieves the test build destination directory.
|
||||||
*
|
*
|
||||||
|
@ -111,10 +150,10 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
*
|
*
|
||||||
* @param classpath one or more classpath entries
|
* @param classpath one or more classpath entries
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
|
* @see #compileMainClasspath(Collection)
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOperation compileMainClasspath(String... classpath) {
|
public CompileKotlinOperation compileMainClasspath(String... classpath) {
|
||||||
compileMainClasspath_.addAll(List.of(classpath));
|
return compileMainClasspath(List.of(classpath));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -164,8 +203,7 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOperation compileTestClasspath(String... classpath) {
|
public CompileKotlinOperation compileTestClasspath(String... classpath) {
|
||||||
compileTestClasspath_.addAll(List.of(classpath));
|
return compileTestClasspath(List.of(classpath));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -412,6 +450,16 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
return kotlinHome(new File(dir));
|
return kotlinHome(new File(dir));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the Kotlin home directory, if it differs from the default {@code KOTLIN_HOME}.
|
||||||
|
*
|
||||||
|
* @param dir the directory path
|
||||||
|
* @return this operation instance
|
||||||
|
*/
|
||||||
|
public CompileKotlinOperation kotlinHome(Path dir) {
|
||||||
|
return kotlinHome(dir.toFile());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the Kotlin home directory.
|
* Retrieves the Kotlin home directory.
|
||||||
*
|
*
|
||||||
|
@ -452,14 +500,13 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides main source directories that should be compiled.
|
* Provides the path to the Kotlin compiler ({@code kotlinc}) executable, if not in {@link #kotlinHome()}.
|
||||||
*
|
*
|
||||||
* @param directories one or more main source directories
|
* @param executable the executable path
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOperation mainSourceDirectories(File... directories) {
|
public CompileKotlinOperation kotlinc(Path executable) {
|
||||||
mainSourceDirectories_.addAll(List.of(directories));
|
return kotlinc(executable.toFile());
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -467,10 +514,32 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
*
|
*
|
||||||
* @param directories one or more main source directories
|
* @param directories one or more main source directories
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
|
* @see #mainSourceDirectories(Collection)
|
||||||
|
*/
|
||||||
|
public CompileKotlinOperation mainSourceDirectories(File... directories) {
|
||||||
|
return mainSourceDirectories(List.of(directories));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides main source directories that should be compiled.
|
||||||
|
*
|
||||||
|
* @param directories one or more main source directories
|
||||||
|
* @return this operation instance
|
||||||
|
* @see #mainSourceDirectoriesPaths(Collection)
|
||||||
|
*/
|
||||||
|
public CompileKotlinOperation mainSourceDirectories(Path... directories) {
|
||||||
|
return mainSourceDirectoriesPaths(List.of(directories));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides main source directories that should be compiled.
|
||||||
|
*
|
||||||
|
* @param directories one or more main source directories
|
||||||
|
* @return this operation instance
|
||||||
|
* @see #mainSourceDirectoriesStrings(Collection)
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOperation mainSourceDirectories(String... directories) {
|
public CompileKotlinOperation mainSourceDirectories(String... directories) {
|
||||||
mainSourceDirectories_.addAll(Arrays.stream(directories).map(File::new).toList());
|
return mainSourceDirectoriesStrings(List.of(directories));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -478,6 +547,7 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
*
|
*
|
||||||
* @param directories the main source directories
|
* @param directories the main source directories
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
|
* @see #mainSourceDirectories(File...)
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOperation mainSourceDirectories(Collection<File> directories) {
|
public CompileKotlinOperation mainSourceDirectories(Collection<File> directories) {
|
||||||
mainSourceDirectories_.addAll(directories);
|
mainSourceDirectories_.addAll(directories);
|
||||||
|
@ -494,14 +564,25 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides main source files that should be compiled.
|
* Provides the main source directories that should be compiled.
|
||||||
*
|
*
|
||||||
* @param files one or more main source files
|
* @param directories the main source directories
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
|
* @see #mainSourceDirectories(Path...)
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOperation mainSourceFiles(File... files) {
|
public CompileKotlinOperation mainSourceDirectoriesPaths(Collection<Path> directories) {
|
||||||
mainSourceFiles_.addAll(List.of(files));
|
return mainSourceDirectories(directories.stream().map(Path::toFile).toList());
|
||||||
return this;
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the main source directories that should be compiled.
|
||||||
|
*
|
||||||
|
* @param directories the main source directories
|
||||||
|
* @return this operation instance
|
||||||
|
* @see #mainSourceDirectories(String...)
|
||||||
|
*/
|
||||||
|
public CompileKotlinOperation mainSourceDirectoriesStrings(Collection<String> directories) {
|
||||||
|
return mainSourceDirectories(directories.stream().map(File::new).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -509,10 +590,32 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
*
|
*
|
||||||
* @param files one or more main source files
|
* @param files one or more main source files
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
|
* @see #mainSourceFiles(Collection)
|
||||||
|
*/
|
||||||
|
public CompileKotlinOperation mainSourceFiles(File... files) {
|
||||||
|
return mainSourceFiles(List.of(files));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides main source files that should be compiled.
|
||||||
|
*
|
||||||
|
* @param files one or more main source files
|
||||||
|
* @return this operation instance
|
||||||
|
* @see #mainSourceFilesStrings(Collection)
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOperation mainSourceFiles(String... files) {
|
public CompileKotlinOperation mainSourceFiles(String... files) {
|
||||||
mainSourceFiles_.addAll(Arrays.stream(files).map(File::new).toList());
|
return mainSourceFilesStrings(List.of(files));
|
||||||
return this;
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides main source files that should be compiled.
|
||||||
|
*
|
||||||
|
* @param files one or more main source files
|
||||||
|
* @return this operation instance
|
||||||
|
* @see #mainSourceFilesPaths(Collection)
|
||||||
|
*/
|
||||||
|
public CompileKotlinOperation mainSourceFiles(Path... files) {
|
||||||
|
return mainSourceFilesPaths(List.of(files));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -520,6 +623,7 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
*
|
*
|
||||||
* @param files the main source files
|
* @param files the main source files
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
|
* @see #mainSourceFiles(File...)
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOperation mainSourceFiles(Collection<File> files) {
|
public CompileKotlinOperation mainSourceFiles(Collection<File> files) {
|
||||||
mainSourceFiles_.addAll(files);
|
mainSourceFiles_.addAll(files);
|
||||||
|
@ -535,6 +639,39 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
return mainSourceFiles_;
|
return mainSourceFiles_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the main source files that should be compiled.
|
||||||
|
*
|
||||||
|
* @param files the main source files
|
||||||
|
* @return this operation instance
|
||||||
|
* @see #mainSourceFiles(Path...)
|
||||||
|
*/
|
||||||
|
public CompileKotlinOperation mainSourceFilesPaths(Collection<Path> files) {
|
||||||
|
return mainSourceFiles(files.stream().map(Path::toFile).toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the main source files that should be compiled.
|
||||||
|
*
|
||||||
|
* @param files the main source files
|
||||||
|
* @return this operation instance
|
||||||
|
* @see #mainSourceFiles(String...)
|
||||||
|
*/
|
||||||
|
public CompileKotlinOperation mainSourceFilesStrings(Collection<String> files) {
|
||||||
|
return mainSourceFiles(files.stream().map(File::new).toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides compiler plugins.
|
||||||
|
*
|
||||||
|
* @param directory the directory containing the plugin JARs
|
||||||
|
* @param plugins one or more plugins
|
||||||
|
* @return this class instance
|
||||||
|
*/
|
||||||
|
public CompileKotlinOperation plugins(String directory, CompilerPlugin... plugins) {
|
||||||
|
return plugins(new File(directory), plugins);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides compiler plugins.
|
* Provides compiler plugins.
|
||||||
*
|
*
|
||||||
|
@ -542,8 +679,7 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
* @return this class instance
|
* @return this class instance
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOperation plugins(String... plugins) {
|
public CompileKotlinOperation plugins(String... plugins) {
|
||||||
plugins_.addAll(List.of(plugins));
|
return plugins(List.of(plugins));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -580,6 +716,17 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides compiler plugins.
|
||||||
|
*
|
||||||
|
* @param directory the directory containing the plugin JARs
|
||||||
|
* @param plugins one or more plugins
|
||||||
|
* @return this class instance
|
||||||
|
*/
|
||||||
|
public CompileKotlinOperation plugins(Path directory, CompilerPlugin... plugins) {
|
||||||
|
return plugins(directory.toFile(), plugins);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides compiler plugins located in the {@link #kotlinHome()} lib directory.
|
* Provides compiler plugins located in the {@link #kotlinHome()} lib directory.
|
||||||
*
|
*
|
||||||
|
@ -613,10 +760,10 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
*
|
*
|
||||||
* @param directories one or more test source directories
|
* @param directories one or more test source directories
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
|
* @see #testSourceDirectories(Collection)
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOperation testSourceDirectories(File... directories) {
|
public CompileKotlinOperation testSourceDirectories(File... directories) {
|
||||||
testSourceDirectories_.addAll(List.of(directories));
|
return testSourceDirectories(List.of(directories));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -624,10 +771,21 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
*
|
*
|
||||||
* @param directories one or more test source directories
|
* @param directories one or more test source directories
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
|
* @see #testSourceDirectoriesPaths(Collection)
|
||||||
|
*/
|
||||||
|
public CompileKotlinOperation testSourceDirectories(Path... directories) {
|
||||||
|
return testSourceDirectoriesPaths(List.of(directories));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides test source directories that should be compiled.
|
||||||
|
*
|
||||||
|
* @param directories one or more test source directories
|
||||||
|
* @return this operation instance
|
||||||
|
* @see #testSourceDirectoriesStrings(Collection)
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOperation testSourceDirectories(String... directories) {
|
public CompileKotlinOperation testSourceDirectories(String... directories) {
|
||||||
testSourceDirectories_.addAll(Arrays.stream(directories).map(File::new).toList());
|
return testSourceDirectoriesStrings(List.of(directories));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -635,6 +793,7 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
*
|
*
|
||||||
* @param directories the test source directories
|
* @param directories the test source directories
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
|
* @see #testSourceDirectories(File...)
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOperation testSourceDirectories(Collection<File> directories) {
|
public CompileKotlinOperation testSourceDirectories(Collection<File> directories) {
|
||||||
testSourceDirectories_.addAll(directories);
|
testSourceDirectories_.addAll(directories);
|
||||||
|
@ -650,15 +809,37 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
return testSourceDirectories_;
|
return testSourceDirectories_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the test source directories that should be compiled.
|
||||||
|
*
|
||||||
|
* @param directories the test source directories
|
||||||
|
* @return this operation instance
|
||||||
|
* @see #testSourceDirectories(Path...)
|
||||||
|
*/
|
||||||
|
public CompileKotlinOperation testSourceDirectoriesPaths(Collection<Path> directories) {
|
||||||
|
return testSourceDirectories(directories.stream().map(Path::toFile).toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the test source directories that should be compiled.
|
||||||
|
*
|
||||||
|
* @param directories the test source directories
|
||||||
|
* @return this operation instance
|
||||||
|
* @see #testSourceDirectories(String...)
|
||||||
|
*/
|
||||||
|
public CompileKotlinOperation testSourceDirectoriesStrings(Collection<String> directories) {
|
||||||
|
return testSourceDirectories(directories.stream().map(File::new).toList());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides test source files that should be compiled.
|
* Provides test source files that should be compiled.
|
||||||
*
|
*
|
||||||
* @param files one or more test source files
|
* @param files one or more test source files
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
|
* @see #testSourceFiles(Collection)
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOperation testSourceFiles(File... files) {
|
public CompileKotlinOperation testSourceFiles(File... files) {
|
||||||
testSourceFiles_.addAll(List.of(files));
|
return testSourceFiles(List.of(files));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -666,10 +847,21 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
*
|
*
|
||||||
* @param files one or more test source files
|
* @param files one or more test source files
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
|
* @see #testSourceFilesStrings(Collection)
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOperation testSourceFiles(String... files) {
|
public CompileKotlinOperation testSourceFiles(String... files) {
|
||||||
testSourceFiles_.addAll(Arrays.stream(files).map(File::new).toList());
|
return testSourceFilesStrings(List.of(files));
|
||||||
return this;
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the test sources files that should be compiled.
|
||||||
|
*
|
||||||
|
* @param files one or more test source files
|
||||||
|
* @return this operation instance
|
||||||
|
* @see #testSourceFilesPaths(Collection)
|
||||||
|
*/
|
||||||
|
public CompileKotlinOperation testSourceFiles(Path... files) {
|
||||||
|
return testSourceFilesPaths(List.of(files));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -677,6 +869,7 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
*
|
*
|
||||||
* @param files the test source files
|
* @param files the test source files
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
|
* @see #testSourceFiles(File...)
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOperation testSourceFiles(Collection<File> files) {
|
public CompileKotlinOperation testSourceFiles(Collection<File> files) {
|
||||||
testSourceFiles_.addAll(files);
|
testSourceFiles_.addAll(files);
|
||||||
|
@ -692,6 +885,28 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
return testSourceFiles_;
|
return testSourceFiles_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the test source files that should be compiled.
|
||||||
|
*
|
||||||
|
* @param files the test source files
|
||||||
|
* @return this operation instance
|
||||||
|
* @see #testSourceFiles(Path...)
|
||||||
|
*/
|
||||||
|
public CompileKotlinOperation testSourceFilesPaths(Collection<Path> files) {
|
||||||
|
return testSourceFiles(files.stream().map(Path::toFile).toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the test source files that should be compiled.
|
||||||
|
*
|
||||||
|
* @param files the test source files
|
||||||
|
* @return this operation instance
|
||||||
|
* @see #testSourceFiles(String...)
|
||||||
|
*/
|
||||||
|
public CompileKotlinOperation testSourceFilesStrings(Collection<String> files) {
|
||||||
|
return testSourceFiles(files.stream().map(File::new).toList());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the working directory.
|
* Retrieves the working directory.
|
||||||
*
|
*
|
||||||
|
@ -712,6 +927,16 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the working directory, if it differs from the project's directory.
|
||||||
|
*
|
||||||
|
* @param dir the directory
|
||||||
|
* @return this operation instance
|
||||||
|
*/
|
||||||
|
public CompileKotlinOperation workDir(Path dir) {
|
||||||
|
return workDir(dir.toFile());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the working directory, if it differs from the project's directory.
|
* Provides the working directory, if it differs from the project's directory.
|
||||||
*
|
*
|
||||||
|
|
|
@ -68,8 +68,7 @@ public class CompileOptions {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public CompileOptions advancedOptions(String... options) {
|
public CompileOptions advancedOptions(String... options) {
|
||||||
advancedOptions_.addAll(List.of(options));
|
return advancedOptions(List.of(options));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -120,8 +119,7 @@ public class CompileOptions {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public CompileOptions apiVersion(int version) {
|
public CompileOptions apiVersion(int version) {
|
||||||
apiVersion_ = String.valueOf(version);
|
return apiVersion(String.valueOf(version));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -141,6 +139,7 @@ public class CompileOptions {
|
||||||
*
|
*
|
||||||
* @param files one or more files
|
* @param files one or more files
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
|
* @see #argFileStrings(Collection)
|
||||||
*/
|
*/
|
||||||
public CompileOptions argFile(String... files) {
|
public CompileOptions argFile(String... files) {
|
||||||
return argFileStrings(List.of(files));
|
return argFileStrings(List.of(files));
|
||||||
|
@ -151,7 +150,7 @@ public class CompileOptions {
|
||||||
*
|
*
|
||||||
* @param files the compiler options files
|
* @param files the compiler options files
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
* @see #argFile(String...)
|
* @see #argFile(File...)
|
||||||
*/
|
*/
|
||||||
public CompileOptions argFile(Collection<File> files) {
|
public CompileOptions argFile(Collection<File> files) {
|
||||||
argFile_.addAll(files);
|
argFile_.addAll(files);
|
||||||
|
@ -175,6 +174,7 @@ public class CompileOptions {
|
||||||
*
|
*
|
||||||
* @param files one or more files
|
* @param files one or more files
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
|
* @see #argFile(Collection)
|
||||||
*/
|
*/
|
||||||
public CompileOptions argFile(File... files) {
|
public CompileOptions argFile(File... files) {
|
||||||
return argFile(List.of(files));
|
return argFile(List.of(files));
|
||||||
|
@ -197,6 +197,7 @@ public class CompileOptions {
|
||||||
*
|
*
|
||||||
* @param files one or more files
|
* @param files one or more files
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
|
* @see #argFilePaths(Collection)
|
||||||
*/
|
*/
|
||||||
public CompileOptions argFile(Path... files) {
|
public CompileOptions argFile(Path... files) {
|
||||||
return argFilePaths(List.of(files));
|
return argFilePaths(List.of(files));
|
||||||
|
@ -216,7 +217,7 @@ public class CompileOptions {
|
||||||
*
|
*
|
||||||
* @param files the compiler options files
|
* @param files the compiler options files
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
* @see #argFile(String...)
|
* @see #argFile(Path...)
|
||||||
*/
|
*/
|
||||||
public CompileOptions argFilePaths(Collection<Path> files) {
|
public CompileOptions argFilePaths(Collection<Path> files) {
|
||||||
return argFile(files.stream().map(Path::toFile).toList());
|
return argFile(files.stream().map(Path::toFile).toList());
|
||||||
|
@ -393,6 +394,7 @@ public class CompileOptions {
|
||||||
*
|
*
|
||||||
* @param paths one pr more paths
|
* @param paths one pr more paths
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
|
* @see #classpathStrings(Collection)
|
||||||
*/
|
*/
|
||||||
public CompileOptions classpath(String... paths) {
|
public CompileOptions classpath(String... paths) {
|
||||||
return classpathStrings(List.of(paths));
|
return classpathStrings(List.of(paths));
|
||||||
|
@ -405,6 +407,7 @@ public class CompileOptions {
|
||||||
*
|
*
|
||||||
* @param paths one or more path
|
* @param paths one or more path
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
|
* @see #classpath(Collection)
|
||||||
*/
|
*/
|
||||||
public CompileOptions classpath(File... paths) {
|
public CompileOptions classpath(File... paths) {
|
||||||
return classpath(List.of(paths));
|
return classpath(List.of(paths));
|
||||||
|
@ -417,6 +420,7 @@ public class CompileOptions {
|
||||||
*
|
*
|
||||||
* @param paths one or more path
|
* @param paths one or more path
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
|
* @see #classpathPaths(Collection)
|
||||||
*/
|
*/
|
||||||
public CompileOptions classpath(Path... paths) {
|
public CompileOptions classpath(Path... paths) {
|
||||||
return classpathPaths(List.of(paths));
|
return classpathPaths(List.of(paths));
|
||||||
|
@ -429,6 +433,7 @@ public class CompileOptions {
|
||||||
*
|
*
|
||||||
* @param paths the search paths
|
* @param paths the search paths
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
|
* @see #classpath(File...)
|
||||||
*/
|
*/
|
||||||
public CompileOptions classpath(Collection<File> paths) {
|
public CompileOptions classpath(Collection<File> paths) {
|
||||||
classpath_.addAll(paths);
|
classpath_.addAll(paths);
|
||||||
|
@ -451,6 +456,7 @@ public class CompileOptions {
|
||||||
*
|
*
|
||||||
* @param paths one pr more paths
|
* @param paths one pr more paths
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
|
* @see #classpath(Path...)
|
||||||
*/
|
*/
|
||||||
public CompileOptions classpathPaths(Collection<Path> paths) {
|
public CompileOptions classpathPaths(Collection<Path> paths) {
|
||||||
return classpath(paths.stream().map(Path::toFile).toList());
|
return classpath(paths.stream().map(Path::toFile).toList());
|
||||||
|
@ -463,6 +469,7 @@ public class CompileOptions {
|
||||||
*
|
*
|
||||||
* @param paths one pr more paths
|
* @param paths one pr more paths
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
|
* @see #classpath(String...)
|
||||||
*/
|
*/
|
||||||
public CompileOptions classpathStrings(Collection<String> paths) {
|
public CompileOptions classpathStrings(Collection<String> paths) {
|
||||||
return classpath(paths.stream().map(File::new).toList());
|
return classpath(paths.stream().map(File::new).toList());
|
||||||
|
@ -679,8 +686,7 @@ public class CompileOptions {
|
||||||
* @see #jdkRelease(String)
|
* @see #jdkRelease(String)
|
||||||
*/
|
*/
|
||||||
public CompileOptions jdkRelease(int version) {
|
public CompileOptions jdkRelease(int version) {
|
||||||
jdkRelease_ = String.valueOf(version);
|
return jdkRelease(String.valueOf(version));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -721,8 +727,7 @@ public class CompileOptions {
|
||||||
* @see #jvmTarget(String)
|
* @see #jvmTarget(String)
|
||||||
*/
|
*/
|
||||||
public CompileOptions jvmTarget(int target) {
|
public CompileOptions jvmTarget(int target) {
|
||||||
jvmTarget_ = String.valueOf(target);
|
return jvmTarget(String.valueOf(target));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -879,8 +884,7 @@ public class CompileOptions {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public CompileOptions optIn(String... annotations) {
|
public CompileOptions optIn(String... annotations) {
|
||||||
optIn_.addAll(List.of(annotations));
|
return optIn(List.of(annotations));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -910,8 +914,7 @@ public class CompileOptions {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public CompileOptions options(String... options) {
|
public CompileOptions options(String... options) {
|
||||||
options_.addAll(List.of(options));
|
return options(List.of(options));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1022,8 +1025,7 @@ public class CompileOptions {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public CompileOptions scriptTemplates(String... classNames) {
|
public CompileOptions scriptTemplates(String... classNames) {
|
||||||
scriptTemplates_.addAll(List.of(classNames));
|
return scriptTemplates(List.of(classNames));
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -37,7 +37,11 @@ import java.util.logging.Logger;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
|
||||||
class CompileKotlinOperationTest {
|
class CompileKotlinOperationTest {
|
||||||
|
private static final String FILE_1 = "file1";
|
||||||
|
private static final String FILE_2 = "file2";
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
static void beforeAll() {
|
static void beforeAll() {
|
||||||
var level = Level.ALL;
|
var level = Level.ALL;
|
||||||
|
@ -49,6 +53,36 @@ class CompileKotlinOperationTest {
|
||||||
logger.setUseParentHandlers(false);
|
logger.setUseParentHandlers(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testBuildMainDirectory() {
|
||||||
|
var foo = new File("foo");
|
||||||
|
var bar = new File("bar");
|
||||||
|
|
||||||
|
var op = new CompileKotlinOperation().buildMainDirectory(foo);
|
||||||
|
assertThat(op.buildMainDirectory()).as("as file").isEqualTo(foo);
|
||||||
|
|
||||||
|
op = op.buildMainDirectory(bar.toPath());
|
||||||
|
assertThat(op.buildMainDirectory()).as("as path").isEqualTo(bar);
|
||||||
|
|
||||||
|
op = new CompileKotlinOperation().buildMainDirectory("foo");
|
||||||
|
assertThat(op.buildMainDirectory()).as("as string").isEqualTo(foo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testBuildTestDirectory() {
|
||||||
|
var foo = new File("foo");
|
||||||
|
var bar = new File("bar");
|
||||||
|
|
||||||
|
var op = new CompileKotlinOperation().buildTestDirectory(foo);
|
||||||
|
assertThat(op.buildTestDirectory()).as("as file").isEqualTo(foo);
|
||||||
|
|
||||||
|
op = op.buildTestDirectory(bar.toPath());
|
||||||
|
assertThat(op.buildTestDirectory()).as("as path").isEqualTo(bar);
|
||||||
|
|
||||||
|
op = new CompileKotlinOperation().buildTestDirectory("foo");
|
||||||
|
assertThat(op.buildTestDirectory()).as("as string").isEqualTo(foo);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testCollections() {
|
void testCollections() {
|
||||||
var op = new CompileKotlinOperation()
|
var op = new CompileKotlinOperation()
|
||||||
|
@ -71,6 +105,9 @@ class CompileKotlinOperationTest {
|
||||||
.plugins("plugin1", "plugin2")
|
.plugins("plugin1", "plugin2")
|
||||||
.plugins(CompilerPlugin.KOTLIN_SERIALIZATION, CompilerPlugin.ASSIGNMENT)
|
.plugins(CompilerPlugin.KOTLIN_SERIALIZATION, CompilerPlugin.ASSIGNMENT)
|
||||||
.plugins(new File("lib/compile"), CompilerPlugin.LOMBOK, CompilerPlugin.POWER_ASSERT)
|
.plugins(new File("lib/compile"), CompilerPlugin.LOMBOK, CompilerPlugin.POWER_ASSERT)
|
||||||
|
.plugins(Path.of("lib/compile"), CompilerPlugin.NOARG, CompilerPlugin.ALL_OPEN)
|
||||||
|
.plugins("lib/compile", CompilerPlugin.KOTLINX_SERIALIZATION, CompilerPlugin.SAM_WITH_RECEIVER)
|
||||||
|
|
||||||
.plugins(List.of("plugin3", "plugin4"));
|
.plugins(List.of("plugin3", "plugin4"));
|
||||||
|
|
||||||
assertThat(op.kotlinHome().getName()).as("kotlin_home").isEqualTo("kotlin_home");
|
assertThat(op.kotlinHome().getName()).as("kotlin_home").isEqualTo("kotlin_home");
|
||||||
|
@ -93,10 +130,15 @@ class CompileKotlinOperationTest {
|
||||||
assertThat(op.testSourceFiles()).as("testSourceFiles").containsOnly(
|
assertThat(op.testSourceFiles()).as("testSourceFiles").containsOnly(
|
||||||
new File("tfile1"), new File("tfile2"), new File("tfile3"),
|
new File("tfile1"), new File("tfile2"), new File("tfile3"),
|
||||||
new File("tfile4"), new File("tfile5"), new File("tfile6"));
|
new File("tfile4"), new File("tfile5"), new File("tfile6"));
|
||||||
assertThat(op.plugins()).as("plugins").contains("plugin2", "plugin3", "plugin4",
|
assertThat(op.plugins()).as("plugins").contains("plugin1", "plugin2", "plugin3", "plugin4",
|
||||||
"/kotlin_home/lib/kotlin-serialization-compiler-plugin.jar",
|
"/kotlin_home/lib/kotlin-serialization-compiler-plugin.jar",
|
||||||
"/kotlin_home/lib/assignment-compiler-plugin.jar");
|
"/kotlin_home/lib/assignment-compiler-plugin.jar",
|
||||||
assertThat(op.plugins()).as("plugins size").hasSize(8);
|
new File("lib/compile", "lombok-compiler-plugin.jar").getAbsolutePath(),
|
||||||
|
new File("lib/compile", "power-assert-compiler-plugin.jar").getAbsolutePath(),
|
||||||
|
new File("lib/compile", "noarg-compiler-plugin.jar").getAbsolutePath(),
|
||||||
|
new File("lib/compile", "allopen-compiler-plugin.jar").getAbsolutePath(),
|
||||||
|
new File("lib/compile", "kotlinx-serialization-compiler-plugin.jar").getAbsolutePath(),
|
||||||
|
new File("lib/compile", "sam-with-receiver-compiler-plugin.jar").getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -155,6 +197,98 @@ class CompileKotlinOperationTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testKotlinHome() {
|
||||||
|
var foo = new File("foo");
|
||||||
|
var bar = new File("bar");
|
||||||
|
|
||||||
|
var op = new CompileKotlinOperation().kotlinHome(foo);
|
||||||
|
assertThat(op.kotlinHome()).as("as file").isEqualTo(foo);
|
||||||
|
|
||||||
|
op = op.kotlinHome(bar.toPath());
|
||||||
|
assertThat(op.kotlinHome()).as("as path").isEqualTo(bar);
|
||||||
|
|
||||||
|
op = new CompileKotlinOperation().kotlinHome("foo");
|
||||||
|
assertThat(op.kotlinHome()).as("as string").isEqualTo(foo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testKotlinc() {
|
||||||
|
var foo = new File("foo");
|
||||||
|
var bar = new File("bar");
|
||||||
|
|
||||||
|
var op = new CompileKotlinOperation().kotlinc(foo);
|
||||||
|
assertThat(op.kotlinc()).as("as file").isEqualTo(foo);
|
||||||
|
|
||||||
|
op = op.kotlinc(bar.toPath());
|
||||||
|
assertThat(op.kotlinc()).as("as path").isEqualTo(bar);
|
||||||
|
|
||||||
|
op = new CompileKotlinOperation().kotlinc("foo");
|
||||||
|
assertThat(op.kotlinc()).as("as string").isEqualTo(foo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testMainSourceDirectories() {
|
||||||
|
var op = new CompileKotlinOperation();
|
||||||
|
|
||||||
|
op.mainSourceDirectories(List.of(new File(FILE_1), new File(FILE_2)));
|
||||||
|
assertThat(op.mainSourceDirectories()).as("List(File...)").containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.mainSourceDirectories().clear();
|
||||||
|
|
||||||
|
op.mainSourceDirectories(new File(FILE_1), new File(FILE_2));
|
||||||
|
assertThat(op.mainSourceDirectories()).as("File...").containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.mainSourceDirectories().clear();
|
||||||
|
|
||||||
|
op.mainSourceDirectories(FILE_1, FILE_2);
|
||||||
|
assertThat(op.mainSourceDirectories()).as("String...")
|
||||||
|
.containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.mainSourceDirectories().clear();
|
||||||
|
|
||||||
|
op = op.mainSourceDirectories(Path.of(FILE_1), Path.of(FILE_2));
|
||||||
|
assertThat(op.mainSourceDirectories()).as("Path...")
|
||||||
|
.containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.mainSourceDirectories().clear();
|
||||||
|
|
||||||
|
op.mainSourceDirectoriesPaths(List.of(new File(FILE_1).toPath(), new File(FILE_2).toPath()));
|
||||||
|
assertThat(op.mainSourceDirectories()).as("List(Path...)").containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.mainSourceDirectories().clear();
|
||||||
|
|
||||||
|
op.mainSourceDirectoriesStrings(List.of(FILE_1, FILE_2));
|
||||||
|
assertThat(op.mainSourceDirectories()).as("List(String...)").containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.mainSourceDirectories().clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testMainSourceFiles() {
|
||||||
|
var op = new CompileKotlinOperation();
|
||||||
|
|
||||||
|
op.mainSourceFiles(List.of(new File(FILE_1), new File(FILE_2)));
|
||||||
|
assertThat(op.mainSourceFiles()).as("List(File...)").containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.mainSourceFiles().clear();
|
||||||
|
|
||||||
|
op.mainSourceFiles(new File(FILE_1), new File(FILE_2));
|
||||||
|
assertThat(op.mainSourceFiles()).as("File...").containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.mainSourceFiles().clear();
|
||||||
|
|
||||||
|
op.mainSourceFiles(FILE_1, FILE_2);
|
||||||
|
assertThat(op.mainSourceFiles()).as("String...")
|
||||||
|
.containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.mainSourceFiles().clear();
|
||||||
|
|
||||||
|
op = op.mainSourceFiles(Path.of(FILE_1), Path.of(FILE_2));
|
||||||
|
assertThat(op.mainSourceFiles()).as("Path...")
|
||||||
|
.containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.mainSourceFiles().clear();
|
||||||
|
|
||||||
|
op.mainSourceFilesPaths(List.of(new File(FILE_1).toPath(), new File(FILE_2).toPath()));
|
||||||
|
assertThat(op.mainSourceFiles()).as("List(Path...)").containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.mainSourceFiles().clear();
|
||||||
|
|
||||||
|
op.mainSourceFilesStrings(List.of(FILE_1, FILE_2));
|
||||||
|
assertThat(op.mainSourceFiles()).as("List(String...)").containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.mainSourceFiles().clear();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
|
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
|
||||||
void testPlugins() {
|
void testPlugins() {
|
||||||
|
@ -173,4 +307,81 @@ class CompileKotlinOperationTest {
|
||||||
assertThat(new File(p)).as(p).exists();
|
assertThat(new File(p)).as(p).exists();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testTestSourceDirectories() {
|
||||||
|
var op = new CompileKotlinOperation();
|
||||||
|
|
||||||
|
op.testSourceDirectories(List.of(new File(FILE_1), new File(FILE_2)));
|
||||||
|
assertThat(op.testSourceDirectories()).as("List(File...)").containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.testSourceDirectories().clear();
|
||||||
|
|
||||||
|
op.testSourceDirectories(new File(FILE_1), new File(FILE_2));
|
||||||
|
assertThat(op.testSourceDirectories()).as("File...").containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.testSourceDirectories().clear();
|
||||||
|
|
||||||
|
op.testSourceDirectories(FILE_1, FILE_2);
|
||||||
|
assertThat(op.testSourceDirectories()).as("String...")
|
||||||
|
.containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.testSourceDirectories().clear();
|
||||||
|
|
||||||
|
op = op.testSourceDirectories(Path.of(FILE_1), Path.of(FILE_2));
|
||||||
|
assertThat(op.testSourceDirectories()).as("Path...")
|
||||||
|
.containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.testSourceDirectories().clear();
|
||||||
|
|
||||||
|
op.testSourceDirectoriesPaths(List.of(new File(FILE_1).toPath(), new File(FILE_2).toPath()));
|
||||||
|
assertThat(op.testSourceDirectories()).as("List(Path...)").containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.testSourceDirectories().clear();
|
||||||
|
|
||||||
|
op.testSourceDirectoriesStrings(List.of(FILE_1, FILE_2));
|
||||||
|
assertThat(op.testSourceDirectories()).as("List(String...)").containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.testSourceDirectories().clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testTestSourceFiles() {
|
||||||
|
var op = new CompileKotlinOperation();
|
||||||
|
|
||||||
|
op.testSourceFiles(List.of(new File(FILE_1), new File(FILE_2)));
|
||||||
|
assertThat(op.testSourceFiles()).as("List(File...)").containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.testSourceFiles().clear();
|
||||||
|
|
||||||
|
op.testSourceFiles(new File(FILE_1), new File(FILE_2));
|
||||||
|
assertThat(op.testSourceFiles()).as("File...").containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.testSourceFiles().clear();
|
||||||
|
|
||||||
|
op.testSourceFiles(FILE_1, FILE_2);
|
||||||
|
assertThat(op.testSourceFiles()).as("String...")
|
||||||
|
.containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.testSourceFiles().clear();
|
||||||
|
|
||||||
|
op = op.testSourceFiles(Path.of(FILE_1), Path.of(FILE_2));
|
||||||
|
assertThat(op.testSourceFiles()).as("Path...")
|
||||||
|
.containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.testSourceFiles().clear();
|
||||||
|
|
||||||
|
op.testSourceFilesPaths(List.of(new File(FILE_1).toPath(), new File(FILE_2).toPath()));
|
||||||
|
assertThat(op.testSourceFiles()).as("List(Path...)").containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.testSourceFiles().clear();
|
||||||
|
|
||||||
|
op.testSourceFilesStrings(List.of(FILE_1, FILE_2));
|
||||||
|
assertThat(op.testSourceFiles()).as("List(String...)").containsExactly(new File(FILE_1), new File(FILE_2));
|
||||||
|
op.testSourceFiles().clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testWorkDir() {
|
||||||
|
var foo = new File("foo");
|
||||||
|
var bar = new File("bar");
|
||||||
|
|
||||||
|
var op = new CompileKotlinOperation().workDir(foo);
|
||||||
|
assertThat(op.workDir()).as("as file").isEqualTo(foo);
|
||||||
|
|
||||||
|
op = op.workDir(bar.toPath());
|
||||||
|
assertThat(op.workDir()).as("as path").isEqualTo(bar);
|
||||||
|
|
||||||
|
op = new CompileKotlinOperation().workDir("foo");
|
||||||
|
assertThat(op.workDir()).as("as string").isEqualTo(foo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,15 +248,29 @@ class CompileOptionsTest {
|
||||||
var options = new CompileOptions();
|
var options = new CompileOptions();
|
||||||
|
|
||||||
options.classpath(foo, bar);
|
options.classpath(foo, bar);
|
||||||
assertThat(options.classpath()).contains(foo, bar);
|
assertThat(options.classpath()).as("File...").containsExactly(foo, bar);
|
||||||
|
options.classpath().clear();
|
||||||
|
|
||||||
|
options.classpath(List.of(foo, bar));
|
||||||
|
assertThat(options.classpath()).as("List(File...)").containsExactly(foo, bar);
|
||||||
options.classpath().clear();
|
options.classpath().clear();
|
||||||
|
|
||||||
options = options.classpath(foo.toPath(), bar.toPath());
|
options = options.classpath(foo.toPath(), bar.toPath());
|
||||||
assertThat(options.classpath()).contains(foo, bar);
|
assertThat(options.classpath()).as("Path...").containsExactly(foo, bar);
|
||||||
|
options.classpath().clear();
|
||||||
|
|
||||||
|
options = options.classpathPaths(List.of(foo.toPath(), bar.toPath()));
|
||||||
|
assertThat(options.classpath()).as("List(Path...)").containsExactly(foo, bar);
|
||||||
options.classpath().clear();
|
options.classpath().clear();
|
||||||
|
|
||||||
options.classpath(foo.getAbsolutePath(), bar.getAbsolutePath());
|
options.classpath(foo.getAbsolutePath(), bar.getAbsolutePath());
|
||||||
assertThat(options.classpath()).contains(new File(foo.getAbsolutePath()), new File(bar.getAbsolutePath()));
|
assertThat(options.classpath()).as("String...")
|
||||||
|
.containsExactly(new File(foo.getAbsolutePath()), new File(bar.getAbsolutePath()));
|
||||||
|
options.classpath().clear();
|
||||||
|
|
||||||
|
options.classpathStrings(List.of(foo.getAbsolutePath(), bar.getAbsolutePath()));
|
||||||
|
assertThat(options.classpath()).as("List(String...)")
|
||||||
|
.containsExactly(new File(foo.getAbsolutePath()), new File(bar.getAbsolutePath()));
|
||||||
options.classpath().clear();
|
options.classpath().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,7 +315,7 @@ class CompileOptionsTest {
|
||||||
.includeRuntime(true)
|
.includeRuntime(true)
|
||||||
.javaParameters(true)
|
.javaParameters(true)
|
||||||
.jdkHome("jdk-home")
|
.jdkHome("jdk-home")
|
||||||
.jdkRelease("22")
|
.jdkRelease(22)
|
||||||
.jvmTarget("9")
|
.jvmTarget("9")
|
||||||
.kotlinHome("kotlin-home")
|
.kotlinHome("kotlin-home")
|
||||||
.languageVersion("1.0")
|
.languageVersion("1.0")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue