Skip to content
Browse files

replace dynamic properties with extension properties

  • Loading branch information...
1 parent 4b4c0a6 commit f2f965f851f9873ffcf9752b86e372789d908fec @AlanKrueger AlanKrueger committed Apr 3, 2012
View
2 build.gradle
@@ -10,7 +10,7 @@ version = '1.0'
def props = new Properties();
def localProperties = new File("local.properties")
if (localProperties.exists()) localProperties.withInputStream { props.load(it) }
-props.each { project.setProperty(it.key, it.value) }
+props.each { project.ext.set it.key, it.value }
configurations {
deployerJars
View
8 src/main/groovy/com/trigonic/gradle/plugins/rpm/Rpm.groovy
@@ -72,8 +72,8 @@ class Rpm extends AbstractArchiveTask {
private <T extends Enum<T>> void aliasEnumValues(T[] values) {
for (T value : values) {
- assert !hasProperty(value.name())
- setProperty value.name(), value
+ assert !ext.hasProperty(value.name())
+ ext.set value.name(), value
}
}
@@ -84,8 +84,8 @@ class Rpm extends AbstractArchiveTask {
private <T, U> void aliasStaticInstances(Class<T> forClass, Class<U> ofClass) {
for (Field field : forClass.fields) {
if (field.type == ofClass && field.hasModifier(Modifier.STATIC)) {
- assert !hasProperty(field.name)
- setProperty field.name, field.get(null)
+ assert !ext.hasProperty(field.name)
+ ext.set field.name, field.get(null)
}
}
}
View
6 src/main/groovy/com/trigonic/gradle/plugins/rpm/RpmCopySpecVisitor.groovy
@@ -78,14 +78,16 @@ class RpmCopySpecVisitor extends EmptyCopySpecVisitor {
@Override
void visitFile(FileVisitDetails fileDetails) {
logger.debug "adding file {}", fileDetails.relativePath.pathString
- builder.addFile "/" + fileDetails.relativePath.pathString, fileDetails.file, spec.fileMode, spec.fileType, spec.user ?: task.user, spec.group ?: task.group
+ builder.addFile "/" + fileDetails.relativePath.pathString, fileDetails.file,
+ spec.fileMode == null ? -1 : spec.fileMode, spec.fileType, spec.user ?: task.user, spec.group ?: task.group
}
@Override
void visitDir(FileVisitDetails dirDetails) {
if (spec.createDirectoryEntry) {
logger.debug "adding directory {}", dirDetails.relativePath.pathString
- builder.addDirectory "/" + dirDetails.relativePath.pathString, spec.dirMode, spec.fileType, spec.user ?: task.user, spec.group ?: task.group
+ builder.addDirectory "/" + dirDetails.relativePath.pathString, spec.dirMode == null ? -1 : spec.dirMode,
+ spec.fileType, spec.user ?: task.user, spec.group ?: task.group
}
}
View
2 src/main/groovy/com/trigonic/gradle/plugins/rpm/RpmPlugin.groovy
@@ -28,7 +28,7 @@ class RpmPlugin implements Plugin<Project> {
void apply(Project project) {
project.plugins.apply(BasePlugin.class)
- project.Rpm = Rpm.class
+ project.ext.Rpm = Rpm.class
CopySpecImpl.metaClass.user = null
CopySpecImpl.metaClass.group = null

0 comments on commit f2f965f

Please sign in to comment.
Something went wrong with that request. Please try again.