Ciaran Sloan
02/05/2024, 3:43 PMbuild-logic
that is declared in my settings.gradle
as includeBuild("build-logic")
where I have written some convention plugins shared across my projects build files.
I'd like to declare an enum class that I can reference in both my build-logic
module as-well as within my projects application modules... Is that possible?Vampire
02/05/2024, 3:46 PMCiaran Sloan
02/05/2024, 3:47 PMVampire
02/05/2024, 3:47 PMCiaran Sloan
02/05/2024, 3:48 PMincludeBuild
multiple times with different modules?Ciaran Sloan
02/05/2024, 3:48 PMephemient
02/05/2024, 3:49 PMenum
with no dependencies, you could cheat with adding it to multiple sourcesetsephemient
02/05/2024, 3:49 PMCiaran Sloan
02/05/2024, 3:49 PMephemient
02/05/2024, 3:49 PMephemient
02/05/2024, 3:50 PMVampire
02/05/2024, 3:50 PMso its possible toof coursemultiple times with different modules?includeBuild
ephemient
02/05/2024, 3:51 PMembeddedKotlin
or older, for Gradle buildscript compatibility, even if your main project's Kotlin version is newerCiaran Sloan
02/05/2024, 3:52 PMCiaran Sloan
02/05/2024, 3:55 PMthen include that build in your build logic build@Vampire by this, do you mean by just a simple implementation in the dependencies?
Ciaran Sloan
02/05/2024, 3:56 PMVampire
02/05/2024, 3:58 PMincludeBuild
that build in the settings script and declare a dependency that is then resolved by building the included buildVampire
02/05/2024, 3:59 PMbuild-logic
, just that you includeBuild
outside pluginManagement { ... }
for normal dependenciesVlad
02/05/2024, 4:03 PMCLOVIS
02/05/2024, 5:58 PMmeta-plugin
includeBuild
that includes the source code of the parent build, which is imported as a plugin into the parent build, which then declares the same source code again to finally declare the resulting plugin.
Of course, this means the source code of the plugin is built twice. The IDE also warns that the same files are included in two source sets. However, everything works fine.
Again, I really do not recommend you use this in general. In my case, this is a specific repository that only contains convention plugins, and I really didn't want to duplicate publishing logic into itself, so I accepted to have some weirdness.CLOVIS
02/05/2024, 5:59 PM.kts
syntax to work, so it uses the plugin class syntax, but that's not a big problem