Add basic kapt tests
This commit is contained in:
+27
@@ -58,4 +58,31 @@ class KotlinGradleIT: BaseGradleIT() {
|
||||
assertContains(":compileKotlin", ":compileTestKotlin")
|
||||
}
|
||||
}
|
||||
|
||||
Test fun testKaptSimple() {
|
||||
Project("kaptSimple", "1.12").build("build") {
|
||||
assertSuccessful()
|
||||
assertContains("kapt: Class file stubs are not used")
|
||||
assertContains(":compileKotlin")
|
||||
assertContains(":compileJava")
|
||||
assertFileExists("build/tmp/kapt/main/wrappers/annotations.main.txt")
|
||||
assertFileExists("build/generated/source/kapt/main/TestClassGenerated.java")
|
||||
assertFileExists("build/classes/main/example/TestClass.class")
|
||||
assertFileExists("build/classes/main/example/TestClassGenerated.class")
|
||||
}
|
||||
}
|
||||
|
||||
Test fun testKaptStubs() {
|
||||
Project("kaptStubs", "1.12").build("build") {
|
||||
assertSuccessful()
|
||||
assertContains("kapt: Using class file stubs")
|
||||
assertContains(":compileKotlin")
|
||||
assertContains(":compileJava")
|
||||
assertFileExists("build/tmp/kapt/main/wrappers/annotations.main.txt")
|
||||
assertFileExists("build/generated/source/kapt/main/TestClassGenerated.java")
|
||||
assertFileExists("build/classes/main/example/TestClass.class")
|
||||
assertFileExists("build/classes/main/example/TestClassGenerated.class")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url 'file://' + pathToKotlinPlugin
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:0.1-SNAPSHOT"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: "java"
|
||||
apply plugin: "kotlin"
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url 'file://' + pathToKotlinPlugin
|
||||
}
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib:0.1-SNAPSHOT"
|
||||
compile "org.jetbrains.kotlin:annotation-processor-example:0.1-SNAPSHOT"
|
||||
kapt "org.jetbrains.kotlin:annotation-processor-example:0.1-SNAPSHOT"
|
||||
}
|
||||
|
||||
task show << {
|
||||
buildscript.configurations.classpath.each { println it }
|
||||
}
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
gradleVersion="1.12"
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package example
|
||||
|
||||
@example.ExampleAnnotation
|
||||
public class TestClass {
|
||||
|
||||
@example.ExampleAnnotation
|
||||
public val testVal: String = "text"
|
||||
|
||||
@example.ExampleAnnotation
|
||||
public fun testFunction(): Int = 5
|
||||
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url 'file://' + pathToKotlinPlugin
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:0.1-SNAPSHOT"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: "java"
|
||||
apply plugin: "kotlin"
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url 'file://' + pathToKotlinPlugin
|
||||
}
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib:0.1-SNAPSHOT"
|
||||
compile "org.jetbrains.kotlin:annotation-processor-example:0.1-SNAPSHOT"
|
||||
kapt "org.jetbrains.kotlin:annotation-processor-example:0.1-SNAPSHOT"
|
||||
}
|
||||
|
||||
task show << {
|
||||
buildscript.configurations.classpath.each { println it }
|
||||
}
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
gradleVersion="1.12"
|
||||
}
|
||||
|
||||
kapt {
|
||||
generateStubs = true
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package example
|
||||
|
||||
@example.ExampleAnnotation
|
||||
public class TestClass {
|
||||
|
||||
@example.ExampleAnnotation
|
||||
public val testVal: String = "text"
|
||||
|
||||
@example.ExampleAnnotation
|
||||
public fun testFunction(): Class<*> = javaClass<TestClassGenerated>()
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user