Juanma Leflet Estrada
05/09/2024, 2:41 PMbuild.gradle
file and using another build file with -b
? I have made a copy of the actual build.gradle
and added some stuff, put that into a different file and ran it with -b
. It doesn't seem to work, whereas when the same file is named build.gradle
and ran normally without -b
, it worksJuanma Leflet Estrada
05/09/2024, 2:44 PMJuanma Leflet Estrada
05/09/2024, 2:46 PMproject
|- src
|- ...
|- build.gradle
|- tmp.gradle
• build.gradle
is the project's build file
• tmp.gradle
is a copy of build.gradle
with a task appended to itJuanma Leflet Estrada
05/09/2024, 2:50 PMtmp.gradle
to build.gradle
, it works. But running with -b tmp.gradle
doesn't workJuanma Leflet Estrada
05/09/2024, 2:51 PMVampire
05/09/2024, 11:02 PM-b
in the meantime got deprecated or even removed.Juanma Leflet Estrada
05/10/2024, 4:26 AMJuanma Leflet Estrada
05/10/2024, 4:26 AMJuanma Leflet Estrada
05/10/2024, 4:28 AMVampire
05/10/2024, 8:09 AMJuanma Leflet Estrada
05/10/2024, 8:10 AMJuanma Leflet Estrada
05/10/2024, 8:11 AMVampire
05/10/2024, 8:12 AM-I ...
.Juanma Leflet Estrada
05/10/2024, 8:22 AMtask
function is not available in init scriptsJuanma Leflet Estrada
05/10/2024, 8:22 AMallprojects
closure, it compiles, but for some reason the logs tell that the task is up to date...Juanma Leflet Estrada
05/10/2024, 8:23 AMbuild.gradle
, without init script or anything, worksJuanma Leflet Estrada
05/10/2024, 8:23 AMJuanma Leflet Estrada
05/10/2024, 8:24 AMJuanma Leflet Estrada
05/10/2024, 8:41 AMJuanma Leflet Estrada
05/10/2024, 8:42 AMJuanma Leflet Estrada
05/10/2024, 8:43 AMallprojects
closure, it runs it earlier that I expectedJuanma Leflet Estrada
05/10/2024, 8:44 AMdoLast
?Juanma Leflet Estrada
05/10/2024, 8:49 AMCannot call TaskInputs.files(Object...) after task has started execution.
Juanma Leflet Estrada
05/10/2024, 8:58 AMbuild.gradle
file, which sucksVampire
05/11/2024, 8:56 AMBut thefunction is not available in init scriptstask
Correct, not top-level. The context of an init script is not a project. Have a look at the documentation for init scripts. And even if it were available, using it is a bad idea anyway. It does not leverage task-configuration avoidance. Well, if you only use it if you know for sure that task is going to be executed, it might be ok, but it is better practice to always use task-configuration avoidance compatible API.
I might need a?doLast
Of course. Anything you do outside
doLast
or doFirst
is not done at task execution time, but at configuration time. So even in the build script it is a bad idea. The work is a task should be done in execution phase. Otherwise you could also right away not use a task if you anyway not do any work at execution time.
Great... Apparently.Cannot call TaskInputs.files(Object...) after task has started execution
Of course, changing the task configuration at execution time, especially the task inputs it output is very problematic and makes little sense. You need to do configuration work at configuration time and execution work at execution time.
I'm going to have to embed the task in the project'sfile, which sucksbuild.gradle
No, you just have to do it right. :-) And as I said, doing it as you do it right now I'm the build script might "work better" as you naturally do the actions later, but it is still highly problematic and fragile. Better do it properly. :-)
Juanma Leflet Estrada
05/16/2024, 9:13 AMJuanma Leflet Estrada
05/16/2024, 9:13 AMJuanma Leflet Estrada
05/16/2024, 9:14 AM