Is there a way to customize gradlew?
What I want is that when someone runs gradlew then it will run gradle with additional args, e.g. ./gradlew
should in practice call gradle --init-script "../../my_init_script.gradle"
Asked
Active
Viewed 382 times
0

LK__
- 6,515
- 5
- 34
- 53
-
You should simply: `apply from: script`. – Opal Mar 24 '15 at 09:43
-
can you explain your use case a bit? I point the wrapper to a custom distribution. By custom distribution I mean a gradle zip with the my_init_script.gradle living in the init.d folder. All init files living in that folder will automatically applied. – Rene Groeschke Mar 24 '15 at 09:46
-
I need everyone to use a custom `init.gradle` file when they run a build, but it is cumbersome to write `gradle --init-script "../../my_init_script.gradle"` every time so I would like to hide this in some way – LK__ Mar 24 '15 at 10:31
-
I could always make my own wrapper task which depends on the built in one and here manually add my arguments within the generated `gradlew` and `gradlew.bat` files, but this is rather hacky... – LK__ Mar 24 '15 at 11:03
-
again. I recommend to create a custom distribution where you put your custom init.gradle files in the init.d folder of the gradle zip for that. then pointing the wrapper to it makes it very convenient for you to endorse rules – Rene Groeschke Mar 24 '15 at 11:35
-
Understand now - sounds like great solution – LK__ Mar 24 '15 at 11:49
-
I ended up writing a script which patches `gradlew/gradlew.bat` as I want there only to be one `custom-init.gradle` file and if anyone changes this one then this will affect all build. Using a custom distribution would mean extra maintenance of this and if anything needed to change in the init file then people would have to take new distributions. – LK__ Mar 24 '15 at 18:00