private ModuleDescriptor findProject(DependencyDescriptor descriptor) { String projectPathValue = descriptor.getAttribute(DependencyDescriptorFactory.PROJECT_PATH_KEY); if (projectPathValue == null) { return null; } Project project = gradle.getRootProject().project(projectPathValue); Module projectModule = ((ProjectInternal) project).getModule(); ModuleDescriptor projectDescriptor = moduleDescriptorConverter.convert( project.getConfigurations().getAll(), projectModule, IvyContext.getContext().getIvy().getSettings()); for (DependencyArtifactDescriptor artifactDescriptor : descriptor.getAllDependencyArtifacts()) { for (Artifact artifact : projectDescriptor.getAllArtifacts()) { if (artifact.getName().equals(artifactDescriptor.getName()) && artifact.getExt().equals(artifactDescriptor.getExt())) { String path = artifact.getExtraAttribute(DefaultIvyDependencyPublisher.FILE_PATH_EXTRA_ATTRIBUTE); ReflectionUtil.invoke( artifactDescriptor, "setExtraAttribute", new Object[] {DefaultIvyDependencyPublisher.FILE_PATH_EXTRA_ATTRIBUTE, path}); } } } return projectDescriptor; }
public ConventionMapping map(Map<String, ? extends ConventionValue> mapping) { for (Map.Entry<String, ? extends ConventionValue> entry : mapping.entrySet()) { String propertyName = entry.getKey(); if (!ReflectionUtil.hasProperty(source, propertyName)) { throw new InvalidUserDataException( "You can't map a property that does not exist: propertyName=" + propertyName); } if (entry.getValue() == null) { throw new IllegalArgumentException( "No convention value provided: propertyName= " + propertyName); } } this.conventionMapping.putAll(mapping); return this; }