Issue #338
Gradle uses Groovy and it has ext
, also known as ExtraPropertiesExtension
Additional, ad-hoc, properties for Gradle domain objects.
Extra properties extensions allow new properties to be added to existing domain objects. They act like maps, allowing the storage of arbitrary key/value pairs. All ExtensionAware Gradle domain objects intrinsically have an extension named “ext” of this type.
project.ext {
myprop = "a"
}
assert project.myprop == "a"
assert project.ext.myprop == "a"
project.myprop = "b"
assert project.myprop == "b"
assert project.ext.myprop == "b"
In root build.gradle
, ext
adds extra property to rootProject
object. There we can access rootProject.ext
or just ext
ext {
myLibraryVersion = '1.0.0'
}
In module app/build.gradle
, ext
adds extra property to project
object. There we can access project.ext
or just ext
ext {
myLibraryVersion = '1.0.0'
}