[Gradle] Add support of configuration cache for CInteropProcess
This commit is contained in:
+1
-1
@@ -38,7 +38,7 @@ internal open class CInteropCommonizerTask
|
|||||||
internal data class CInteropGist(
|
internal data class CInteropGist(
|
||||||
@get:Input val identifier: CInteropIdentifier,
|
@get:Input val identifier: CInteropIdentifier,
|
||||||
@get:Input val konanTarget: KonanTarget,
|
@get:Input val konanTarget: KonanTarget,
|
||||||
@get:Internal val sourceSets: Provider<Set<KotlinSourceSet>>,
|
@Transient @get:Internal val sourceSets: Provider<Set<KotlinSourceSet>>,
|
||||||
|
|
||||||
@get:Classpath
|
@get:Classpath
|
||||||
val libraryFile: Provider<File>
|
val libraryFile: Provider<File>
|
||||||
|
|||||||
+39
-36
@@ -1122,7 +1122,9 @@ internal class CacheBuilder(
|
|||||||
@CacheableTask
|
@CacheableTask
|
||||||
open class CInteropProcess
|
open class CInteropProcess
|
||||||
@Inject constructor(
|
@Inject constructor(
|
||||||
@get:Internal val settings: DefaultCInteropSettings,
|
@Transient
|
||||||
|
@Internal
|
||||||
|
val settings: DefaultCInteropSettings,
|
||||||
private val objectFactory: ObjectFactory,
|
private val objectFactory: ObjectFactory,
|
||||||
private val execOperations: ExecOperations
|
private val execOperations: ExecOperations
|
||||||
) : DefaultTask() {
|
) : DefaultTask() {
|
||||||
@@ -1130,27 +1132,30 @@ open class CInteropProcess
|
|||||||
@Internal // Taken into account in the outputFileProvider property
|
@Internal // Taken into account in the outputFileProvider property
|
||||||
lateinit var destinationDir: Provider<File>
|
lateinit var destinationDir: Provider<File>
|
||||||
|
|
||||||
val konanTarget: KonanTarget
|
@get:Input
|
||||||
@Input get() = settings.compilation.konanTarget
|
val konanTarget: KonanTarget = settings.compilation.konanTarget
|
||||||
|
|
||||||
val interopName: String
|
@get:Input
|
||||||
@Input get() = settings.name
|
val konanVersion: CompilerVersion = project.konanVersion
|
||||||
|
|
||||||
val baseKlibName: String
|
@get:Input
|
||||||
@Input get() {
|
val interopName: String = settings.name
|
||||||
val compilationPrefix = settings.compilation.let {
|
|
||||||
if (it.isMainCompilationData()) project.name else it.compilationPurpose
|
@get:Input
|
||||||
}
|
val baseKlibName: String = run {
|
||||||
return "$compilationPrefix-cinterop-$interopName"
|
val compilationPrefix = settings.compilation.let {
|
||||||
|
if (it.isMainCompilationData()) project.name else it.compilationPurpose
|
||||||
}
|
}
|
||||||
|
"$compilationPrefix-cinterop-$interopName"
|
||||||
|
}
|
||||||
|
|
||||||
val outputFileName: String
|
@get:Internal
|
||||||
@Internal get() = with(CompilerOutputKind.LIBRARY) {
|
val outputFileName: String = with(CompilerOutputKind.LIBRARY) {
|
||||||
"$baseKlibName${suffix(konanTarget)}"
|
"$baseKlibName${suffix(konanTarget)}"
|
||||||
}
|
}
|
||||||
|
|
||||||
val moduleName: String
|
@get:Input
|
||||||
@Input get() = project.klibModuleName(baseKlibName)
|
val moduleName: String = project.klibModuleName(baseKlibName)
|
||||||
|
|
||||||
@get:Internal
|
@get:Internal
|
||||||
val outputFile: File
|
val outputFile: File
|
||||||
@@ -1166,38 +1171,36 @@ open class CInteropProcess
|
|||||||
|
|
||||||
@get:InputFile
|
@get:InputFile
|
||||||
@get:PathSensitive(PathSensitivity.RELATIVE)
|
@get:PathSensitive(PathSensitivity.RELATIVE)
|
||||||
val defFile: File
|
val defFile: File = settings.defFileProperty.get()
|
||||||
get() = settings.defFileProperty.get()
|
|
||||||
|
|
||||||
val packageName: String?
|
@get:Optional
|
||||||
@Optional @Input get() = settings.packageName
|
@get:Input
|
||||||
|
val packageName: String? = settings.packageName
|
||||||
|
|
||||||
val compilerOpts: List<String>
|
@get:Input
|
||||||
@Input get() = settings.compilerOpts
|
val compilerOpts: List<String> = settings.compilerOpts
|
||||||
|
|
||||||
val linkerOpts: List<String>
|
@get:Input
|
||||||
@Input get() = settings.linkerOpts
|
val linkerOpts: List<String> = settings.linkerOpts
|
||||||
|
|
||||||
@get:IgnoreEmptyDirectories
|
@get:IgnoreEmptyDirectories
|
||||||
@get:InputFiles
|
@get:InputFiles
|
||||||
@get:PathSensitive(PathSensitivity.RELATIVE)
|
@get:PathSensitive(PathSensitivity.RELATIVE)
|
||||||
val headers: FileCollection
|
val headers: FileCollection = settings.headers
|
||||||
get() = settings.headers
|
|
||||||
|
|
||||||
val allHeadersDirs: Set<File>
|
@get:Input
|
||||||
@Input get() = settings.includeDirs.allHeadersDirs.files
|
val allHeadersDirs: Set<File> = settings.includeDirs.allHeadersDirs.files
|
||||||
|
|
||||||
val headerFilterDirs: Set<File>
|
@get:Input
|
||||||
@Input get() = settings.includeDirs.headerFilterDirs.files
|
val headerFilterDirs: Set<File> = settings.includeDirs.headerFilterDirs.files
|
||||||
|
|
||||||
@get:IgnoreEmptyDirectories
|
@get:IgnoreEmptyDirectories
|
||||||
@get:InputFiles
|
@get:InputFiles
|
||||||
@get:PathSensitive(PathSensitivity.RELATIVE)
|
@get:PathSensitive(PathSensitivity.RELATIVE)
|
||||||
val libraries: FileCollection
|
val libraries: FileCollection = settings.dependencyFiles.filterOutPublishableInteropLibs(project)
|
||||||
get() = settings.dependencyFiles.filterOutPublishableInteropLibs(project)
|
|
||||||
|
|
||||||
val extraOpts: List<String>
|
@get:Input
|
||||||
@Input get() = settings.extraOpts
|
val extraOpts: List<String> = settings.extraOpts
|
||||||
|
|
||||||
private val isInIdeaSync = project.isInIdeaSync
|
private val isInIdeaSync = project.isInIdeaSync
|
||||||
|
|
||||||
@@ -1228,7 +1231,7 @@ open class CInteropProcess
|
|||||||
addArgs("-compiler-option", allHeadersDirs.map { "-I${it.absolutePath}" })
|
addArgs("-compiler-option", allHeadersDirs.map { "-I${it.absolutePath}" })
|
||||||
addArgs("-headerFilterAdditionalSearchPrefix", headerFilterDirs.map { it.absolutePath })
|
addArgs("-headerFilterAdditionalSearchPrefix", headerFilterDirs.map { it.absolutePath })
|
||||||
|
|
||||||
if (project.konanVersion.isAtLeast(1, 4, 0)) {
|
if (konanVersion.isAtLeast(1, 4, 0)) {
|
||||||
addArg("-Xmodule-name", moduleName)
|
addArg("-Xmodule-name", moduleName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user