[Gradle, JS] Correct renaming
This commit is contained in:
+2
-2
@@ -38,7 +38,7 @@ import org.jetbrains.kotlin.gradle.model.builder.KotlinModelBuilder
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.*
|
import org.jetbrains.kotlin.gradle.plugin.mpp.*
|
||||||
import org.jetbrains.kotlin.gradle.scripting.internal.ScriptingGradleSubplugin
|
import org.jetbrains.kotlin.gradle.scripting.internal.ScriptingGradleSubplugin
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryType
|
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryType
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.ir.JsBinary
|
import org.jetbrains.kotlin.gradle.targets.js.ir.JsIrBinary
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrCompilation
|
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrCompilation
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrLink
|
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrLink
|
||||||
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
|
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
|
||||||
@@ -354,7 +354,7 @@ internal class KotlinJsIrSourceSetProcessor(
|
|||||||
val compilation = kotlinCompilation as KotlinJsIrCompilation
|
val compilation = kotlinCompilation as KotlinJsIrCompilation
|
||||||
|
|
||||||
compilation.binaries
|
compilation.binaries
|
||||||
.withType(JsBinary::class.java)
|
.withType(JsIrBinary::class.java)
|
||||||
.all { binary ->
|
.all { binary ->
|
||||||
registerKotlinCompileTask(
|
registerKotlinCompileTask(
|
||||||
binary.linkTaskName
|
binary.linkTaskName
|
||||||
|
|||||||
+2
-2
@@ -14,7 +14,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilationWithResources
|
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilationWithResources
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
|
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsTarget
|
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsTarget
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.ir.JsBinary
|
import org.jetbrains.kotlin.gradle.targets.js.ir.JsIrBinary
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsBinaryContainer
|
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsBinaryContainer
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.npm.PackageJson
|
import org.jetbrains.kotlin.gradle.targets.js.npm.PackageJson
|
||||||
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
|
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
|
||||||
@@ -28,7 +28,7 @@ open class KotlinJsCompilation(
|
|||||||
target.project.objects.newInstance(
|
target.project.objects.newInstance(
|
||||||
KotlinJsBinaryContainer::class.java,
|
KotlinJsBinaryContainer::class.java,
|
||||||
target,
|
target,
|
||||||
WrapUtil.toDomainObjectSet(JsBinary::class.java)
|
WrapUtil.toDomainObjectSet(JsIrBinary::class.java)
|
||||||
)
|
)
|
||||||
|
|
||||||
override val processResourcesTaskName: String
|
override val processResourcesTaskName: String
|
||||||
|
|||||||
+4
-4
@@ -13,17 +13,17 @@ import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryType
|
|||||||
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsBinaryContainer.Companion.generateBinaryName
|
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsBinaryContainer.Companion.generateBinaryName
|
||||||
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
||||||
|
|
||||||
interface JsBinary2 {
|
interface JsBinary {
|
||||||
val compilation: KotlinJsCompilation
|
val compilation: KotlinJsCompilation
|
||||||
val name: String
|
val name: String
|
||||||
val type: KotlinJsBinaryType
|
val type: KotlinJsBinaryType
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class JsBinary(
|
sealed class JsIrBinary(
|
||||||
override val compilation: KotlinJsCompilation,
|
override val compilation: KotlinJsCompilation,
|
||||||
override val name: String,
|
override val name: String,
|
||||||
override val type: KotlinJsBinaryType
|
override val type: KotlinJsBinaryType
|
||||||
) : JsBinary2 {
|
) : JsBinary {
|
||||||
val linkTaskName: String = linkTaskName()
|
val linkTaskName: String = linkTaskName()
|
||||||
|
|
||||||
val linkTask: TaskProvider<KotlinJsIrLink>
|
val linkTask: TaskProvider<KotlinJsIrLink>
|
||||||
@@ -50,7 +50,7 @@ class Executable(
|
|||||||
compilation: KotlinJsCompilation,
|
compilation: KotlinJsCompilation,
|
||||||
name: String,
|
name: String,
|
||||||
type: KotlinJsBinaryType
|
type: KotlinJsBinaryType
|
||||||
) : JsBinary(
|
) : JsIrBinary(
|
||||||
compilation,
|
compilation,
|
||||||
name,
|
name,
|
||||||
type
|
type
|
||||||
|
|||||||
+9
-9
@@ -24,8 +24,8 @@ open class KotlinJsBinaryContainer
|
|||||||
@Inject
|
@Inject
|
||||||
constructor(
|
constructor(
|
||||||
val target: KotlinTargetWithBinaries<KotlinJsCompilation, KotlinJsBinaryContainer>,
|
val target: KotlinTargetWithBinaries<KotlinJsCompilation, KotlinJsBinaryContainer>,
|
||||||
backingContainer: DomainObjectSet<JsBinary2>
|
backingContainer: DomainObjectSet<JsBinary>
|
||||||
) : DomainObjectSet<JsBinary2> by backingContainer {
|
) : DomainObjectSet<JsBinary> by backingContainer {
|
||||||
val project: Project
|
val project: Project
|
||||||
get() = target.project
|
get() = target.project
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ constructor(
|
|||||||
(this as KotlinJsIrSubTarget).produceExecutable()
|
(this as KotlinJsIrSubTarget).produceExecutable()
|
||||||
}
|
}
|
||||||
|
|
||||||
compilation.binaries.executableInternal(compilation)
|
compilation.binaries.executableIrInternal(compilation)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target is KotlinJsTarget) {
|
if (target is KotlinJsTarget) {
|
||||||
@@ -65,7 +65,7 @@ constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun executableInternal(compilation: KotlinJsCompilation) = createBinaries(
|
internal fun executableIrInternal(compilation: KotlinJsCompilation) = createBinaries(
|
||||||
compilation = compilation,
|
compilation = compilation,
|
||||||
jsBinaryType = JsBinaryType.EXECUTABLE,
|
jsBinaryType = JsBinaryType.EXECUTABLE,
|
||||||
create = ::Executable
|
create = ::Executable
|
||||||
@@ -75,7 +75,7 @@ constructor(
|
|||||||
compilation = compilation,
|
compilation = compilation,
|
||||||
jsBinaryType = JsBinaryType.EXECUTABLE,
|
jsBinaryType = JsBinaryType.EXECUTABLE,
|
||||||
create = { compilation, name, type ->
|
create = { compilation, name, type ->
|
||||||
object : JsBinary2 {
|
object : JsBinary {
|
||||||
override val compilation: KotlinJsCompilation = compilation
|
override val compilation: KotlinJsCompilation = compilation
|
||||||
override val name: String = name
|
override val name: String = name
|
||||||
override val type: KotlinJsBinaryType = type
|
override val type: KotlinJsBinaryType = type
|
||||||
@@ -83,14 +83,14 @@ constructor(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
internal fun getBinary(
|
internal fun getIrBinary(
|
||||||
type: KotlinJsBinaryType
|
type: KotlinJsBinaryType
|
||||||
): JsBinary =
|
): JsIrBinary =
|
||||||
matching { it.type == type }
|
matching { it.type == type }
|
||||||
.withType(JsBinary::class.java)
|
.withType(JsIrBinary::class.java)
|
||||||
.single()
|
.single()
|
||||||
|
|
||||||
private fun <T : JsBinary2> createBinaries(
|
private fun <T : JsBinary> createBinaries(
|
||||||
compilation: KotlinJsCompilation,
|
compilation: KotlinJsCompilation,
|
||||||
types: Collection<KotlinJsBinaryType> = listOf(PRODUCTION, DEVELOPMENT),
|
types: Collection<KotlinJsBinaryType> = listOf(PRODUCTION, DEVELOPMENT),
|
||||||
jsBinaryType: JsBinaryType,
|
jsBinaryType: JsBinaryType,
|
||||||
|
|||||||
+3
-3
@@ -44,7 +44,7 @@ abstract class KotlinJsIrSubTarget(
|
|||||||
target.compilations.all {
|
target.compilations.all {
|
||||||
val npmProject = it.npmProject
|
val npmProject = it.npmProject
|
||||||
it.binaries
|
it.binaries
|
||||||
.withType(JsBinary::class.java)
|
.withType(JsIrBinary::class.java)
|
||||||
.all { binary ->
|
.all { binary ->
|
||||||
binary.linkTask.configure {
|
binary.linkTask.configure {
|
||||||
it.kotlinOptions.outputFile = npmProject.dir.resolve(npmProject.main).canonicalPath
|
it.kotlinOptions.outputFile = npmProject.dir.resolve(npmProject.main).canonicalPath
|
||||||
@@ -75,7 +75,7 @@ abstract class KotlinJsIrSubTarget(
|
|||||||
|
|
||||||
protected open fun configureTestRunDefaults(testRun: KotlinJsPlatformTestRun) {
|
protected open fun configureTestRunDefaults(testRun: KotlinJsPlatformTestRun) {
|
||||||
target.compilations.matching { it.name == KotlinCompilation.TEST_COMPILATION_NAME }.all { compilation ->
|
target.compilations.matching { it.name == KotlinCompilation.TEST_COMPILATION_NAME }.all { compilation ->
|
||||||
compilation.binaries.executableInternal(compilation)
|
compilation.binaries.executableIrInternal(compilation)
|
||||||
configureTestsRun(testRun, compilation)
|
configureTestsRun(testRun, compilation)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ abstract class KotlinJsIrSubTarget(
|
|||||||
testJs.group = LifecycleBasePlugin.VERIFICATION_GROUP
|
testJs.group = LifecycleBasePlugin.VERIFICATION_GROUP
|
||||||
testJs.description = testTaskDescription
|
testJs.description = testTaskDescription
|
||||||
|
|
||||||
val testExecutableTask = compilation.binaries.getBinary(
|
val testExecutableTask = compilation.binaries.getIrBinary(
|
||||||
KotlinJsBinaryType.DEVELOPMENT
|
KotlinJsBinaryType.DEVELOPMENT
|
||||||
).linkTask
|
).linkTask
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -118,7 +118,7 @@ constructor(
|
|||||||
it.compileKotlinTask.configureCommonJsOptions()
|
it.compileKotlinTask.configureCommonJsOptions()
|
||||||
|
|
||||||
binaries
|
binaries
|
||||||
.filterIsInstance<JsBinary>()
|
.filterIsInstance<JsIrBinary>()
|
||||||
.forEach {
|
.forEach {
|
||||||
it.linkTask.configure { linkTask ->
|
it.linkTask.configure { linkTask ->
|
||||||
linkTask.configureCommonJsOptions()
|
linkTask.configureCommonJsOptions()
|
||||||
|
|||||||
+1
-1
@@ -74,7 +74,7 @@ open class KotlinJsIrTargetConfigurator(kotlinPluginVersion: String) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
it.binaries
|
it.binaries
|
||||||
.filterIsInstance<JsBinary>()
|
.filterIsInstance<JsIrBinary>()
|
||||||
.forEach {
|
.forEach {
|
||||||
it.linkTask.configure { linkTask ->
|
it.linkTask.configure { linkTask ->
|
||||||
linkTask.kotlinOptions.configureOptions()
|
linkTask.kotlinOptions.configureOptions()
|
||||||
|
|||||||
+2
-2
@@ -31,7 +31,7 @@ open class KotlinNodeJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
|||||||
override fun configureRun(
|
override fun configureRun(
|
||||||
compilation: KotlinJsIrCompilation
|
compilation: KotlinJsIrCompilation
|
||||||
) {
|
) {
|
||||||
val developmentExecutable = compilation.binaries.getBinary(KotlinJsBinaryType.DEVELOPMENT)
|
val developmentExecutable = compilation.binaries.getIrBinary(KotlinJsBinaryType.DEVELOPMENT)
|
||||||
|
|
||||||
val runTaskHolder = NodeJsExec.create(compilation, disambiguateCamelCased(RUN_TASK_NAME)) {
|
val runTaskHolder = NodeJsExec.create(compilation, disambiguateCamelCased(RUN_TASK_NAME)) {
|
||||||
inputFileProperty.set(developmentExecutable.linkTask.map { it.outputFileProperty.get() })
|
inputFileProperty.set(developmentExecutable.linkTask.map { it.outputFileProperty.get() })
|
||||||
@@ -42,7 +42,7 @@ open class KotlinNodeJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
|||||||
override fun configureBuild(
|
override fun configureBuild(
|
||||||
compilation: KotlinJsIrCompilation
|
compilation: KotlinJsIrCompilation
|
||||||
) {
|
) {
|
||||||
val productionExecutable = compilation.binaries.getBinary(KotlinJsBinaryType.PRODUCTION)
|
val productionExecutable = compilation.binaries.getIrBinary(KotlinJsBinaryType.PRODUCTION)
|
||||||
|
|
||||||
val assembleTask = project.tasks.getByName(LifecycleBasePlugin.ASSEMBLE_TASK_NAME)
|
val assembleTask = project.tasks.getByName(LifecycleBasePlugin.ASSEMBLE_TASK_NAME)
|
||||||
assembleTask.dependsOn(productionExecutable.linkTask)
|
assembleTask.dependsOn(productionExecutable.linkTask)
|
||||||
|
|||||||
Reference in New Issue
Block a user