Compare commits

...

3 commits

6 changed files with 26 additions and 10 deletions

View file

@ -2,7 +2,7 @@
[![License](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Java](https://img.shields.io/badge/java-17%2B-blue)](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
[![Kotlin](https://img.shields.io/badge/kotlin-1.9.24-7f52ff.svg)](https://kotlinlang.org)
[![Kotlin](https://img.shields.io/badge/kotlin-2.0.0-7f52ff.svg)](https://kotlinlang.org)
[![bld](https://img.shields.io/badge/1.9.1-FA9052?label=bld&labelColor=2392FF)](https://rife2.com/bld)
[![Release](https://flat.badgen.net/maven/v/metadata-url/repo.rife2.com/releases/com/uwyn/rife2/bld-kotlin/maven-metadata.xml?color=blue)](https://repo.rife2.com/#/releases/com/uwyn/rife2/bld-kotlin)
[![Snapshot](https://flat.badgen.net/maven/v/metadata-url/repo.rife2.com/snapshots/com/uwyn/rife2/bld-kotlin/maven-metadata.xml?label=snapshot)](https://repo.rife2.com/#/snapshots/com/uwyn/rife2/bld-kotlin)

View file

@ -1,6 +1,6 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
bld.extensions=com.uwyn.rife2:bld-kotlin:0.9.5
bld.extensions=com.uwyn.rife2:bld-kotlin:0.9.6
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.downloadLocation=
bld.sourceDirectories=

View file

@ -34,7 +34,7 @@ public class ExampleBuild extends Project {
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES);
final var kotlin = version(1, 9, 24);
final var kotlin = version(2, 0, 0);
scope(compile)
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlin));
scope(test)

View file

@ -33,7 +33,7 @@ public class CompileKotlinOperationBuild extends Project {
public CompileKotlinOperationBuild() {
pkg = "rife.bld.extension";
name = "bld-kotlin";
version = version(0, 9, 5);
version = version(0, 9, 6);
javaRelease = 17;
downloadSources = true;
@ -41,7 +41,7 @@ public class CompileKotlinOperationBuild extends Project {
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES);
var dokka = version(1, 9, 20);
var kotlin = version(1, 9, 24);
var kotlin = version(2, 0, 0);
scope(compile)
.include(dependency("org.jetbrains.kotlin", "kotlin-compiler", kotlin))
.include(dependency("org.jetbrains.kotlin", "kotlin-annotation-processing", kotlin))

View file

@ -65,6 +65,17 @@ public class CompileKotlinOptions {
return this;
}
/**
* Allow using declarations only from the specified version of Kotlin bundled libraries.
*
* @param version the api version
* @return this operation instance
*/
public CompileKotlinOptions apiVersion(int version) {
apiVersion_ = String.valueOf(version);
return this;
}
/**
* Read the compiler options from the given files.
* <p>

View file

@ -19,6 +19,7 @@ package rife.bld.extension;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.IntStream;
@ -54,7 +55,7 @@ class CompileKotlinOptionsTest {
@Test
void argsTest() {
var args = new CompileKotlinOptions()
var options = new CompileKotlinOptions()
.apiVersion("11")
.argFile("file.txt", "file2.txt")
.classpath("path1", "path2")
@ -76,8 +77,7 @@ class CompileKotlinOptionsTest {
.progressive(true)
.scriptTemplates("name", "name2")
.verbose(true)
.wError(true)
.args();
.wError(true);
var matches = List.of(
"-api-version", "11",
@ -105,8 +105,13 @@ class CompileKotlinOptionsTest {
"-verbose",
"-Werror");
assertThat(args).hasSize(matches.size());
var args = new ArrayList<List<String>>();
args.add(options.args());
args.add(options.apiVersion(11).jvmTarget(11).args());
IntStream.range(0, args.size()).forEach(i -> assertThat(args.get(i)).isEqualTo(matches.get(i)));
for (var a: args) {
assertThat(a).hasSize(matches.size());
IntStream.range(0, a.size()).forEach(i -> assertThat(a.get(i)).isEqualTo(matches.get(i)));
}
}
}