diff --git a/examples/src/bld/java/com/example/ExampleBuild.java b/examples/src/bld/java/com/example/ExampleBuild.java index 5a8bac6..9338d1b 100644 --- a/examples/src/bld/java/com/example/ExampleBuild.java +++ b/examples/src/bld/java/com/example/ExampleBuild.java @@ -1,7 +1,7 @@ package com.example; -import rife.bld.BaseProject; import rife.bld.BuildCommand; +import rife.bld.Project; import rife.bld.extension.CompileKotlinOperation; import rife.bld.extension.CompileKotlinOptions; import rife.bld.extension.dokka.DokkaOperation; @@ -19,8 +19,9 @@ import java.util.logging.Logger; import static rife.bld.dependencies.Repository.*; import static rife.bld.dependencies.Scope.compile; +import static rife.bld.dependencies.Scope.test; -public class ExampleBuild extends BaseProject { +public class ExampleBuild extends Project { public ExampleBuild() { pkg = "com.example"; name = "Example"; @@ -34,8 +35,10 @@ public class ExampleBuild extends BaseProject { scope(compile) .include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", version(1, 9, 20))); - - testOperation().mainClass("com.example.ExampleTest"); + scope(test) + .include(dependency("org.jetbrains.kotlin:kotlin-test-junit5:1.9.20")) + .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 1))) + .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 1))); } public static void main(String[] args) { diff --git a/examples/src/test/kotlin/com/example/ExampleTest.kt b/examples/src/test/kotlin/com/example/ExampleTest.kt index 5fc94d4..6d8cf65 100644 --- a/examples/src/test/kotlin/com/example/ExampleTest.kt +++ b/examples/src/test/kotlin/com/example/ExampleTest.kt @@ -1,18 +1,11 @@ package com.example -class ExampleTest { - fun verifyHello() { - if ("Hello World!" != Example().message) { - throw AssertionError() - } else { - println("Succeeded") - } - } +import kotlin.test.Test +import kotlin.test.assertEquals - companion object { - @JvmStatic - fun main(args: Array) { - ExampleTest().verifyHello() - } +class ExampleTest { + @Test + fun verifyHello() { + assertEquals("Hello World!", Example().message) } } \ No newline at end of file diff --git a/src/main/java/rife/bld/extension/CompileKotlinOptions.java b/src/main/java/rife/bld/extension/CompileKotlinOptions.java index 0be8e98..ff82c56 100644 --- a/src/main/java/rife/bld/extension/CompileKotlinOptions.java +++ b/src/main/java/rife/bld/extension/CompileKotlinOptions.java @@ -307,6 +307,18 @@ public class CompileKotlinOptions { return this; } + /** + * Specify the target version of the generated JVM bytecode. + * + * @param version the target version + * @return this class insance + * @see #jdkRelease(String) + */ + public CompileKotlinOptions jdkRelease(int version) { + jdkRelease_ = String.valueOf(version); + return this; + } + /** * Specify the target version of the generated JVM bytecode. * Possible values are 1.8, 9, 10, ..., 21. The default value is 1.8. @@ -319,6 +331,18 @@ public class CompileKotlinOptions { return this; } + /** + * Specify the target version of the generated JVM bytecode. + * + * @param target the target version + * @return this class instance + * @see #jvmTarget(String) + */ + public CompileKotlinOptions jvmTarget(int target) { + jvmTarget_ = String.valueOf(target); + return this; + } + /** * Enable verbose logging output which includes details of the compilation process. *