--build-file breaks multi project builds if the build file is not called build.gradle

atorok@elibook:~/hpsa_work/GitRepo/twist$ ./gradle-1.12/bin/gradle --build-file build.gradle.static getbindeps Parallel execution is an incubating feature. :getToolsBindeps UP-TO-DATE :getToolsJaxpBindeps UP-TO-DATE :getTwistBindeps UP-TO-DATE :getTwistOldBindeps UP-TO-DATE :getTwistBindepsDuplicate UP-TO-DATE :getbindeps UP-TO-DATE

BUILD SUCCESSFUL

Total time: 1 mins 9.735 secs atorok@elibook:~/hpsa_work/GitRepo/twist$ ./gradle-1.12/bin/gradle --build-file build.gradle getbindeps Parallel execution is an incubating feature. :getToolsBindeps :unittests:getbindeps :tools:getTopbindeps :tests:getbindeps UP-TO-DATE :getToolsJaxpBindeps UP-TO-DATE :tools:getTopbindeps UP-TO-DATE :tools:getbindeps UP-TO-DATE :unittests:getbindeps UP-TO-DATE :getTwistBindeps UP-TO-DATE :getToolsBindeps UP-TO-DATE :getTwistOldBindeps UP-TO-DATE :getTwistBindepsDuplicate UP-TO-DATE :getbindeps UP-TO-DATE

BUILD SUCCESSFUL

Total time: 1 mins 15.887 secs atorok@elibook:~/hpsa_work/GitRepo/twist$ ./gradle-1.12/bin/gradle --build-file build.gradle.static --settings-file settings.gradle getbindeps Parallel execution is an incubating feature. :getToolsBindeps UP-TO-DATE :getToolsJaxpBindeps UP-TO-DATE :getTwistBindeps UP-TO-DATE :getTwistOldBindeps UP-TO-DATE :getTwistBindepsDuplicate UP-TO-DATE :getbindeps UP-TO-DATE

BUILD SUCCESSFUL

Total time: 55.88 secs atorok@elibook:~/hpsa_work/GitRepo/twist$ diff build.gradle build.gradle.static

‘-b’ and ‘-c’ cannot be combined. In a multi-project build, ‘settings.gradle’ alone determines the names and locations of build scripts.

To me it looks more like a defect. At least it’s not obvious and expected.

How does settings.gradle determine the name ? To my knowledge it only determines the location. Why shouldn’t I be able to change the name of the build.gradle file in a multi-project build ?

All build script names and locations are configurable in ‘settings.gradle’. I guess ‘-b’ could be defined as overriding the root build script when used together with ‘-c’, although I can’t think of a strong use case.

If the build script name is not configured in settings.gradle , I would see -b change the default.

Otherwise what is it’s use ? Suppose that for some reason I want to call all build scripts something else for my project.

The use case is in fact this: We have multiple non linked projects, some of them have sub-projects. For convenience we want to have some dynamic versions, but we also want reproducible builds, and the ability to stop using dynamic versions

( like before the release ) and just use the last version that was known to work ( last build that passed validation ).

For this we developed a plug-in (which we did not yet release, bu thinking about it) that generates a build.gradle.static

build script for every build.gradle build script, that has “+” replaced with the actual version being used. To make sure the

plug-in works, we generate build.gradle.static , and then use that to build the project ( so we have 2 invocations of gradle when we do our integration builds ).

This is why we need to be able to call Gradle with a different build script, this is how we found this problem, which is in my view a bug.