From 5347fc235bac073f94c8e64d24ed2d1b4fd8b4f4 Mon Sep 17 00:00:00 2001 From: Anton Lakotka Date: Thu, 8 Dec 2022 11:29:31 +0100 Subject: [PATCH] [Gradle, Test] GranularMetadataTransformation should be accessible in JS Pure JS projects should still be able to import even thus calling `getDependenciesTransformation` should not throw any runtime exceptions and results should be empty. Since JS projects doesn't support metadata dependencies transformations. ^KT-55347 In Progress --- .../kotlin/gradle/KT55347JsProjectImport.kt | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/KT55347JsProjectImport.kt diff --git a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/KT55347JsProjectImport.kt b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/KT55347JsProjectImport.kt new file mode 100644 index 00000000000..bbde0493ac7 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/KT55347JsProjectImport.kt @@ -0,0 +1,40 @@ +/* + * Copyright 2010-2022 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. + */ + +package org.jetbrains.kotlin.gradle + +import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension +import org.jetbrains.kotlin.gradle.dsl.kotlinExtension +import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType +import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType.* +import org.jetbrains.kotlin.gradle.plugin.sources.DefaultKotlinSourceSet +import org.junit.Test +import kotlin.test.assertTrue + +class KT55347JsProjectImport { + private fun `GranularMetadataTransformation should be accessible in pure js projects`(jsCompiler: KotlinJsCompilerType) { + val project = buildProject { plugins.apply("org.jetbrains.kotlin.js") } + val kotlin = project.kotlinExtension as KotlinJsProjectExtension + with (kotlin) { + js(jsCompiler) { + nodejs() + } + } + + project.evaluate() + + kotlin.sourceSets + .filterIsInstance() + .forEach { assertTrue(it.getDependenciesTransformation().toList().isEmpty()) } + } + + @Test + fun `GranularMetadataTransformation should be accessible in pure js projects -- IR`() = + `GranularMetadataTransformation should be accessible in pure js projects`(IR) + + @Test + fun `GranularMetadataTransformation should be accessible in pure js projects -- BOTH`() = + `GranularMetadataTransformation should be accessible in pure js projects`(BOTH) +} \ No newline at end of file