org.gradle.language.base.artifact.SourcesArtifact Java Examples
The following examples show how to use
org.gradle.language.base.artifact.SourcesArtifact.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IdeDependenciesExtractor.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public Collection<IdeExtendedRepoFileDependency> extractRepoFileDependencies(DependencyHandler dependencyHandler, Collection<Configuration> plusConfigurations, Collection<Configuration> minusConfigurations, boolean downloadSources, boolean downloadJavadoc) { // can have multiple IDE dependencies with same component identifier (see GRADLE-1622) Multimap<ComponentIdentifier, IdeExtendedRepoFileDependency> resolvedDependenciesComponentMap = LinkedHashMultimap.create(); for (IdeExtendedRepoFileDependency dep : resolvedExternalDependencies(plusConfigurations, minusConfigurations)) { resolvedDependenciesComponentMap.put(toComponentIdentifier(dep.getId()), dep); } List<Class<? extends Artifact>> artifactTypes = new ArrayList<Class<? extends Artifact>>(2); if (downloadSources) { artifactTypes.add(SourcesArtifact.class); } if (downloadJavadoc) { artifactTypes.add(JavadocArtifact.class); } downloadAuxiliaryArtifacts(dependencyHandler, resolvedDependenciesComponentMap, artifactTypes); Collection<UnresolvedIdeRepoFileDependency> unresolvedDependencies = unresolvedExternalDependencies(plusConfigurations, minusConfigurations); Collection<IdeExtendedRepoFileDependency> resolvedDependencies = resolvedDependenciesComponentMap.values(); Collection<IdeExtendedRepoFileDependency> resolvedAndUnresolved = new ArrayList<IdeExtendedRepoFileDependency>(unresolvedDependencies.size() + resolvedDependencies.size()); resolvedAndUnresolved.addAll(resolvedDependencies); resolvedAndUnresolved.addAll(unresolvedDependencies); return resolvedAndUnresolved; }
Example #2
Source File: IdeDependenciesExtractor.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public Collection<IdeExtendedRepoFileDependency> extractRepoFileDependencies(DependencyHandler dependencyHandler, Collection<Configuration> plusConfigurations, Collection<Configuration> minusConfigurations, boolean downloadSources, boolean downloadJavadoc) { // can have multiple IDE dependencies with same component identifier (see GRADLE-1622) Multimap<ComponentIdentifier, IdeExtendedRepoFileDependency> resolvedDependenciesComponentMap = LinkedHashMultimap.create(); for (IdeExtendedRepoFileDependency dep : resolvedExternalDependencies(plusConfigurations, minusConfigurations)) { resolvedDependenciesComponentMap.put(toComponentIdentifier(dep.getId()), dep); } List<Class<? extends Artifact>> artifactTypes = new ArrayList<Class<? extends Artifact>>(2); if (downloadSources) { artifactTypes.add(SourcesArtifact.class); } if (downloadJavadoc) { artifactTypes.add(JavadocArtifact.class); } downloadAuxiliaryArtifacts(dependencyHandler, resolvedDependenciesComponentMap, artifactTypes); Collection<UnresolvedIdeRepoFileDependency> unresolvedDependencies = unresolvedExternalDependencies(plusConfigurations, minusConfigurations); Collection<IdeExtendedRepoFileDependency> resolvedDependencies = resolvedDependenciesComponentMap.values(); Collection<IdeExtendedRepoFileDependency> resolvedAndUnresolved = new ArrayList<IdeExtendedRepoFileDependency>(unresolvedDependencies.size() + resolvedDependencies.size()); resolvedAndUnresolved.addAll(resolvedDependencies); resolvedAndUnresolved.addAll(unresolvedDependencies); return resolvedAndUnresolved; }
Example #3
Source File: IdeDependenciesExtractor.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
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>[]) new Class<?>[artifactTypes.size()]; query.withArtifacts(JvmLibrary.class, artifactTypes.toArray(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.setSourceFile(((ResolvedArtifactResult) sourcesResult).getFile()); } } for (ArtifactResult javadocResult : componentResult.getArtifacts(JavadocArtifact.class)) { if (javadocResult instanceof ResolvedArtifactResult) { dependency.setJavadocFile(((ResolvedArtifactResult) javadocResult).getFile()); } } } } }
Example #4
Source File: AtlasDependencyGraph.java From atlas with Apache License 2.0 | 5 votes |
private static void handleSources( @NonNull Project project, @NonNull Set<ComponentIdentifier> artifacts, @NonNull Consumer<SyncIssue> failureConsumer) { final DependencyHandler dependencies = project.getDependencies(); try { ArtifactResolutionQuery query = dependencies.createArtifactResolutionQuery(); query.forComponents(artifacts); @SuppressWarnings("unchecked") Class<? extends Artifact>[] artifactTypesArray = (Class<? extends Artifact>[]) new Class<?>[] {SourcesArtifact.class}; query.withArtifacts(JvmLibrary.class, artifactTypesArray); query.execute().getResolvedComponents(); } catch (Throwable t) { DependencyFailureHandlerKt.processDependencyThrowable( t, s -> null, (data, messages) -> failureConsumer.accept( new SyncIssueImpl( SyncIssue.TYPE_GENERIC, SyncIssue.SEVERITY_WARNING, null, String.format( "Unable to download sources: %s", messages.get(0)), messages))); } }
Example #5
Source File: IdeDependenciesExtractor.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
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>[]) new Class<?>[artifactTypes.size()]; query.withArtifacts(JvmLibrary.class, artifactTypes.toArray(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.setSourceFile(((ResolvedArtifactResult) sourcesResult).getFile()); } } for (ArtifactResult javadocResult : componentResult.getArtifacts(JavadocArtifact.class)) { if (javadocResult instanceof ResolvedArtifactResult) { dependency.setJavadocFile(((ResolvedArtifactResult) javadocResult).getFile()); } } } } }
Example #6
Source File: JvmPluginServiceRegistry.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public void configure(ServiceRegistration registration, ComponentTypeRegistry componentTypeRegistry) { // TODO There should be a more explicit way to execute an action against existing services // TODO:DAZ Dependency Management should be able to extract this from the plugin, without explicit registration componentTypeRegistry.maybeRegisterComponentType(JvmLibrary.class) .registerArtifactType(SourcesArtifact.class, ArtifactType.SOURCES); }
Example #7
Source File: JvmPluginServiceRegistry.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public void configure(ServiceRegistration registration, ComponentTypeRegistry componentTypeRegistry) { // TODO There should be a more explicit way to execute an action against existing services // TODO:DAZ Dependency Management should be able to extract this from the plugin, without explicit registration componentTypeRegistry.maybeRegisterComponentType(JvmLibrary.class) .registerArtifactType(SourcesArtifact.class, ArtifactType.SOURCES); }