Skip to content

Instantly share code, notes, and snippets.

@venkatperi
Created March 20, 2014 14:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save venkatperi/9664988 to your computer and use it in GitHub Desktop.
Save venkatperi/9664988 to your computer and use it in GitHub Desktop.
Walk up project tree to resolve project (ext) properties in Gradle
//root build.gradle
ext {
javaVersion = JavaVersion.VERSION_1_7
}
Project.metaClass.prop { name ->
delegate.with {
ext.properties.containsKey( name ) ?
ext.properties[ name ] : parent?.prop( name )
}
}
//:subproject1 build.gradle
sourceCompatibility = prop("javaVersion")
@sarnobat
Copy link

sarnobat commented Mar 2, 2022

I wish gradle :properties had a recursive option to automate this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment