https://kotlinlang.org logo
#gradle
Title
# gradle
n

neerav

02/13/2023, 12:06 PM
Hello All I have one project which is currently targeted as Android app. This project have one kotlin library module. Purpose of this module is to maintain only kotlin specific code not anything Android related. In Android app’s build.gradle.kts dependecy of that module added and also includes in settings.gradle.kts ====== Now when I write the one gradle.kts script for Jacobo to get code base from all submodules(means the kotlin library) In SubProjects it returns 0 as a subproject. https://docs.gradle.org/current/javadoc/org/gradle/api/Project.html#getSubprojects-- Can anyone help me in how to get all attached library modules in gradle script written in buildSrc ? • App’s build.gradle.kts : https://gist.github.com/adneerav/a864c9fc25c7659e35fcbd5e9ae2a0d8 • Settings.gradle.kts :: https://gist.github.com/adneerav/fa0378889b611b45c670bedb598aed97 • Kotlin library’s build.gradle.kts : https://gist.github.com/adneerav/d7cbdeabbd13d28d84a4e78eb6f5f556 • Gradle Script from buildSrc : https://gist.github.com/adneerav/b352d65a01a7a7545fd6a1b49df8d542
v

Vampire

02/13/2023, 12:37 PM
Are you trying to create an aggregated JaCoCo report?
n

neerav

02/13/2023, 12:38 PM
You read my mind 😄
v

Vampire

02/13/2023, 12:38 PM
Then just use the
jacoco-report-aggregation
plugin 🙂
n

neerav

02/13/2023, 1:53 PM
Do you have any suggested blogs or any sample to take reference. I want to add this for main Android app and libraries are in Kotlin without any android dependecies
v

Vampire

02/13/2023, 3:01 PM
I have just the docs I linked you to at hand. But actually if you say "Android app" it might not be compatible according to those docs. So you might need to do it manually like the plugin does but adapted to Android, no idea. I'm not doing Android development and also don't know why it is not compatible with the android application plugin.
e

Emil Kantis

02/13/2023, 6:05 PM
Kover should be able to generate a coverage report and includes aggregation task, https://github.com/Kotlin/kotlinx-kover
Plus it has better support for inlined code 🙂
e

ephemient

02/13/2023, 6:06 PM
I don't think it works for Android projects yet either
e

Emil Kantis

02/13/2023, 6:07 PM
Huh.. I understood the following as if android support would be no problem (Feature bullet #4)
Support for
Kotlin Android
without the need to divide it into build types and flavours.
e

ephemient

02/13/2023, 6:09 PM
oh! that seems to be added since the last time I checked… over a year ago. neat, worth a shot
n

neerav

02/14/2023, 7:40 AM
Thanks for help and sharing details. I think still I need to wait to switch from jacoco to Kover as rightnow its not supported to generate specific build flavors and type wise report. https://github.com/Kotlin/kotlinx-kover/issues/18 But thanks again for sharing 🤝
5 Views