Reputation: 5598
build.gradle
task foo(type: GradleBuild) {
dir = '/foo'
tasks = ['foo']
}
println foo.version
/foo/build.gradle
project.ext {
version = "1.0"
}
How to pass a property(e.g. version) defined in "/foo/build.gradle" back during evaluation?
Upvotes: 1
Views: 77
Reputation: 14503
This won't be possible. The functionality of the GradleBuild
task is limited, you can't even read the output of the Gradle invocation via the public API.
But, if your builds are connected, you should include the foo
project as subproject of your parent project. Simply include the project in your settings.gradle
file (you can create one if it does not exist):
include ':foo'
Now, if you invoke gradle, the entered tasks will be executed in your root project as well as in your foo
project (if existent). You can let tasks of your root project depend on tasks of your foo
project by using:
myRootTask.dependsOn ':foo:myFooTask'
Upvotes: 1