com.admc.gradle..JavaPropFile.groovy.swp Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-javaPropFile-plugin Show documentation
Show all versions of gradle-javaPropFile-plugin Show documentation
Load Gradle Project with properties from Java properties files
b0VIM 7.3 ?I?Np? ? blaine beyla ~blaine/gradle-javaPropFile-plugin/src/main/groovy/com/admc/gradle/JavaPropFile.groovy utf-8
3210 #"! U tp Q ad ? Q ? ? ? ? ? ? u S ! ? ? ? ? ? F B ?
?
}
g
L
'
? ? ? v / ? ? ` ' ?
?
m
=
? ? ? ? V ? ~ G ? ? ~ Y G 9 ? ? m ? ? Z C 5 ? ? ? p 1 ? ? ? ? = } } strict = originalStrictness if (localPropertiesFile.exists()) load(localPropertiesFile) strict = false; if (appPropertiesFile.exists()) load(appPropertiesFile) strict = true; // Unlike Ant, the LAST loaded properties will override. File localPropertiesFile = gp.file('local.properties') File appPropertiesFile = gp.file('app.properties') boolean originalStrictness = strict; void traditionalPropertiesInit() { } } prevCount = props.size() } return + '\ndue to unresolved references to: ' + unresolveds) 'Unable to resolve top-level properties: ' + props.keySet() gp.logger.error( + '\ndue to unresolved references to: ' + unresolveds) 'Unable to resolve top-level properties: ' + props.keySet() throw new GradleException( if (strict) if (prevCount == props.size()) { } } props.remove(pk) gp.setProperty(pk, newVal) } "Property setting '$pk' attempts to override non-String property value: ${gp.property(pk).class.name}") throw new GradleException( if (!(gp.property(pk) instanceof String)) "Property setting '$pk' attempts to override null property value") throw new GradleException( if (gp.property(pk) == null) if (gp.hasProperty(pk)) { if (haveNewVal) { }) return matchGrps[0] haveNewVal = false unresolveds << matchGrps[1] return System.properties[matchGrps[1]] && System.properties.containsKey(matchGrps[1])) if (expandSystemProperties return gp.property(matchGrps[1]) && (gp.property(matchGrps[1]) instanceof String)) if (gp.hasProperty(matchGrps[1]) // This block resolves ${references} in property values newVal = pv.replaceAll(/\$\{([^}]+)\}/, { matchGrps -> haveNewVal = true new HashMap(props).each() { pk, pv -> unresolveds.clear() while (prevCount > 0) { def unresolveds = [] int prevCount = props.size() boolean haveNewVal String newVal 'Loaded ' + props.size() + ' from ' + propFile.absolutePath) gp.logger.info( propFile.withInputStream { props.load(it) } Properties props = new Properties() """ """Specified properties file inaccessible: $propFile.absolutePath assert propFile.isFile() && propFile.canRead(): void load(File propFile) { } gp = p JavaPropFile(Project p) { private boolean expandSystemProperties = true private boolean strict = true private Project gp class JavaPropFile { import org.gradle.api.GradleException import org.gradle.api.Project package com.admc.gradle;