com.admc.gradle..Ivyxml.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.2 g??N ? s5ubis S5UBIS-PC d:/Data/tmp/graivyxml/buildSrc/src/main/groovy/com/admc/gradle/Ivyxml.groovy
3210#"! U tp ? A ; ) P ad ? ? ? ? ? ? { Y 2 ?
?
^
/
.
*
? ? ? W D ? w ) ?
?
o
l
!
? ? ? a ^ ? ? ? ? ? ? A ? ? ? ? p U 8 ? ? v H ? ? ? T ) ? ? ? T
? ? V ? ? ^ 3 ? ? ? ? t M L DependencyDescriptor descriptor -> moduleDescriptor.dependencies.each { } gradleConfig.description = c.description if (gradleConfig.description == null) gradleConfig.visible = c.visibility == Visibility.PUBLIC gradleConfig.transitive = c.transitive gradleConfig.extendsFrom(gp.configurations.getByName(parentConfName)) for (parentConfName in c.getExtends()) Configuration gradleConfig = gp.configurations.getByName(confName) moduleDescriptor.getConfiguration(confName) org.apache.ivy.core.module.descriptor.Configuration c = if (!gradleProjConfMap.containsKey(confName)) continue for (def confName in moduleDescriptor.configurationsNames) { if (e.value.endsWith('/ivy/maven')) { mavenNsPrefix = e.key; break; } for (e in moduleDescriptor.extraAttributesNamespaces) String mavenNsPrefix = null .parseDescriptor(ivySettings, depFile.toURL(), false) (DefaultModuleDescriptor) XmlModuleDescriptorParser.instance DefaultModuleDescriptor moduleDescriptor = ivySettings.addAllVariables(gp.project.ivyProperties, true) if (gp.project.hasProperty('ivyProperties')) """ set project property 'ivyDepFile' to a File object for your ivy xml file. """Ivy dep file inaccessible: $depFile.absolutePath assert depFile.isFile() && depFile.canRead(): File depFile = gp.project.hasProperty('ivyDepFile') ? gp.ivyDepFile : gp.file("ivy.xml") } ivySettings.setVariable('gproj|' + it.key, it.value, true) if (it.value instanceof String) gp.project.properties.each { ivySettings.defaultInit(); IvySettings ivySettings = new IvySettings(); for (p in gp.configurations) gradleProjConfMap[p.name] = p def gradleProjConfMap = [:] //def gradleProjConfMap = configurations.collectEntries { [(it.name): it] } // configurations apparently not a Collection, since this doesn't work: public static void doIvyxml(gp) { */ * @author Blaine Simpson (blaine dot simpson at admc dot com) * * only dependency settings. * Does not attempt to load any ivysettings files or do any repository setup, * * Set project property ivyProperties, for the obvious purpose. * * This corresponds to Ivy property 'ivy.dep.file'. * you want to use a file other than "ivy.xml" in the project directory. * Set project property ivyDepFile to File of the Ivy dependencies file if * * User-configurable additional Ivy variables. * User-configurable ivy dep file (a real File instance). * (With keys all prefixed with 'gproj|', e.g. use ${gproj|name}). * Automatically set Ivy variables for every Gradle String-type property. * Support for 'classifier's specified using a .../ivy/maven' namespace * Support for 'transitive' settings on confs and/or dependencies * Support for configuration inheritance via 'extends' * Code review * The code here includes my own enhancements, including * * issue for GRADLE-197 at http://issues.gradle.org/browse/GRADLE-197 . * This Gradle support for 'ivy.xml' is based on contributed fragments in Jira /** import org.gradle.api.artifacts.Configuration; import org.apache.ivy.core.module.descriptor.Configuration.Visibility import org.gradle.api.internal.artifacts.DefaultExcludeRule import org.gradle.api.internal.artifacts.dependencies.DefaultDependencyArtifact import org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency import org.apache.ivy.core.module.descriptor.DependencyArtifactDescriptor import org.apache.ivy.core.module.id.ModuleRevisionId import org.apache.ivy.core.module.descriptorimport org.apache.ivy.core.settings.Ivyimport org.apache.ivy.core.settingimport org.apache.ivy.core.seimport org.apache.ivy.core.seiimport org.apache.ivy.core.settings.IvySettings package com.admc.gradle; ad ?
? ? C ? ? ? I ?
}
=
? ? e 2 ? ? ? x K ?
DependencyDescriptor descriptor -> DependencyDescriptor descriptor -> moduleDescriptor.dependencies.each { } gradleConfig.description = c.description if (gradleConfig.description == null) gradleConfig.visible = c.visibility == Visibility.PUBLIC gradleConfig.transitive = c.transitive gradleConfig.extendsFrom(gp.configurations.getByName(parentConfName)) for (parentConfName in c.getExtends()) Configuration gradleConfig = gp.configurations.getByName(confName) moduleDescriptor.getConfiguration(confName) org.apache.ivy.core.module.descriptor.Configuration c = if (!gradleProjConfMap.containsKey(confName)) continue for (def confName in moduleDescriptor.configurationsNames) { if (e.value.endsWith('/ivy/maven')) { mavenNsPrefix = e.key; break; } for (e in moduleDescriptor.extraAttributesNamespaces) String mavenNsPrefix = null .parseDescriptor(ivySettings, depFile.toURL(), false) (DefaultModuleDescriptor) XmlModuleDescriptorParser.instance DefaultModuleDescriptor moduleDescriptor = ivySettings.addAllVariables(ivyProperties, true) ad ? ? A ? x 6 ? ` ?
?
_
^
Z
? ? ? t 9 ? ? Y ?
?
?
Q
? ? ? ? @ # ? ? ? ? ? ? ? Y X H 9
? ? W 3 ? ? ? ? W + ? ? ? _ ? ? ? V + ? ? ? ? l E { DependencyDescriptor descriptor -> moduleDescriptor.dependencies.each { } gradleConfig.description = c.description if (gradleConfig.description == null) gradleConfig.visible = c.visibility == Visibility.PUBLIC gradleConfig.transitive = c.transitive gradleConfig.extendsFrom(gp.configurations.getByName(parentConfName)) for (parentConfName in c.getExtends()) Configuration gradleConfig = gp.configurations.getByName(confName) moduleDescriptor.getConfiguration(confName) org.apache.ivy.core.module.descriptor.Configuration c = if (!gradleProjConfMap.containsKey(confName)) continue for (def confName in moduleDescriptor.configurationsNames) { if (e.value.endsWith('/ivy/maven')) { mavenNsPrefix = e.key; break; } for (e in moduleDescriptor.extraAttributesNamespaces) String mavenNsPrefix = null .parseDescriptor(ivySettings, depFile.toURL(), f if ( i if (ivyProperties != null) """ Set plugin property 'ivyxml.depFile' to a File object for your ivy xml file. """Ivy dep file inaccessible: $depFile.absolutePath assert depFile.isFile() && depFile.canRead(): } ivySettings.setVariable('gproj|' + it.key, it.value, true) if (it.value instanceof String) if (variablizeProjStrings) gp.project.properties.each { ivySettings.defaultInit(); IvySettings ivySettings = new IvySettings(); for (p in gp.configurations) gradleProjConfMap[p.name] = p def gradleProjConfMap = [:] //def gradleProjConfMap = configurations.collectEntries { [(it.name): it] } // configurations apparently not a Collection, since this doesn't work: void load() { } depFile = gp.file('ivy.xml') gp = p Ivyxml(p) { boolean variablizeProjStrings = true Map ivyProperties File depFile private def gp class Ivyxml { */ * @author Blaine Simpson (blaine dot simpson at admc dot com) * * only dependency settings. * Does not attempt to load any ivysettings files or do any repository setup, * * Set project property ivyProperties, for the obvious purpose. * * This corresponds to Ivy property 'ivy.dep.file'. * you want to use a file other than "ivy.xml" in the project directory. * Set project property ivyDepFile to File of the Ivy dependencies file if * * User-configurable additional Ivy variables. * User-configurable ivy dep file (a real File instance). * (With keys all prefixed with 'gproj|', e.g. use ${gproj|name}). * Automatically set Ivy variables for every Gradle String-type property. * Support for 'classifier's specified using a .../ivy/maven' namespace * Support for 'transitive' settings on confs and/or dependencies * Support for configuration inheritance via 'extends' * Code review * The code here includes my own enhancements, including * * issue for GRADLE-197 at http://issues.gradle.org/browse/GRADLE-197 . * This Gradle support for 'ivy.xml' is based on contributed fragments in Jira /** import org.gradle.api.artifacts.Configuration; import org.apache.ivy.core.module.descriptor.Configuration.Visibility import org.gradle.api.internal.artifacts.DefaultExcludeRule import org.gradle.api.internal.artifacts.dependencies.DefaultDependencyArtifact import org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency import org.apache.ivy.core.module.descriptor.DependencyArtifactDescriptor import org.apache.ivy.core.module.id.ModuleRevisionId import org.apache.ivy.core.module.descriptor.DependencyDescriptor import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor ad 4 ? ) ? x f , ? ? ? c 7 ?
?
?
c
+
!
? ? b X ? ? ? j / ?
?
}
|
D
? ? m [ ? ? ? ? ? ? ? ? P ? ? 2 ? ? ? */ d*/ */ displayDeps.descrip*/ displayDeps.description = '''Lists Ivy dep*/ displayDeps.description = '''Lis*/ displayDeps.description = '''Lists Ivy deps only for specified 'config.name'*/ displayDeps.description = '''Lists Ivy deps only for specified 'config.n*/ displayDeps.description = '''Lists Ivy deps only for specified 'conf*/ displayDeps.description = '''Lists Ivy deps only for speci*/ displayDeps.description = '''Lists Ivy deps only for specified 'co*/*/ displayDeps.description = '''Lists Ivy deps only for specified 'config.name'.'*/ } } } } gradleProjConfMap[mappableConfName].getDependencies().add(dep) } } excRuleContainer.add(new DefaultExcludeRule(it.attributes)) def ruleList -> ruleList.each { descriptor.excludeRules?.values().each { def excRuleContainer = dep.excludeRules } depArt.name, depArt.type, depArt.ext, null, depArt.url)) dep.addArtifact(new DefaultDependencyArtifact( DependencyArtifactDescriptor depArt -> descriptor.allDependencyArtifacts.each { dep.transitive = descriptor.transitive dep.changing = descriptor.changing gp.dependencies { dep = add(mappableConfName, depAttrs) } } println "CLASSIFIER=$depAttrs.classifier" mavenNsPrefix + ':classifier'] depAttrs['classifier'] = descriptor.qualifiedExtraAttributes[ { mavenNsPrefix + ':classifier')) && descriptor.qualifiedExtraAttributes.containsKey( if (mavenNsPrefix != null ] version: id.revision name: id.name, group: id.organisation, def depAttrs = [ DefaultExternalModuleDependency dep ModuleRevisionId id = descriptor.dependencyRevisionId if (!mappableConfName) return for (mappableConfName in mappableConfNames) { } gradleProjConfMap.containsKey(it) def mappableConfNames = descriptor.moduleConfigurations.findAll {