Migrate only Kapt tests to new test dsl.
^KT-45745 In Progress
This commit is contained in:
+29
-3
@@ -134,16 +134,29 @@ class Kapt3Android70IT : Kapt3AndroidIT() {
|
||||
}
|
||||
}
|
||||
|
||||
class Kapt3Android42IT : Kapt3BaseIT() {
|
||||
class Kapt3Android42IT : BaseGradleIT() {
|
||||
companion object {
|
||||
private val KAPT_SUCCESSFUL_REGEX = "Annotation processing complete, errors: 0".toRegex()
|
||||
}
|
||||
|
||||
private fun kaptOptions(): KaptOptions =
|
||||
KaptOptions(verbose = true, useWorkers = false)
|
||||
|
||||
private fun CompiledProject.assertKaptSuccessful() {
|
||||
KAPT_SUCCESSFUL_REGEX.findAll(this.output).count() > 0
|
||||
}
|
||||
|
||||
override val defaultGradleVersion: GradleVersionRequired
|
||||
get() = GradleVersionRequired.AtLeast("6.7.1")
|
||||
|
||||
override fun defaultBuildOptions(): BuildOptions =
|
||||
super.defaultBuildOptions().copy(
|
||||
kaptOptions = kaptOptions(),
|
||||
warningMode = WarningMode.Summary,
|
||||
androidHome = KtTestUtil.findAndroidSdk(),
|
||||
androidGradlePluginVersion = AGPVersion.v4_2_0
|
||||
)
|
||||
|
||||
|
||||
/** Regression test for https://youtrack.jetbrains.com/issue/KT-44020. */
|
||||
@Test
|
||||
fun testDatabindingWithAndroidX() {
|
||||
@@ -156,11 +169,24 @@ class Kapt3Android42IT : Kapt3BaseIT() {
|
||||
}
|
||||
}
|
||||
|
||||
abstract class Kapt3AndroidIT : Kapt3BaseIT() {
|
||||
abstract class Kapt3AndroidIT : BaseGradleIT() {
|
||||
companion object {
|
||||
private val KAPT_SUCCESSFUL_REGEX = "Annotation processing complete, errors: 0".toRegex()
|
||||
}
|
||||
|
||||
protected open fun kaptOptions(): KaptOptions =
|
||||
KaptOptions(verbose = true, useWorkers = false)
|
||||
|
||||
fun CompiledProject.assertKaptSuccessful() {
|
||||
KAPT_SUCCESSFUL_REGEX.findAll(this.output).count() > 0
|
||||
}
|
||||
|
||||
protected abstract val androidGradlePluginVersion: AGPVersion
|
||||
|
||||
override fun defaultBuildOptions() =
|
||||
super.defaultBuildOptions().copy(
|
||||
kaptOptions = kaptOptions(),
|
||||
warningMode = WarningMode.Summary,
|
||||
androidHome = KtTestUtil.findAndroidSdk(),
|
||||
androidGradlePluginVersion = androidGradlePluginVersion
|
||||
)
|
||||
|
||||
+770
-694
File diff suppressed because it is too large
Load Diff
+5
-12
@@ -1,17 +1,9 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
plugins {
|
||||
id "java"
|
||||
id "org.jetbrains.kotlin.jvm"
|
||||
id "org.jetbrains.kotlin.kapt"
|
||||
}
|
||||
|
||||
apply plugin: "java"
|
||||
apply plugin: "kotlin"
|
||||
apply plugin: "kotlin-kapt"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
@@ -24,5 +16,6 @@ kapt {
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
kapt "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
// kapt "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version"
|
||||
}
|
||||
-1
@@ -1 +0,0 @@
|
||||
kapt.verbose=true
|
||||
+3
-11
@@ -1,16 +1,8 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
plugins {
|
||||
id "org.jetbrains.kotlin.jvm"
|
||||
id "org.jetbrains.kotlin.kapt"
|
||||
}
|
||||
|
||||
apply plugin: "kotlin"
|
||||
apply plugin: "kotlin-kapt"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
|
||||
-1
@@ -1 +0,0 @@
|
||||
kapt.verbose=true
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'kotlin'
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation project(":processor")
|
||||
kapt project(":processor")
|
||||
}
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'kotlin'
|
||||
|
||||
dependencies {
|
||||
ext.autoServiceVersion = '1.0-rc2'
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation "com.google.auto.service:auto-service:$autoServiceVersion"
|
||||
kapt "com.google.auto.service:auto-service:$autoServiceVersion"
|
||||
}
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
package processor
|
||||
|
||||
import com.google.auto.service.AutoService
|
||||
import javax.annotation.processing.*
|
||||
import javax.lang.model.SourceVersion
|
||||
import javax.lang.model.element.TypeElement
|
||||
import javax.tools.Diagnostic
|
||||
|
||||
@AutoService(Processor::class)
|
||||
@SupportedAnnotationTypes("annotation.ProcessThis")
|
||||
@SupportedSourceVersion(SourceVersion.RELEASE_8)
|
||||
class MyProcessor() : AbstractProcessor() {
|
||||
|
||||
private var fileCreated = false
|
||||
|
||||
override fun process(annotations: Set<TypeElement>,
|
||||
roundEnv: RoundEnvironment): Boolean {
|
||||
processingEnv.messager.printMessage(Diagnostic.Kind.NOTE, "Working!")
|
||||
if (fileCreated) return true
|
||||
fileCreated = true
|
||||
val file = processingEnv.filer.createSourceFile("Check")
|
||||
file.openWriter().use {
|
||||
it.appendLine("// $annotations")
|
||||
it.appendLine("public class Check {}")
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
-1
@@ -1 +0,0 @@
|
||||
rootProject.name = 'kaptbug'
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
package annotation
|
||||
|
||||
annotation class ProcessThis
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
package model
|
||||
|
||||
import annotation.ProcessThis
|
||||
|
||||
@ProcessThis
|
||||
interface Model {
|
||||
|
||||
var a: Int
|
||||
|
||||
var b: Int
|
||||
}
|
||||
|
||||
@ProcessThis
|
||||
class Class {
|
||||
|
||||
var a = 0
|
||||
}
|
||||
+5
-13
@@ -1,17 +1,9 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
plugins {
|
||||
id "java"
|
||||
id "org.jetbrains.kotlin.jvm"
|
||||
id "org.jetbrains.kotlin.kapt"
|
||||
}
|
||||
|
||||
apply plugin: "java"
|
||||
apply plugin: "kotlin"
|
||||
apply plugin: "kotlin-kapt"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
@@ -21,4 +13,4 @@ dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version"
|
||||
kapt "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -1 +0,0 @@
|
||||
kapt.verbose=true
|
||||
+4
-12
@@ -1,17 +1,9 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
plugins {
|
||||
id "java"
|
||||
id "org.jetbrains.kotlin.jvm"
|
||||
id "org.jetbrains.kotlin.kapt"
|
||||
}
|
||||
|
||||
apply plugin: "java"
|
||||
apply plugin: "kotlin"
|
||||
apply plugin: "kotlin-kapt"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
|
||||
+3
-12
@@ -1,17 +1,8 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
plugins {
|
||||
id "org.jetbrains.kotlin.jvm"
|
||||
id "org.jetbrains.kotlin.kapt"
|
||||
}
|
||||
|
||||
apply plugin: "java"
|
||||
apply plugin: "kotlin"
|
||||
apply plugin: "kotlin-kapt"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
|
||||
-1
@@ -1 +0,0 @@
|
||||
kapt.verbose=true
|
||||
-10
@@ -1,13 +1,3 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
||||
-1
@@ -1,3 +1,2 @@
|
||||
kapt.verbose=true
|
||||
kapt.workers.log.classloading=true
|
||||
kapt.workers.isolation=process
|
||||
+4
-2
@@ -1,5 +1,7 @@
|
||||
apply plugin: "kotlin"
|
||||
apply plugin: "kotlin-kapt"
|
||||
plugins {
|
||||
id "org.jetbrains.kotlin.jvm"
|
||||
id "org.jetbrains.kotlin.kapt"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
|
||||
+4
-2
@@ -1,5 +1,7 @@
|
||||
apply plugin: "kotlin"
|
||||
apply plugin: "kotlin-kapt"
|
||||
plugins {
|
||||
id "org.jetbrains.kotlin.jvm"
|
||||
id "org.jetbrains.kotlin.kapt"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(":module1")
|
||||
|
||||
+4
-13
@@ -1,18 +1,9 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
plugins {
|
||||
id "java"
|
||||
id "org.jetbrains.kotlin.jvm"
|
||||
id "org.jetbrains.kotlin.kapt"
|
||||
}
|
||||
|
||||
apply plugin: "java"
|
||||
apply plugin: "kotlin"
|
||||
apply plugin: "kotlin-kapt"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
|
||||
-1
@@ -1 +0,0 @@
|
||||
kapt.verbose=true
|
||||
+1
-13
@@ -1,13 +1 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "org.jetbrains.kotlin.jvm" version "$kotlin_version"
|
||||
id "org.jetbrains.kotlin.kapt" version "$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
include ':app', ':lib'
|
||||
include ':app', ':lib'
|
||||
|
||||
+3
-11
@@ -1,16 +1,8 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
plugins {
|
||||
id 'org.jetbrains.kotlin.jvm'
|
||||
id 'org.jetbrains.kotlin.kapt'
|
||||
}
|
||||
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
|
||||
+4
-12
@@ -1,17 +1,9 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
plugins {
|
||||
id "java"
|
||||
id "org.jetbrains.kotlin.jvm"
|
||||
id "org.jetbrains.kotlin.kapt"
|
||||
}
|
||||
|
||||
apply plugin: "java"
|
||||
apply plugin: "kotlin"
|
||||
apply plugin: "kotlin-kapt"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
|
||||
+4
-2
@@ -1,5 +1,7 @@
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
plugins {
|
||||
id 'org.jetbrains.kotlin.jvm'
|
||||
id 'org.jetbrains.kotlin.kapt'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
|
||||
-10
@@ -1,13 +1,3 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
+3
-2
@@ -1,5 +1,6 @@
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: 'java-library'
|
||||
plugins {
|
||||
id 'org.jetbrains.kotlin.jvm'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
|
||||
+4
-2
@@ -1,5 +1,7 @@
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
plugins {
|
||||
id 'org.jetbrains.kotlin.jvm'
|
||||
id 'org.jetbrains.kotlin.kapt'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
|
||||
-11
@@ -1,14 +1,3 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
||||
+4
-2
@@ -1,5 +1,7 @@
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
plugins {
|
||||
id 'org.jetbrains.kotlin.jvm'
|
||||
id 'org.jetbrains.kotlin.kapt'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
|
||||
+3
-1
@@ -1,4 +1,6 @@
|
||||
apply plugin: 'kotlin'
|
||||
plugins {
|
||||
id 'org.jetbrains.kotlin.jvm'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
|
||||
-10
@@ -1,13 +1,3 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
||||
+5
-4
@@ -1,5 +1,8 @@
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
plugins {
|
||||
id 'org.jetbrains.kotlin.jvm'
|
||||
id 'org.jetbrains.kotlin.kapt'
|
||||
id 'idea'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
@@ -12,8 +15,6 @@ dependencies {
|
||||
testImplementation'junit:junit:4.12'
|
||||
}
|
||||
|
||||
apply plugin: 'idea'
|
||||
|
||||
idea {
|
||||
module {
|
||||
sourceDirs += files('build/generated/source/kapt/main', 'build/generated/source/kaptKotlin/main')
|
||||
|
||||
-1
@@ -1 +0,0 @@
|
||||
kapt.verbose=true
|
||||
+4
-12
@@ -1,17 +1,9 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
plugins {
|
||||
id "java"
|
||||
id "org.jetbrains.kotlin.jvm"
|
||||
id "org.jetbrains.kotlin.kapt"
|
||||
}
|
||||
|
||||
apply plugin: "java"
|
||||
apply plugin: "kotlin"
|
||||
apply plugin: "kotlin-kapt"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
|
||||
+3
-11
@@ -1,16 +1,8 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
plugins {
|
||||
id "java"
|
||||
id "org.jetbrains.kotlin.jvm"
|
||||
}
|
||||
|
||||
apply plugin: "java"
|
||||
apply plugin: "kotlin"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
|
||||
+4
-12
@@ -1,17 +1,9 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
plugins {
|
||||
id "java"
|
||||
id "org.jetbrains.kotlin.jvm"
|
||||
id "org.jetbrains.kotlin.kapt"
|
||||
}
|
||||
|
||||
apply plugin: "java"
|
||||
apply plugin: "kotlin"
|
||||
apply plugin: "kotlin-kapt"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
|
||||
-1
@@ -1 +0,0 @@
|
||||
kapt.verbose=true
|
||||
+3
-1
@@ -1,10 +1,12 @@
|
||||
pluginManagement {
|
||||
// Required for KaptModeIT. Remove it once these tests will be migrated.
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "org.jetbrains.kotlin.jvm" version "$kotlin_version"
|
||||
id "org.jetbrains.kotlin.kapt" version "$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -10,5 +10,6 @@ pluginManagement {
|
||||
plugins {
|
||||
id "org.jetbrains.kotlin.jvm" version "$kotlin_version"
|
||||
id "org.jetbrains.kotlin.plugin.allopen" version "$kotlin_version"
|
||||
id "org.jetbrains.kotlin.kapt" version "$kotlin_version"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user