plugin_ = new ArrayList<>();
@@ -65,7 +60,6 @@ public class CompileOptions {
private boolean progressive_;
private boolean verbose_;
private boolean wError_;
- private boolean wExtra_;
/**
* Specify advanced compiler options.
@@ -117,6 +111,7 @@ public class CompileOptions {
return this;
}
+
/**
* Allow using declarations only from the specified version of Kotlin bundled libraries.
*
@@ -255,27 +250,13 @@ public class CompileOptions {
// @argfile
if (!argFile_.isEmpty()) {
- argFile_.forEach(f -> {
- if (f.exists()) {
- try {
- try (var reader = Files.newBufferedReader(f.toPath(), Charset.defaultCharset())) {
- var tokenizer = new AbstractToolProviderOperation.CommandLineTokenizer(reader);
- String token;
- while ((token = tokenizer.nextToken()) != null) {
- args.add(token);
- }
- }
- } catch (IOException e) {
- if (LOGGER.isLoggable(Level.WARNING)) {
- LOGGER.log(Level.WARNING, "Could not read: " + f.getAbsolutePath(), e);
- }
- }
- } else {
- if (LOGGER.isLoggable(Level.WARNING)) {
- LOGGER.warning("File not found: " + f.getAbsolutePath());
- }
- }
- });
+ argFile_.forEach(f -> args.add("@" + f.getAbsolutePath()));
+ }
+
+ // classpath
+ if (!classpath_.isEmpty()) {
+ args.add("-classpath");
+ args.add(classpath_.stream().map(File::getAbsolutePath).collect(Collectors.joining(File.pathSeparator)));
}
// expression
@@ -311,6 +292,11 @@ public class CompileOptions {
args.add("-Xjdk-release=" + jdkRelease_);
}
+ // JVM options
+ if (!jvmOptions_.isEmpty()) {
+ jvmOptions_.forEach(s -> args.add("-J" + s));
+ }
+
// kotlin-home
if (kotlinHome_ != null) {
args.add("-kotlin-home");
@@ -393,20 +379,9 @@ public class CompileOptions {
args.add("-Werror");
}
- // Wextra
- if (wExtra_) {
- args.add("-Wextra");
- }
-
- // advanced options (X)
+ // advanced option (X)
if (!advancedOptions_.isEmpty()) {
- advancedOptions_.forEach(it -> {
- if (it.startsWith("-X")) {
- args.add(it);
- } else {
- args.add("-X" + it);
- }
- });
+ advancedOptions_.forEach(it -> args.add("-X" + it));
}
return args;
@@ -622,15 +597,6 @@ public class CompileOptions {
return wError_;
}
- /**
- * Indicates whether additional declaration, expression, and type compiler checks emit warnings.
- *
- * @return {@code true} or {@code false}
- */
- public boolean isWExtra() {
- return wExtra_;
- }
-
/**
* Generate metadata for Java 1.8 reflection on method parameters.
*
@@ -697,7 +663,7 @@ public class CompileOptions {
* Limit the API of the JDK in the classpath to the specified Java version. Automatically sets
* {@link #jvmTarget(String) JVM target} version.
*
- * Possible values are 1.8, 9, 10, ..., 23. The default value is 1.8.
+ * Possible values are 1.8, 9, 10, ..., 22. The default value is 1.8.
*
* @param version the target version
* @return this operation instance
@@ -712,6 +678,8 @@ public class CompileOptions {
*
* Limit the API of the JDK in the classpath to the specified Java version. Automatically sets
* {@link #jvmTarget(String) JVM target} version.
+ *
+ * Possible values are 1.8, 9, 10, ..., 22. The default value is 1.8.
*
* @param version the target version
* @return this operation instance
@@ -721,6 +689,36 @@ public class CompileOptions {
return jdkRelease(String.valueOf(version));
}
+ /**
+ * Retrieves the Java Virtual Machine options.
+ *
+ * @return the JVM options
+ */
+ public Collection jvmOptions() {
+ return jvmOptions_;
+ }
+
+ /**
+ * Pass an option directly to Java Virtual Machine
+ *
+ * @param jvmOptions the JVM options
+ * @return this operation instance
+ */
+ public CompileOptions jvmOptions(Collection jvmOptions) {
+ jvmOptions_.addAll(jvmOptions);
+ return this;
+ }
+
+ /**
+ * Pass an option directly to JVM
+ *
+ * @param jvmOptions one or more JVM option
+ * @return this operation instance
+ */
+ public CompileOptions jvmOptions(String... jvmOptions) {
+ return jvmOptions(List.of(jvmOptions));
+ }
+
/**
* Specify the target version of the generated JVM bytecode.
*
@@ -735,7 +733,7 @@ public class CompileOptions {
/**
* Specify the target version of the generated JVM bytecode.
*
- * Possible values are 1.8, 9, 10, ..., 23. The default value is 1.8.
+ * Possible values are 1.8, 9, 10, ..., 22. The default value is 1.8.
*
* @param target the target version
* @return this operation instance
@@ -1073,15 +1071,4 @@ public class CompileOptions {
wError_ = wError;
return this;
}
-
- /**
- * Enable additional declaration, expression, and type compiler checks that emit warnings if {@code true}.
- *
- * @param wExtra {@code true} or {@code false}
- * @return this operation instance
- */
- public CompileOptions wExtra(boolean wExtra) {
- wExtra_ = wExtra;
- return this;
- }
}
diff --git a/src/main/java/rife/bld/extension/kotlin/CompilerPlugin.java b/src/main/java/rife/bld/extension/kotlin/CompilerPlugin.java
index f1fd584..bbf3304 100644
--- a/src/main/java/rife/bld/extension/kotlin/CompilerPlugin.java
+++ b/src/main/java/rife/bld/extension/kotlin/CompilerPlugin.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2023-2025 the original author or authors.
+ * Copyright 2023-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
package rife.bld.extension.kotlin;
/**
- * @author Erik C. Thauvin
* Defines the known Kotlin compiler plugin JARs.
*
* @author Erik C. Thauvin
@@ -26,8 +25,6 @@ package rife.bld.extension.kotlin;
public enum CompilerPlugin {
ALL_OPEN("allopen-compiler-plugin.jar"),
ASSIGNMENT("assignment-compiler-plugin.jar"),
- COMPOSE("compose-compiler-plugin.jar"),
- KOTLIN_IMPORTS_DUMPER("kotlin-imports-dumper-compiler-plugin.jar"),
KOTLINX_SERIALIZATION("kotlinx-serialization-compiler-plugin.jar"),
KOTLIN_SERIALIZATION("kotlin-serialization-compiler-plugin.jar"),
LOMBOK("lombok-compiler-plugin.jar"),
diff --git a/src/main/java/rife/bld/extension/kotlin/JvmOptions.java b/src/main/java/rife/bld/extension/kotlin/JvmOptions.java
deleted file mode 100644
index 7e2ec62..0000000
--- a/src/main/java/rife/bld/extension/kotlin/JvmOptions.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright 2023-2025 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package rife.bld.extension.kotlin;
-
-import rife.tools.StringUtils;
-
-import java.io.Serial;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * Java Virtual Machine options.
- *
- * @author Erik C. Thauvin
- * @since 1.1.0
- */
-@SuppressWarnings("PMD.LooseCoupling")
-public class JvmOptions extends ArrayList {
- /**
- * Keyword to enable native access for all code on the class path.
- */
- public final static String ALL_UNNAMED = "ALL-UNNAMED";
-
- @Serial
- private static final long serialVersionUID = 1L;
-
- /**
- * Modules that are permitted to perform restricted native operations.
- * The module name can also be {@link #ALL_UNNAMED}.
- *
- * @param modules the module names
- * @return this list of options
- */
- public JvmOptions enableNativeAccess(String... modules) {
- return enableNativeAccess(List.of(modules));
- }
-
- /**
- * Modules that are permitted to perform restricted native operations.
- * The module name can also be {@link #ALL_UNNAMED}.
- *
- * @param modules the module names
- * @return this list of options
- */
- public JvmOptions enableNativeAccess(Collection modules) {
- add("--enable-native-access=" + StringUtils.join(modules, ","));
- return this;
- }
-
- /**
- * Controls what action the Java runtime takes when native access is not enabled for a module.
- *
- * @param access the access mode
- * @return this list of options
- */
- public JvmOptions illegalNativeAccess(NativeAccess access) {
- add("--illegal-native-access=" + access.mode);
- return this;
- }
-
- /**
- * Illegal native access modes.
- */
- public enum NativeAccess {
- ALLOW("allow"),
- DENY("deny"),
- WARN("warn");
-
- public final String mode;
-
- NativeAccess(String mode) {
- this.mode = mode;
- }
- }
-}
diff --git a/src/test/java/rife/bld/extension/CompileKotlinOperationTest.java b/src/test/java/rife/bld/extension/CompileKotlinOperationTest.java
index 4e0182e..efea216 100644
--- a/src/test/java/rife/bld/extension/CompileKotlinOperationTest.java
+++ b/src/test/java/rife/bld/extension/CompileKotlinOperationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2023-2025 the original author or authors.
+ * Copyright 2023-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,6 @@ import rife.bld.BaseProject;
import rife.bld.blueprints.BaseProjectBlueprint;
import rife.bld.extension.kotlin.CompileOptions;
import rife.bld.extension.kotlin.CompilerPlugin;
-import rife.bld.extension.kotlin.JvmOptions;
import rife.tools.FileUtils;
import java.io.File;
@@ -31,7 +30,6 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
-import java.util.Locale;
import java.util.Objects;
import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
@@ -88,7 +86,7 @@ class CompileKotlinOperationTest {
@Test
void testCollections() {
var op = new CompileKotlinOperation()
- .fromProject(new BaseProjectBlueprint(new File("examples"), "com.example", "Example", "Example"))
+ .fromProject(new BaseProjectBlueprint(new File("examples"), "com.example", "Example"))
.kotlinHome("/kotlin_home")
.kotlinc("kotlinc")
.workDir("work_dir")
@@ -105,11 +103,11 @@ class CompileKotlinOperationTest {
.testSourceFiles(List.of(new File("tfile3"), new File("tfile4")))
.testSourceFiles(new File("tfile5"), new File("tfile6"))
.plugins("plugin1", "plugin2")
- .plugins(CompilerPlugin.KOTLIN_SERIALIZATION, CompilerPlugin.ASSIGNMENT, CompilerPlugin.COMPOSE)
+ .plugins(CompilerPlugin.KOTLIN_SERIALIZATION, CompilerPlugin.ASSIGNMENT)
.plugins(new File("lib/compile"), CompilerPlugin.LOMBOK, CompilerPlugin.POWER_ASSERT)
- .plugins(Path.of("lib/compile"), CompilerPlugin.NOARG, CompilerPlugin.ALL_OPEN,
- CompilerPlugin.KOTLIN_IMPORTS_DUMPER)
+ .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"));
try (var softly = new AutoCloseableSoftAssertions()) {
@@ -133,14 +131,12 @@ class CompileKotlinOperationTest {
new File("tfile1"), new File("tfile2"), new File("tfile3"),
new File("tfile4"), new File("tfile5"), new File("tfile6"));
softly.assertThat(op.plugins()).as("plugins").contains("plugin1", "plugin2", "plugin3", "plugin4",
- new File("/kotlin_home/lib/kotlin-serialization-compiler-plugin.jar").getAbsolutePath(),
- new File("/kotlin_home/lib/assignment-compiler-plugin.jar").getAbsolutePath(),
- new File("/kotlin_home/lib/compose-compiler-plugin.jar").getAbsolutePath(),
+ "/kotlin_home/lib/kotlin-serialization-compiler-plugin.jar",
+ "/kotlin_home/lib/assignment-compiler-plugin.jar",
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", "kotlin-imports-dumper-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());
}
@@ -171,7 +167,8 @@ class CompileKotlinOperationTest {
}
var op = new CompileKotlinOperation()
- .fromProject(new BaseProjectBlueprint(new File("examples"), "com.example", "Example", "Example"))
+ .fromProject(new BaseProjectBlueprint(new File("examples"), "com.example",
+ "Example"))
.buildMainDirectory(mainDir)
.buildTestDirectory(testDir)
.compileMainClasspath(compileJars)
@@ -180,16 +177,10 @@ class CompileKotlinOperationTest {
.compileTestClasspath(mainDir.getAbsolutePath());
op.compileOptions().verbose(true);
- op.compileOptions().argFile("src/test/resources/argfile.txt", "src/test/resources/argfile2.txt");
-
- if (!CompileKotlinOperation.isWindows()) {
- op.jvmOptions().enableNativeAccess(JvmOptions.ALL_UNNAMED);
- assertThat(op.jvmOptions()).containsExactly("--enable-native-access=ALL-UNNAMED");
- }
+ op.compileOptions().jdkRelease("17");
var args = op.compileOptions().args();
- var matches = List.of("-Xjdk-release=17", "-no-reflect", "-progressive", "-include-runtime", "-no-stdlib",
- "-verbose");
+ var matches = List.of("-Xjdk-release=17", "-no-stdlib", "-verbose");
assertThat(args).as(args + " == " + matches).isEqualTo(matches);
op.execute();
@@ -214,43 +205,14 @@ class CompileKotlinOperationTest {
}
}
- @Test
- void testFindKotlincPath() {
- assertThat(CompileKotlinOperation.findKotlincPath()).doesNotStartWith("kotlinc");
- }
-
- @Test
- void testFromProject() {
- var examples = new File("examples");
- var op = new CompileKotlinOperation().fromProject(
- new BaseProjectBlueprint(examples, "com.example", "examples", "examples"));
- assertThat(op.mainSourceDirectories()).containsExactly(new File(examples, "src/main/kotlin"));
- assertThat(op.testSourceDirectories()).containsExactly(new File(examples, "src/test/kotlin"));
- }
-
@Test
void testFromProjectNoKotlin() {
var op = new CompileKotlinOperation().fromProject(
- new BaseProjectBlueprint(new File("foo"), "org.example", "foo", "foo"));
+ new BaseProjectBlueprint(new File("foo"), "org.example", "foo"));
assertThat(op.mainSourceDirectories()).isEmpty();
assertThat(op.testSourceDirectories()).isEmpty();
}
- @Test
- void testIsOS() {
- var osName = System.getProperty("os.name");
- if (osName != null) {
- var os = osName.toLowerCase(Locale.US);
- if (os.contains("win")) {
- assertThat(CompileKotlinOperation.isWindows()).isTrue();
- } else if (os.contains("linux") || os.contains("unix")) {
- assertThat(CompileKotlinOperation.isLinux()).isTrue();
- } else if (os.contains("mac") || os.contains("darwin")) {
- assertThat(CompileKotlinOperation.isMacOS()).isTrue();
- }
- }
- }
-
@Test
void testKotlinHome() {
var foo = new File("foo");
@@ -352,8 +314,6 @@ class CompileKotlinOperationTest {
.fromProject(new BaseProject())
.plugins(CompilerPlugin.ALL_OPEN,
CompilerPlugin.ASSIGNMENT,
- CompilerPlugin.COMPOSE,
- CompilerPlugin.KOTLIN_IMPORTS_DUMPER,
CompilerPlugin.KOTLINX_SERIALIZATION,
CompilerPlugin.KOTLIN_SERIALIZATION,
CompilerPlugin.LOMBOK,
diff --git a/src/test/java/rife/bld/extension/kotlin/CompileOptionsTest.java b/src/test/java/rife/bld/extension/kotlin/CompileOptionsTest.java
index c6e6965..5417115 100644
--- a/src/test/java/rife/bld/extension/kotlin/CompileOptionsTest.java
+++ b/src/test/java/rife/bld/extension/kotlin/CompileOptionsTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2023-2025 the original author or authors.
+ * Copyright 2023-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +18,6 @@ package rife.bld.extension.kotlin;
import org.assertj.core.api.AutoCloseableSoftAssertions;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.EnabledOnOs;
-import org.junit.jupiter.api.condition.OS;
import java.io.File;
import java.io.IOException;
@@ -47,11 +45,14 @@ class CompileOptionsTest {
.collect(Collectors.joining(File.pathSeparator));
}
+
@Test
- @SuppressWarnings("PMD.UnitTestShouldIncludeAssert")
+ @SuppressWarnings("PMD.JUnitTestsShouldIncludeAssert")
void testArgs() {
var options = new CompileOptions()
.apiVersion("11")
+ .argFile(new File("file.txt"), new File("file2.txt"))
+ .classpath(new File("path1"), new File("path2"))
.javaParameters(true)
.jvmTarget("11")
.includeRuntime(true)
@@ -70,11 +71,12 @@ class CompileOptionsTest {
.progressive(true)
.scriptTemplates("name", "name2")
.verbose(true)
- .wError(true)
- .wExtra(true);
+ .wError(true);
var matches = List.of(
"-api-version", "11",
+ "@" + localPath("file.txt"), "@" + localPath("file2.txt"),
+ "-classpath", localPath("path1", "path2"),
"-java-parameters",
"-jvm-target", "11",
"-include-runtime",
@@ -95,8 +97,7 @@ class CompileOptionsTest {
"-progressive",
"-script-templates", "name,name2",
"-verbose",
- "-Werror",
- "-Wextra");
+ "-Werror");
var args = new ArrayList>();
args.add(options.args());
@@ -112,9 +113,10 @@ class CompileOptionsTest {
@Test
void testArgsCollections() {
- var advanceOptions = List.of("-Xoption1", "option=2");
+ var advanceOptions = List.of("Xoption1", "Xoption2");
var argFile = List.of(new File("arg1.txt"), new File("arg2.txt"));
var classpath = List.of(new File("path1"), new File("path2"));
+ var jvmOptions = List.of("option1", "option2");
var optIn = List.of("opt1", "opt2");
var options = List.of("-foo", "-bar");
var plugin = List.of("id:name:value", "id2:name2:value2");
@@ -124,6 +126,7 @@ class CompileOptionsTest {
.advancedOptions(advanceOptions)
.argFile(argFile)
.classpath(classpath)
+ .jvmOptions(jvmOptions)
.noStdLib(false)
.optIn(optIn)
.options(options)
@@ -141,6 +144,8 @@ class CompileOptionsTest {
.hasSize(argFile.size()).containsAll(argFile);
softly.assertThat(op.classpath()).as("classpath")
.hasSize(classpath.size()).containsAll(classpath);
+ softly.assertThat(op.jvmOptions()).as("jvmOptions")
+ .hasSize(jvmOptions.size()).containsAll(jvmOptions);
softly.assertThat(op.optIn()).as("optIn")
.hasSize(optIn.size()).containsAll(optIn);
softly.assertThat(op.options()).as("options")
@@ -160,7 +165,7 @@ class CompileOptionsTest {
"-foo", "-bar",
"-script-templates",
"temp1,temp2",
- "-Xoption1", "-Xoption=2",
+ "-XXoption1", "-XXoption2",
"-P", "plugin:id:name:value",
"-P", "plugin:id2:name2:value2");
@@ -185,27 +190,20 @@ class CompileOptionsTest {
var bar = new File("bar.txt");
var options = new CompileOptions();
- options = options.argFile(foo);
- assertThat(options.argFile()).contains(foo);
- options.argFile().clear();
- assertThat(options.argFile()).isEmpty();
-
options.argFile(foo, bar);
assertThat(options.argFile()).contains(foo, bar);
options.argFile().clear();
- assertThat(options.argFile()).isEmpty();
options = options.argFile(foo.toPath(), bar.toPath());
assertThat(options.argFile()).contains(foo, bar);
options.argFile().clear();
- assertThat(options.argFile()).isEmpty();
- options = options.argFile(foo.getAbsolutePath(), bar.getAbsolutePath());
+ options.argFile(foo.getAbsolutePath(), bar.getAbsolutePath());
assertThat(options.argFile()).contains(new File(foo.getAbsolutePath()), new File(bar.getAbsolutePath()));
+ options.argFile().clear();
}
@Test
- @EnabledOnOs(OS.LINUX)
void testCheckAllParams() throws IOException {
var args = Files.readAllLines(Paths.get("src", "test", "resources", "kotlinc-args.txt"));
@@ -214,7 +212,10 @@ class CompileOptionsTest {
var params = new CompileOptions()
.advancedOptions("Xoption")
.apiVersion("11")
+ .argFile("file")
+ .classpath("classpath")
.expression("expression")
+ .jvmOptions("option")
.includeRuntime(true)
.javaParameters(true)
.jdkHome("jdkhome")
@@ -233,12 +234,7 @@ class CompileOptionsTest {
.progressive(true)
.scriptTemplates("template")
.verbose(true)
- .wError(true)
- .wExtra(true);
-
- var skipArgs = List.of("-J", "-classpath", "@");
- assertThat(args).as(skipArgs + " not found.").containsAll(skipArgs);
- args.removeAll(skipArgs);
+ .wError(true);
try (var softly = new AutoCloseableSoftAssertions()) {
for (var p : args) {
@@ -260,45 +256,31 @@ class CompileOptionsTest {
var bar = new File("bar.txt");
var options = new CompileOptions();
- options = options.classpath(foo);
- assertThat(options.classpath()).as("File").containsExactly(foo);
- options.classpath().clear();
- assertThat(options.argFile()).isEmpty();
-
-
options.classpath(foo, bar);
assertThat(options.classpath()).as("File...").containsExactly(foo, bar);
options.classpath().clear();
- assertThat(options.argFile()).isEmpty();
-
options.classpath(List.of(foo, bar));
assertThat(options.classpath()).as("List(File...)").containsExactly(foo, bar);
options.classpath().clear();
- assertThat(options.argFile()).isEmpty();
-
options = options.classpath(foo.toPath(), bar.toPath());
assertThat(options.classpath()).as("Path...").containsExactly(foo, bar);
options.classpath().clear();
- assertThat(options.argFile()).isEmpty();
-
options = options.classpathPaths(List.of(foo.toPath(), bar.toPath()));
assertThat(options.classpath()).as("List(Path...)").containsExactly(foo, bar);
options.classpath().clear();
- assertThat(options.argFile()).isEmpty();
-
options.classpath(foo.getAbsolutePath(), bar.getAbsolutePath());
assertThat(options.classpath()).as("String...")
.containsExactly(new File(foo.getAbsolutePath()), new File(bar.getAbsolutePath()));
options.classpath().clear();
- assertThat(options.argFile()).isEmpty();
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();
}
@Test
@@ -358,8 +340,7 @@ class CompileOptionsTest {
.progressive(true)
.scriptTemplates("name", "name2")
.verbose(true)
- .wError(true)
- .wExtra(true);
+ .wError(true);
try (var softly = new AutoCloseableSoftAssertions()) {
softly.assertThat(options.advancedOptions()).containsExactly("xopt1", "xopt2");
@@ -387,7 +368,6 @@ class CompileOptionsTest {
softly.assertThat(options.plugin()).containsExactly("id:name:value");
softly.assertThat(options.scriptTemplates()).containsExactly("name", "name2");
softly.assertThat(options.isWError()).isTrue();
- softly.assertThat(options.isWExtra()).isTrue();
}
}
}
diff --git a/src/test/java/rife/bld/extension/kotlin/JvmOptionsTest.java b/src/test/java/rife/bld/extension/kotlin/JvmOptionsTest.java
deleted file mode 100644
index 6f8474f..0000000
--- a/src/test/java/rife/bld/extension/kotlin/JvmOptionsTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2023-2025 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package rife.bld.extension.kotlin;
-
-import org.junit.jupiter.api.Test;
-import rife.bld.extension.CompileKotlinOperation;
-
-import java.util.List;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-@SuppressWarnings("PMD.AvoidDuplicateLiterals")
-class JvmOptionsTest {
- @Test
- void testop() {
- var op = new CompileKotlinOperation().jvmOptions(new JvmOptions().enableNativeAccess(JvmOptions.ALL_UNNAMED));
- assertThat(op.jvmOptions()).as(JvmOptions.ALL_UNNAMED).containsExactly("--enable-native-access=ALL-UNNAMED");
-
- op = new CompileKotlinOperation().jvmOptions(new JvmOptions().enableNativeAccess("m1", "m2"));
- assertThat(op.jvmOptions()).as("m1,m2").containsExactly("--enable-native-access=m1,m2");
- }
-
- @Test
- void testEnableNativeAccess() {
- var options = new JvmOptions().enableNativeAccess(JvmOptions.ALL_UNNAMED);
- assertThat(options).as(JvmOptions.ALL_UNNAMED).containsExactly("--enable-native-access=ALL-UNNAMED");
-
- options = new JvmOptions().enableNativeAccess("m1");
- assertThat(options).as("m1").containsExactly("--enable-native-access=m1");
-
- options = new JvmOptions().enableNativeAccess("m1", "m2");
- assertThat(options).as("m1,m2").containsExactly("--enable-native-access=m1,m2");
- }
-
- @Test
- void testIllegalNativeAccess() {
- var options = new JvmOptions().illegalNativeAccess(JvmOptions.NativeAccess.ALLOW);
- assertThat(options).as("ALLOW").containsExactly("--illegal-native-access=allow");
-
- options = new JvmOptions().illegalNativeAccess(JvmOptions.NativeAccess.DENY);
- assertThat(options).as("DENY").containsExactly("--illegal-native-access=deny");
-
- options = new JvmOptions().illegalNativeAccess(JvmOptions.NativeAccess.WARN);
- assertThat(options).as("WARN").containsExactly("--illegal-native-access=warn");
- }
-
- @Test
- void testJvmOptions() {
- var op = new CompileKotlinOperation().jvmOptions("option1", "option2");
- assertThat(op.jvmOptions()).as("option1,option2").containsExactly("option1", "option2");
-
- op = new CompileKotlinOperation().jvmOptions(List.of("option1", "option2"));
- assertThat(op.jvmOptions()).as("List.of(option1,option2)").containsExactly("option1", "option2");
-
- op = op.jvmOptions(new JvmOptions().enableNativeAccess(JvmOptions.ALL_UNNAMED));
- assertThat(op.jvmOptions()).as("List.of(option1,option2,ALL_UNNAMED)")
- .containsExactly("option1", "option2", "--enable-native-access=ALL-UNNAMED");
-
- op = op.jvmOptions(new JvmOptions().illegalNativeAccess(JvmOptions.NativeAccess.ALLOW));
- assertThat(op.jvmOptions()).as("allow")
- .containsExactly("option1", "option2", "--enable-native-access=ALL-UNNAMED",
- "--illegal-native-access=allow");
- }
-}
diff --git a/src/test/resources/argfile.txt b/src/test/resources/argfile.txt
deleted file mode 100644
index d128d62..0000000
--- a/src/test/resources/argfile.txt
+++ /dev/null
@@ -1,3 +0,0 @@
--Xjdk-release=17 -no-reflect
-
--progressive
diff --git a/src/test/resources/argfile2.txt b/src/test/resources/argfile2.txt
deleted file mode 100644
index 93f9181..0000000
--- a/src/test/resources/argfile2.txt
+++ /dev/null
@@ -1 +0,0 @@
--include-runtime
\ No newline at end of file
diff --git a/src/test/resources/kotlinc-args.txt b/src/test/resources/kotlinc-args.txt
index e764231..b3c7f27 100644
--- a/src/test/resources/kotlinc-args.txt
+++ b/src/test/resources/kotlinc-args.txt
@@ -22,5 +22,4 @@
-script-templates
-verbose
-Werror
--Wextra
-X