Reproducer for build tooling issue
diff --git a/native/objcexport-header-generator/testDependencies/ReadMe.md b/native/objcexport-header-generator/testDependencies/ReadMe.md
new file mode 100644
index 0000000..f16d42c
--- /dev/null
+++ b/native/objcexport-header-generator/testDependencies/ReadMe.md
@@ -0,0 +1,3 @@
+# Test Dependencies for ObjC Export tests:
+Those dependencies will be built and the klibs can be used for the header generator to run tests against.
+This should emulate the situation of having 'real life' dependencies in your project.
\ No newline at end of file
diff --git a/native/objcexport-header-generator/testDependencies/testLibraryA/build.gradle.kts b/native/objcexport-header-generator/testDependencies/testLibraryA/build.gradle.kts
new file mode 100644
index 0000000..7761778
--- /dev/null
+++ b/native/objcexport-header-generator/testDependencies/testLibraryA/build.gradle.kts
@@ -0,0 +1,27 @@
+import org.jetbrains.kotlin.konan.target.HostManager
+import org.jetbrains.kotlin.konan.target.KonanTarget
+
+plugins {
+ kotlin("multiplatform")
+}
+
+kotlin {
+ macosArm64()
+ macosX64()
+ linuxX64()
+ linuxArm64()
+}
+
+
+tasks.register("prepareDependencyKlib") {
+ val target = when (HostManager.host) {
+ KonanTarget.MACOS_X64 -> kotlin.macosX64()
+ KonanTarget.MACOS_ARM64 -> kotlin.macosArm64()
+ KonanTarget.LINUX_X64 -> kotlin.linuxX64()
+ KonanTarget.LINUX_ARM64 -> kotlin.linuxArm64()
+ else -> return@register
+ }
+
+ val mainCompilation = target.compilations["main"]
+ dependsOn(mainCompilation.compileTaskProvider)
+}
diff --git a/native/objcexport-header-generator/testDependencies/testLibraryA/src/nativeMain/kotlin/MyLibraryA.kt b/native/objcexport-header-generator/testDependencies/testLibraryA/src/nativeMain/kotlin/MyLibraryA.kt
new file mode 100644
index 0000000..5a8f188
--- /dev/null
+++ b/native/objcexport-header-generator/testDependencies/testLibraryA/src/nativeMain/kotlin/MyLibraryA.kt
@@ -0,0 +1,9 @@
+/*
+ * Copyright 2010-2024 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.
+ */
+
+class MyLibraryA {
+ fun returnInt(): Int = 42
+ fun returnMe(): MyLibraryA = this
+}
\ No newline at end of file
diff --git a/native/objcexport-header-generator/testDependencies/testLibraryB/build.gradle.kts b/native/objcexport-header-generator/testDependencies/testLibraryB/build.gradle.kts
new file mode 100644
index 0000000..c0a207b
--- /dev/null
+++ b/native/objcexport-header-generator/testDependencies/testLibraryB/build.gradle.kts
@@ -0,0 +1,10 @@
+plugins {
+ kotlin("multiplatform")
+}
+
+kotlin {
+ macosArm64()
+ macosX64()
+ linuxX64()
+ linuxArm64()
+}
\ No newline at end of file
diff --git a/native/objcexport-header-generator/testDependencies/testLibraryB/src/nativeMain/kotlin/MyLibraryB.kt b/native/objcexport-header-generator/testDependencies/testLibraryB/src/nativeMain/kotlin/MyLibraryB.kt
new file mode 100644
index 0000000..2e1f7f3
--- /dev/null
+++ b/native/objcexport-header-generator/testDependencies/testLibraryB/src/nativeMain/kotlin/MyLibraryB.kt
@@ -0,0 +1,9 @@
+/*
+ * Copyright 2010-2024 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.
+ */
+
+class MyLibraryB {
+ fun returnInt(): Int = 42
+ fun returnMe(): MyLibraryB = this
+}
\ No newline at end of file
diff --git a/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/common-configuration.gradle.kts b/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/common-configuration.gradle.kts
index 0025152..d4a1f2c 100644
--- a/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/common-configuration.gradle.kts
+++ b/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/common-configuration.gradle.kts
@@ -165,7 +165,7 @@
// This is a workaround for KT-50876, but with no clear explanation why doFirst is used.
// However, KGP with Native targets is used in the native-xctest project, and this code fails with
// The value for property 'freeCompilerArgs' is final and cannot be changed any further.
- if (project.path != ":native:kotlin-test-native-xctest") {
+ if (project.path != ":native:kotlin-test-native-xctest" /*&& !project.path.startsWith(":native:objcexport-header-generator") <- workaround */) {
doFirst {
if (!useAbsolutePathsInKlib) {
kotlinOptions.freeCompilerArgs += "-Xklib-relative-path-base=${layout.buildDirectory.get().asFile},${layout.projectDirectory.asFile},$rootDir"
diff --git a/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/objcExportHeaderGeneratorTest.kt b/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/objcExportHeaderGeneratorTest.kt
index de8ff0b..8adbc36 100644
--- a/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/objcExportHeaderGeneratorTest.kt
+++ b/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/objcExportHeaderGeneratorTest.kt
@@ -19,6 +19,8 @@
tag = null,
requirePlatformLibs = false,
) {
+ dependsOn(":objcexport-header-generator:testLibraryA:assemble")
+ dependsOn(":objcexport-header-generator:testLibraryB:assemble")
useJUnitPlatform()
enableJunit5ExtensionsAutodetection()
systemProperty("kif.local", project.providers.gradleProperty("kif.local").isPresent)
diff --git a/settings.gradle b/settings.gradle
index 1e719db..eee3cee 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -122,6 +122,8 @@
":native:objcexport-header-generator",
":native:objcexport-header-generator-k1",
":native:objcexport-header-generator-analysis-api",
+ ":native:objcexport-header-generator:testLibraryA",
+ ":native:objcexport-header-generator:testLibraryB",
":core:compiler.common",
":core:compiler.common.jvm",
":core:compiler.common.js",
@@ -724,6 +726,8 @@
project(':native:kotlin-klib-commonizer-embeddable').projectDir = "$rootDir/native/commonizer-embeddable" as File
project(':native:objcexport-header-generator-k1').projectDir = "$rootDir/native/objcexport-header-generator/impl/k1" as File
project(':native:objcexport-header-generator-analysis-api').projectDir = "$rootDir/native/objcexport-header-generator/impl/analysis-api" as File
+project(':native:objcexport-header-generator:testLibraryA').projectDir = "$rootDir/native/objcexport-header-generator/testDependencies/testLibraryA" as File
+project(':native:objcexport-header-generator:testLibraryB').projectDir = "$rootDir/native/objcexport-header-generator/testDependencies/testLibraryB" as File
project(':plugins:android-extensions-compiler').projectDir = "$rootDir/plugins/android-extensions/android-extensions-compiler" as File
project(':kotlin-android-extensions').projectDir = "$rootDir/prepare/android-extensions-compiler-gradle" as File
project(':kotlin-parcelize-compiler').projectDir = "$rootDir/prepare/parcelize-compiler-gradle" as File