Compare commits
No commits in common. "1623b902f9d05e6b7f74172e819a74f975d7af30" and "81ab2e829cda042790114b2c788caa76040ac5aa" have entirely different histories.
1623b902f9
...
81ab2e829c
10 changed files with 52 additions and 217 deletions
|
@ -5,19 +5,12 @@ new=/tmp/checkcliargs-new
|
||||||
old=/tmp/checkcliargs-old
|
old=/tmp/checkcliargs-old
|
||||||
|
|
||||||
java -cp "lib/compile/*" $main -h >$new
|
java -cp "lib/compile/*" $main -h >$new
|
||||||
java -cp "examples/lib/bld/*" $main -h >$old
|
java -cp "/examples/lib/bld*" $main -h >$old
|
||||||
|
|
||||||
diff $old $new
|
diff $old $new
|
||||||
|
|
||||||
java -cp "lib/compile/*" $main -sourceSet -h >$new
|
java -cp "lib/compile/*" $main -sourceSet -h >$new
|
||||||
java -cp "examples/lib/bld/*" $main -sourceSet -h >$old
|
java -cp "/examples/lib/bld*" $main -sourceSet -h >$old
|
||||||
|
|
||||||
diff $old $new
|
|
||||||
|
|
||||||
main=org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
|
|
||||||
|
|
||||||
java -cp "lib/compile/*" $main -h 2>$new
|
|
||||||
java -cp "examples/lib/bld/*" $main -h 2>$old
|
|
||||||
|
|
||||||
diff $old $new
|
diff $old $new
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
java -cp "lib/compile/*" org.jetbrains.kotlin.cli.jvm.K2JVMCompiler -h 2> >(grep "^ ") |\
|
|
||||||
sed -e "s/^ //" -e "s/ .*//" -e "s/<.*//" -e '/-help/d' -e '/-version/d' -e '/^$/d'|\
|
|
||||||
sort > "src/test/resources/kotlinc-args.txt"
|
|
||||||
|
|
||||||
main=org.jetbrains.dokka.MainKt
|
main=org.jetbrains.dokka.MainKt
|
||||||
|
|
||||||
java -cp "lib/compile/*" $main -h |\
|
java -cp "lib/compile/*" $main -h |\
|
||||||
|
|
|
@ -98,15 +98,6 @@ public class CompileKotlinOperationBuild extends Project {
|
||||||
new CompileKotlinOperationBuild().start(args);
|
new CompileKotlinOperationBuild().start(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@BuildCommand(summary = "Runs PMD analysis")
|
|
||||||
public void pmd() {
|
|
||||||
new PmdOperation()
|
|
||||||
.fromProject(this)
|
|
||||||
.failOnViolation(true)
|
|
||||||
.ruleSets("config/pmd.xml")
|
|
||||||
.execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void test() throws Exception {
|
public void test() throws Exception {
|
||||||
new ExecOperation()
|
new ExecOperation()
|
||||||
|
@ -115,4 +106,13 @@ public class CompileKotlinOperationBuild extends Project {
|
||||||
.execute();
|
.execute();
|
||||||
super.test();
|
super.test();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@BuildCommand(summary = "Runs PMD analysis")
|
||||||
|
public void pmd() {
|
||||||
|
new PmdOperation()
|
||||||
|
.fromProject(this)
|
||||||
|
.failOnViolation(true)
|
||||||
|
.ruleSets("config/pmd.xml")
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,7 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOperation compileMainClasspath(String... classpath) {
|
public CompileKotlinOperation compileMainClasspath(String... classpath) {
|
||||||
Collections.addAll(compileMainClasspath_, classpath);
|
compileMainClasspath_.addAll(Arrays.asList(classpath));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +205,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) {
|
||||||
Collections.addAll(compileTestClasspath_, classpath);
|
compileTestClasspath_.addAll(Arrays.asList(classpath));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,7 +398,7 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOperation mainSourceDirectories(File... directories) {
|
public CompileKotlinOperation mainSourceDirectories(File... directories) {
|
||||||
Collections.addAll(mainSourceDirectories_, directories);
|
mainSourceDirectories_.addAll(List.of(directories));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,7 +460,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) {
|
||||||
Collections.addAll(plugins_, plugins);
|
plugins_.addAll(List.of(plugins));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -526,7 +526,7 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOperation testSourceDirectories(File... directories) {
|
public CompileKotlinOperation testSourceDirectories(File... directories) {
|
||||||
Collections.addAll(testSourceDirectories_, directories);
|
testSourceDirectories_.addAll(List.of(directories));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ package rife.bld.extension;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static rife.bld.extension.CompileKotlinOperation.isNotBlank;
|
import static rife.bld.extension.CompileKotlinOperation.isNotBlank;
|
||||||
|
@ -31,16 +30,13 @@ import static rife.bld.extension.CompileKotlinOperation.isNotBlank;
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public class CompileKotlinOptions {
|
public class CompileKotlinOptions {
|
||||||
private final List<String> advancedOptions_ = new ArrayList<>();
|
|
||||||
private final List<String> argFile_ = new ArrayList<>();
|
private final List<String> argFile_ = new ArrayList<>();
|
||||||
private final List<String> classpath_ = new ArrayList<>();
|
private final List<String> classpath_ = new ArrayList<>();
|
||||||
private final List<String> jvmOptions_ = new ArrayList<>();
|
|
||||||
private final List<String> optIn_ = new ArrayList<>();
|
private final List<String> optIn_ = new ArrayList<>();
|
||||||
private final List<String> options_ = new ArrayList<>();
|
private final List<String> options_ = new ArrayList<>();
|
||||||
private final List<String> plugin_ = new ArrayList<>();
|
private final List<String> plugin_ = new ArrayList<>();
|
||||||
private final List<String> scriptTemplates_ = new ArrayList<>();
|
private final List<String> scriptTemplates_ = new ArrayList<>();
|
||||||
private String apiVersion_;
|
private String apiVersion_;
|
||||||
private String expression_;
|
|
||||||
private boolean includeRuntime_;
|
private boolean includeRuntime_;
|
||||||
private boolean javaParameters_;
|
private boolean javaParameters_;
|
||||||
private String jdkHome_;
|
private String jdkHome_;
|
||||||
|
@ -58,28 +54,6 @@ public class CompileKotlinOptions {
|
||||||
private boolean verbose_;
|
private boolean verbose_;
|
||||||
private boolean wError_;
|
private boolean wError_;
|
||||||
|
|
||||||
/**
|
|
||||||
* Specify advanced compiler options.
|
|
||||||
*
|
|
||||||
* @param options one or more advanced options
|
|
||||||
* @return this operation instance
|
|
||||||
*/
|
|
||||||
public CompileKotlinOptions advancedOptions(String... options) {
|
|
||||||
Collections.addAll(advancedOptions_, options);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specify advanced compiler options.
|
|
||||||
*
|
|
||||||
* @param options list of compiler options
|
|
||||||
* @return this operation instance
|
|
||||||
*/
|
|
||||||
public CompileKotlinOptions advancedOptions(Collection<String> options) {
|
|
||||||
advancedOptions_.addAll(options);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow using declarations only from the specified version of Kotlin bundled libraries.
|
* Allow using declarations only from the specified version of Kotlin bundled libraries.
|
||||||
*
|
*
|
||||||
|
@ -121,7 +95,7 @@ public class CompileKotlinOptions {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOptions argFile(String... files) {
|
public CompileKotlinOptions argFile(String... files) {
|
||||||
Collections.addAll(argFile_, files);
|
argFile_.addAll(List.of(files));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +119,7 @@ public class CompileKotlinOptions {
|
||||||
public List<String> args() {
|
public List<String> args() {
|
||||||
var args = new ArrayList<String>();
|
var args = new ArrayList<String>();
|
||||||
|
|
||||||
// api-version
|
// api-isNotBlankversion
|
||||||
if (isNotBlank(apiVersion_)) {
|
if (isNotBlank(apiVersion_)) {
|
||||||
args.add("-api-version");
|
args.add("-api-version");
|
||||||
args.add(apiVersion_);
|
args.add(apiVersion_);
|
||||||
|
@ -162,12 +136,6 @@ public class CompileKotlinOptions {
|
||||||
args.add(String.join(File.pathSeparator, classpath_));
|
args.add(String.join(File.pathSeparator, classpath_));
|
||||||
}
|
}
|
||||||
|
|
||||||
// expression
|
|
||||||
if (isNotBlank(expression_)) {
|
|
||||||
args.add("-expression");
|
|
||||||
args.add(expression_);
|
|
||||||
}
|
|
||||||
|
|
||||||
// java-parameters
|
// java-parameters
|
||||||
if (javaParameters_) {
|
if (javaParameters_) {
|
||||||
args.add("-java-parameters");
|
args.add("-java-parameters");
|
||||||
|
@ -195,11 +163,6 @@ public class CompileKotlinOptions {
|
||||||
args.add("-Xjdk-release=" + jdkRelease_);
|
args.add("-Xjdk-release=" + jdkRelease_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// JVM options
|
|
||||||
if (!jvmOptions_.isEmpty()) {
|
|
||||||
jvmOptions_.forEach(s -> args.add("-J" + s));
|
|
||||||
}
|
|
||||||
|
|
||||||
// kotlin-home
|
// kotlin-home
|
||||||
if (isNotBlank(kotlinHome_)) {
|
if (isNotBlank(kotlinHome_)) {
|
||||||
args.add("-kotlin-home");
|
args.add("-kotlin-home");
|
||||||
|
@ -235,7 +198,7 @@ public class CompileKotlinOptions {
|
||||||
|
|
||||||
// no-warn
|
// no-warn
|
||||||
if (noWarn_) {
|
if (noWarn_) {
|
||||||
args.add("-nowarn");
|
args.add("-no-warn");
|
||||||
}
|
}
|
||||||
|
|
||||||
// opt-in
|
// opt-in
|
||||||
|
@ -282,11 +245,6 @@ public class CompileKotlinOptions {
|
||||||
args.add("-Werror");
|
args.add("-Werror");
|
||||||
}
|
}
|
||||||
|
|
||||||
// advanced option (X)
|
|
||||||
if (!advancedOptions_.isEmpty()) {
|
|
||||||
advancedOptions_.forEach(it -> args.add("-X" + it));
|
|
||||||
}
|
|
||||||
|
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,7 +257,7 @@ public class CompileKotlinOptions {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOptions classpath(String... paths) {
|
public CompileKotlinOptions classpath(String... paths) {
|
||||||
Collections.addAll(classpath_, paths);
|
classpath_.addAll(List.of(paths));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,17 +274,6 @@ public class CompileKotlinOptions {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Evaluate the given string as a Kotlin script.
|
|
||||||
*
|
|
||||||
* @param expression the expression
|
|
||||||
* @return this operation instance
|
|
||||||
*/
|
|
||||||
public CompileKotlinOptions expression(String expression) {
|
|
||||||
expression_ = expression;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the {@link #jdkRelease(String) jdkRelease} was set.
|
* Indicates whether the {@link #jdkRelease(String) jdkRelease} was set.
|
||||||
*
|
*
|
||||||
|
@ -398,28 +345,6 @@ public class CompileKotlinOptions {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Pass an option directly to JVM
|
|
||||||
*
|
|
||||||
* @param jvmOptions one or more JVM option
|
|
||||||
* @return this operation instance
|
|
||||||
*/
|
|
||||||
public CompileKotlinOptions jvmOptions(String... jvmOptions) {
|
|
||||||
Collections.addAll(jvmOptions_, jvmOptions);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Pass an option directly to JVM
|
|
||||||
*
|
|
||||||
* @param jvmOptions the list JVM options
|
|
||||||
* @return this operation instance
|
|
||||||
*/
|
|
||||||
public CompileKotlinOptions jvmOptions(Collection<String> jvmOptions) {
|
|
||||||
jvmOptions_.addAll(jvmOptions);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify the target version of the generated JVM bytecode.
|
* Specify the target version of the generated JVM bytecode.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -530,7 +455,7 @@ public class CompileKotlinOptions {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOptions optIn(String... annotations) {
|
public CompileKotlinOptions optIn(String... annotations) {
|
||||||
Collections.addAll(optIn_, annotations);
|
optIn_.addAll(List.of(annotations));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,7 +477,7 @@ public class CompileKotlinOptions {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOptions options(String... options) {
|
public CompileKotlinOptions options(String... options) {
|
||||||
Collections.addAll(options_, options);
|
options_.addAll(List.of(options));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -626,7 +551,7 @@ public class CompileKotlinOptions {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public CompileKotlinOptions scriptTemplates(String... classNames) {
|
public CompileKotlinOptions scriptTemplates(String... classNames) {
|
||||||
Collections.addAll(scriptTemplates_, classNames);
|
scriptTemplates_.addAll(List.of(classNames));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -309,7 +309,7 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public DokkaOperation globalPackageOptions(String... options) {
|
public DokkaOperation globalPackageOptions(String... options) {
|
||||||
Collections.addAll(globalPackageOptions_, options);
|
globalPackageOptions_.addAll(Arrays.asList(options));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,7 +342,7 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public DokkaOperation globalSrcLink(String... links) {
|
public DokkaOperation globalSrcLink(String... links) {
|
||||||
Collections.addAll(globalSrcLinks_, links);
|
globalSrcLinks_.addAll(Arrays.asList(links));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public DokkaOperation includes(String... files) {
|
public DokkaOperation includes(String... files) {
|
||||||
Collections.addAll(includes_, files);
|
includes_.addAll(Arrays.asList(files));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -555,7 +555,7 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public DokkaOperation pluginsClasspath(String... jars) {
|
public DokkaOperation pluginsClasspath(String... jars) {
|
||||||
Collections.addAll(pluginsClasspath_, jars);
|
pluginsClasspath_.addAll(Arrays.asList(jars));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -241,7 +241,7 @@ public class SourceSet {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public SourceSet classpath(String... files) {
|
public SourceSet classpath(String... files) {
|
||||||
Collections.addAll(classpath_, files);
|
classpath_.addAll(Arrays.asList(files));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ public class SourceSet {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public SourceSet includes(String... files) {
|
public SourceSet includes(String... files) {
|
||||||
Collections.addAll(includes_, files);
|
includes_.addAll(Arrays.asList(files));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -535,7 +535,7 @@ public class SourceSet {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public SourceSet perPackageOptions(String... perPackageOptions) {
|
public SourceSet perPackageOptions(String... perPackageOptions) {
|
||||||
Collections.addAll(perPackageOptions_, perPackageOptions);
|
perPackageOptions_.addAll(List.of(perPackageOptions));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -581,7 +581,7 @@ public class SourceSet {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public SourceSet samples(String... samples) {
|
public SourceSet samples(String... samples) {
|
||||||
Collections.addAll(samples_, samples);
|
samples_.addAll(List.of(samples));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -635,7 +635,7 @@ public class SourceSet {
|
||||||
* @return this operation instance
|
* @return this operation instance
|
||||||
*/
|
*/
|
||||||
public SourceSet src(String... src) {
|
public SourceSet src(String... src) {
|
||||||
Collections.addAll(src_, src);
|
src_.addAll(List.of(src));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,6 @@ package rife.bld.extension;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
@ -33,10 +30,8 @@ class CompileKotlinOptionsTest {
|
||||||
@Test
|
@Test
|
||||||
void argsCollectionTest() {
|
void argsCollectionTest() {
|
||||||
var args = new CompileKotlinOptions()
|
var args = new CompileKotlinOptions()
|
||||||
.advancedOptions(List.of("Xoption1", "Xoption2"))
|
|
||||||
.argFile(List.of("arg1.txt", "arg2.txt"))
|
.argFile(List.of("arg1.txt", "arg2.txt"))
|
||||||
.classpath(List.of("path1", "path2"))
|
.classpath(List.of("path1", "path2"))
|
||||||
.jvmOptions(List.of("option1", "option2"))
|
|
||||||
.noStdLib(false)
|
.noStdLib(false)
|
||||||
.optIn(List.of("opt1", "opt2"))
|
.optIn(List.of("opt1", "opt2"))
|
||||||
.options(List.of("-foo", "-bar"))
|
.options(List.of("-foo", "-bar"))
|
||||||
|
@ -45,26 +40,18 @@ class CompileKotlinOptionsTest {
|
||||||
var matches = List.of(
|
var matches = List.of(
|
||||||
"@arg1.txt", "@arg2.txt",
|
"@arg1.txt", "@arg2.txt",
|
||||||
"-classpath", "path1:path2",
|
"-classpath", "path1:path2",
|
||||||
"-Joption1", "-Joption2",
|
|
||||||
"-opt-in", "opt1",
|
"-opt-in", "opt1",
|
||||||
"-opt-in", "opt2",
|
"-opt-in", "opt2",
|
||||||
"-foo", "-bar",
|
"-foo",
|
||||||
"-script-templates",
|
"-bar",
|
||||||
"temp1,temp2",
|
"-script-templates", "temp1,temp2");
|
||||||
"-XXoption1", "-XXoption2");
|
|
||||||
|
|
||||||
for (var arg : args) {
|
assertThat(args).hasSize(matches.size());
|
||||||
var found = false;
|
|
||||||
for (var match : matches) {
|
|
||||||
if (match.equals(arg)) {
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assertThat(found).as(arg).isTrue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
IntStream.range(0, args.size()).forEach(i -> assertThat(args.get(i)).isEqualTo(matches.get(i)));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void argsTest() {
|
void argsTest() {
|
||||||
|
@ -106,7 +93,7 @@ class CompileKotlinOptionsTest {
|
||||||
"-module-name", "module",
|
"-module-name", "module",
|
||||||
"-no-jdk",
|
"-no-jdk",
|
||||||
"-no-reflect",
|
"-no-reflect",
|
||||||
"-nowarn",
|
"-no-warn",
|
||||||
"-opt-in", "opt1",
|
"-opt-in", "opt1",
|
||||||
"-opt-in", "opt2",
|
"-opt-in", "opt2",
|
||||||
"-foo",
|
"-foo",
|
||||||
|
@ -127,47 +114,4 @@ class CompileKotlinOptionsTest {
|
||||||
IntStream.range(0, a.size()).forEach(i -> assertThat(a.get(i)).isEqualTo(matches.get(i)));
|
IntStream.range(0, a.size()).forEach(i -> assertThat(a.get(i)).isEqualTo(matches.get(i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
void checkAllParamsTest() throws IOException {
|
|
||||||
var args = Files.readAllLines(Paths.get("src", "test", "resources", "kotlinc-args.txt"));
|
|
||||||
|
|
||||||
assertThat(args).isNotEmpty();
|
|
||||||
|
|
||||||
var params = new CompileKotlinOptions()
|
|
||||||
.advancedOptions("Xoption")
|
|
||||||
.argFile("file")
|
|
||||||
.classpath("classpath")
|
|
||||||
.expression("expression")
|
|
||||||
.jvmOptions("option")
|
|
||||||
.includeRuntime(true)
|
|
||||||
.javaParameters(true)
|
|
||||||
.jdkHome("jdkhome")
|
|
||||||
.jvmTarget(12)
|
|
||||||
.kotlinHome("kotlin")
|
|
||||||
.moduleName("moduleName")
|
|
||||||
.noJdk(true)
|
|
||||||
.noReflect(true)
|
|
||||||
.noStdLib(true)
|
|
||||||
.noWarn(true)
|
|
||||||
.optIn("annotation")
|
|
||||||
.options("option")
|
|
||||||
.path("path")
|
|
||||||
.plugin("id", "option", "value")
|
|
||||||
.progressive(true)
|
|
||||||
.scriptTemplates("template")
|
|
||||||
.verbose(true)
|
|
||||||
.wError(true);
|
|
||||||
|
|
||||||
for (var p : args) {
|
|
||||||
var found = false;
|
|
||||||
for (var a : params.args()) {
|
|
||||||
if (a.startsWith(p)) {
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assertThat(found).as(p + " not found.").isTrue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,13 +34,13 @@ class DokkaOperationTest {
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings({"ExtractMethodRecommender", "PMD.AvoidDuplicateLiterals"})
|
@SuppressWarnings({"ExtractMethodRecommender", "PMD.AvoidDuplicateLiterals"})
|
||||||
void executeConstructProcessCommandListTest() throws IOException {
|
void executeConstructProcessCommandListTest() throws IOException {
|
||||||
var args = Files.readAllLines(Paths.get("src", "test", "resources", "dokka-args.txt"));
|
var params = Files.readAllLines(Paths.get("src", "test", "resources", "dokka-args.txt"));
|
||||||
|
|
||||||
assertThat(args).isNotEmpty();
|
assertThat(params).isNotEmpty();
|
||||||
|
|
||||||
var examples = new File("examples");
|
var examples = new File("examples");
|
||||||
var jsonConf = new File("config.json");
|
var jsonConf = new File("config.json");
|
||||||
var params = new DokkaOperation()
|
var args = new DokkaOperation()
|
||||||
.delayTemplateSubstitution(true)
|
.delayTemplateSubstitution(true)
|
||||||
.failOnWarning(true)
|
.failOnWarning(true)
|
||||||
.fromProject(new BaseProjectBlueprint(examples, "com.example", "Example"))
|
.fromProject(new BaseProjectBlueprint(examples, "com.example", "Example"))
|
||||||
|
@ -72,9 +72,9 @@ class DokkaOperationTest {
|
||||||
.suppressInheritedMembers(true)
|
.suppressInheritedMembers(true)
|
||||||
.executeConstructProcessCommandList();
|
.executeConstructProcessCommandList();
|
||||||
|
|
||||||
for (var p : args) {
|
for (var p : params) {
|
||||||
var found = false;
|
var found = false;
|
||||||
for (var a : params) {
|
for (var a : args) {
|
||||||
if (a.startsWith(p)) {
|
if (a.startsWith(p)) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
|
@ -109,14 +109,14 @@ class DokkaOperationTest {
|
||||||
"-suppressInheritedMembers",
|
"-suppressInheritedMembers",
|
||||||
jsonConf.getAbsolutePath());
|
jsonConf.getAbsolutePath());
|
||||||
|
|
||||||
assertThat(params).hasSize(matches.size());
|
assertThat(args).hasSize(matches.size());
|
||||||
|
|
||||||
IntStream.range(0, params.size()).forEach(i -> {
|
IntStream.range(0, args.size()).forEach(i -> {
|
||||||
if (params.get(i).contains(".jar;")) {
|
if (args.get(i).contains(".jar;")) {
|
||||||
var jars = params.get(i).split(";");
|
var jars = args.get(i).split(";");
|
||||||
Arrays.stream(jars).forEach(jar -> assertThat(matches.get(i)).as(matches.get(i)).contains(jar));
|
Arrays.stream(jars).forEach(jar -> assertThat(matches.get(i)).as(matches.get(i)).contains(jar));
|
||||||
} else {
|
} else {
|
||||||
assertThat(params.get(i)).as(params.get(i)).isEqualTo(matches.get(i));
|
assertThat(args.get(i)).as(args.get(i)).isEqualTo(matches.get(i));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
@
|
|
||||||
-classpath
|
|
||||||
-d
|
|
||||||
-expression
|
|
||||||
-include-runtime
|
|
||||||
-J
|
|
||||||
-java-parameters
|
|
||||||
-jdk-home
|
|
||||||
-jvm-target
|
|
||||||
-kotlin-home
|
|
||||||
-module-name
|
|
||||||
-no-jdk
|
|
||||||
-no-reflect
|
|
||||||
-no-stdlib
|
|
||||||
-nowarn
|
|
||||||
-opt-in
|
|
||||||
-P
|
|
||||||
-progressive
|
|
||||||
-script
|
|
||||||
-script-templates
|
|
||||||
-verbose
|
|
||||||
-Werror
|
|
||||||
-X
|
|
Loading…
Add table
Add a link
Reference in a new issue