mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-28 00:58:12 -07:00
add a test for kotlinCompiler version setting
This commit is contained in:
parent
cdd30873d0
commit
e1adc87281
1 changed files with 58 additions and 0 deletions
|
@ -0,0 +1,58 @@
|
||||||
|
package com.beust.kobalt.internal
|
||||||
|
|
||||||
|
import com.beust.kobalt.BaseTest
|
||||||
|
import com.beust.kobalt.BuildFile
|
||||||
|
import com.beust.kobalt.ProjectFile
|
||||||
|
import com.beust.kobalt.ProjectInfo
|
||||||
|
import com.beust.kobalt.misc.KFiles
|
||||||
|
import org.assertj.core.api.Assertions.assertThat
|
||||||
|
import org.testng.annotations.Test
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
class KotlinCompilerVersionTest : BaseTest() {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun shouldCompileWithExternalKotlin() {
|
||||||
|
val projectInfo = ProjectInfo(
|
||||||
|
BuildFile(
|
||||||
|
listOf("com.beust.kobalt.plugin.packaging.*", "com.beust.kobalt.plugin.kotlin.kotlinCompiler"),
|
||||||
|
"""
|
||||||
|
kotlinCompiler {
|
||||||
|
version = "1.2.60"
|
||||||
|
args("-jvm-target", "1.8")
|
||||||
|
}
|
||||||
|
assemble{ jar{} }
|
||||||
|
"""
|
||||||
|
),
|
||||||
|
listOf(
|
||||||
|
ProjectFile("src/main/kotlin/A.kt", "val a = Bob()"),
|
||||||
|
ProjectFile("src/main/kotlin/Bob.java", "class Bob { }")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
val result = launchProject(projectInfo, arrayOf("assemble"))
|
||||||
|
|
||||||
|
val project = result.projectDescription
|
||||||
|
val jarFile = File(KFiles.joinDir(project.file.absolutePath, "kobaltBuild/libs", project.name + "-"
|
||||||
|
+ project.version + ".jar"))
|
||||||
|
|
||||||
|
assertThat(jarFile).exists()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun shouldFailWhenKotlinVersionDoesNotExist() {
|
||||||
|
val projectInfo = ProjectInfo(
|
||||||
|
BuildFile(
|
||||||
|
listOf("com.beust.kobalt.plugin.packaging.*", "com.beust.kobalt.plugin.kotlin.kotlinCompiler"),
|
||||||
|
"""
|
||||||
|
kotlinCompiler { version = "1.1.20" }
|
||||||
|
assemble{ jar{} }
|
||||||
|
"""
|
||||||
|
),
|
||||||
|
listOf(ProjectFile("src/main/kotlin/A.kt", "val a = \"foo\"")))
|
||||||
|
|
||||||
|
val result = launchProject(projectInfo, arrayOf("assemble"))
|
||||||
|
|
||||||
|
assertThat(result).isEqualTo(1)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue