Compare commits
5 commits
fe46c87334
...
fb793e254a
Author | SHA1 | Date | |
---|---|---|---|
fb793e254a | |||
d658bcf0c4 | |||
fbaa0264e1 | |||
53df02fa71 | |||
6305dd3de4 |
9 changed files with 51 additions and 20 deletions
2
.github/workflows/bld.yml
vendored
2
.github/workflows/bld.yml
vendored
|
@ -12,7 +12,7 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
java-version: [17, 21, 23]
|
||||
kotlin-version: [1.9.24, 2.0.21]
|
||||
kotlin-version: [1.9.24, 2.0.21, 2.1.0]
|
||||
|
||||
steps:
|
||||
- name: Checkout source repository
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
bld.downloadExtensionJavadoc=false
|
||||
bld.downloadExtensionSources=true
|
||||
bld.downloadLocation=
|
||||
bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.0.2
|
||||
bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.0.3
|
||||
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
||||
bld.sourceDirectories=
|
||||
bld.version=2.1.0
|
||||
|
|
|
@ -28,7 +28,7 @@ public class ExampleBuild extends Project {
|
|||
|
||||
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES);
|
||||
|
||||
final var kotlin = version(2, 0, 21);
|
||||
final var kotlin = version(2, 1, 0);
|
||||
scope(compile)
|
||||
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlin));
|
||||
scope(test)
|
||||
|
@ -58,14 +58,11 @@ public class ExampleBuild extends Project {
|
|||
@Override
|
||||
public void compile() throws Exception {
|
||||
// The source code located in src/main/kotlin and src/test/kotlin will be compiled
|
||||
new CompileKotlinOperation()
|
||||
.fromProject(this)
|
||||
var op = new CompileKotlinOperation()
|
||||
// .kotlinHome("path/to/kotlin")
|
||||
// .kotlinc("path/to/kotlinc")
|
||||
.execute();
|
||||
|
||||
// var op = new CompileKotlinOperation().fromProject(this);
|
||||
// op.compileOptions().verbose(true);
|
||||
// op.execute();
|
||||
.fromProject(this);
|
||||
op.compileOptions().verbose(true);
|
||||
op.execute();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ new=/tmp/checkcliargs-new
|
|||
old=/tmp/checkcliargs-old
|
||||
|
||||
kotlinc -h 2>$new
|
||||
~/.sdkman/candidates/kotlin/2.0.0/bin/kotlinc -h 2>$old
|
||||
~/.sdkman/candidates/kotlin/2.1.0/bin/kotlinc -h 2>$old
|
||||
|
||||
code --diff --wait $old $new
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public class CompileKotlinOperationBuild extends Project {
|
|||
public CompileKotlinOperationBuild() {
|
||||
pkg = "rife.bld.extension";
|
||||
name = "bld-kotlin";
|
||||
version = version(1, 0, 3, "SNAPSHOT");
|
||||
version = version(1, 0, 3);
|
||||
|
||||
javaRelease = 17;
|
||||
|
||||
|
|
|
@ -406,10 +406,12 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
|||
public CompileKotlinOperation fromProject(BaseProject project) {
|
||||
project_ = project;
|
||||
|
||||
if (kotlinHome_ == null) {
|
||||
var env = System.getenv("KOTLIN_HOME");
|
||||
if (env != null) {
|
||||
kotlinHome_ = new File(env);
|
||||
}
|
||||
}
|
||||
|
||||
workDir_ = new File(project.workDirectory().getAbsolutePath());
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ public class CompileOptions {
|
|||
private boolean progressive_;
|
||||
private boolean verbose_;
|
||||
private boolean wError_;
|
||||
private boolean wExtra_;
|
||||
|
||||
/**
|
||||
* Specify advanced compiler options.
|
||||
|
@ -374,11 +375,16 @@ public class CompileOptions {
|
|||
args.add("-verbose");
|
||||
}
|
||||
|
||||
// Werror
|
||||
// Wwrror
|
||||
if (wError_) {
|
||||
args.add("-Werror");
|
||||
}
|
||||
|
||||
// Wextra
|
||||
if (wExtra_) {
|
||||
args.add("-Wextra");
|
||||
}
|
||||
|
||||
// advanced option (X)
|
||||
if (!advancedOptions_.isEmpty()) {
|
||||
advancedOptions_.forEach(it -> args.add("-X" + it));
|
||||
|
@ -597,6 +603,15 @@ 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.
|
||||
*
|
||||
|
@ -1071,4 +1086,15 @@ 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,8 @@ class CompileOptionsTest {
|
|||
.progressive(true)
|
||||
.scriptTemplates("name", "name2")
|
||||
.verbose(true)
|
||||
.wError(true);
|
||||
.wError(true)
|
||||
.wExtra(true);
|
||||
|
||||
var matches = List.of(
|
||||
"-api-version", "11",
|
||||
|
@ -97,7 +98,8 @@ class CompileOptionsTest {
|
|||
"-progressive",
|
||||
"-script-templates", "name,name2",
|
||||
"-verbose",
|
||||
"-Werror");
|
||||
"-Werror",
|
||||
"-Wextra");
|
||||
|
||||
var args = new ArrayList<List<String>>();
|
||||
args.add(options.args());
|
||||
|
@ -234,7 +236,8 @@ class CompileOptionsTest {
|
|||
.progressive(true)
|
||||
.scriptTemplates("template")
|
||||
.verbose(true)
|
||||
.wError(true);
|
||||
.wError(true)
|
||||
.wExtra(true);
|
||||
|
||||
try (var softly = new AutoCloseableSoftAssertions()) {
|
||||
for (var p : args) {
|
||||
|
@ -340,7 +343,8 @@ class CompileOptionsTest {
|
|||
.progressive(true)
|
||||
.scriptTemplates("name", "name2")
|
||||
.verbose(true)
|
||||
.wError(true);
|
||||
.wError(true)
|
||||
.wExtra(true);
|
||||
|
||||
try (var softly = new AutoCloseableSoftAssertions()) {
|
||||
softly.assertThat(options.advancedOptions()).containsExactly("xopt1", "xopt2");
|
||||
|
@ -368,6 +372,7 @@ 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,4 +22,5 @@
|
|||
-script-templates
|
||||
-verbose
|
||||
-Werror
|
||||
-Wextra
|
||||
-X
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue