Leon Kiefer
01/30/2025, 6:56 PMThe task was not up-to-date because of the following reasons:
Output property 'buildResult$kotlin_gradle_plugin_common$1' file /Users/leon/git/voize/voize-core/android/mobile/build/cocoapods/synthetic/ios/build/XCBuildData/cbfe183fac4926b39634880cb9ecea50.xcbuilddata has been removed.
Output property 'buildResult$kotlin_gradle_plugin_common$1' file /Users/leon/git/voize/voize-core/android/mobile/build/cocoapods/synthetic/ios/build/XCBuildData/cbfe183fac4926b39634880cb9ecea50.xcbuilddata/attachments has been removed.
Leon Kiefer
01/30/2025, 7:23 PMprojectA:podBuildX <- projectA:cinteropXArm64 <- projectA:commonizeCInterop <- projectA:compileNativeMainKotlinMetadata <- projectA:iosArm64MetadataElements <- projectB:transformCommonMainDependenciesMetadata
for some reason the projectB transformCommonMainDependenciesMetadata task depends on the podBuild on projectA. This causes the ios podBuild to be triggered even if I only want to build for android on a mac. In combination with the gradle cache not working for the podBuild task not working, we spent 1 minute every time we do an android build, building ios pods.tapchicoma
01/31/2025, 8:40 AMLeon Kiefer
02/03/2025, 9:51 AMAndrey Yastrebov
02/03/2025, 11:07 AMLeon Kiefer
02/03/2025, 11:10 AMLeon Kiefer
02/03/2025, 1:32 PM./gradlew installDebug --scan
it will also run the PodBuild Tasks but they should not run for the android only build
2. if you run ./gradlew installDebug --scan
twice, in the second run all the PodBuild Tasks are not UP-TO-DATE
Leon Kiefer
02/03/2025, 1:36 PMLeon Kiefer
02/03/2025, 2:06 PMPodBuildTask
buildResult
, because this is referenced in the no up to date reason https://kotlinlang.slack.com/archives/C3PQML5NU/p1738263403334339?thread_ts=1725462362.768709&cid=C3PQML5NU
@Suppress("unused") // declares an output
@get:OutputFiles
internal val buildResult: FileCollection = objectFactory.fileTree()
.from(synthetic.map { it.dir("build") })
.matching {
it.include("**/${pod.get().schemeName}.*/")
it.include("**/${pod.get().schemeName}/")
}
But from looking at the code I don't understand why the path .../build/XCBuildData/...
is part of this buildResult
, it does not match the include
and when I print all the task outputs in gradle I also don't see the .../build/XCBuildData/...
path.Andrey Yastrebov
02/04/2025, 4:20 PM:shared
project or only in :composeApp
or probably both?Andrey Yastrebov
02/04/2025, 4:25 PMtasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>>().configureEach {
if(name != "kspCommonMainKotlinMetadata") {
dependsOn("kspCommonMainKotlinMetadata")
}
}
If I remove it, the task :installDebug
runs without triggering :podBuild...
Leon Kiefer
02/04/2025, 5:37 PMreakt-native-toolkit
processor, which I also added to the demo project, this ksp processor generates common code, so we need to have the dependsOn("kspCommonMainKotlinMetadata")
workaround (and also other config, which I not included in the demo project to keep it simple). The workaround is from here https://github.com/google/ksp/issues/567#issuecomment-1510477456. How did you build the iosArtifact without invalidating the podBuild Tasks?Andrey Yastrebov
02/05/2025, 8:34 AMHow did you build the iosArtifact without invalidating the podBuild Tasks?Removed the ksp stuff. Actually there is still a problem, from the second build the podBuild tasks are not up-to-date, but from 3-4 attempt they are. Need to investigate this.
We use KSP with theI'm not familiar with ksp, but this problem is also worth investigatingprocessorreakt-native-toolkit
Leon Kiefer
02/17/2025, 12:41 PMAndrey Yastrebov
02/19/2025, 5:08 PMLeon Kiefer
02/19/2025, 5:10 PMAndrey Yastrebov
02/19/2025, 6:05 PMAndrey Yastrebov
02/19/2025, 6:12 PMLeon Kiefer
02/19/2025, 6:18 PMAndrey Yastrebov
02/25/2025, 6:31 PMcomposeApp
| ├──ios
| | └──cocoapods
| | ├──dependency_1
| | ├──dependency_2
| | ├──dependency_3
| | └──dependency_4 (link only)
| └──android
|
└──shared
├──ios
| └──cocoapods
| └──dependency_4
└──android
So we have composeApp
with some cocoapods dependencies and shared
module which also have a cocoapod dependency.
From the ksp docs we need to specify the following dependency in order to generate metadata from commonMain
tasks.withType<KotlinCompilationTask<*>>().configureEach {
if (name != "kspCommonMainKotlinMetadata") {
dependsOn("kspCommonMainKotlinMetadata")
}
}
This solution works fine for composeApp
and when running ./gradlew installDebug
the pod build tasks for dependency_1/2/3
will not be triggered, but it will trigger the pod build for dependency_4
. To fix that, we can disable all iOS related tasks when running installDebug
To summarize:
• try to use cocoapods only for top level module
• use as little pods as possible (even better to not use them at all)
• disable ios related tasks when running installDebug
or any other android related taskAndrey Yastrebov
02/25/2025, 6:31 PMLeon Kiefer
02/25/2025, 7:03 PMshared
project so it does not mix cocoapods in multi-modules. When I move the pods in your sample project into the shared
project I can reproduce the problem again and every time I execute installDebug the pods are also rebuild.
2. how to disable all iOS related tasks during android builds? And is this even possible if we have tasks which are required by android which depend on common code generation of KSP?Andrey Yastrebov
02/26/2025, 11:13 AMshared
is not a top level module, it is a dependency for composeApp
. It's better to have pods in top level module only. The second thing is that you use direct integration of composeApp
and cocoapods in shared
, you shouldn't mix it.
2. Add this to your build script (see in my sample)
gradle.taskGraph.whenReady {
if (allTasks.any { it.name.contains("installDebug", ignoreCase = true) } &&
allTasks.any { !it.name.contains("syncFramework", ignoreCase = true) }) {
allTasks.forEach { task ->
if (task.name.matches(Regex(".*(pod|ios|cocoa).*", RegexOption.IGNORE_CASE))) {
task.enabled = false
}
}
}
}
Leon Kiefer
02/26/2025, 12:10 PMAndrey Yastrebov
02/26/2025, 12:21 PMLeon Kiefer
02/26/2025, 12:27 PMalias(libs.plugins.kotlinCocoapods) apply false
Here is a screenshot form the documentation you linkedAndrey Yastrebov
02/26/2025, 12:36 PMshared
is just a dependency for composeApp
First of all you don't need this in shared
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "shared"
isStatic = true
}
}
In cocoapods block you don't need this information, as we just want to add some pod dependencies
version = "1.0"
ios.deploymentTarget = "16.0"
summary = "Some description for a Kotlin/Native module"
homepage = "Link to a Kotlin/Native module homepage"
name = "MyCocoaPod"
framework {
baseName = "MyFramework"
isStatic = false
}
Leon Kiefer
02/26/2025, 1:08 PMCocoapods Integration requires pod version to be specified.
2. Specs satisfying the 'AppAuth (= 1.5.0)' dependency were found, but they required a higher minimum deployment target.
Therefore I had to keep this config:
version = "1.0"
ios.deploymentTarget = "16.0"
Now the framework is only configured in the project which is published as Framework for ios. however still a composeAppinstallDebug will cause the pods definend in shared to be rebuild. I can send you the updated sample project if you like.Andrey Yastrebov
02/26/2025, 3:46 PMTherefore I had to keep this config:Yes, thats right, or as alternative you can specify version on top level
group = "org.example.shared"
version = "1.0-SNAPSHOT"
kotlin {
composeAppinstallDebug will cause the pods definend in shared to be rebuildAfter further investigation I've noticed that it's more like ksp bug. Look at the tasks graph
./gradlew installDebug --dry-run
:shared:compileAppleMainKotlinMetadata SKIPPED
:shared:metadataAppleMainProcessResources SKIPPED
:shared:metadataAppleMainClasses SKIPPED
:shared:transformIosMainDependenciesMetadata SKIPPED
:shared:compileIosMainKotlinMetadata SKIPPED
:shared:metadataIosMainProcessResources SKIPPED
:shared:metadataIosMainClasses SKIPPED
:shared:iosArm64MetadataElements SKIPPED
:shared:iosSimulatorArm64MetadataElements SKIPPED
:shared:iosX64MetadataElements SKIPPED
:composeApp:transformCommonMainDependenciesMetadata SKIPPED
:composeApp:kspCommonMainKotlinMetadata SKIPPED
ios related tasks should not be triggered. I'll keep you updated