Vlad
02/07/2024, 3:18 PMtasks.register("hello") {
doLast {
println("Hello world!")
}
}
I copy-paste that on top of my shared/build.gradle.kts.
It never runs, I never see doLast/doFirst.
What I am missing?Chris Lee
02/07/2024, 3:20 PM./gradlew hello
Vlad
02/07/2024, 3:20 PMChris Lee
02/07/2024, 3:21 PMbuild
lifecycle task you’d add a dependency on hello
there.Vlad
02/07/2024, 3:22 PMChris Lee
02/07/2024, 3:22 PMregister
registers a new task. You can explicitly create dependencies (possible, but discouraged) or wire task inputs as outputs from other tasks to create a dependency graph.Vlad
02/07/2024, 3:26 PMVlad
02/07/2024, 3:27 PMVampire
02/07/2024, 4:16 PMVampire
02/07/2024, 4:17 PMVlad
02/07/2024, 4:18 PMVampire
02/07/2024, 4:18 PMVlad
02/07/2024, 4:19 PMVampire
02/07/2024, 4:19 PMbuild
lifecycle task, you could just add a dependency from one to the otherVampire
02/07/2024, 4:19 PMVampire
02/07/2024, 4:21 PMWell my task is copy-task, which copies resources from FolderX to main depends on X from paramsTo start with a copy task is seldomly what you want, usually you want a sync task. Then, if the target of your copy task is the output of another task, then you should definitely never ever ever even try to do that as you disturb up-to-date checks, caching, and might even get failed builds due to "missing" dependencies with Gradle 8+
Vampire
02/07/2024, 4:21 PMprocessResources
task to include the resources you want to have additionally.Vampire
02/07/2024, 4:22 PMmain
sourceSet
with your additional resources likeVampire
02/07/2024, 4:23 PMsourceSets {
main {
resources {
srcDir("...")
}
}
}
or similar, depends on the exact details of the situationVlad
02/07/2024, 4:24 PMVampire
02/07/2024, 4:25 PMVlad
02/07/2024, 4:25 PMVlad
02/07/2024, 4:27 PMVlad
02/07/2024, 4:27 PMVlad
02/07/2024, 4:28 PMVampire
02/07/2024, 4:28 PMVlad
02/07/2024, 4:29 PMVlad
02/07/2024, 4:29 PMVampire
02/07/2024, 4:31 PMVlad
02/07/2024, 4:46 PM../shared/src/main
and because I haven't copied the resources, iOS project will not know (I assume) that the resources dir added for the main.
I can't believe that gradle's magic is that strongVampire
02/07/2024, 5:04 PMVlad
02/07/2024, 5:07 PMcommonMain { resources.srcDir(customXdir) }
android can't see those resources even tho androd {} points to common: sourceSets["main"].res.srcDirs("src/commonMain/res")
Vlad
02/07/2024, 5:10 PMit sounds like you should not have such a direct path
Likely yes.
When we jumped into KMP our iOS developers ran. So we had to improvise.
The initial POC idea was to have "everything possible into KMP" module. Both iOS icons folder and android icons folder.
Then we natively per platform pointed to that folder.
And now I want to remove that 2 native implementations and trying to implement KMP only way.
It is "build variants/flavors" topic.
There are like 10 different things:
icons, app name, firebase json for both platforms, applinks associations etcVlad
02/07/2024, 5:10 PMVlad
02/07/2024, 5:10 PMVampire
02/07/2024, 5:13 PMVlad
02/07/2024, 5:14 PMVlad
02/07/2024, 5:15 PM