Hi Community, I've a small doubt regarding Gradle ...
# gradle
r
Hi Community, I've a small doubt regarding Gradle dependencies. Please have look at it 🙂 If I created a module say
testing
and add some dependencies in the
commonMain
source set:
Copy code
commonMain.dependencies {
            @OptIn(ExperimentalComposeLibrary::class)
            api(compose.uiTest)
        }
        desktopMain.dependencies {
            api(compose.desktop.currentOs)
        }
And implements this module into another module, i.e.,
home
module in the
commonTest
source set:
Copy code
commonTest.dependencies {
            implementation(projects.uiTesting)
        }
Will the dependencies added in the
commonMain
inside
testing
module included into the build-artifact/APK?
m
commonTest
is usually not part of your final binary
👆 1
r
That's what I thought but I also have commonMain source-set for testing module. I just wanted to clarify if that will be added or not in the final artifact.
I tried inspect the APK but was failed.
v
Assuming
home
is your "main thing". Everything in
home:commonMain
is productive code, everything in
home:commonTest
is test code. Whatever
home:commonTest
depends on is test code from the PoV of the
home
project.
2
👍 1
r
Yeah, make sense. Test code doesn't included in the final artifact. Thanks for your help @Vampire
👌 1
Hi @Vampire I also tried adding test dependencies like this so that these dependencies will be added to the implementing module, i.e.,
home
module. But it didn't happened. Do you know why?
Copy code
dependencies {
    @OptIn(ExperimentalComposeLibrary::class)
    commonTestApi(compose.uiTest)
    desktopTestApi(compose.desktop.currentOs)
    androidTestImplementation(libs.androidx.compose.ui.test)
    debugImplementation(libs.androidx.compose.ui.test.manifest)
}
I get the unresolved references errors after moving deps from the commonMain and desktopMain source-set: