[K/N][build] Add artifacts depending on input in library task

Depending on noPack option compiler produces file or directory.
Artifact field that contains .klib file can't use @OutputDirectory
annotation. The same applies for @OutputFile with directory.
To workaround make an artifact field internal and use two optional
fields that return either file or directory depending on noPack option.
This commit is contained in:
Pavel Punegov
2021-11-18 16:05:20 +03:00
committed by Space
parent e3ac2b661a
commit c5a02902a7
2 changed files with 12 additions and 1 deletions
-1
View File
@@ -439,7 +439,6 @@ konanArtifacts {
stdlibBuildTask = project.findKonanBuildTask("stdlib", project.platformManager.hostPlatform.target).apply {
configure {
dependsOn(":kotlin-native:distCompiler")
outputs.dir(project.buildDir.resolve("stdlib/$hostName/stdlib"))
}
}
}
@@ -391,6 +391,18 @@ open class KonanCompileFrameworkTask: KonanCompileNativeBinary() {
}
open class KonanCompileLibraryTask: KonanCompileTask() {
override val artifact: File
@Internal get() = destinationDir.resolve(artifactFullName)
val artifactFile: File?
@Optional @OutputFile get() = if (!noPack) artifact else null
val artifactDirectory: File?
@Optional @OutputDirectory get() = if (noPack) artifact else null
override val artifactSuffix: String
@Internal get() = if (!noPack) produce.suffix(konanTarget) else ""
override fun buildCommonArgs() = super.buildCommonArgs().apply {
addKey("-nopack", noPack)
}