[KT-53191] Fix header dirs inputs for CInteropProcess task.
This commit is contained in:
committed by
Space
parent
903a5d69a4
commit
5ca9d3d706
+38
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.gradle.native
|
||||
|
||||
import org.gradle.util.GradleVersion
|
||||
import org.jetbrains.kotlin.gradle.testbase.*
|
||||
|
||||
@MppGradlePluginTests
|
||||
class CinteropIT : KGPBaseTest() {
|
||||
|
||||
@GradleTest
|
||||
fun `rerun cinterop after a header changing`(gradleVersion: GradleVersion) {
|
||||
nativeProject("cinterop-kt-53191", gradleVersion = gradleVersion) {
|
||||
val headerFile = projectPath.resolve("native_lib/nlib.h").toFile()
|
||||
|
||||
build(":compileKotlinLinux") {
|
||||
assertTasksExecuted(":cinteropNlibLinux")
|
||||
}
|
||||
build(":compileKotlinLinux") {
|
||||
assertTasksUpToDate(":cinteropNlibLinux", ":compileKotlinLinux")
|
||||
}
|
||||
|
||||
headerFile.writeText("void foo();")
|
||||
buildAndFail(":compileKotlinLinux") {
|
||||
assertTasksExecuted(":cinteropNlibLinux")
|
||||
assertOutputContains("src/linuxMain/kotlin/org/sample/Platform.kt:2:10 Unresolved reference: sample")
|
||||
}
|
||||
|
||||
headerFile.writeText("void sample(int i);")
|
||||
build(":compileKotlinLinux") {
|
||||
assertTasksExecuted(":cinteropNlibLinux")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
linuxX64("linux") {
|
||||
compilations.getByName("main") {
|
||||
cinterops.create("nlib") {
|
||||
defFile(file("$projectDir/native_lib/nlib.def"))
|
||||
includeDirs("$projectDir/native_lib")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
headers = nlib.h
|
||||
+1
@@ -0,0 +1 @@
|
||||
void sample(int i);
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun foo() {
|
||||
nlib.sample(5)
|
||||
}
|
||||
+6
-2
@@ -1007,10 +1007,14 @@ open class CInteropProcess
|
||||
@get:PathSensitive(PathSensitivity.RELATIVE)
|
||||
val headers: FileCollection get() = settings.headers
|
||||
|
||||
@get:Input
|
||||
@get:IgnoreEmptyDirectories
|
||||
@get:InputFiles
|
||||
@get:PathSensitive(PathSensitivity.RELATIVE)
|
||||
val allHeadersDirs: Set<File> get() = settings.includeDirs.allHeadersDirs.files
|
||||
|
||||
@get:Input
|
||||
@get:IgnoreEmptyDirectories
|
||||
@get:InputFiles
|
||||
@get:PathSensitive(PathSensitivity.RELATIVE)
|
||||
val headerFilterDirs: Set<File> get() = settings.includeDirs.headerFilterDirs.files
|
||||
|
||||
private val libDirectories = project.buildLibDirectories()
|
||||
|
||||
Reference in New Issue
Block a user