Slackbot
04/11/2022, 11:31 AMMichal
04/11/2022, 11:36 AMIwo Polański
04/11/2022, 11:43 AMapply-from
with scripts, projects contains at least 30+ modules and is growing, we would like to share as much code as possible, the way you work with apply-from
is to create base script file and then then extend is with more specialized ones
the only way I found to to mimic that in KTS is by using functions defined in buildSrc
something like that
private fun Project.moduleJvm() {
moduleBase()
// Uniform way of configuring Kotlin tasks in all Kotlin modules
tasks.withType<KotlinJvmCompile>().configureEach {
kotlinOptions.jvmTarget = KotlinConfig.jvmTarget
}
}
Where functions are calling one another, from more specialized one to basic one
Maybe "limitation" is not a best word, but this approach makes things very cumbersome with comparison to Groovy approach with apply-from.
More or less that's itMichal
04/11/2022, 11:44 AMMichal
04/11/2022, 11:45 AMIwo Polański
04/11/2022, 11:45 AMMichal
04/11/2022, 11:46 AMMichal
04/11/2022, 11:46 AMMichal
04/11/2022, 11:46 AMMichal
04/11/2022, 11:46 AMMichal
04/11/2022, 11:46 AMephemient
04/11/2022, 11:47 AMVampire
04/11/2022, 11:47 AMIwo Polański
04/11/2022, 11:48 AMapply-from
approach in previous company and main benefit of that was syntax, teams understood it right away and plugins were not required
- but I will take a look at pluginsVampire
04/11/2022, 11:52 AMapply from:
are long discouraged already in favor of convention plugins which are most often implemented as precompiled script plugins.Javi
04/11/2022, 12:32 PMAnze Sodja
04/11/2022, 12:34 PMJavi
04/11/2022, 12:34 PMJavi
04/11/2022, 12:36 PMVampire
04/11/2022, 1:35 PMapply from will be deprecated?Not that I'm aware of. I said it is discouraged, not deprecated.
ephemient
04/11/2022, 1:41 PMapply from
does work with Kotlin DSL same as Groovy, you just get zero generated type-safe accessors. whether you stick with Groovy or Kotlin you should change them to plugins. as Björn mentions, it is easy to just copy-them into precompiled script plugins. and then you get generated type-safe accessors and all that.