Introduce tooling model for Kotlin gradle projects
A KotlinProject model for Gradle projects including Kotlin (JVM, JS or common) plugins is introduced. Its model builder KotlinModelBuilder produces an implementation of these models and can be queried through the Gradle Tooling API when needed. Model builder is registered in the corresponding Kotlin Gradle plugins. Model definition should be published as a separate artifact in public repositories so it can be consumed when needed.
This commit is contained in:
committed by
Sergey Igushkin
parent
4b03db771a
commit
9def6f020f
+15
@@ -1,7 +1,10 @@
|
||||
package org.jetbrains.kotlin.gradle
|
||||
|
||||
import org.gradle.api.logging.LogLevel
|
||||
import org.gradle.tooling.GradleConnector
|
||||
import org.gradle.util.GradleVersion
|
||||
import org.jetbrains.kotlin.gradle.model.ModelContainer
|
||||
import org.jetbrains.kotlin.gradle.model.ModelFetcherBuildAction
|
||||
import org.jetbrains.kotlin.gradle.util.*
|
||||
import org.junit.After
|
||||
import org.junit.AfterClass
|
||||
@@ -274,6 +277,18 @@ abstract class BaseGradleIT {
|
||||
}
|
||||
}
|
||||
|
||||
fun <T> Project.getModels(modelType: Class<T>): ModelContainer<T> {
|
||||
if (!projectDir.exists()) {
|
||||
setupWorkingDir()
|
||||
}
|
||||
|
||||
val connection = GradleConnector.newConnector().forProjectDirectory(projectDir).connect()
|
||||
val options = defaultBuildOptions()
|
||||
val model = connection.action(ModelFetcherBuildAction(modelType)) .withArguments("-Pkotlin_version=" + options.kotlinVersion).run()
|
||||
connection.close()
|
||||
return model
|
||||
}
|
||||
|
||||
fun CompiledProject.assertSuccessful() {
|
||||
if (resultCode == 0) return
|
||||
|
||||
|
||||
+154
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* 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.assertTrue
|
||||
|
||||
class KotlinProjectIT : BaseGradleIT() {
|
||||
|
||||
@Test
|
||||
fun testKotlinProject() {
|
||||
val project = Project("kotlinProject")
|
||||
val kotlinProject = project.getModels(KotlinProject::class.java).getModel(":")!!
|
||||
|
||||
kotlinProject.assertBasics("kotlinProject", defaultBuildOptions().kotlinVersion, KotlinProject.ProjectType.PLATFORM_JVM, "WARN")
|
||||
assertTrue(kotlinProject.expectedByDependencies.isEmpty())
|
||||
|
||||
assertEquals(2, kotlinProject.sourceSets.size)
|
||||
val mainSourceSet = kotlinProject.sourceSets.find { it.name == "main" }!!
|
||||
val testSourceSet = kotlinProject.sourceSets.find { it.name == "test" }!!
|
||||
|
||||
mainSourceSet.assertBasics("main", SourceSet.SourceSetType.PRODUCTION, emptySet())
|
||||
testSourceSet.assertBasics("test", SourceSet.SourceSetType.TEST, listOf("main"))
|
||||
|
||||
assertEquals(2, mainSourceSet.sourceDirectories.size)
|
||||
assertEquals(1, mainSourceSet.sourceDirectories.filter { it.absolutePath.contains("src/main/kotlin") }.size)
|
||||
assertEquals(1, mainSourceSet.sourceDirectories.filter { it.absolutePath.contains("src/main/java") }.size)
|
||||
assertEquals(1, mainSourceSet.resourcesDirectories.size)
|
||||
assertEquals(1, mainSourceSet.resourcesDirectories.filter { it.absolutePath.contains("src/main/resources") }.size)
|
||||
assertTrue(mainSourceSet.classesOutputDirectory.absolutePath.contains("build/classes/kotlin/main"))
|
||||
assertTrue(mainSourceSet.resourcesOutputDirectory.absolutePath.contains("build/resources/main"))
|
||||
assertTrue(mainSourceSet.compilerArguments.compileClasspath.any { it.absolutePath.contains("guava") })
|
||||
assertFalse(mainSourceSet.compilerArguments.compileClasspath.any { it.absolutePath.contains("testng") })
|
||||
|
||||
assertEquals(2, testSourceSet.sourceDirectories.size)
|
||||
assertEquals(1, testSourceSet.sourceDirectories.filter { it.absolutePath.contains("src/test/kotlin") }.size)
|
||||
assertEquals(1, testSourceSet.sourceDirectories.filter { it.absolutePath.contains("src/test/java") }.size)
|
||||
assertEquals(1, testSourceSet.resourcesDirectories.size)
|
||||
assertEquals(1, testSourceSet.resourcesDirectories.filter { it.absolutePath.contains("src/test/resources") }.size)
|
||||
assertTrue(testSourceSet.classesOutputDirectory.absolutePath.contains("build/classes/kotlin/test"))
|
||||
assertTrue(testSourceSet.resourcesOutputDirectory.absolutePath.contains("build/resources/test"))
|
||||
assertTrue(testSourceSet.compilerArguments.compileClasspath.any { it.absolutePath.contains("guava") })
|
||||
assertTrue(testSourceSet.compilerArguments.compileClasspath.any { it.absolutePath.contains("testng") })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testKotlinJavaProject() {
|
||||
val project = Project("kotlinJavaProject")
|
||||
val kotlinProject = project.getModels(KotlinProject::class.java).getModel(":")!!
|
||||
|
||||
kotlinProject.assertBasics(
|
||||
"kotlinJavaProject",
|
||||
defaultBuildOptions().kotlinVersion,
|
||||
KotlinProject.ProjectType.PLATFORM_JVM,
|
||||
"WARN"
|
||||
)
|
||||
|
||||
assertEquals(3, kotlinProject.sourceSets.size)
|
||||
val mainSourceSet = kotlinProject.sourceSets.find { it.name == "main" }!!
|
||||
val deploySourceSet = kotlinProject.sourceSets.find { it.name == "deploy" }!!
|
||||
val testSourceSet = kotlinProject.sourceSets.find { it.name == "test" }!!
|
||||
|
||||
mainSourceSet.assertBasics("main", SourceSet.SourceSetType.PRODUCTION, emptySet())
|
||||
deploySourceSet.assertBasics("deploy", SourceSet.SourceSetType.PRODUCTION, emptySet())
|
||||
testSourceSet.assertBasics("test", SourceSet.SourceSetType.TEST, listOf("main"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testMultiplatformProject() {
|
||||
val project = Project("multiplatformProject")
|
||||
val models = project.getModels(KotlinProject::class.java)
|
||||
|
||||
val libKotlinProject = models.getModel(":lib")!!
|
||||
val libJsKotlinProject = models.getModel(":libJs")!!
|
||||
val libJvmKotlinProject = models.getModel(":libJvm")!!
|
||||
|
||||
libKotlinProject.assertBasics("lib", defaultBuildOptions().kotlinVersion, KotlinProject.ProjectType.PLATFORM_COMMON, "WARN")
|
||||
libJsKotlinProject.assertBasics("libJs", defaultBuildOptions().kotlinVersion, KotlinProject.ProjectType.PLATFORM_JS, "WARN")
|
||||
libJvmKotlinProject.assertBasics("libJvm", defaultBuildOptions().kotlinVersion, KotlinProject.ProjectType.PLATFORM_JVM, "WARN")
|
||||
|
||||
assertEquals(1, libJsKotlinProject.expectedByDependencies.size)
|
||||
assertTrue(libJsKotlinProject.expectedByDependencies.contains(":lib"))
|
||||
|
||||
assertEquals(1, libJvmKotlinProject.expectedByDependencies.size)
|
||||
assertTrue(libJvmKotlinProject.expectedByDependencies.contains(":lib"))
|
||||
|
||||
|
||||
assertEquals(2, libJsKotlinProject.sourceSets.size)
|
||||
val mainJsSourceSet = libJsKotlinProject.sourceSets.find { it.name == "main" }!!
|
||||
val testJsSourceSet = libJsKotlinProject.sourceSets.find { it.name == "test" }!!
|
||||
|
||||
mainJsSourceSet.assertBasics("main", SourceSet.SourceSetType.PRODUCTION, emptySet())
|
||||
testJsSourceSet.assertBasics("test", SourceSet.SourceSetType.TEST, listOf("main"))
|
||||
|
||||
assertEquals(1, mainJsSourceSet.sourceDirectories.size)
|
||||
assertEquals(1, mainJsSourceSet.sourceDirectories.filter { it.absolutePath.contains("src/main/kotlin") }.size)
|
||||
assertEquals(1, mainJsSourceSet.resourcesDirectories.size)
|
||||
assertEquals(1, mainJsSourceSet.resourcesDirectories.filter { it.absolutePath.contains("src/main/resources") }.size)
|
||||
assertTrue(mainJsSourceSet.classesOutputDirectory.absolutePath.contains("build/classes/kotlin/main"))
|
||||
assertTrue(mainJsSourceSet.resourcesOutputDirectory.absolutePath.contains("build/resources/main"))
|
||||
|
||||
assertEquals(1, testJsSourceSet.sourceDirectories.size)
|
||||
assertEquals(1, testJsSourceSet.sourceDirectories.filter { it.absolutePath.contains("src/test/kotlin") }.size)
|
||||
assertEquals(1, testJsSourceSet.resourcesDirectories.size)
|
||||
assertEquals(1, testJsSourceSet.resourcesDirectories.filter { it.absolutePath.contains("src/test/resources") }.size)
|
||||
assertTrue(testJsSourceSet.classesOutputDirectory.absolutePath.contains("build/classes/kotlin/test"))
|
||||
assertTrue(testJsSourceSet.resourcesOutputDirectory.absolutePath.contains("build/resources/test"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testCoroutinesProjectDSL() {
|
||||
val project = Project("coroutinesProjectDSL")
|
||||
val kotlinProject = project.getModels(KotlinProject::class.java).getModel(":")!!
|
||||
|
||||
kotlinProject.assertBasics(
|
||||
"coroutinesProjectDSL",
|
||||
defaultBuildOptions().kotlinVersion,
|
||||
KotlinProject.ProjectType.PLATFORM_JVM,
|
||||
"ENABLE"
|
||||
)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
private fun KotlinProject.assertBasics(
|
||||
expectedName: String,
|
||||
expectedKotlinVersion: String,
|
||||
expectedProjectType: KotlinProject.ProjectType,
|
||||
expectedCoroutines: String
|
||||
) {
|
||||
assertEquals(1L, modelVersion)
|
||||
assertEquals(expectedName, name)
|
||||
assertEquals(expectedKotlinVersion, kotlinVersion)
|
||||
assertEquals(expectedProjectType, projectType)
|
||||
assertEquals(expectedCoroutines, experimentalFeatures.coroutines)
|
||||
}
|
||||
|
||||
private fun SourceSet.assertBasics(
|
||||
expectedName: String,
|
||||
expectedType: SourceSet.SourceSetType,
|
||||
expectedFriendSourceSets: Collection<String>
|
||||
) {
|
||||
assertEquals(expectedName, name)
|
||||
assertEquals(expectedType, type)
|
||||
assertEquals(expectedFriendSourceSets.toList(), friendSourceSets.toList())
|
||||
}
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* 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 java.io.Serializable
|
||||
|
||||
/**
|
||||
* Wraps models of a given type for all different projects inside a Gradle multi project.
|
||||
*/
|
||||
class ModelContainer<T> : Serializable {
|
||||
// Key is the project path
|
||||
private val modelContainer = HashMap<String, T>()
|
||||
|
||||
fun addModel(path: String, model: T) {
|
||||
modelContainer[path] = model
|
||||
}
|
||||
|
||||
fun getModel(path: String): T? {
|
||||
return modelContainer[path]
|
||||
}
|
||||
|
||||
fun hasModel(path: String): Boolean {
|
||||
return modelContainer[path] != null
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* 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.gradle.tooling.BuildAction
|
||||
import org.gradle.tooling.BuildController
|
||||
import org.gradle.tooling.model.gradle.BasicGradleProject
|
||||
import java.io.Serializable
|
||||
|
||||
class ModelFetcherBuildAction<T>(private val modelType: Class<T>) : BuildAction<ModelContainer<T>>, Serializable {
|
||||
|
||||
override fun execute(controller: BuildController): ModelContainer<T> {
|
||||
val modelContainer = ModelContainer<T>()
|
||||
modelContainer.populateModels(controller, controller.buildModel.rootProject)
|
||||
return modelContainer
|
||||
}
|
||||
|
||||
private fun ModelContainer<T>.populateModels(controller: BuildController, gradleProject: BasicGradleProject) {
|
||||
val model = controller.findModel(gradleProject, modelType)
|
||||
if (model != null && !hasModel(gradleProject.path)) {
|
||||
addModel(gradleProject.path, model)
|
||||
}
|
||||
gradleProject.children.forEach { populateModels(controller, it) }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
apply plugin: 'kotlin'
|
||||
|
||||
configureJvmProject(project)
|
||||
configurePublishing(project)
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains:annotations:13.0"
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
archives javadocJar
|
||||
}
|
||||
|
||||
jar {
|
||||
manifestAttributes(manifest, project)
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents the compiler arguments for a given Kotlin source set.
|
||||
* @see SourceSet
|
||||
*/
|
||||
public interface CompilerArguments {
|
||||
|
||||
/**
|
||||
* Return current arguments for the given source set.
|
||||
*
|
||||
* @return current arguments for the given source set.
|
||||
*/
|
||||
@NotNull
|
||||
List<String> getCurrentArguments();
|
||||
|
||||
/**
|
||||
* Return default arguments for the given source set.
|
||||
*
|
||||
* @return default arguments for the given source set.
|
||||
*/
|
||||
@NotNull
|
||||
List<String> getDefaultArguments();
|
||||
|
||||
/**
|
||||
* Return the classpath the given source set is compiled against.
|
||||
*
|
||||
* @return the classpath the given source set is compiled against.
|
||||
*/
|
||||
@NotNull
|
||||
List<File> getCompileClasspath();
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* 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.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Wraps all experimental features information for a given Kotlin project.
|
||||
* @see KotlinProject
|
||||
*/
|
||||
public interface ExperimentalFeatures {
|
||||
|
||||
/**
|
||||
* Return coroutines string.
|
||||
*
|
||||
* @return coroutines.
|
||||
*/
|
||||
@Nullable
|
||||
String getCoroutines();
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* 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.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Entry point for the model of Kotlin Projects.
|
||||
* Plugins 'kotlin', 'kotlin-platform-jvm', 'kotlin2js', 'kotlin-platform-js' and 'kotlin-platform-common' can produce this model.
|
||||
*/
|
||||
public interface KotlinProject {
|
||||
|
||||
/**
|
||||
* Possible Kotlin project types.
|
||||
*/
|
||||
enum ProjectType {
|
||||
|
||||
/** Indicator of platform plugin id 'kotlin-platform-jvm' or 'kotlin'. */
|
||||
PLATFORM_JVM,
|
||||
|
||||
/** Indicator of platform plugin id 'kotlin-platform-js' or 'kotlin2js'. */
|
||||
PLATFORM_JS,
|
||||
|
||||
/** Indicator of platform plugin id 'kotlin-platform-common'. */
|
||||
PLATFORM_COMMON
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a number representing the version of this API.
|
||||
* Always increasing if changed.
|
||||
*
|
||||
* @return the version of this model.
|
||||
*/
|
||||
long getModelVersion();
|
||||
|
||||
/**
|
||||
* Returns the module (Gradle project) name.
|
||||
*
|
||||
* @return the module name.
|
||||
*/
|
||||
@NotNull
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Return the Kotlin version.
|
||||
*
|
||||
* @return the Kotlin version.
|
||||
*/
|
||||
@NotNull
|
||||
String getKotlinVersion();
|
||||
|
||||
/**
|
||||
* Return the type of the platform plugin applied.
|
||||
*
|
||||
* @return the type of the platform plugin applied. Possible values are defined in the enum.
|
||||
*/
|
||||
@NotNull
|
||||
ProjectType getProjectType();
|
||||
|
||||
/**
|
||||
* Return all source sets used by Kotlin.
|
||||
*
|
||||
* @return all source sets.
|
||||
*/
|
||||
@NotNull
|
||||
Collection<SourceSet> getSourceSets();
|
||||
|
||||
/**
|
||||
* Return all modules (Gradle projects) registered as 'expectedBy' dependency.
|
||||
*
|
||||
* @return expectedBy dependencies.
|
||||
*/
|
||||
@NotNull
|
||||
Collection<String> getExpectedByDependencies();
|
||||
|
||||
/**
|
||||
* Return an object containing a descriptor of the experimental features.
|
||||
*
|
||||
* @return experimental features.
|
||||
*/
|
||||
@NotNull
|
||||
ExperimentalFeatures getExperimentalFeatures();
|
||||
}
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* 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.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Represents a source set for a given Kotlin Gradle project.
|
||||
* @see KotlinProject
|
||||
*/
|
||||
public interface SourceSet {
|
||||
|
||||
/**
|
||||
* Possible source set types.
|
||||
*/
|
||||
enum SourceSetType {
|
||||
PRODUCTION,
|
||||
TEST
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the source set name.
|
||||
*
|
||||
* @return the source set name.
|
||||
*/
|
||||
@NotNull
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Return the type of the source set.
|
||||
*
|
||||
* @return the type of the source set.
|
||||
*/
|
||||
@NotNull
|
||||
SourceSetType getType();
|
||||
|
||||
/**
|
||||
* Return the names of all friend source sets.
|
||||
*
|
||||
* @return friend source sets.
|
||||
*/
|
||||
@NotNull
|
||||
Collection<String> getFriendSourceSets();
|
||||
|
||||
/**
|
||||
* Return all Kotlin sources directories.
|
||||
*
|
||||
* @return all Kotlin sources directories.
|
||||
*/
|
||||
@NotNull
|
||||
Collection<File> getSourceDirectories();
|
||||
|
||||
/**
|
||||
* Return all Kotlin resources directories.
|
||||
*
|
||||
* @return all Kotlin resources directories.
|
||||
*/
|
||||
@NotNull
|
||||
Collection<File> getResourcesDirectories();
|
||||
|
||||
/**
|
||||
* Return the classes output directory.
|
||||
*
|
||||
* @return the classes output directory.
|
||||
*/
|
||||
@NotNull
|
||||
File getClassesOutputDirectory();
|
||||
|
||||
/**
|
||||
* Return the resources output directory.
|
||||
*
|
||||
* @return the resources output directory.
|
||||
*/
|
||||
@NotNull
|
||||
File getResourcesOutputDirectory();
|
||||
|
||||
/**
|
||||
* Return an object containing all compiler arguments for this source set.
|
||||
*
|
||||
* @return compiler arguments for this source set.
|
||||
*/
|
||||
@NotNull
|
||||
CompilerArguments getCompilerArguments();
|
||||
}
|
||||
@@ -32,6 +32,7 @@ pill {
|
||||
|
||||
dependencies {
|
||||
compile project(':kotlin-gradle-plugin-api')
|
||||
compile project(':kotlin-gradle-plugin-model')
|
||||
compileOnly project(':compiler')
|
||||
compileOnly project(':compiler:incremental-compilation-impl')
|
||||
compileOnly project(':compiler:daemon-common')
|
||||
@@ -77,6 +78,7 @@ dependencies {
|
||||
testCompile project(':kotlin-compiler-runner')
|
||||
testCompile project(':kotlin-test::kotlin-test-junit')
|
||||
testCompile "junit:junit:4.12"
|
||||
testCompile "nl.jqno.equalsverifier:equalsverifier:2.1.5"
|
||||
testCompileOnly project(':kotlin-reflect-api')
|
||||
testCompileOnly project(':kotlin-annotation-processing')
|
||||
testCompileOnly project(':kotlin-annotation-processing-gradle')
|
||||
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* 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.builder
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.Dependency
|
||||
import org.gradle.api.artifacts.ProjectDependency
|
||||
import org.gradle.api.plugins.JavaPluginConvention
|
||||
import org.gradle.tooling.provider.model.ToolingModelBuilder
|
||||
import org.jetbrains.kotlin.gradle.model.CompilerArguments
|
||||
import org.jetbrains.kotlin.gradle.model.ExperimentalFeatures
|
||||
import org.jetbrains.kotlin.gradle.model.KotlinProject
|
||||
import org.jetbrains.kotlin.gradle.model.SourceSet
|
||||
import org.jetbrains.kotlin.gradle.model.impl.CompilerArgumentsImpl
|
||||
import org.jetbrains.kotlin.gradle.model.impl.ExperimentalFeaturesImpl
|
||||
import org.jetbrains.kotlin.gradle.model.impl.KotlinProjectImpl
|
||||
import org.jetbrains.kotlin.gradle.model.impl.SourceSetImpl
|
||||
import org.jetbrains.kotlin.gradle.plugin.KOTLIN_DSL_NAME
|
||||
import org.jetbrains.kotlin.gradle.plugin.KOTLIN_JS_DSL_NAME
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
||||
import org.jetbrains.kotlin.gradle.plugin.getConvention
|
||||
import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile
|
||||
|
||||
/**
|
||||
* [ToolingModelBuilder] for [KotlinProject] models.
|
||||
* This model builder is registered for base Kotlin JVM, Kotlin JS and Kotlin Common plugins.
|
||||
*/
|
||||
class KotlinModelBuilder(private val kotlinPluginVersion: String) : ToolingModelBuilder {
|
||||
|
||||
override fun canBuild(modelName: String): Boolean {
|
||||
return modelName == KotlinProject::class.java.name
|
||||
}
|
||||
|
||||
override fun buildAll(modelName: String, project: Project): Any? {
|
||||
if (modelName == KotlinProject::class.java.name) {
|
||||
val kotlinCompileTasks = project.tasks.withType(AbstractKotlinCompile::class.java)
|
||||
val projectType = getProjectType(project)
|
||||
return KotlinProjectImpl(
|
||||
project.name,
|
||||
kotlinPluginVersion,
|
||||
projectType,
|
||||
kotlinCompileTasks.mapNotNull { it.createSourceSet(project, projectType) },
|
||||
getExpectedByDependencies(project),
|
||||
kotlinCompileTasks.first()!!.createExperimentalFeatures()
|
||||
)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
private fun getProjectType(project: Project): KotlinProject.ProjectType {
|
||||
return if (project.plugins.hasPlugin("kotlin") || project.plugins.hasPlugin("kotlin-platform-jvm")) {
|
||||
KotlinProject.ProjectType.PLATFORM_JVM
|
||||
} else if (project.plugins.hasPlugin("kotlin2js") || project.plugins.hasPlugin("kotlin-platform-js")) {
|
||||
KotlinProject.ProjectType.PLATFORM_JS
|
||||
} else {
|
||||
KotlinProject.ProjectType.PLATFORM_COMMON
|
||||
}
|
||||
}
|
||||
|
||||
private fun getExpectedByDependencies(project: Project): Collection<String> {
|
||||
return listOf("expectedBy", "implement")
|
||||
.flatMap { project.configurations.findByName(it)?.dependencies ?: emptySet<Dependency>() }
|
||||
.filterIsInstance<ProjectDependency>()
|
||||
.mapNotNull { it.dependencyProject }
|
||||
.map { it.pathOrName() }
|
||||
}
|
||||
|
||||
private fun Project.pathOrName() = if (path == ":") name else path
|
||||
|
||||
private fun AbstractKotlinCompile<*>.createSourceSet(project: Project, projectType: KotlinProject.ProjectType): SourceSet? {
|
||||
val javaSourceSet =
|
||||
project.convention.findPlugin(JavaPluginConvention::class.java)?.sourceSets?.find { it.name == sourceSetName }
|
||||
val kotlinSourceSet =
|
||||
javaSourceSet?.getConvention(if (projectType == KotlinProject.ProjectType.PLATFORM_JS) KOTLIN_JS_DSL_NAME else KOTLIN_DSL_NAME) as? KotlinSourceSet
|
||||
return if (kotlinSourceSet != null) {
|
||||
SourceSetImpl(
|
||||
sourceSetName,
|
||||
if (sourceSetName.contains("test", true)) SourceSet.SourceSetType.TEST else SourceSet.SourceSetType.PRODUCTION,
|
||||
findFriendSourceSets(),
|
||||
kotlinSourceSet.kotlin.srcDirs,
|
||||
javaSourceSet.resources.srcDirs,
|
||||
destinationDir,
|
||||
javaSourceSet.output.resourcesDir,
|
||||
createCompilerArguments()
|
||||
)
|
||||
} else null
|
||||
}
|
||||
|
||||
private fun AbstractKotlinCompile<*>.findFriendSourceSets(): Collection<String> {
|
||||
val friendSourceSets = ArrayList<String>()
|
||||
friendTask?.sourceSetName?.let { friendSourceSets.add(it) }
|
||||
return friendSourceSets
|
||||
}
|
||||
|
||||
private fun AbstractKotlinCompile<*>.createCompilerArguments(): CompilerArguments {
|
||||
return CompilerArgumentsImpl(
|
||||
serializedCompilerArguments,
|
||||
defaultSerializedCompilerArguments,
|
||||
compileClasspath.toList()
|
||||
)
|
||||
}
|
||||
|
||||
private fun AbstractKotlinCompile<*>.createExperimentalFeatures(): ExperimentalFeatures {
|
||||
return ExperimentalFeaturesImpl(coroutinesStr)
|
||||
}
|
||||
}
|
||||
}
|
||||
+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.impl
|
||||
|
||||
import org.jetbrains.kotlin.gradle.model.CompilerArguments
|
||||
import java.io.File
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* Implementation of the [CompilerArguments] interface.
|
||||
*/
|
||||
data class CompilerArgumentsImpl(
|
||||
private val myCurrentArguments: List<String>,
|
||||
private val myDefaultArguments: List<String>,
|
||||
private val myCompilerClasspath: List<File>
|
||||
) : CompilerArguments, Serializable {
|
||||
|
||||
override fun getCurrentArguments(): List<String> {
|
||||
return myCurrentArguments
|
||||
}
|
||||
|
||||
override fun getDefaultArguments(): List<String> {
|
||||
return myDefaultArguments
|
||||
}
|
||||
|
||||
override fun getCompileClasspath(): List<File> {
|
||||
return myCompilerClasspath
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = 1L
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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.impl
|
||||
|
||||
import org.jetbrains.kotlin.gradle.model.ExperimentalFeatures
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* Implementation of the [ExperimentalFeatures] interface.
|
||||
*/
|
||||
data class ExperimentalFeaturesImpl(
|
||||
private val myCoroutines: String?
|
||||
) : ExperimentalFeatures, Serializable {
|
||||
|
||||
override fun getCoroutines(): String? {
|
||||
return myCoroutines
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = 1L
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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.impl
|
||||
|
||||
import org.jetbrains.kotlin.gradle.model.ExperimentalFeatures
|
||||
import org.jetbrains.kotlin.gradle.model.KotlinProject
|
||||
import org.jetbrains.kotlin.gradle.model.SourceSet
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* Implementation of the [KotlinProject] interface.
|
||||
*/
|
||||
data class KotlinProjectImpl(
|
||||
private val myName: String,
|
||||
private val myKotlinVersion: String,
|
||||
private val myProjectType: KotlinProject.ProjectType,
|
||||
private val mySourceSets: Collection<SourceSet>,
|
||||
private val myExpectedByDependencies: Collection<String>,
|
||||
private val myExperimentalFeatures: ExperimentalFeatures
|
||||
) : KotlinProject, Serializable {
|
||||
|
||||
override fun getModelVersion(): Long {
|
||||
return serialVersionUID
|
||||
}
|
||||
|
||||
override fun getName(): String {
|
||||
return myName
|
||||
}
|
||||
|
||||
override fun getKotlinVersion(): String {
|
||||
return myKotlinVersion
|
||||
}
|
||||
|
||||
override fun getProjectType(): KotlinProject.ProjectType {
|
||||
return myProjectType
|
||||
}
|
||||
|
||||
override fun getSourceSets(): Collection<SourceSet> {
|
||||
return mySourceSets
|
||||
}
|
||||
|
||||
override fun getExpectedByDependencies(): Collection<String> {
|
||||
return myExpectedByDependencies
|
||||
}
|
||||
|
||||
override fun getExperimentalFeatures(): ExperimentalFeatures {
|
||||
return myExperimentalFeatures
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = 1L
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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.impl
|
||||
|
||||
import org.jetbrains.kotlin.gradle.model.CompilerArguments
|
||||
import org.jetbrains.kotlin.gradle.model.SourceSet
|
||||
import java.io.File
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* Implementation of the [SourceSet] interface.
|
||||
*/
|
||||
data class SourceSetImpl(
|
||||
private val myName: String,
|
||||
private val myType: SourceSet.SourceSetType,
|
||||
private val myFriendSourceSets: Collection<String>,
|
||||
private val mySourceDirectories: Collection<File>,
|
||||
private val myResourcesDirectories: Collection<File>,
|
||||
private val myClassesOutputDirectory: File,
|
||||
private val myResourcesOutputDirectory: File,
|
||||
private val myCompilerArguments: CompilerArguments
|
||||
) : SourceSet, Serializable {
|
||||
|
||||
override fun getName(): String {
|
||||
return myName
|
||||
}
|
||||
|
||||
override fun getType(): SourceSet.SourceSetType {
|
||||
return myType
|
||||
}
|
||||
|
||||
override fun getFriendSourceSets(): Collection<String> {
|
||||
return myFriendSourceSets
|
||||
}
|
||||
|
||||
override fun getSourceDirectories(): Collection<File> {
|
||||
return mySourceDirectories
|
||||
}
|
||||
|
||||
override fun getResourcesDirectories(): Collection<File> {
|
||||
return myResourcesDirectories
|
||||
}
|
||||
|
||||
override fun getClassesOutputDirectory(): File {
|
||||
return myClassesOutputDirectory
|
||||
}
|
||||
|
||||
override fun getResourcesOutputDirectory(): File {
|
||||
return myResourcesOutputDirectory
|
||||
}
|
||||
|
||||
override fun getCompilerArguments(): CompilerArguments {
|
||||
return myCompilerArguments
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = 1L
|
||||
}
|
||||
}
|
||||
+14
-7
@@ -23,12 +23,14 @@ import org.gradle.api.tasks.SourceSetOutput
|
||||
import org.gradle.api.tasks.compile.AbstractCompile
|
||||
import org.gradle.api.tasks.compile.JavaCompile
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
import org.gradle.tooling.provider.model.ToolingModelBuilderRegistry
|
||||
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptionsImpl
|
||||
import org.jetbrains.kotlin.gradle.internal.Kapt3GradleSubplugin.Companion.getKaptGeneratedClassesDir
|
||||
import org.jetbrains.kotlin.gradle.internal.Kapt3KotlinGradleSubplugin
|
||||
import org.jetbrains.kotlin.gradle.internal.KaptVariantData
|
||||
import org.jetbrains.kotlin.gradle.internal.checkAndroidAnnotationProcessorDependencyUsage
|
||||
import org.jetbrains.kotlin.gradle.model.builder.KotlinModelBuilder
|
||||
import org.jetbrains.kotlin.gradle.scripting.internal.ScriptingGradleSubplugin
|
||||
import org.jetbrains.kotlin.gradle.tasks.*
|
||||
import org.jetbrains.kotlin.gradle.utils.*
|
||||
@@ -333,7 +335,8 @@ internal class KotlinCommonSourceSetProcessor(
|
||||
internal abstract class AbstractKotlinPlugin(
|
||||
val tasksProvider: KotlinTasksProvider,
|
||||
val kotlinSourceSetProvider: KotlinSourceSetProvider,
|
||||
protected val kotlinPluginVersion: String
|
||||
protected val kotlinPluginVersion: String,
|
||||
val registry: ToolingModelBuilderRegistry
|
||||
) : Plugin<Project> {
|
||||
internal abstract fun buildSourceSetProcessor(project: Project, javaBasePlugin: JavaBasePlugin, sourceSet: SourceSet, kotlinPluginVersion: String): KotlinSourceSetProcessor<*>
|
||||
|
||||
@@ -346,6 +349,7 @@ internal abstract class AbstractKotlinPlugin(
|
||||
configureSourceSetDefaults(project, javaBasePlugin, javaPluginConvention)
|
||||
configureDefaultVersionsResolutionStrategy(project)
|
||||
configureClassInspectionForIC(project)
|
||||
registry.register(KotlinModelBuilder(kotlinPluginVersion))
|
||||
}
|
||||
|
||||
open protected fun configureSourceSetDefaults(
|
||||
@@ -402,8 +406,9 @@ internal abstract class AbstractKotlinPlugin(
|
||||
internal open class KotlinPlugin(
|
||||
tasksProvider: KotlinTasksProvider,
|
||||
kotlinSourceSetProvider: KotlinSourceSetProvider,
|
||||
kotlinPluginVersion: String
|
||||
) : AbstractKotlinPlugin(tasksProvider, kotlinSourceSetProvider, kotlinPluginVersion) {
|
||||
kotlinPluginVersion: String,
|
||||
registry: ToolingModelBuilderRegistry
|
||||
) : AbstractKotlinPlugin(tasksProvider, kotlinSourceSetProvider, kotlinPluginVersion, registry) {
|
||||
override fun buildSourceSetProcessor(project: Project, javaBasePlugin: JavaBasePlugin, sourceSet: SourceSet, kotlinPluginVersion: String) =
|
||||
Kotlin2JvmSourceSetProcessor(project, javaBasePlugin, sourceSet, tasksProvider, kotlinSourceSetProvider, kotlinPluginVersion)
|
||||
|
||||
@@ -416,8 +421,9 @@ internal open class KotlinPlugin(
|
||||
internal open class KotlinCommonPlugin(
|
||||
tasksProvider: KotlinTasksProvider,
|
||||
kotlinSourceSetProvider: KotlinSourceSetProvider,
|
||||
kotlinPluginVersion: String
|
||||
) : AbstractKotlinPlugin(tasksProvider, kotlinSourceSetProvider, kotlinPluginVersion) {
|
||||
kotlinPluginVersion: String,
|
||||
registry: ToolingModelBuilderRegistry
|
||||
) : AbstractKotlinPlugin(tasksProvider, kotlinSourceSetProvider, kotlinPluginVersion, registry) {
|
||||
override fun buildSourceSetProcessor(project: Project, javaBasePlugin: JavaBasePlugin, sourceSet: SourceSet, kotlinPluginVersion: String) =
|
||||
KotlinCommonSourceSetProcessor(project, javaBasePlugin, sourceSet, tasksProvider, kotlinSourceSetProvider, kotlinPluginVersion)
|
||||
}
|
||||
@@ -425,8 +431,9 @@ internal open class KotlinCommonPlugin(
|
||||
internal open class Kotlin2JsPlugin(
|
||||
tasksProvider: KotlinTasksProvider,
|
||||
kotlinSourceSetProvider: KotlinSourceSetProvider,
|
||||
kotlinPluginVersion: String
|
||||
) : AbstractKotlinPlugin(tasksProvider, kotlinSourceSetProvider, kotlinPluginVersion) {
|
||||
kotlinPluginVersion: String,
|
||||
registry: ToolingModelBuilderRegistry
|
||||
) : AbstractKotlinPlugin(tasksProvider, kotlinSourceSetProvider, kotlinPluginVersion, registry) {
|
||||
override fun buildSourceSetProcessor(project: Project, javaBasePlugin: JavaBasePlugin, sourceSet: SourceSet, kotlinPluginVersion: String) =
|
||||
Kotlin2JsSourceSetProcessor(project, javaBasePlugin, sourceSet, tasksProvider, kotlinSourceSetProvider, kotlinPluginVersion)
|
||||
}
|
||||
|
||||
+8
-7
@@ -21,6 +21,7 @@ import org.gradle.api.Project
|
||||
import org.gradle.api.internal.file.FileResolver
|
||||
import org.gradle.api.logging.Logger
|
||||
import org.gradle.api.logging.Logging
|
||||
import org.gradle.tooling.provider.model.ToolingModelBuilderRegistry
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
|
||||
import org.jetbrains.kotlin.gradle.dsl.createKotlinExtension
|
||||
@@ -60,27 +61,27 @@ abstract class KotlinBasePluginWrapper(protected val fileResolver: FileResolver)
|
||||
open val projectExtensionClass: KClass<out KotlinProjectExtension> get() = KotlinProjectExtension::class
|
||||
}
|
||||
|
||||
open class KotlinPluginWrapper @Inject constructor(fileResolver: FileResolver): KotlinBasePluginWrapper(fileResolver) {
|
||||
open class KotlinPluginWrapper @Inject internal constructor(fileResolver: FileResolver, protected val registry: ToolingModelBuilderRegistry): KotlinBasePluginWrapper(fileResolver) {
|
||||
override fun getPlugin(kotlinGradleBuildServices: KotlinGradleBuildServices) =
|
||||
KotlinPlugin(KotlinTasksProvider(), KotlinSourceSetProviderImpl(fileResolver), kotlinPluginVersion)
|
||||
KotlinPlugin(KotlinTasksProvider(), KotlinSourceSetProviderImpl(fileResolver), kotlinPluginVersion, registry)
|
||||
|
||||
override val projectExtensionClass: KClass<out KotlinJvmProjectExtension>
|
||||
get() = KotlinJvmProjectExtension::class
|
||||
}
|
||||
|
||||
open class KotlinCommonPluginWrapper @Inject constructor(fileResolver: FileResolver): KotlinBasePluginWrapper(fileResolver) {
|
||||
open class KotlinCommonPluginWrapper @Inject internal constructor(fileResolver: FileResolver, protected val registry: ToolingModelBuilderRegistry): KotlinBasePluginWrapper(fileResolver) {
|
||||
override fun getPlugin(kotlinGradleBuildServices: KotlinGradleBuildServices) =
|
||||
KotlinCommonPlugin(KotlinCommonTasksProvider(), KotlinSourceSetProviderImpl(fileResolver), kotlinPluginVersion)
|
||||
KotlinCommonPlugin(KotlinCommonTasksProvider(), KotlinSourceSetProviderImpl(fileResolver), kotlinPluginVersion, registry)
|
||||
}
|
||||
|
||||
open class KotlinAndroidPluginWrapper @Inject constructor(fileResolver: FileResolver): KotlinBasePluginWrapper(fileResolver) {
|
||||
open class KotlinAndroidPluginWrapper @Inject internal constructor(fileResolver: FileResolver, protected val registry: ToolingModelBuilderRegistry): KotlinBasePluginWrapper(fileResolver) {
|
||||
override fun getPlugin(kotlinGradleBuildServices: KotlinGradleBuildServices) =
|
||||
KotlinAndroidPlugin(AndroidTasksProvider(), KotlinSourceSetProviderImpl(fileResolver), kotlinPluginVersion)
|
||||
}
|
||||
|
||||
open class Kotlin2JsPluginWrapper @Inject constructor(fileResolver: FileResolver): KotlinBasePluginWrapper(fileResolver) {
|
||||
open class Kotlin2JsPluginWrapper @Inject internal constructor(fileResolver: FileResolver, protected val registry: ToolingModelBuilderRegistry): KotlinBasePluginWrapper(fileResolver) {
|
||||
override fun getPlugin(kotlinGradleBuildServices: KotlinGradleBuildServices) =
|
||||
Kotlin2JsPlugin(Kotlin2JsTasksProvider(), KotlinSourceSetProviderImpl(fileResolver), kotlinPluginVersion)
|
||||
Kotlin2JsPlugin(Kotlin2JsTasksProvider(), KotlinSourceSetProviderImpl(fileResolver), kotlinPluginVersion, registry)
|
||||
}
|
||||
|
||||
fun Project.getKotlinPluginVersion(): String? =
|
||||
|
||||
+2
-2
@@ -148,7 +148,7 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments>() : AbstractKo
|
||||
protected val additionalClasspath = arrayListOf<File>()
|
||||
|
||||
@get:Internal // classpath already participates in the checks
|
||||
protected val compileClasspath: Iterable<File>
|
||||
val compileClasspath: Iterable<File>
|
||||
get() = (classpath + additionalClasspath)
|
||||
.filterTo(LinkedHashSet(), File::exists)
|
||||
|
||||
@@ -201,7 +201,7 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments>() : AbstractKo
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@get:Internal
|
||||
protected val friendTask: AbstractKotlinCompile<T>?
|
||||
val friendTask: AbstractKotlinCompile<T>?
|
||||
get() = friendTaskName?.let { project.tasks.findByName(it) } as? AbstractKotlinCompile<T>
|
||||
|
||||
/** Classes directories that are not produced by this task but should be consumed by
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* 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.builder
|
||||
|
||||
import org.jetbrains.kotlin.gradle.model.KotlinProject
|
||||
import org.junit.Test
|
||||
import kotlin.test.assertFalse
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class KotlinModelBuilderTest {
|
||||
@Test
|
||||
fun testCanBuild() {
|
||||
val modelBuilder = KotlinModelBuilder("version")
|
||||
assertTrue(modelBuilder.canBuild(KotlinProject::class.java.name))
|
||||
assertFalse(modelBuilder.canBuild("wrongModel"))
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* 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.impl
|
||||
|
||||
import nl.jqno.equalsverifier.EqualsVerifier
|
||||
import nl.jqno.equalsverifier.Warning
|
||||
import org.junit.Test
|
||||
|
||||
class CompilerArgumentsImplTest {
|
||||
@Test
|
||||
@Throws(Exception::class)
|
||||
fun equals() {
|
||||
EqualsVerifier.forClass(CompilerArgumentsImpl::class.java).suppress(Warning.NULL_FIELDS).verify()
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* 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.impl
|
||||
|
||||
import nl.jqno.equalsverifier.EqualsVerifier
|
||||
import nl.jqno.equalsverifier.Warning
|
||||
import org.junit.Test
|
||||
|
||||
class ExperimentalFeaturesImplTest {
|
||||
@Test
|
||||
@Throws(Exception::class)
|
||||
fun equals() {
|
||||
EqualsVerifier.forClass(ExperimentalFeaturesImpl::class.java).suppress(Warning.NULL_FIELDS).verify()
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* 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.impl
|
||||
|
||||
import nl.jqno.equalsverifier.EqualsVerifier
|
||||
import nl.jqno.equalsverifier.Warning
|
||||
import org.junit.Test
|
||||
|
||||
class KotlinProjectImplTest {
|
||||
@Test
|
||||
@Throws(Exception::class)
|
||||
fun equals() {
|
||||
EqualsVerifier.forClass(KotlinProjectImpl::class.java).suppress(Warning.NULL_FIELDS).verify()
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* 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.impl
|
||||
|
||||
import nl.jqno.equalsverifier.EqualsVerifier
|
||||
import nl.jqno.equalsverifier.Warning
|
||||
import org.junit.Test
|
||||
|
||||
class SourceSetImplTest {
|
||||
@Test
|
||||
@Throws(Exception::class)
|
||||
fun equals() {
|
||||
EqualsVerifier.forClass(SourceSetImpl::class.java).suppress(Warning.NULL_FIELDS).verify()
|
||||
}
|
||||
}
|
||||
@@ -141,6 +141,7 @@ include ":kotlin-build-common",
|
||||
":tools:kotlinp",
|
||||
":kotlin-gradle-plugin-api",
|
||||
":kotlin-gradle-plugin",
|
||||
":kotlin-gradle-plugin-model",
|
||||
":kotlin-gradle-plugin-test-utils-embeddable",
|
||||
":kotlin-gradle-plugin-integration-tests",
|
||||
":kotlin-allopen",
|
||||
@@ -251,6 +252,7 @@ project(':tools:kotlin-stdlib-gen').projectDir = "$rootDir/libraries/tools/kotli
|
||||
project(':tools:kotlinp').projectDir = "$rootDir/libraries/tools/kotlinp" as File
|
||||
project(':kotlin-gradle-plugin-api').projectDir = "$rootDir/libraries/tools/kotlin-gradle-plugin-api" as File
|
||||
project(':kotlin-gradle-plugin').projectDir = "$rootDir/libraries/tools/kotlin-gradle-plugin" as File
|
||||
project(':kotlin-gradle-plugin-model').projectDir = "$rootDir/libraries/tools/kotlin-gradle-plugin-model" as File
|
||||
project(':kotlin-gradle-plugin-test-utils-embeddable').projectDir = "$rootDir/libraries/tools/kotlin-gradle-plugin-test-utils-embeddable" as File
|
||||
project(':kotlin-gradle-plugin-integration-tests').projectDir = "$rootDir/libraries/tools/kotlin-gradle-plugin-integration-tests" as File
|
||||
project(':kotlin-allopen').projectDir = "$rootDir/libraries/tools/kotlin-allopen" as File
|
||||
|
||||
Reference in New Issue
Block a user