Gradle: respect the order of dependencies
(cherry picked from commit dca7107)
IDEA-119467 Gradle: auto discovery of buildSrc project
(cherry picked from commit 3cb5420)