This message was deleted.
# community-support
s
This message was deleted.
v
ext
is practically always bad practice and you should feel dirty every tiem you use it. 😉 And yes it does, especially when changing versions. Because if you have the versions in code, it needs to be recompiled and classpaths change and thus also make things out-of-date that shouldn't be. With version catalog (if defined a TOML that is) the build logic stays the same and only the things where really something changed due to the different version has to be re-executed.
v
assuming I use configuration caching or not?
v
Either way
v
alright great, time to migrate then
btw where should I keep api url, and other non version constants if ext is icky?
v
alright great, time to migrate then
Not that you got me wrong, CC will not be reused if the TOML changes. But you still save time for the actual configuration that is necessary then.
btw where should I keep api url, and other non version constants if ext is icky?
Depends on where you need them. If you for example just need them within the same build script, just use local variables.
Or if they are constant anyway, just put them to
gradle.properties
, then you also have it available in all projects if needed
Heavily depends on the concrete details
v
I have a new project where I added the version in the toml, and subjectively gradle sync times & configuration feels snappy granted my other project with the ext, is 100x the size 😀 so wondering if there are perf gains other than using a standard way of doing things
v
As I said, at least when changing a version and not changing other build logic, definitvely, especially in more complex builds.
v
the constants are mostly different api urls based on build variant (different environments) so I found it simple enough to chuck it into a map in a ext
would you really put api urls in gradle.properties? that always felt like a place for constants plugins use, not "application" stuff
v
Often it is simple use
ext
but that does not make it any cleaner. 😄 It is usually just a work-around for not making it in some proper way. Or as I said, often even an even simpler local variable would be more appropriate, but ill examples are out there.
would you really put api urls in gradle.properties? that always felt like a place for constants plugins use, not "application" stuff
As I said, depends. If I need it in multiple build scripts, probably. If I just need it in one, I might more use a local variable. But probably also depends on mood. 😄
v
yea the constant needs to be available to 3 apps in the build
v
Might also be a sign that the according logic should instead go into a convention plugin, then you only need the constant there. 🙂
✅ 1
v
honestly I never understood this suggestion, conv. plugins sure are nice, but are a pain to develop, pain to use locally without uploaing to maven therefore I now need a composite build, which is slower isnt it a overkill?
c
composite build is trivial to setup, and only built when it changes, so no perf impacts other than when modifying that build. Creating a precompiled script plugin in there is likewise trivial, it’s exposed to your main build w/o requiring maven etc.
v
how do I distribute the precompiled plugin without maven?
c
if its in a composite build you don’t need to do anything.
v
are composite builds really same speed? I read some blogpost some time ago..
c
it’s all cached - assuming minimal/infrequent changes to plugins etc theres no perf impact.
v
I mean clean build yea
c
yea, but who ever really does a clean build locally? That’s a crutch for misconfigured build scripts etc that should properly manage their inputs and outputs.
✅ 1
On CI, say GitHub Actions, use
gradle-build-action
(and turn on the Gradle build cache) to benefit there as well.
v
well.. yea, but its the reality
v
We live in the reality too and I always use convention plugins in included builds.
v
ksp breaks config cache every other release.. cant even have that turned on
v
I even do that for single-project builds
To not have one 2000 lines build script, but have it modularized conveniently
v
and you disrribute it via internal maven?
v
No distribution, I said included build
c
no, its a composite build included in your main build.
v
Just locally in that build
For things I need or want for multiple projects, I publish it to our internal Nexus as artifact though, yeah. But also easy as pie
v
interesting, guess I have to measure my assumptions
c
Docs on composite builds w/ plugin
v
If you do clean builds, then you will have negative impact, yes. But just don't do clean builds, but fix the build that requires it instead, this is not Maven where you always need to include
clean
to get halfway correct builds. 😄
c
ah, Maven, have almost managed to erase that experience from my memory…
v
I always managed to avoid it, except when contributing somewhere.
Other than that, jumped from Ant/Ivy to Gradle. 🙂
c
yep, pretty much same here. 🙂