Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gradle: Fix bnd extension property lookup for Gradle 2.14 #1496

Merged
merged 1 commit into from
Jun 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion biz.aQute.bnd.gradle/src/aQute/bnd/gradle/BndPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public class BndPlugin implements Plugin<Project> {
}
this.preCompileRefresh = project.hasProperty('bnd_preCompileRefresh') ? parseBoolean(bnd_preCompileRefresh) : false
extensions.create('bnd', BndProperties, bndProject)
bnd.ext.project = bndProject
convention.plugins.bnd = new BndPluginConvention(this)

buildDir = relativePath(bndProject.getTargetDir())
Expand Down
56 changes: 35 additions & 21 deletions biz.aQute.bnd.gradle/src/aQute/bnd/gradle/BndProperties.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,47 @@

package aQute.bnd.gradle

import aQute.bnd.build.Project
import org.gradle.api.plugins.ExtraPropertiesExtension

class BndProperties {
private final bndProject
BndProperties(bndProject) {
this.bndProject = bndProject
final Project project
BndProperties(Project bndProject) {
this.project = bndProject
}
String get(String name) {
String value = bndProject.getProperty(name)
if (value instanceof String) {
value = value.trim()
}
return value

def get(String name) {
return trimmed(project.getProperty(name))
}
Object get(String name, Object defaultValue) {

def get(String name, Object defaultValue) {
def value = get(name)
if (value == null) {
value = defaultValue
if (value instanceof String) {
value = value.trim()
}
if (value != null) {
return value
}
return value
return trimmed(defaultValue)
}
String propertyMissing(String name) {
String value = get(name)
if (value == null) {
value = get(name.replace('_', '.'))

def propertyMissing(String name) {
if (name == 'ext') {
throw new MissingPropertyException(name, String)
}
return value
ExtraPropertiesExtension ext = extensions.extraProperties
if (ext.has(name)) {
return ext.get(name)
}
def value = extensions.findByName(name)
if (value != null) {
return value
}
value = get(name)
if (value != null) {
return value
}
return get(name.replace('_', '.'))
}

def trimmed(value) {
return (value instanceof String) ? value.trim() : value
}
}