André Martins
03/24/2022, 6:16 PMAndré Martins
03/24/2022, 6:16 PMAndré Martins
03/24/2022, 6:17 PMVampire
03/24/2022, 11:08 PMext
trick you used in Groovy, just with Kotlin syntax.
That is to initially define the variable, you use extra
explicitly, so val foo by extra("bar")
, in the root project
and just get it from the subproject to use it, so val foo: String by project
But the question is whether you should do it.
In almost all cases using ext
or extra
is a work-around and one should feel dirty when using it.
Most often there is a better way, like for example adding a properly typed extension to the project instead.