[Gradle, JS] Rename NPM aggregated configuration
^KT-59116 fixed
This commit is contained in:
committed by
Space Team
parent
7aea0af307
commit
96a4821df6
+10
@@ -650,6 +650,16 @@ class Kotlin2JsIrGradlePluginIT : AbstractKotlin2JsGradlePluginIT(true) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("Custom plugin applying Kotlin/JS plugin")
|
||||
@GradleTest
|
||||
fun customPluginApplyingKotlinJsPlugin(gradleVersion: GradleVersion) {
|
||||
project("js-custom-build-src-plugin", gradleVersion) {
|
||||
build("checkConfigurationsResolve") {
|
||||
assertTasksExecuted(":checkConfigurationsResolve")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JsGradlePluginTests
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
plugins {
|
||||
id("my-plugin")
|
||||
}
|
||||
|
||||
group = "me.user"
|
||||
version = "1.0-SNAPSHOT"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(npm("async", "3.2.4"))
|
||||
}
|
||||
|
||||
kotlin {
|
||||
js {
|
||||
tasks.register("checkConfigurationsResolve") {
|
||||
doLast {
|
||||
configurations.named(compilations["main"].npmAggregatedConfigurationName).resolve()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
plugins {
|
||||
`java-gradle-plugin`
|
||||
`kotlin-dsl`
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
val kotlinVersion = project.property("kotlin_version")
|
||||
|
||||
dependencies {
|
||||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
plugins {
|
||||
create("myPlugins") {
|
||||
id = "my-plugin"
|
||||
implementationClass = "MyPlugin"
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
|
||||
|
||||
open class MyPlugin : Plugin<Project> {
|
||||
override fun apply(target: Project) {
|
||||
target.plugins.apply("org.jetbrains.kotlin.js")
|
||||
|
||||
target.configure<KotlinJsProjectExtension> {
|
||||
js(IR) { browser { } }
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
fun main() {
|
||||
println("Hello, ${greet()}")
|
||||
}
|
||||
|
||||
fun greet() = "world"
|
||||
+3
-3
@@ -54,8 +54,8 @@ open class KotlinJsCompilation @Inject internal constructor(
|
||||
override val processResourcesTaskName: String
|
||||
get() = disambiguateName("processResources")
|
||||
|
||||
val npmConfigurationName
|
||||
get() = compilation.disambiguateName("npm")
|
||||
val npmAggregatedConfigurationName
|
||||
get() = compilation.disambiguateName("npmAggregated")
|
||||
|
||||
val publicPackageJsonConfigurationName
|
||||
get() = compilation.disambiguateName("publicPackageJsonConfiguration")
|
||||
@@ -63,7 +63,7 @@ open class KotlinJsCompilation @Inject internal constructor(
|
||||
@Deprecated("Scheduled for removal with Kotlin 2.0")
|
||||
@Suppress("DEPRECATION")
|
||||
override val relatedConfigurationNames: List<String>
|
||||
get() = super.relatedConfigurationNames + npmConfigurationName + publicPackageJsonConfigurationName
|
||||
get() = super.relatedConfigurationNames + npmAggregatedConfigurationName + publicPackageJsonConfigurationName
|
||||
|
||||
override fun getAttributes(): AttributeContainer {
|
||||
return compilation.attributes
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ class KotlinCompilationNpmResolver(
|
||||
}
|
||||
|
||||
private fun createAggregatedConfiguration(): Configuration {
|
||||
val all = project.configurations.create(compilation.npmConfigurationName)
|
||||
val all = project.configurations.create(compilation.npmAggregatedConfigurationName)
|
||||
|
||||
all.usesPlatformOf(target)
|
||||
all.attributes.attribute(Usage.USAGE_ATTRIBUTE, KotlinUsages.consumerRuntimeUsage(target))
|
||||
|
||||
Reference in New Issue
Block a user