From 2137d26ce83c01f0d294b87886b4f98a52b451e7 Mon Sep 17 00:00:00 2001 From: Anton Lakotka Date: Thu, 20 Apr 2023 13:44:10 +0200 Subject: [PATCH] [Gradle] Test that extra jvm compilation can be created with java enabled ^KT-41506 Verification Pending --- .../KT41506WithJavaSourceSet.kt | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/regressionTests/KT41506WithJavaSourceSet.kt diff --git a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/regressionTests/KT41506WithJavaSourceSet.kt b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/regressionTests/KT41506WithJavaSourceSet.kt new file mode 100644 index 00000000000..978b67d5fb1 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/regressionTests/KT41506WithJavaSourceSet.kt @@ -0,0 +1,45 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +@file:Suppress("FunctionName") + +package org.jetbrains.kotlin.gradle.regressionTests + +import org.jetbrains.kotlin.gradle.dsl.multiplatformExtension +import org.jetbrains.kotlin.gradle.plugin.mpp.javaSourceSets +import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget +import org.jetbrains.kotlin.gradle.util.buildProjectWithMPP +import org.jetbrains.kotlin.gradle.util.kotlin +import kotlin.test.Test +import kotlin.test.fail + +class KT41506WithJavaSourceSet { + @Test + fun `test that arbitrary compilation can be created with java enabled in Multiplatform project`() { + val project = buildProjectWithMPP { + kotlin { + jvm { + compilations.create("integrationTest") + withJava() + //compilations.create("integrationTest") + } + } + } + project.evaluate() + + val jvmTarget = project.multiplatformExtension.targets.getByName("jvm") as KotlinJvmTarget + if ("integrationTest" !in jvmTarget.compilations.names) { + fail("Expected jvm compilation 'integrationTest' is not found") + } + + if ("jvmIntegrationTest" !in project.multiplatformExtension.sourceSets.names) { + fail("Expected kotlin source set 'jvmIntegrationTest' id not found") + } + + if ("integrationTest" !in project.javaSourceSets.names) { + fail("Expected java source set 'integrationTest' id not found") + } + } +} \ No newline at end of file