本文整理汇总了Java中org.gradle.api.artifacts.component.ComponentIdentifier类的典型用法代码示例。如果您正苦于以下问题:Java ComponentIdentifier类的具体用法?Java ComponentIdentifier怎么用?Java ComponentIdentifier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ComponentIdentifier类属于org.gradle.api.artifacts.component包,在下文中一共展示了ComponentIdentifier类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitFiles
import org.gradle.api.artifacts.component.ComponentIdentifier; //导入依赖的package包/类
@Override
public void visitFiles(@Nullable ComponentIdentifier componentIdentifier, Iterable<File> files) {
try {
for (File file : files) {
if (seenFiles.add(file)) {
ComponentArtifactIdentifier artifactIdentifier;
if (componentIdentifier == null) {
artifactIdentifier = new OpaqueComponentArtifactIdentifier(file);
} else {
artifactIdentifier = new ComponentFileArtifactIdentifier(componentIdentifier, file.getName());
}
artifacts.add(new DefaultResolvedArtifactResult(artifactIdentifier, Artifact.class, file));
}
}
} catch (Throwable t) {
failures.add(t);
}
}
示例2: resolve
import org.gradle.api.artifacts.component.ComponentIdentifier; //导入依赖的package包/类
public void resolve(ComponentIdentifier identifier, ComponentOverrideMetadata componentOverrideMetadata, BuildableComponentResolveResult result) {
resolver.resolve(identifier, componentOverrideMetadata, result);
if (result.getFailure() != null) {
return;
}
ClientModule clientModule = componentOverrideMetadata.getClientModule();
if (clientModule != null) {
MutableModuleComponentResolveMetadata clientModuleMetaData = ((ModuleComponentResolveMetadata)result.getMetaData()).asMutable();
addClientModuleDependencies(clientModule, clientModuleMetaData);
setClientModuleArtifact(clientModuleMetaData);
result.setMetaData(clientModuleMetaData.asImmutable());
}
}
示例3: getName
import org.gradle.api.artifacts.component.ComponentIdentifier; //导入依赖的package包/类
@Override
public String getName() {
ComponentSelector requested = getRequested();
ComponentIdentifier selected = getActual();
if(requested.matchesStrictly(selected)) {
return getSimpleName();
}
if(requested instanceof ModuleComponentSelector && selected instanceof ModuleComponentIdentifier) {
ModuleComponentSelector requestedModuleComponentSelector = (ModuleComponentSelector)requested;
ModuleComponentIdentifier selectedModuleComponentedIdentifier = (ModuleComponentIdentifier)selected;
if(isSameGroupAndModuleButDifferentVersion(requestedModuleComponentSelector, selectedModuleComponentedIdentifier)) {
return getSimpleName() + " -> " + selectedModuleComponentedIdentifier.getVersion();
}
}
return getSimpleName() + " -> " + selected.getDisplayName();
}
示例4: resolveArtifacts
import org.gradle.api.artifacts.component.ComponentIdentifier; //导入依赖的package包/类
@Override
public void resolveArtifacts(ComponentResolveMetadata component, BuildableComponentArtifactsResolveResult result) {
ComponentIdentifier componentId = component.getComponentId();
if (isLibrary(componentId)) {
result.resolved(new MetadataSourcedComponentArtifacts());
}
}
示例5: emptyGraph
import org.gradle.api.artifacts.component.ComponentIdentifier; //导入依赖的package包/类
private void emptyGraph(ConfigurationInternal configuration, ResolverResults results) {
Module module = configuration.getModule();
ModuleVersionIdentifier id = DefaultModuleVersionIdentifier.newId(module);
ComponentIdentifier componentIdentifier = componentIdentifierFactory.createComponentIdentifier(module);
ResolutionResult emptyResult = DefaultResolutionResultBuilder.empty(id, componentIdentifier);
ResolvedLocalComponentsResult emptyProjectResult = new ResolvedLocalComponentsResultGraphVisitor();
results.graphResolved(emptyResult, emptyProjectResult, new EmptyResults());
}
示例6: resolve
import org.gradle.api.artifacts.component.ComponentIdentifier; //导入依赖的package包/类
@Override
public void resolve(ComponentIdentifier identifier, ComponentOverrideMetadata componentOverrideMetadata, BuildableComponentResolveResult result) {
if (identifier instanceof ProjectComponentIdentifier) {
ProjectComponentIdentifier projectId = (ProjectComponentIdentifier) identifier;
LocalComponentMetadata componentMetaData = localComponentRegistry.getComponent(projectId);
if (componentMetaData == null) {
result.failed(new ModuleVersionResolveException(DefaultProjectComponentSelector.newSelector(projectId), projectId + " not found."));
} else {
result.resolved(componentMetaData);
}
}
}
示例7: getLocalComponentMetaData
import org.gradle.api.artifacts.component.ComponentIdentifier; //导入依赖的package包/类
private LocalComponentMetadata getLocalComponentMetaData(ProjectInternal project) {
Module module = project.getModule();
ModuleVersionIdentifier moduleVersionIdentifier = DefaultModuleVersionIdentifier.newId(module);
ComponentIdentifier componentIdentifier = newProjectId(project);
DefaultLocalComponentMetadata metaData = new DefaultLocalComponentMetadata(moduleVersionIdentifier, componentIdentifier, module.getStatus(), project.getAttributesSchema());
metaDataBuilder.addConfigurations(metaData, project.getConfigurations().withType(ConfigurationInternal.class));
return metaData;
}
示例8: resolve
import org.gradle.api.artifacts.component.ComponentIdentifier; //导入依赖的package包/类
@Override
public void resolve(final ComponentIdentifier identifier, final ComponentOverrideMetadata componentOverrideMetadata, final BuildableComponentResolveResult result) {
cacheLockingManager.useCache("Resolve " + identifier, new Runnable() {
public void run() {
delegate.getComponentResolver().resolve(identifier, componentOverrideMetadata, result);
}
});
}
示例9: resolve
import org.gradle.api.artifacts.component.ComponentIdentifier; //导入依赖的package包/类
public void resolve(ComponentIdentifier identifier, ComponentOverrideMetadata componentOverrideMetadata, BuildableComponentResolveResult result) {
if (!(identifier instanceof ModuleComponentIdentifier)) {
throw new UnsupportedOperationException("Can resolve meta-data for module components only.");
}
resolveModule((ModuleComponentIdentifier) identifier, componentOverrideMetadata, result);
}
示例10: supplyArtifacts
import org.gradle.api.artifacts.component.ComponentIdentifier; //导入依赖的package包/类
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;
}
示例11: getCachedArtifacts
import org.gradle.api.artifacts.component.ComponentIdentifier; //导入依赖的package包/类
public CachedArtifacts getCachedArtifacts(ModuleComponentRepository repository, ComponentIdentifier componentId, String context) {
ModuleArtifactsKey key = new ModuleArtifactsKey(repository.getId(), componentId, context);
ModuleArtifactsCacheEntry entry = getCache().get(key);
if (entry == null) {
return null;
}
return createCacheArtifacts(entry);
}
示例12: resolve
import org.gradle.api.artifacts.component.ComponentIdentifier; //导入依赖的package包/类
@Override
public void resolve(ComponentIdentifier identifier, ComponentOverrideMetadata componentOverrideMetadata, BuildableComponentResolveResult result) {
for (ComponentMetaDataResolver resolver : resolvers) {
if (result.hasResult()) {
return;
}
resolver.resolve(identifier, componentOverrideMetadata, result);
}
}
示例13: write
import org.gradle.api.artifacts.component.ComponentIdentifier; //导入依赖的package包/类
public void write(Encoder encoder, ComponentIdentifier value) throws IOException {
if (value == null) {
throw new IllegalArgumentException("Provided component identifier may not be null");
}
Implementation implementation = resolveImplementation(value);
encoder.writeByte(implementation.getId());
if (implementation == Implementation.MODULE) {
ModuleComponentIdentifier moduleComponentIdentifier = (ModuleComponentIdentifier) value;
encoder.writeString(moduleComponentIdentifier.getGroup());
encoder.writeString(moduleComponentIdentifier.getModule());
encoder.writeString(moduleComponentIdentifier.getVersion());
} else if (implementation == Implementation.BUILD) {
ProjectComponentIdentifier projectComponentIdentifier = (ProjectComponentIdentifier) value;
BuildIdentifier build = projectComponentIdentifier.getBuild();
buildIdentifierSerializer.write(encoder, build);
encoder.writeString(projectComponentIdentifier.getProjectPath());
} else if (implementation == Implementation.LIBRARY) {
LibraryBinaryIdentifier libraryIdentifier = (LibraryBinaryIdentifier) value;
encoder.writeString(libraryIdentifier.getProjectPath());
encoder.writeString(libraryIdentifier.getLibraryName());
encoder.writeString(libraryIdentifier.getVariant());
} else {
throw new IllegalStateException("Unsupported implementation type: " + implementation);
}
}
示例14: resolveImplementation
import org.gradle.api.artifacts.component.ComponentIdentifier; //导入依赖的package包/类
private Implementation resolveImplementation(ComponentIdentifier value) {
Implementation implementation;
if (value instanceof ModuleComponentIdentifier) {
implementation = Implementation.MODULE;
} else if (value instanceof ProjectComponentIdentifier) {
implementation = Implementation.BUILD;
} else if (value instanceof LibraryBinaryIdentifier) {
implementation = Implementation.LIBRARY;
} else {
throw new IllegalArgumentException("Unsupported component identifier class: " + value.getClass());
}
return implementation;
}
示例15: downloadAuxiliaryArtifacts
import org.gradle.api.artifacts.component.ComponentIdentifier; //导入依赖的package包/类
private static void downloadAuxiliaryArtifacts(DependencyHandler dependencyHandler, Multimap<ComponentIdentifier, IdeExtendedRepoFileDependency> dependencies, List<Class<? extends Artifact>> artifactTypes) {
if (artifactTypes.isEmpty()) {
return;
}
ArtifactResolutionQuery query = dependencyHandler.createArtifactResolutionQuery();
query.forComponents(dependencies.keySet());
@SuppressWarnings("unchecked") Class<? extends Artifact>[] artifactTypesArray = (Class<? extends Artifact>[]) artifactTypes.toArray(new Class<?>[0]);
query.withArtifacts(JvmLibrary.class, artifactTypesArray);
Set<ComponentArtifactsResult> componentResults = query.execute().getResolvedComponents();
for (ComponentArtifactsResult componentResult : componentResults) {
for (IdeExtendedRepoFileDependency dependency : dependencies.get(componentResult.getId())) {
for (ArtifactResult sourcesResult : componentResult.getArtifacts(SourcesArtifact.class)) {
if (sourcesResult instanceof ResolvedArtifactResult) {
dependency.addSourceFile(((ResolvedArtifactResult) sourcesResult).getFile());
}
}
for (ArtifactResult javadocResult : componentResult.getArtifacts(JavadocArtifact.class)) {
if (javadocResult instanceof ResolvedArtifactResult) {
dependency.addJavadocFile(((ResolvedArtifactResult) javadocResult).getFile());
}
}
}
}
}