[Gradle, JS] dependsOn for test tasks
This commit is contained in:
+5
-1
@@ -157,7 +157,11 @@ internal abstract class KotlinSourceSetProcessor<T : AbstractKotlinCompile<*>>(
|
|||||||
protected fun applyStandardTaskConfiguration(taskConfiguration: AbstractKotlinCompileConfig<*>) {
|
protected fun applyStandardTaskConfiguration(taskConfiguration: AbstractKotlinCompileConfig<*>) {
|
||||||
taskConfiguration.configureTask {
|
taskConfiguration.configureTask {
|
||||||
it.description = taskDescription
|
it.description = taskDescription
|
||||||
it.destinationDirectory.convention(defaultKotlinDestinationDir)
|
if (it is Kotlin2JsCompile) {
|
||||||
|
it.defaultDestinationDirectory.convention(defaultKotlinDestinationDir)
|
||||||
|
} else {
|
||||||
|
it.destinationDirectory.convention(defaultKotlinDestinationDir)
|
||||||
|
}
|
||||||
it.libraries.from({ kotlinCompilation.compileDependencyFiles })
|
it.libraries.from({ kotlinCompilation.compileDependencyFiles })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-10
@@ -121,17 +121,15 @@ abstract class KotlinJsIrSubTarget(
|
|||||||
KotlinJsBinaryMode.DEVELOPMENT
|
KotlinJsBinaryMode.DEVELOPMENT
|
||||||
).single()
|
).single()
|
||||||
|
|
||||||
testJs.inputFileProperty.set(
|
testJs.dependsOn(binary.linkSyncTask)
|
||||||
project.layout.file(
|
testJs.inputFileProperty.fileProvider(
|
||||||
binary.linkSyncTask.flatMap { copyTask ->
|
binary.linkSyncTask.flatMap { linkSyncTask ->
|
||||||
binary.linkTask
|
binary.linkTask.flatMap { linkTask ->
|
||||||
.flatMap { linkTask -> linkTask.compilerOptions.moduleName }
|
linkTask.outputFileProperty.map {
|
||||||
.map { outputName ->
|
linkSyncTask.destinationDir.resolve(it.name)
|
||||||
copyTask.destinationDir
|
}
|
||||||
.resolve(outputName + compilation.platformType.fileExtension)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
)
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
configureTestDependencies(testJs)
|
configureTestDependencies(testJs)
|
||||||
|
|||||||
+4
@@ -977,6 +977,10 @@ abstract class Kotlin2JsCompile @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Workaround to be able to use default value and change it later based on external input
|
||||||
|
@get:Internal
|
||||||
|
internal abstract val defaultDestinationDirectory: DirectoryProperty
|
||||||
|
|
||||||
@Deprecated("Use destinationDirectory and moduleName instead")
|
@Deprecated("Use destinationDirectory and moduleName instead")
|
||||||
@get:Internal
|
@get:Internal
|
||||||
abstract val outputFileProperty: Property<File>
|
abstract val outputFileProperty: Property<File>
|
||||||
|
|||||||
+18
@@ -50,6 +50,24 @@ internal open class BaseKotlin2JsCompileConfig<TASK : Kotlin2JsCompile>(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
task.destinationDirectory
|
||||||
|
.convention(
|
||||||
|
project.objects.directoryProperty().fileProvider(
|
||||||
|
task.defaultDestinationDirectory.map {
|
||||||
|
val freeArgs = task.enhancedFreeCompilerArgs.get()
|
||||||
|
if (task.compilerOptions.outputFile.orNull != null) {
|
||||||
|
if (freeArgs.contains(PRODUCE_UNZIPPED_KLIB)) {
|
||||||
|
File(task.compilerOptions.outputFile.get())
|
||||||
|
} else {
|
||||||
|
File(task.compilerOptions.outputFile.get()).parentFile
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
it.asFile
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
task.libraryCache.set(libraryCacheService).also { task.libraryCache.disallowChanges() }
|
task.libraryCache.set(libraryCacheService).also { task.libraryCache.disallowChanges() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user