[Gradle, JS] Use target disambiguation classifier for compilation name
This commit is contained in:
+3
@@ -82,6 +82,9 @@ interface KotlinCompilation<out T : KotlinCommonOptions> : Named, HasAttributes,
|
|||||||
get() = super.relatedConfigurationNames + compileDependencyConfigurationName
|
get() = super.relatedConfigurationNames + compileDependencyConfigurationName
|
||||||
|
|
||||||
val moduleName: String
|
val moduleName: String
|
||||||
|
|
||||||
|
val disambiguatedName
|
||||||
|
get() = target.disambiguationClassifier + name
|
||||||
}
|
}
|
||||||
|
|
||||||
interface KotlinCompilationToRunnableFiles<T : KotlinCommonOptions> : KotlinCompilation<T> {
|
interface KotlinCompilationToRunnableFiles<T : KotlinCommonOptions> : KotlinCompilation<T> {
|
||||||
|
|||||||
+1
-1
@@ -27,7 +27,7 @@ internal class DukatCompilationResolverPlugin(
|
|||||||
val npmProject get() = resolver.npmProject
|
val npmProject get() = resolver.npmProject
|
||||||
val compilation get() = npmProject.compilation
|
val compilation get() = npmProject.compilation
|
||||||
val compilationName by lazy {
|
val compilationName by lazy {
|
||||||
compilation.name
|
compilation.disambiguatedName
|
||||||
}
|
}
|
||||||
val legacyTargetReuseIrTask by lazy {
|
val legacyTargetReuseIrTask by lazy {
|
||||||
val target = compilation.target
|
val target = compilation.target
|
||||||
|
|||||||
+2
-2
@@ -23,7 +23,7 @@ abstract class DukatTask(
|
|||||||
|
|
||||||
@get:Internal
|
@get:Internal
|
||||||
val compilationName by lazy {
|
val compilationName by lazy {
|
||||||
compilation.name
|
compilation.disambiguatedName
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@@ -96,7 +96,7 @@ abstract class DukatTask(
|
|||||||
|
|
||||||
@TaskAction
|
@TaskAction
|
||||||
open fun run() {
|
open fun run() {
|
||||||
// nodeJs.npmResolutionManager.checkRequiredDependencies(this)
|
nodeJs.npmResolutionManager.checkRequiredDependencies(this, services, logger, projectPath)
|
||||||
|
|
||||||
destinationDir.deleteRecursively()
|
destinationDir.deleteRecursively()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ class TasksRequirements {
|
|||||||
.filterIsInstance<NpmDependency>()
|
.filterIsInstance<NpmDependency>()
|
||||||
.toMutableSet()
|
.toMutableSet()
|
||||||
|
|
||||||
val compilation = task.compilation.name
|
val compilation = task.compilation.disambiguatedName
|
||||||
if (compilation in byCompilation) {
|
if (compilation in byCompilation) {
|
||||||
byCompilation[compilation]!!.addAll(requiredNpmDependencies.map { it.toDeclaration() })
|
byCompilation[compilation]!!.addAll(requiredNpmDependencies.map { it.toDeclaration() })
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ val KotlinJsCompilation.npmProject: NpmProject
|
|||||||
* More info can be obtained from [KotlinCompilationNpmResolution], which is available after project resolution (after [KotlinNpmInstallTask] execution).
|
* More info can be obtained from [KotlinCompilationNpmResolution], which is available after project resolution (after [KotlinNpmInstallTask] execution).
|
||||||
*/
|
*/
|
||||||
open class NpmProject(@Transient val compilation: KotlinJsCompilation) {
|
open class NpmProject(@Transient val compilation: KotlinJsCompilation) {
|
||||||
val compilationName = compilation.name
|
val compilationName = compilation.disambiguatedName
|
||||||
|
|
||||||
val name: String by lazy {
|
val name: String by lazy {
|
||||||
buildNpmProjectName()
|
buildNpmProjectName()
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ constructor(
|
|||||||
private val npmProject = compilation.npmProject
|
private val npmProject = compilation.npmProject
|
||||||
private val nodeJs = npmProject.nodeJs
|
private val nodeJs = npmProject.nodeJs
|
||||||
|
|
||||||
private val compilationName = compilation.name
|
private val compilationName = compilation.disambiguatedName
|
||||||
private val projectPath = project.path
|
private val projectPath = project.path
|
||||||
|
|
||||||
private val compilationResolution
|
private val compilationResolution
|
||||||
|
|||||||
-1
@@ -15,7 +15,6 @@ class KotlinCompilationNpmResolution(
|
|||||||
@Transient
|
@Transient
|
||||||
private val _project: Project?,
|
private val _project: Project?,
|
||||||
val npmProject: NpmProject,
|
val npmProject: NpmProject,
|
||||||
val internalDependencies: Collection<KotlinCompilationNpmResolution>,
|
|
||||||
val internalCompositeDependencies: Collection<GradleNodeModule>,
|
val internalCompositeDependencies: Collection<GradleNodeModule>,
|
||||||
val externalGradleDependencies: Collection<GradleNodeModule>,
|
val externalGradleDependencies: Collection<GradleNodeModule>,
|
||||||
private val _externalNpmDependencies: Collection<NpmDependencyDeclaration>,
|
private val _externalNpmDependencies: Collection<NpmDependencyDeclaration>,
|
||||||
|
|||||||
+2
-3
@@ -62,7 +62,7 @@ internal class KotlinCompilationNpmResolver(
|
|||||||
|
|
||||||
val npmProject = compilation.npmProject
|
val npmProject = compilation.npmProject
|
||||||
|
|
||||||
val compilationName = compilation.name
|
val compilationDisambiguatedName = compilation.disambiguatedName
|
||||||
|
|
||||||
val npmName by lazy {
|
val npmName by lazy {
|
||||||
npmProject.name
|
npmProject.name
|
||||||
@@ -435,7 +435,7 @@ internal class KotlinCompilationNpmResolver(
|
|||||||
.filterNotNull()
|
.filterNotNull()
|
||||||
|
|
||||||
val toolsNpmDependencies = taskRequirements
|
val toolsNpmDependencies = taskRequirements
|
||||||
.getCompilationNpmRequirements(compilationName)
|
.getCompilationNpmRequirements(compilationDisambiguatedName)
|
||||||
|
|
||||||
val allNpmDependencies = externalNpmDependencyDeclarations + toolsNpmDependencies
|
val allNpmDependencies = externalNpmDependencyDeclarations + toolsNpmDependencies
|
||||||
|
|
||||||
@@ -469,7 +469,6 @@ internal class KotlinCompilationNpmResolver(
|
|||||||
return KotlinCompilationNpmResolution(
|
return KotlinCompilationNpmResolution(
|
||||||
if (compilation != null) project else null,
|
if (compilation != null) project else null,
|
||||||
npmProject,
|
npmProject,
|
||||||
resolvedInternalDependencies,
|
|
||||||
compositeDependencies,
|
compositeDependencies,
|
||||||
importedExternalGradleDependencies,
|
importedExternalGradleDependencies,
|
||||||
allNpmDependencies,
|
allNpmDependencies,
|
||||||
|
|||||||
+2
-2
@@ -37,7 +37,7 @@ internal class KotlinProjectNpmResolver(
|
|||||||
|
|
||||||
operator fun get(compilation: KotlinJsCompilation): KotlinCompilationNpmResolver {
|
operator fun get(compilation: KotlinJsCompilation): KotlinCompilationNpmResolver {
|
||||||
check(compilation.target.project == project)
|
check(compilation.target.project == project)
|
||||||
return byCompilation[compilation.name] ?: error("$compilation was not registered in $this")
|
return byCompilation[compilation.disambiguatedName] ?: error("$compilation was not registered in $this")
|
||||||
}
|
}
|
||||||
|
|
||||||
operator fun get(compilationName: String): KotlinCompilationNpmResolver {
|
operator fun get(compilationName: String): KotlinCompilationNpmResolver {
|
||||||
@@ -110,7 +110,7 @@ internal class KotlinProjectNpmResolver(
|
|||||||
private fun addCompilation(compilation: KotlinJsCompilation) {
|
private fun addCompilation(compilation: KotlinJsCompilation) {
|
||||||
check(!closed) { resolver.alreadyResolvedMessage("add compilation $compilation") }
|
check(!closed) { resolver.alreadyResolvedMessage("add compilation $compilation") }
|
||||||
|
|
||||||
byCompilation[compilation.name] = KotlinCompilationNpmResolver(this, compilation)
|
byCompilation[compilation.disambiguatedName] = KotlinCompilationNpmResolver(this, compilation)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun close(): KotlinProjectNpmResolution {
|
fun close(): KotlinProjectNpmResolution {
|
||||||
|
|||||||
+4
-4
@@ -33,15 +33,15 @@ open class KotlinPackageJsonTask : DefaultTask() {
|
|||||||
@Transient
|
@Transient
|
||||||
private lateinit var compilation: KotlinJsCompilation
|
private lateinit var compilation: KotlinJsCompilation
|
||||||
|
|
||||||
private val compilationName by lazy {
|
private val compilationDisambiguatedName by lazy {
|
||||||
compilation.name
|
compilation.disambiguatedName
|
||||||
}
|
}
|
||||||
|
|
||||||
@Input
|
@Input
|
||||||
val projectPath = project.path
|
val projectPath = project.path
|
||||||
|
|
||||||
private val compilationResolver
|
private val compilationResolver
|
||||||
get() = nodeJs.npmResolutionManager.resolver[projectPath][compilationName]
|
get() = nodeJs.npmResolutionManager.resolver[projectPath][compilationDisambiguatedName]
|
||||||
|
|
||||||
private val producer: KotlinCompilationNpmResolver.PackageJsonProducer
|
private val producer: KotlinCompilationNpmResolver.PackageJsonProducer
|
||||||
get() = compilationResolver.packageJsonProducer
|
get() = compilationResolver.packageJsonProducer
|
||||||
@@ -64,7 +64,7 @@ open class KotlinPackageJsonTask : DefaultTask() {
|
|||||||
@get:Input
|
@get:Input
|
||||||
internal val toolsNpmDependencies: List<String> by lazy {
|
internal val toolsNpmDependencies: List<String> by lazy {
|
||||||
nodeJs.taskRequirements
|
nodeJs.taskRequirements
|
||||||
.getCompilationNpmRequirements(compilationName)
|
.getCompilationNpmRequirements(compilationDisambiguatedName)
|
||||||
.map { it.toString() }
|
.map { it.toString() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user