Introduce tooling model for annotation based projects
Introduce Gradle models for plugins 'kotlin-allopen', 'kotlin-noarg' and 'kotlin-sam-with-receiver'. Corresponding model builders are registered in each one of those plugin main classes.
This commit is contained in:
committed by
Sergey Igushkin
parent
5671dbb929
commit
5a423e8dcd
@@ -17,6 +17,8 @@ dependencies {
|
||||
testCompile project(':kotlin-gradle-plugin').sourceSets.test.output
|
||||
testCompile project(':kotlin-gradle-subplugin-example')
|
||||
testCompile project(':kotlin-allopen')
|
||||
testCompile project(':kotlin-noarg')
|
||||
testCompile project(':kotlin-sam-with-receiver')
|
||||
testCompile project(':kotlin-test:kotlin-test-jvm')
|
||||
|
||||
testCompile project(path: ':kotlin-compiler-embeddable', configuration: 'runtimeJar')
|
||||
@@ -43,6 +45,8 @@ dependencies {
|
||||
test.dependsOn(":kotlin-gradle-plugin:validateTaskProperties")
|
||||
|
||||
test.dependsOn(":kotlin-allopen:install",
|
||||
":kotlin-noarg:install",
|
||||
":kotlin-sam-with-receiver:install",
|
||||
":kotlin-android-extensions:install",
|
||||
":kotlin-build-common:install",
|
||||
":kotlin-compiler-embeddable:install",
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.gradle.model
|
||||
|
||||
import org.jetbrains.kotlin.gradle.BaseGradleIT
|
||||
import org.junit.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertNull
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class AllOpenModelIT : BaseGradleIT() {
|
||||
|
||||
@Test
|
||||
fun testAllOpenSimple() {
|
||||
val project = Project("allOpenSimple")
|
||||
val allOpenModel = project.getModels(AllOpen::class.java).getModel(":")!!
|
||||
assertEquals(1L, allOpenModel.modelVersion)
|
||||
assertEquals("allOpenSimple", allOpenModel.name)
|
||||
assertEquals(1, allOpenModel.annotations.size)
|
||||
assertTrue(allOpenModel.annotations.contains("lib.AllOpen"))
|
||||
assertTrue(allOpenModel.presets.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testNonAllOpenProjects() {
|
||||
val project = Project("kotlinProject")
|
||||
val model = project.getModels(AllOpen::class.java).getModel(":")
|
||||
|
||||
assertNull(model)
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.gradle.model
|
||||
|
||||
import org.jetbrains.kotlin.gradle.BaseGradleIT
|
||||
import org.junit.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertFalse
|
||||
import kotlin.test.assertNull
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class NoArgModelIT : BaseGradleIT() {
|
||||
|
||||
@Test
|
||||
fun testNoArgKt18668() {
|
||||
val project = Project("noArgKt18668")
|
||||
val noArgModel = project.getModels(NoArg::class.java).getModel(":")!!
|
||||
assertEquals(1L, noArgModel.modelVersion)
|
||||
assertEquals("noArgKt18668", noArgModel.name)
|
||||
assertEquals(1, noArgModel.annotations.size)
|
||||
assertTrue(noArgModel.annotations.contains("test.NoArg"))
|
||||
assertTrue(noArgModel.presets.isEmpty())
|
||||
assertFalse(noArgModel.isInvokeInitializers)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testNonNoArgProjects() {
|
||||
val project = Project("kotlinProject")
|
||||
val model = project.getModels(NoArg::class.java).getModel(":")
|
||||
|
||||
assertNull(model)
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.gradle.model
|
||||
|
||||
import org.jetbrains.kotlin.gradle.BaseGradleIT
|
||||
import org.junit.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertNull
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class SamWithReceiverModelIT : BaseGradleIT() {
|
||||
|
||||
@Test
|
||||
fun testSamWithReceiverSimple() {
|
||||
val project = Project("samWithReceiverSimple")
|
||||
val samWithReceiverModel = project.getModels(SamWithReceiver::class.java).getModel(":")!!
|
||||
assertEquals(1L, samWithReceiverModel.modelVersion)
|
||||
assertEquals("samWithReceiverSimple", samWithReceiverModel.name)
|
||||
assertEquals(1, samWithReceiverModel.annotations.size)
|
||||
assertTrue(samWithReceiverModel.annotations.contains("lib.SamWithReceiver"))
|
||||
assertTrue(samWithReceiverModel.presets.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testNonSamWithReceiverProjects() {
|
||||
val project = Project("kotlinProject")
|
||||
val model = project.getModels(SamWithReceiver::class.java).getModel(":")
|
||||
|
||||
assertNull(model)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user