[Gradle, JS] Add possibility to not add js compiler attribute on publish

This commit is contained in:
Ilya Goncharov
2023-01-18 16:26:21 +01:00
committed by Space Team
parent 4fa338ccf4
commit f4cda71d9e
2 changed files with 10 additions and 2 deletions
@@ -425,11 +425,13 @@ fun Configuration.usesPlatformOf(target: KotlinTarget): Configuration {
else -> setJavaTargetEnvironmentAttributeIfSupported(target.project, "non-jvm") else -> setJavaTargetEnvironmentAttributeIfSupported(target.project, "non-jvm")
} }
if (target is KotlinJsTarget) { val publishJsCompilerAttribute = PropertiesProvider(target.project).publishJsCompilerAttribute
if (publishJsCompilerAttribute && target is KotlinJsTarget) {
attributes.attribute(KotlinJsCompilerAttribute.jsCompilerAttribute, KotlinJsCompilerAttribute.legacy) attributes.attribute(KotlinJsCompilerAttribute.jsCompilerAttribute, KotlinJsCompilerAttribute.legacy)
} }
if (target is KotlinJsIrTarget && target.platformType == KotlinPlatformType.js) { if (publishJsCompilerAttribute && target is KotlinJsIrTarget && target.platformType == KotlinPlatformType.js) {
attributes.attribute(KotlinJsCompilerAttribute.jsCompilerAttribute, KotlinJsCompilerAttribute.ir) attributes.attribute(KotlinJsCompilerAttribute.jsCompilerAttribute, KotlinJsCompilerAttribute.ir)
} }
@@ -430,6 +430,12 @@ internal class PropertiesProvider private constructor(private val project: Proje
val jsCompiler: KotlinJsCompilerType? val jsCompiler: KotlinJsCompilerType?
get() = this.property(jsCompilerProperty)?.let { KotlinJsCompilerType.byArgumentOrNull(it) } get() = this.property(jsCompilerProperty)?.let { KotlinJsCompilerType.byArgumentOrNull(it) }
/**
* Use Kotlin/JS backend compiler publishing attribute
*/
val publishJsCompilerAttribute: Boolean
get() = this.booleanProperty("$jsCompilerProperty.publish.attribute") ?: true
/** /**
* Use Webpack 4 for compatibility * Use Webpack 4 for compatibility
*/ */