Multiple build scripts

(Michael Clovis) #1

I have created multiple build scripts based upon functionality. I thought I could combine them using apply from:. I am unsure if I can use this tactic, and am unsure if property files are still respected. Can anyone please clarify these and other “issues” with this approach.

I wish to clarify my question, in that I have not received an answer yet. The question is trying to address the following: I am not seeking solutions for a multi-project build, I instead have blocks of logic that could be applied at different times for different projects. I am seeking to create build “fragments” that when creating a NEW project could be combined without copying and pasting. There is “apply from” but it seems to only accept one other build file. I hope this clarifies my question and someone can clarify if it is possible and how.

(James Justinic) #2

Yes, this is perfectly fine. The functionality will be the same as if you included the other file inline. That means your apply from: line must occur after setting any property you want to use or applying a plugin that does the same.

You will need to use one apply from: line for each file you want to include.

You can see an example of this in the build of Gradle itself: