Migrate 'kotlin-gradle-plugin' module to variants

^KT-49227 In Progress
This commit is contained in:
Yahor Berdnikau
2022-03-24 16:27:21 +01:00
parent f25b00daa3
commit d9ddcd991b
546 changed files with 83 additions and 79 deletions
+1
View File
@@ -329,6 +329,7 @@ extra["compilerArtifactsForIde"] = listOf(
// TODO: fix remaining warnings and remove this property. // TODO: fix remaining warnings and remove this property.
extra["tasksWithWarnings"] = listOf( extra["tasksWithWarnings"] = listOf(
":kotlin-gradle-plugin:compileKotlin", ":kotlin-gradle-plugin:compileKotlin",
":kotlin-gradle-plugin:compileCommonKotlin",
":kotlin-gradle-plugin:compileGradle70Kotlin" ":kotlin-gradle-plugin:compileGradle70Kotlin"
) )
@@ -28,58 +28,55 @@ kotlin.sourceSets.all {
} }
dependencies { dependencies {
compileOnly(gradleKotlinDsl()) commonApi(project(":kotlin-gradle-plugin-api"))
api(project(":kotlin-gradle-plugin-api")) commonApi(project(":kotlin-gradle-plugin-model"))
api(project(":kotlin-gradle-plugin-model")) commonApi(project(":kotlin-tooling-core"))
api(project(":kotlin-tooling-core"))
implementation(project(":kotlin-gradle-plugin-idea")) commonCompileOnly(gradleKotlinDsl())
compileOnly(project(":compiler")) commonCompileOnly(project(":compiler"))
compileOnly(project(":compiler:incremental-compilation-impl")) commonCompileOnly(project(":compiler:incremental-compilation-impl"))
compileOnly(project(":daemon-common")) commonCompileOnly(project(":daemon-common"))
commonCompileOnly(project(":native:kotlin-native-utils"))
commonCompileOnly(project(":kotlin-reflect-api"))
commonCompileOnly(project(":kotlin-android-extensions"))
commonCompileOnly(project(":kotlin-build-common"))
commonCompileOnly(project(":kotlin-compiler-runner"))
commonCompileOnly(project(":kotlin-annotation-processing"))
commonCompileOnly(project(":kotlin-annotation-processing-gradle"))
commonCompileOnly(project(":kotlin-scripting-compiler"))
commonCompileOnly(project(":kotlin-gradle-statistics"))
commonCompileOnly(project(":kotlin-gradle-build-metrics"))
commonCompileOnly("com.android.tools.build:gradle:3.6.4")
commonCompileOnly("com.android.tools.build:gradle-api:3.6.4")
commonCompileOnly("com.android.tools.build:builder:3.6.4")
commonCompileOnly("com.android.tools.build:builder-model:3.6.4")
commonCompileOnly("org.codehaus.groovy:groovy-all:2.4.12")
commonCompileOnly(project(":kotlin-reflect"))
commonCompileOnly(intellijCore())
commonCompileOnly(commonDependency("org.jetbrains.teamcity:serviceMessages"))
commonCompileOnly("com.gradle:gradle-enterprise-gradle-plugin:3.6.3")
implementation(project(":kotlin-util-klib")) commonImplementation(project(":kotlin-gradle-plugin-idea"))
implementation(project(":native:kotlin-klib-commonizer-api")) commonImplementation(project(":kotlin-util-klib"))
implementation(project(":kotlin-tooling-metadata")) commonImplementation(project(":native:kotlin-klib-commonizer-api"))
implementation(project(":kotlin-project-model")) commonImplementation(project(":kotlin-tooling-metadata"))
compileOnly(project(":native:kotlin-native-utils")) commonImplementation(project(":kotlin-project-model"))
compileOnly(project(":kotlin-reflect-api")) commonImplementation(commonDependency("com.google.code.gson:gson"))
compileOnly(project(":kotlin-android-extensions")) commonImplementation(commonDependency("com.google.guava:guava"))
compileOnly(project(":kotlin-build-common")) commonImplementation("de.undercouch:gradle-download-task:4.1.1")
compileOnly(project(":kotlin-compiler-runner")) commonImplementation("com.github.gundy:semver4j:0.16.4:nodeps") {
compileOnly(project(":kotlin-annotation-processing"))
compileOnly(project(":kotlin-annotation-processing-gradle"))
compileOnly(project(":kotlin-scripting-compiler"))
compileOnly(project(":kotlin-gradle-statistics"))
embedded(project(":kotlin-gradle-statistics"))
compileOnly(project(":kotlin-gradle-build-metrics"))
embedded(project(":kotlin-gradle-build-metrics"))
implementation(commonDependency("com.google.code.gson:gson"))
implementation(commonDependency("com.google.guava:guava"))
implementation("de.undercouch:gradle-download-task:4.1.1")
implementation("com.github.gundy:semver4j:0.16.4:nodeps") {
exclude(group = "*") exclude(group = "*")
} }
compileOnly("com.android.tools.build:gradle:3.6.4") commonRuntimeOnly(project(":kotlin-compiler-embeddable"))
compileOnly("com.android.tools.build:gradle-api:3.6.4") commonRuntimeOnly(project(":kotlin-annotation-processing-gradle"))
compileOnly("com.android.tools.build:builder:3.6.4") commonRuntimeOnly(project(":kotlin-android-extensions"))
compileOnly("com.android.tools.build:builder-model:3.6.4") commonRuntimeOnly(project(":kotlin-compiler-runner"))
compileOnly("org.codehaus.groovy:groovy-all:2.4.12") commonRuntimeOnly(project(":kotlin-scripting-compiler-embeddable"))
compileOnly(project(":kotlin-reflect")) commonRuntimeOnly(project(":kotlin-scripting-compiler-impl-embeddable"))
compileOnly(intellijCore())
runtimeOnly(project(":kotlin-compiler-embeddable"))
runtimeOnly(project(":kotlin-annotation-processing-gradle"))
runtimeOnly(project(":kotlin-android-extensions"))
runtimeOnly(project(":kotlin-compiler-runner"))
runtimeOnly(project(":kotlin-scripting-compiler-embeddable"))
runtimeOnly(project(":kotlin-scripting-compiler-impl-embeddable"))
compileOnly(commonDependency("org.jetbrains.teamcity:serviceMessages"))
embedded(project(":kotlin-gradle-build-metrics"))
embedded(project(":kotlin-gradle-statistics"))
embedded(commonDependency("org.jetbrains.intellij.deps:asm-all")) { isTransitive = false } embedded(commonDependency("org.jetbrains.intellij.deps:asm-all")) { isTransitive = false }
embedded(commonDependency("com.google.code.gson:gson")) { isTransitive = false } embedded(commonDependency("com.google.code.gson:gson")) { isTransitive = false }
embedded(commonDependency("com.google.guava:guava")) { isTransitive = false } embedded(commonDependency("com.google.guava:guava")) { isTransitive = false }
@@ -94,28 +91,26 @@ dependencies {
"functionalTestImplementation"(testFixtures(project(":kotlin-gradle-plugin-idea"))) "functionalTestImplementation"(testFixtures(project(":kotlin-gradle-plugin-idea")))
} }
testImplementation(commonDependency("org.jetbrains.teamcity:serviceMessages"))
testCompileOnly(project(":compiler")) testCompileOnly(project(":compiler"))
testCompileOnly(project(":kotlin-reflect-api"))
testCompileOnly(project(":kotlin-annotation-processing"))
testCompileOnly(project(":kotlin-annotation-processing-gradle"))
testImplementation(commonDependency("org.jetbrains.teamcity:serviceMessages"))
testImplementation(projectTests(":kotlin-build-common")) testImplementation(projectTests(":kotlin-build-common"))
testImplementation(project(":kotlin-android-extensions")) testImplementation(project(":kotlin-android-extensions"))
testImplementation(project(":kotlin-compiler-runner")) testImplementation(project(":kotlin-compiler-runner"))
testImplementation(project(":kotlin-test:kotlin-test-junit")) testImplementation(project(":kotlin-test:kotlin-test-junit"))
testImplementation(commonDependency("junit:junit")) testImplementation(commonDependency("junit:junit"))
testImplementation(project(":kotlin-gradle-statistics")) testImplementation(project(":kotlin-gradle-statistics"))
testCompileOnly(project(":kotlin-reflect-api"))
testCompileOnly(project(":kotlin-annotation-processing"))
testCompileOnly(project(":kotlin-annotation-processing-gradle"))
compileOnly("com.gradle:gradle-enterprise-gradle-plugin:3.6.3")
} }
if (kotlinBuildProperties.isInJpsBuildIdeaSync) { if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
configurations.api.get().exclude("com.android.tools.external.com-intellij", "intellij-core") configurations.commonApi.get().exclude("com.android.tools.external.com-intellij", "intellij-core")
} }
tasks { tasks {
named<ProcessResources>("processResources") { named<ProcessResources>("processCommonResources") {
val propertiesToExpand = mapOf( val propertiesToExpand = mapOf(
"projectVersion" to project.version, "projectVersion" to project.version,
"kotlinNativeVersion" to project.kotlinNativeVersion "kotlinNativeVersion" to project.kotlinNativeVersion
@@ -1,33 +1,41 @@
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
project.extensions.getByType<KotlinJvmProjectExtension>().target.compilations { val mainSourceSet: SourceSet = sourceSets["main"]
val main by getting val functionalTestSourceSet: SourceSet = sourceSets.create("functionalTest") {
create("functionalTest") { compileClasspath += mainSourceSet.output
associateWith(main) runtimeClasspath += mainSourceSet.output
val functionalTest by tasks.register<Test>("functionalTest") {
group = JavaBasePlugin.VERIFICATION_GROUP
description = "Runs functional tests"
testClassesDirs = output.classesDirs
classpath = sourceSets["functionalTest"].runtimeClasspath
workingDir = projectDir
dependsOnKotlinGradlePluginInstall()
testLogging { configurations.getByName(implementationConfigurationName) {
events("passed", "skipped", "failed") extendsFrom(configurations.getByName(mainSourceSet.implementationConfigurationName))
} extendsFrom(configurations.getByName("testImplementation"))
} }
tasks.named("check") {
dependsOn(functionalTest) configurations.getByName(runtimeOnlyConfigurationName) {
} extendsFrom(configurations.getByName(mainSourceSet.runtimeOnlyConfigurationName))
extendsFrom(configurations.getByName("testRuntimeOnly"))
} }
} }
configurations.getByName("functionalTestImplementation") { project.extensions.getByType<KotlinJvmProjectExtension>().target.compilations {
extendsFrom(configurations.getByName("implementation")) named(functionalTestSourceSet.name) {
extendsFrom(configurations.getByName("testImplementation")) associateWith(this@compilations.getByName("main"))
associateWith(this@compilations.getByName("common"))
}
} }
configurations.getByName("functionalTestRuntimeOnly") { val functionalTest by tasks.register<Test>("functionalTest") {
extendsFrom(configurations.getByName("runtimeOnly")) group = JavaBasePlugin.VERIFICATION_GROUP
extendsFrom(configurations.getByName("testRuntimeOnly")) description = "Runs functional tests"
testClassesDirs = functionalTestSourceSet.output.classesDirs
classpath = functionalTestSourceSet.runtimeClasspath
workingDir = projectDir
dependsOnKotlinGradlePluginInstall()
testLogging {
events("passed", "skipped", "failed")
}
}
tasks.named("check") {
dependsOn(functionalTest)
} }

Some files were not shown because too many files have changed in this diff Show More