org.gradle.api.artifacts.ResolvableDependencies Java Examples
The following examples show how to use
org.gradle.api.artifacts.ResolvableDependencies.
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: SonarRunnerPlugin.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
private void addConfiguration(final Project project, final SonarRunnerRootExtension rootExtension) { final Configuration configuration = project.getConfigurations().create(SonarRunnerExtension.SONAR_RUNNER_CONFIGURATION_NAME); configuration .setVisible(false) .setTransitive(false) .setDescription("The SonarRunner configuration to use to run analysis") .getIncoming() .beforeResolve(new Action<ResolvableDependencies>() { public void execute(ResolvableDependencies resolvableDependencies) { DependencySet dependencies = resolvableDependencies.getDependencies(); if (dependencies.isEmpty()) { String toolVersion = rootExtension.getToolVersion(); DependencyHandler dependencyHandler = project.getDependencies(); Dependency dependency = dependencyHandler.create("org.codehaus.sonar.runner:sonar-runner-dist:" + toolVersion); configuration.getDependencies().add(dependency); } } }); }
Example #2
Source File: SonarRunnerPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
private void addConfiguration(final Project project, final SonarRunnerRootExtension rootExtension) { final Configuration configuration = project.getConfigurations().create(SonarRunnerExtension.SONAR_RUNNER_CONFIGURATION_NAME); configuration .setVisible(false) .setTransitive(false) .setDescription("The SonarRunner configuration to use to run analysis") .getIncoming() .beforeResolve(new Action<ResolvableDependencies>() { public void execute(ResolvableDependencies resolvableDependencies) { DependencySet dependencies = resolvableDependencies.getDependencies(); if (dependencies.isEmpty()) { String toolVersion = rootExtension.getToolVersion(); DependencyHandler dependencyHandler = project.getDependencies(); Dependency dependency = dependencyHandler.create("org.codehaus.sonar.runner:sonar-runner-dist:" + toolVersion); configuration.getDependencies().add(dependency); } } }); }
Example #3
Source File: CompileDependenciesFileGenerator.java From Phantom with Apache License 2.0 | 6 votes |
private Set<String> getCompileArtifactsForAgp2x() { Set<String> compileLibs = new HashSet<>(); Configuration configuration = project.getConfigurations().getByName("compile"); if (configuration.isCanBeResolved()) { ResolvableDependencies incoming = configuration.getIncoming(); ResolutionResult resolutionResult = incoming.getResolutionResult(); Set<ResolvedComponentResult> components = resolutionResult.getAllComponents(); for (ResolvedComponentResult result : components) { ModuleVersionIdentifier identifier = result.getModuleVersion(); if (identifier != null && !"unspecified".equals(identifier.getVersion())) { compileLibs.add( String.join(":", identifier.getGroup(), identifier.getName(), identifier.getVersion())); } } } return compileLibs; }
Example #4
Source File: DependencyResolutionLogger.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public void beforeResolve(ResolvableDependencies dependencies) { LinkedList<ProgressLogger> loggers = progressLoggers.get(); progressLoggers.set(loggers); ProgressLogger logger = loggerFactory.newOperation(DependencyResolutionLogger.class); logger.start(String.format("Resolve %s", dependencies), String.format("Resolving %s", dependencies)); loggers.add(logger); }
Example #5
Source File: DependencyResolutionLogger.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public void afterResolve(ResolvableDependencies dependencies) { LinkedList<ProgressLogger> loggers = progressLoggers.get(); if (loggers.isEmpty()) { throw new IllegalStateException("Logging operation was not started or it has already completed."); } ProgressLogger logger = loggers.removeLast(); logger.completed(); if (loggers.isEmpty()) { progressLoggers.remove(); } }
Example #6
Source File: DependencyResolutionLogger.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public void beforeResolve(ResolvableDependencies dependencies) { LinkedList<ProgressLogger> loggers = progressLoggers.get(); progressLoggers.set(loggers); ProgressLogger logger = loggerFactory.newOperation(DependencyResolutionLogger.class); logger.start(String.format("Resolve %s", dependencies), String.format("Resolving %s", dependencies)); loggers.add(logger); }
Example #7
Source File: DependencyResolutionLogger.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public void afterResolve(ResolvableDependencies dependencies) { LinkedList<ProgressLogger> loggers = progressLoggers.get(); if (loggers.isEmpty()) { throw new IllegalStateException("Logging operation was not started or it has already completed."); } ProgressLogger logger = loggers.removeLast(); logger.completed(); if (loggers.isEmpty()) { progressLoggers.remove(); } }
Example #8
Source File: DependencyResolutionLogger.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public void beforeResolve(ResolvableDependencies dependencies) { LinkedList<ProgressLogger> loggers = progressLoggers.get(); progressLoggers.set(loggers); ProgressLogger logger = loggerFactory.newOperation(DependencyResolutionLogger.class); logger.start(String.format("Resolve %s", dependencies), String.format("Resolving %s", dependencies)); loggers.add(logger); }
Example #9
Source File: DependencyInspector.java From play-services-plugins with Apache License 2.0 | 5 votes |
@Override public void beforeResolve(ResolvableDependencies resolvableDependencies) { // This information isn't currently useful to the plugin. // After doing testing, the only dependencies info available in // resolvableDependencies is resolvableDependencies.dependencies. // Those are the declared dependencies for task within the module. // Also, not sure if Android test tasks have already had the // dependencies de-duped by this time. }
Example #10
Source File: DependencyResolutionLogger.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public void afterResolve(ResolvableDependencies dependencies) { LinkedList<ProgressLogger> loggers = progressLoggers.get(); if (loggers.isEmpty()) { throw new IllegalStateException("Logging operation was not started or it has already completed."); } ProgressLogger logger = loggers.removeLast(); logger.completed(); if (loggers.isEmpty()) { progressLoggers.remove(); } }
Example #11
Source File: DependencyResolutionLogger.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public void beforeResolve(ResolvableDependencies dependencies) { LinkedList<ProgressLogger> loggers = progressLoggers.get(); progressLoggers.set(loggers); ProgressLogger logger = loggerFactory.newOperation(DependencyResolutionLogger.class); logger.start(String.format("Resolve %s", dependencies), String.format("Resolving %s", dependencies)); loggers.add(logger); }
Example #12
Source File: DependencyResolutionLogger.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public void afterResolve(ResolvableDependencies dependencies) { LinkedList<ProgressLogger> loggers = progressLoggers.get(); if (loggers.isEmpty()) { throw new IllegalStateException("Logging operation was not started or it has already completed."); } ProgressLogger logger = loggers.removeLast(); logger.completed(); if (loggers.isEmpty()) { progressLoggers.remove(); } }
Example #13
Source File: ProfileEventAdapter.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public void afterResolve(ResolvableDependencies dependencies) { long now = timeProvider.getCurrentTime(); buildProfile.getDependencySetProfile(dependencies.getPath()).setFinish(now); }
Example #14
Source File: DependencyInspector.java From play-services-plugins with Apache License 2.0 | 4 votes |
@Override public void afterResolve(ResolvableDependencies resolvableDependencies) { String taskName = resolvableDependencies.getName(); // Use of Product Flavors can change task names so skip tasks without compile in the name (case // in-sensitive). if (!taskName.contains("ompile")) { return; } // Phase 1: register all the dependency information from the project globally. logger.info("Registered task dependencies: " + projectName + ":" + taskName); if (resolvableDependencies.getResolutionResult() != null && resolvableDependencies.getResolutionResult().getAllDependencies() != null) { registerDependencies(resolvableDependencies, projectName, taskName); } // Phase 2: take the resolved versions of Artifacts, go get the dependencies that // apply to those specific versions, and then ensure all are being honored. logger.info("Starting dependency analysis"); ResolutionResult resolutionResult = resolvableDependencies.getResolutionResult(); // Create an Artifact to ArtifactVersion mapping for resolved components. HashMap<Artifact, ArtifactVersion> resolvedVersions = new HashMap<>(); for (ResolvedComponentResult resolvedComponentResult : resolutionResult.getAllComponents()) { ArtifactVersion version = ArtifactVersion.Companion.fromGradleRefOrNull( resolvedComponentResult.getId().toString()); if (version != null) { resolvedVersions.put(version.getArtifact(), version); } } // Quick no-op when no versions. if (resolvedVersions.size() < 1) { return; } // Retrieve dependencies that apply to the resolved dep set. Collection<Dependency> activeDeps = dependencyAnalyzer.getActiveDependencies( resolvedVersions.values()); // Validate each of the dependencies that should apply. for (Dependency dep : activeDeps) { ArtifactVersion resolvedVersion = resolvedVersions.get(dep.getToArtifact()); // Check whether dependency is still valid. if (!dep.isVersionCompatible(resolvedVersion.getVersion())) { // This means a resolved version failed a dependency rule. logger.warn("Dependency resolved to an incompatible version: " + dep); // TODO: Warn, not fail, when the Major version boundaries are breached. // TODO: Experiment with collecting all issues and reporting them at once. Collection<Node> depsPaths = dependencyAnalyzer.getPaths( resolvedVersion.getArtifact()); // Print extended path information at INFO level. logger.info("Dependency Resolution Help: Displaying all currently known " + "paths to any version of the dependency: " + dep.getToArtifact()); logger.info("NOTE: com.google.android.gms translated to c.g.a.g for brevity. " + "Same for com.google.firebase -> c.g.f"); // TODO: The depPaths nodes need to be consolidated prior to display. for (Node n : depsPaths) { printNode(1, n); } throw new GradleException(getErrorMessage(dep, resolvedVersion, depsPaths)); } } }
Example #15
Source File: ProfileEventAdapter.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public void beforeResolve(ResolvableDependencies dependencies) { long now = timeProvider.getCurrentTime(); buildProfile.getDependencySetProfile(dependencies.getPath()).setStart(now); }
Example #16
Source File: ProfileEventAdapter.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public void afterResolve(ResolvableDependencies dependencies) { long now = timeProvider.getCurrentTime(); buildProfile.getDependencySetProfile(dependencies.getPath()).setFinish(now); }
Example #17
Source File: ProfileEventAdapter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public void beforeResolve(ResolvableDependencies dependencies) { long now = timeProvider.getCurrentTime(); buildProfile.getDependencySetProfile(dependencies.getPath()).setStart(now); }
Example #18
Source File: ProfileEventAdapter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public void afterResolve(ResolvableDependencies dependencies) { long now = timeProvider.getCurrentTime(); buildProfile.getDependencySetProfile(dependencies.getPath()).setFinish(now); }
Example #19
Source File: ProfileEventAdapter.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public void beforeResolve(ResolvableDependencies dependencies) { long now = timeProvider.getCurrentTime(); buildProfile.getDependencySetProfile(dependencies.getPath()).setStart(now); }
Example #20
Source File: ProfileEventAdapter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public void beforeResolve(ResolvableDependencies dependencies) { long now = timeProvider.getCurrentTime(); buildProfile.getDependencySetProfile(dependencies.getPath()).setStart(now); }
Example #21
Source File: ProfileEventAdapter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public void afterResolve(ResolvableDependencies dependencies) { long now = timeProvider.getCurrentTime(); buildProfile.getDependencySetProfile(dependencies.getPath()).setFinish(now); }
Example #22
Source File: GradleBuildMetricsCollector.java From gradle-metrics-plugin with Apache License 2.0 | 4 votes |
@Override public void beforeResolve(ResolvableDependencies dependencies) { initializeBuildMetrics(); long now = clock.getCurrentTime(); buildMetrics.getDependencySetProfile(dependencies.getPath()).setStart(now); }
Example #23
Source File: GradleBuildMetricsCollector.java From gradle-metrics-plugin with Apache License 2.0 | 4 votes |
@Override public void afterResolve(ResolvableDependencies dependencies) { initializeBuildMetrics(); long now = clock.getCurrentTime(); buildMetrics.getDependencySetProfile(dependencies.getPath()).setFinish(now); }