@Override public void resolveArtifactsWithType( ComponentResolveMetadata component, ArtifactType type, BuildableArtifactSetResolveResult result ) { if ( type != ArtifactType.MAVEN_POM ) { logger.debug( "resolveModuleArtifacts() called for artifact type {}", type ); result.failed( new ArtifactResolveException( "resolveModuleArtifacts() is implemended only for Maven POMs" ) ); return; } ModuleComponentIdentifier id = (ModuleComponentIdentifier) component.getComponentId(); DefaultIvyArtifactName name = new DefaultIvyArtifactName( id.getModule(), "pom", "pom" ); DefaultModuleComponentArtifactMetadata resolvedMetaData = new DefaultModuleComponentArtifactMetadata( id, name ); result.resolved( Collections.singleton( resolvedMetaData ) ); }
@Override public void resolveModuleArtifacts(ComponentResolveMetaData component, ArtifactType artifactType, BuildableArtifactSetResolveResult result) { LOG.trace("resolveModuleArtifacts"); ModuleComponentResolveMetaData moduleMetaData = (ModuleComponentResolveMetaData) component; if (artifactType == ArtifactType.JAVADOC) { resolveJavadocArtifacts(moduleMetaData, result); } else if (artifactType == ArtifactType.SOURCES) { resolveSourceArtifacts(moduleMetaData, result); // } else if (isMetaDataArtifact(artifactType)) { // resolveMetaDataArtifacts(moduleMetaData, result); } else { int i = 0; } LOG.trace("resolveModuleArtifacts - end"); }
@Override public void resolveArtifactsWithType(final ComponentResolveMetadata component, final ArtifactType artifactType, final BuildableArtifactSetResolveResult result) { String description = "Resolve " + artifactType + " for " + component; lockingManager.useCache(description, new Runnable() { public void run() { delegate.resolveArtifactsWithType(component, artifactType, result); } }); }
@Override public void resolveArtifactsWithType(ComponentResolveMetadata component, ArtifactType artifactType, BuildableArtifactSetResolveResult result) { try { delegate.resolveArtifactsWithType(component, artifactType, result); } catch (Throwable throwable) { result.failed(new ArtifactResolveException(component.getComponentId(), throwable)); } }
@Override public void resolveArtifactsWithType(final ComponentResolveMetadata component, final ArtifactType artifactType, final BuildableArtifactSetResolveResult result) { cacheLockingManager.useCache("Resolve " + artifactType + " for " + component, new Runnable() { public void run() { delegate.getArtifactResolver().resolveArtifactsWithType(component, artifactType, result); } }); }
@Override public void resolveArtifactsWithType(final ComponentResolveMetadata component, final ArtifactType artifactType, final BuildableArtifactSetResolveResult result) { cacheLockingManager.longRunningOperation("Resolve " + artifactType + " for " + component + " using repository " + name, new Runnable() { public void run() { delegate.resolveArtifactsWithType(component, artifactType, result); } }); }
public boolean supplyArtifacts(ComponentIdentifier component, ArtifactType type, BuildableArtifactSetResolveResult result) { Set<ComponentArtifactMetadata> artifacts = typedArtifacts.get(new TypedArtifactsKey(component, type)); if (artifacts != null) { result.resolved(artifacts); return true; } return false; }
@Override public void resolveArtifactsWithType(ComponentResolveMetadata component, ArtifactType artifactType, BuildableArtifactSetResolveResult result) { if (!artifactsCache.supplyArtifacts(component.getComponentId(), artifactType, result)) { super.resolveArtifactsWithType(component, artifactType, result); artifactsCache.newArtifacts(component.getComponentId(), artifactType, result); } }
@Override public void resolveArtifactsWithType(ComponentResolveMetadata component, ArtifactType artifactType, BuildableArtifactSetResolveResult result) { final CachingModuleSource cachedModuleSource = (CachingModuleSource) component.getSource(); // First try to determine the artifacts in-memory (e.g using the metadata): don't use the cache in this case delegate.getLocalAccess().resolveArtifactsWithType(component.withSource(cachedModuleSource.getDelegate()), artifactType, result); if (result.hasResult()) { return; } resolveModuleArtifactsFromCache(cacheKey(artifactType), component, result, cachedModuleSource); }
@Override public void resolveArtifactsWithType(ComponentResolveMetadata component, ArtifactType artifactType, BuildableArtifactSetResolveResult result) { final CachingModuleSource moduleSource = (CachingModuleSource) component.getSource(); delegate.getRemoteAccess().resolveArtifactsWithType(component.withSource(moduleSource.getDelegate()), artifactType, result); if (result.getFailure() == null) { moduleArtifactsCache.cacheArtifacts(delegate, component.getComponentId(), cacheKey(artifactType), moduleSource.getDescriptorHash(), result.getResult()); } }
@Override public void resolveArtifactsWithType(ComponentResolveMetadata component, ArtifactType artifactType, BuildableArtifactSetResolveResult result) { ModuleComponentRepository sourceRepository = findSourceRepository(component.getSource()); ComponentResolveMetadata unpackedComponent = unpackSource(component); // First try to determine the artifacts locally before going remote sourceRepository.getLocalAccess().resolveArtifactsWithType(unpackedComponent, artifactType, result); if (!result.hasResult()) { sourceRepository.getRemoteAccess().resolveArtifactsWithType(unpackedComponent, artifactType, result); } }
@Override public void resolveArtifactsWithType(ComponentResolveMetadata component, ArtifactType artifactType, BuildableArtifactSetResolveResult result) { try { resolver.resolveArtifactsWithType(component, artifactType, result); } catch (Throwable t) { result.failed(new ArtifactResolveException(component.getComponentId(), t)); } }
@Override public void resolveArtifactsWithType(ComponentResolveMetadata component, ArtifactType artifactType, BuildableArtifactSetResolveResult result) { delegate.getLocalAccess().resolveArtifactsWithType(component, artifactType, result); if(!result.hasResult()) { delegate.getRemoteAccess().resolveArtifactsWithType(component, artifactType, result); } }
@Override public void resolveArtifactsWithType(ComponentResolveMetadata component, ArtifactType artifactType, BuildableArtifactSetResolveResult result) { for (ArtifactResolver resolver : resolvers) { if (result.hasResult()) { return; } resolver.resolveArtifactsWithType(component, artifactType, result); } }
@Override public void resolveArtifactsWithType(ComponentResolveMetadata component, ArtifactType artifactType, BuildableArtifactSetResolveResult result) { T moduleMetaData = getSupportedMetadataType().cast(component); if (artifactType == ArtifactType.JAVADOC) { resolveJavadocArtifacts(moduleMetaData, result); } else if (artifactType == ArtifactType.SOURCES) { resolveSourceArtifacts(moduleMetaData, result); } else if (isMetaDataArtifact(artifactType)) { resolveMetaDataArtifacts(moduleMetaData, result); } }
private File resolveMetaDataArtifactFile(ModuleComponentIdentifier moduleComponentIdentifier, ComponentMetaDataResolver componentResolver, ArtifactResolver artifactResolver, ArtifactType artifactType) { BuildableComponentResolveResult moduleVersionResolveResult = new DefaultBuildableComponentResolveResult(); componentResolver.resolve(moduleComponentIdentifier, new DefaultComponentOverrideMetadata(), moduleVersionResolveResult); BuildableArtifactSetResolveResult moduleArtifactsResolveResult = new DefaultBuildableArtifactSetResolveResult(); artifactResolver.resolveArtifactsWithType(moduleVersionResolveResult.getMetaData(), artifactType, moduleArtifactsResolveResult); BuildableArtifactResolveResult artifactResolveResult = new DefaultBuildableArtifactResolveResult(); ComponentArtifactMetadata artifactMetaData = moduleArtifactsResolveResult.getResult().iterator().next(); artifactResolver.resolveArtifact(artifactMetaData, moduleVersionResolveResult.getMetaData().getSource(), artifactResolveResult); return artifactResolveResult.getResult(); }
/*** * @param registration unused parameter required by convention, see {@link org.gradle.internal.service.DefaultServiceRegistry}. */ public void configure(ServiceRegistration registration, ComponentTypeRegistry componentTypeRegistry) { componentTypeRegistry .maybeRegisterComponentType(JvmLibrary.class) .registerArtifactType(SourcesArtifact.class, ArtifactType.SOURCES); }
@Override public LocallyAvailableExternalResource getMetaDataArtifact( ModuleComponentIdentifier id, ArtifactType type ) { Path pomPath = resolve( new DefaultArtifact( id.getGroup(), id.getModule(), "pom", id.getVersion() ) ); if ( pomPath == null ) return null; DefaultExternalResourceMetaData metadata = new DefaultExternalResourceMetaData( pomPath.toUri(), 0, 0 ); return fileRepository.resource( pomPath.toFile(), pomPath.toUri(), metadata ); }
public void resolveModuleArtifacts(final ComponentResolveMetaData component, final ArtifactType artifactType, final BuildableArtifactSetResolveResult result) { executeInContext(String.format("Resolve %s for %s", artifactType, component), new Action<Ivy>() { public void execute(Ivy ivy) { delegate.resolveModuleArtifacts(component, artifactType, result); } }); }
public void resolveModuleArtifacts(final ComponentResolveMetaData component, final ArtifactType artifactType, final BuildableArtifactSetResolveResult result) { cacheLockingManager.useCache(String.format("Resolve %s for %s", artifactType, component), new Runnable() { public void run() { artifactResolver.resolveModuleArtifacts(component, artifactType, result); } }); }
public void resolveModuleArtifacts(final ComponentResolveMetaData component, final ArtifactType artifactType, final BuildableArtifactSetResolveResult result) { cacheLockingManager.longRunningOperation(String.format("Resolve %s for %s using repository %s", artifactType, component, name), new Runnable() { public void run() { delegate.resolveModuleArtifacts(component, artifactType, result); } }); }
public void resolveModuleArtifacts(ComponentResolveMetaData component, ArtifactType artifactType, BuildableArtifactSetResolveResult result) { final CachingModuleSource cachedModuleSource = (CachingModuleSource) component.getSource(); // First try to determine the artifacts in-memory (e.g using the metadata): don't use the cache in this case delegate.getLocalAccess().resolveModuleArtifacts(component.withSource(cachedModuleSource.getDelegate()), artifactType, result); if (result.hasResult()) { return; } resolveModuleArtifactsFromCache(cacheKey(artifactType), component, result, cachedModuleSource); }
public void resolveModuleArtifacts(ComponentResolveMetaData component, ArtifactType artifactType, BuildableArtifactSetResolveResult result) { ModuleComponentRepository sourceRepository = findSourceRepository(component.getSource()); ComponentResolveMetaData unpackedComponent = unpackSource(component); // First try to determine the artifacts locally before going remote sourceRepository.getLocalAccess().resolveModuleArtifacts(unpackedComponent, artifactType, result); if (!result.hasResult()) { sourceRepository.getRemoteAccess().resolveModuleArtifacts(unpackedComponent, artifactType, result); } }
public void resolveModuleArtifacts(ComponentResolveMetaData component, ArtifactType artifactType, BuildableArtifactSetResolveResult result) { try { resolver.resolveModuleArtifacts(component, artifactType, result); } catch (Throwable t) { result.failed(new ArtifactResolveException(component.getComponentId(), t)); } }
public void resolveModuleArtifacts(ComponentResolveMetaData component, ArtifactType artifactType, BuildableArtifactSetResolveResult result) { ModuleComponentResolveMetaData moduleMetaData = (ModuleComponentResolveMetaData) component; if (artifactType == ArtifactType.JAVADOC) { resolveJavadocArtifacts(moduleMetaData, result); } else if (artifactType == ArtifactType.SOURCES) { resolveSourceArtifacts(moduleMetaData, result); } else if (isMetaDataArtifact(artifactType)) { resolveMetaDataArtifacts(moduleMetaData, result); } }
private File resolveMetaDataArtifactFile(ModuleVersionIdentifier moduleVersionIdentifier, DependencyToComponentResolver dependencyResolver, ArtifactResolver artifactResolver, ArtifactType artifactType) { BuildableComponentResolveResult moduleVersionResolveResult = new DefaultBuildableComponentResolveResult(); dependencyResolver.resolve(new DefaultDependencyMetaData(moduleVersionIdentifier), moduleVersionResolveResult); BuildableArtifactSetResolveResult moduleArtifactsResolveResult = new DefaultBuildableArtifactSetResolveResult(); artifactResolver.resolveModuleArtifacts(moduleVersionResolveResult.getMetaData(), artifactType, moduleArtifactsResolveResult); BuildableArtifactResolveResult artifactResolveResult = new DefaultBuildableArtifactResolveResult(); ComponentArtifactMetaData artifactMetaData = moduleArtifactsResolveResult.getArtifacts().iterator().next(); artifactResolver.resolveArtifact(artifactMetaData, moduleVersionResolveResult.getMetaData().getSource(), artifactResolveResult); return artifactResolveResult.getFile(); }
@Override public void resolveArtifactsWithType(ComponentResolveMetadata component, ArtifactType artifactType, BuildableArtifactSetResolveResult result) { if (isLibrary(component.getComponentId())) { result.resolved(Collections.<ComponentArtifactMetadata>emptySet()); } }
public void configure(ServiceRegistration registration, ComponentTypeRegistry componentTypeRegistry) { // TODO There should be a more explicit way to execute an action against existing services componentTypeRegistry.maybeRegisterComponentType(MavenModule.class) .registerArtifactType(MavenPomArtifact.class, ArtifactType.MAVEN_POM); }
@Override public void resolveArtifactsWithType(ComponentResolveMetadata component, ArtifactType artifactType, BuildableArtifactSetResolveResult result) { if (isProjectModule(component.getComponentId())) { throw new UnsupportedOperationException("Resolving artifacts by type is not yet supported for project modules"); } }
protected ModuleDescriptor parseOtherIvyFile(String parentOrganisation, String parentModule, String parentRevision) throws IOException, ParseException, SAXException { ModuleComponentIdentifier importedId = DefaultModuleComponentIdentifier.newId(parentOrganisation, parentModule, parentRevision); LocallyAvailableExternalResource externalResource = parseContext.getMetaDataArtifact(importedId, ArtifactType.IVY_DESCRIPTOR); return parseModuleDescriptor(externalResource, externalResource.getLocalResource().getFile().toURI().toURL()); }
public LocallyAvailableExternalResource getMetaDataArtifact(ModuleComponentIdentifier moduleComponentIdentifier, ArtifactType artifactType) { throw new UnsupportedOperationException(); }
@Override public void resolveArtifactsWithType(ComponentResolveMetadata component, ArtifactType artifactType, BuildableArtifactSetResolveResult result) { result.failed(new ArtifactResolveException(component.getComponentId(), "No cached version available for offline mode")); }
@Override public void resolveArtifactsWithType(ComponentResolveMetadata component, ArtifactType artifactType, BuildableArtifactSetResolveResult result) { throw new UnsupportedOperationException(); }
public void newArtifacts(ComponentIdentifier component, ArtifactType type, BuildableArtifactSetResolveResult result) { if (result.isSuccessful()) { this.typedArtifacts.put(new TypedArtifactsKey(component, type), ImmutableSet.copyOf(result.getResult())); } }
public TypedArtifactsKey(ComponentIdentifier componentId, ArtifactType type) { this.componentId = componentId; this.type = type; }
private String cacheKey(ArtifactType artifactType) { return "artifacts:" + artifactType.name(); }
@Override public void resolveArtifactsWithType(ComponentResolveMetadata component, ArtifactType artifactType, BuildableArtifactSetResolveResult result) { }
@Override public void resolveArtifactsWithType(ComponentResolveMetadata component, ArtifactType artifactType, BuildableArtifactSetResolveResult result) { delegate.resolveArtifactsWithType(component, artifactType, result); }
public LocallyAvailableExternalResource getMetaDataArtifact(ModuleComponentIdentifier componentIdentifier, ArtifactType artifactType) { throw new UnsupportedOperationException(); }
private <T extends Artifact> ArtifactType convertType(Class<T> requestedType) { return componentTypeRegistry.getComponentRegistration(componentType).getArtifactType(requestedType); }