Compare commits

...

2 commits

Author SHA1 Message Date
03fb0164c2 Added int parameter option where applicable 2023-11-07 04:14:43 -08:00
6dd83d0073 Added JUnit to tests 2023-11-07 04:13:34 -08:00
3 changed files with 37 additions and 17 deletions

View file

@ -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) {

View file

@ -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<String>) {
ExampleTest().verifyHello()
}
class ExampleTest {
@Test
fun verifyHello() {
assertEquals("Hello World!", Example().message)
}
}

View file

@ -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.
*