Tom Brus
02/24/2022, 9:52 AM--build-file
option is deprecated and will be removed in 8.
What is the alternative I should use to work with multiple build*.gradle.kts
files?
I think I need multiple build files… but maybe there is another solution.
Let me explain my situation:
• I need to import an ant file (btw this ant file is not under my control)
• the ant file needs a jar with some custom tasks, otherwise the ant code will throw an exception
• so: this jar needs to be downloaded before the ant file can be imported
• so: my gradle script needs to download a jar before my gradle script can be read correctly…. huh? yeah catch-22!
my conclusion is that I need to make two gradle files:
1. one that only downloads the jar with the custom ant tasks (bootstrap.gradle.kts
)
2. one that imports the ant file and does the rest of the build (build.gradle.kts
)
then I need to call gradle twice: first using --build-file bootstrap.gradle.kts
and then just a plain call of gradle.
Since --build-file
is deprecated this is not a future proof solution…
Any hints appreciated.Vampire
02/24/2022, 9:59 AMTom Brus
02/24/2022, 10:27 AMclean
task? (haha it would not be very productive to first download and install a zip only to have it removed immediately by clean
...)
I agree that my solution is more a workaround then a clean solution.
Do you know what the status of the --build-file
option is?
Does gradle 8 completely remove multiple build file support?Vampire
02/24/2022, 10:39 AMclean
.
But you probably don't need to always download but can use a cached version?
Using an Ivy repository, it does not have to "your regular maven repo".
Ivy repositories are extremely flexible and configurable, you can download from virtually any place.
As long as the place supports HEAD
requests iirc, I think Gradle cannot do without them.Tom Brus
02/24/2022, 11:17 AMsettings.gradle.kts
and bootstrap.gradle.kts
) with different build scripts mentioned in them and that I could run gradle with --settings-file bootstrap.gradle.kts
to select the proper settings file?But the --settings-file
option is also deprecated…. how would that help?
Or do you mean to have one settings.gradle.kts
and select the name of the gradle script conditionally?
Yes, I cache it, but still a waste of time to unzip 1.2G and then remove it immediately… 🥴
I did not know Ivy repos are that flexible… sounds like a neat toy, I will read up on them, thanks for the tip!Vampire
02/24/2022, 11:33 AMOr do you mean to have oneYes, that's what I said. 🙂 To quote myself:and select the name of the gradle script conditionally?settings.gradle.kts
Well, you can configure the build script name for a project in the settings script, so you could declare different build scripts for the project, for example depending on some Gradle property.
Yes, I cache it, but still a waste of time to unzip 1.2G and then remove it immediately… 🥴Indeed, so don't unzip it in your plugin code directly, but let an artifact transform do it. Then the unzipped files are in the transform results directory and not in your project, so are not affected by a
clean
🙂Tom Brus
02/24/2022, 12:05 PMYes, that’s what I said. 🙂hihi reading/understanding is difficult sometimes 😉 I think I understand now, I will try it out.
Indeed, so don’t unzip it in your plugin code directly, but let an artifact transform do it.
Then the unzipped files are in the transform results directory and not in your project, so are not affected by atrying to understand 🤯….. I am not too familiar with Transforms yet 😳. Let me check if I understand you correctly: • I do not need to put the unzipped files in the project build dir at all anymore • I can instead directly use the files in the transform results directory! • what I still have to solve is how to relay to ant where the files in the transform results directory are • the download and unzip will only happen once on a certain machine, the unzipped files are shared between all projects on that machine and they will survive any projects🙂clean
clean
run
❗sounds like a plan!Vampire
02/24/2022, 2:36 PMVampire
02/24/2022, 2:37 PM