/** * Checks if the configuration has any empty annotation processors. * * @param project project on which the configuration is defined. * @param configuration Configuration which is used to query the deps. * @return A boolean whether the configuration has any empty annotation processors. */ public boolean hasEmptyAnnotationProcessors(Project project, Configuration configuration) { Map<Set<Dependency>, Scope> depToScope = createProcessorScopes(project, configuration.getAllDependencies(), false); return depToScope .values() .stream() .anyMatch(scope -> scope.getAnnotationProcessors().isEmpty()); }
createProcessorScopes(project, configuration.getAllDependencies(), false);
DependencySet dependencies = configuration.getAllDependencies(); String processorsUID = dependencies
Set<VersionlessDependency> firstLevelDependencies = configuration .getAllDependencies() .stream() .map(
public static Iterable<TaskDependency> getTaskDependencies( Configuration configuration) { Set<TaskDependency> taskDependencies = new HashSet<>(); DependencySet dependencySet = configuration.getAllDependencies(); for (ProjectDependency projectDependency : dependencySet.withType(ProjectDependency.class)) { taskDependencies.add(projectDependency.getBuildDependencies()); } return taskDependencies; }
private boolean isDirectDependency(DependencyResolveDetails details) { if (this.directDependencies == null) { Set<String> directDependencies = new HashSet<String>(); for (Dependency dependency : this.configuration.getAllDependencies()) { directDependencies.add(dependency.getGroup() + ":" + dependency.getName()); } this.directDependencies = directDependencies; } return this.directDependencies.contains(details.getRequested().getGroup() + ":" + details.getRequested().getName()); }
public void createDependencyInfoFile(CreateDependencyInfoFileTask task) { String result = "# Description" + NEWLINE + DESCRIPTION + NEWLINE + "# Dependencies"; //sorting dependencies to assure that they are always in the same order //without depending on Gradle implementation SortedSet<String> dependencies = new TreeSet<>(); for (Dependency dependency: task.getConfiguration().getAllDependencies()) { if (dependency instanceof ModuleDependency) { String dep = getDependencyWithArtifacts(task, (ModuleDependency) dependency); dependencies.add(dep); } } result += DEPENDENCY_INDENT + StringUtil.join(dependencies, DEPENDENCY_INDENT); IOUtil.writeFile(task.getOutputFile(), result.toString()); }
public void createDependencyInfoFile(CreateDependencyInfoFileTask task) { String result = "# Description" + NEWLINE + DESCRIPTION + NEWLINE + "# Dependencies"; //sorting dependencies to assure that they are always in the same order //without depending on Gradle implementation SortedSet<String> dependencies = new TreeSet<>(); for (Dependency dependency: task.getConfiguration().getAllDependencies()) { if (dependency instanceof ModuleDependency) { String dep = getDependencyWithArtifacts(task, (ModuleDependency) dependency); dependencies.add(dep); } } result += DEPENDENCY_INDENT + StringUtil.join(dependencies, DEPENDENCY_INDENT); IOUtil.writeFile(task.getOutputFile(), result.toString()); }
System.out.println("Conf: "+c); for(Dependency d: c.getAllDependencies()){ System.out.println("Dep: "+d); System.out.println("Conf: "+c); for(Dependency d: c.getAllDependencies()){ System.out.println("Dep: "+d);
@Override public void resolve(DependencyResolveContext context) { boolean transitive = isTransitive() && context.isTransitive(); if (transitive) { for (Dependency dependency : findProjectConfiguration().getAllDependencies()) { context.add(dependency); } } }
private void applyRecommendationToDependency(final RecommendationStrategyFactory factory, Dependency dependency, List<ProjectDependency> visited) { if (dependency instanceof ExternalModuleDependency) { factory.getRecommendationStrategy().inspectDependency(dependency); } else if (dependency instanceof ProjectDependency) { ProjectDependency projectDependency = (ProjectDependency) dependency; if (!visited.contains(projectDependency)) { visited.add(projectDependency); Configuration configuration; try { ProjectDependency.class.getMethod("getTargetConfiguration"); String targetConfiguration = projectDependency.getTargetConfiguration() == null ? Dependency.DEFAULT_CONFIGURATION : projectDependency.getTargetConfiguration(); configuration = projectDependency.getDependencyProject().getConfigurations().getByName(targetConfiguration); } catch (NoSuchMethodException ignore) { try { Method method = ProjectDependency.class.getMethod("getProjectConfiguration"); configuration = (Configuration) method.invoke(dependency); } catch (Exception e) { throw new RuntimeException("Unable to retrieve configuration for project dependency", e); } } DependencySet dependencies = configuration.getAllDependencies(); for (Dependency dep : dependencies) { applyRecommendationToDependency(factory, dep, visited); } } } }
private void ensureConfigured(Configuration config) { for (Dependency dependency : config.getAllDependencies()) { if (dependency instanceof ProjectDependency) { ProjectDependency projectDependency = (ProjectDependency) dependency; project.evaluationDependsOn(projectDependency.getDependencyProject().getPath()); try { ensureConfigured(projectDependency.getProjectConfiguration()); } catch (Throwable e) { throw new UnknownProjectException(String.format( "Cannot evaluate module %s : %s", projectDependency.getName(), e.getMessage()), e); } } } }
@Override public List<Buildable> call() { return getProject().getConfigurations() .getByName(getTargetConfiguration()) .getAllDependencies().stream() .filter(dependency -> dependency instanceof ProjectDependency) .flatMap(dependency -> { final ProjectDependency projectDependency = (ProjectDependency) dependency; final Project project = projectDependency.getDependencyProject(); final String configurationName = projectDependency.getTargetConfiguration(); return ConfigurationUtils.getConfiguration (project, configurationName) .getAllArtifacts().stream(); }) .collect(Collectors.toList()); } });
public static List<String> searchForEtaProjectDependencies (final Project project, final Configuration configuration) { List<String> allMavenDependencies = new ArrayList<String>(); for (Dependency dependency : configuration.getAllDependencies()) { if (dependency instanceof ProjectDependency) { final ProjectDependency projectDependency = (ProjectDependency) dependency; final Project targetProject = projectDependency.getDependencyProject(); final String targetConfiguration = projectDependency.getTargetConfiguration(); List<String> mavenDependencies; if (targetProject.getPlugins().hasPlugin(EtaBasePlugin.class)) { mavenDependencies = ConfigurationUtils.getEtaConfiguration (targetProject, targetConfiguration) .getAllResolvedDependencies(project); } else { mavenDependencies = searchForEtaProjectDependencies (project, ConfigurationUtils.getConfiguration (targetProject, targetConfiguration)); } allMavenDependencies.addAll(mavenDependencies); } } return allMavenDependencies; } }
@NonNull public Set<File> resolveAndGetJackPluginClassPath( @NonNull ErrorReporter errorReporter) { if (getJackPluginConfiguration().getAllDependencies().isEmpty()) { return Collections.emptySet(); } ResolvedConfiguration resolvedConfiguration = getJackPluginConfiguration().getResolvedConfiguration(); if (resolvedConfiguration.hasError()) { try { resolvedConfiguration.rethrowFailure(); } catch (Exception e) { errorReporter.handleSyncError( "jackPlugin", SyncIssue.TYPE_UNRESOLVED_DEPENDENCY, "Unable to find Jack plugin. " + e.getMessage()); return Collections.emptySet(); } } return getJackPluginConfiguration().getFiles(); }
private Collection<File> listProjectDepsSrcDirs(Project project) { ConfigurationContainer configs = project.getConfigurations(); Configuration compileConf = configs.getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME); DependencySet depSet = compileConf.getAllDependencies(); List<File> result = Lists.newArrayList(); for (Dependency dep : depSet) { if (dep instanceof ProjectDependency) { Project projectDependency = ((ProjectDependency) dep).getDependencyProject(); if (projectDependency.getPlugins().hasPlugin(PwtLibPlugin.class)) { JavaPluginConvention javaConvention = projectDependency.getConvention().getPlugin(JavaPluginConvention.class); SourceSet mainSourceSet = javaConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME); result.addAll(mainSourceSet.getAllSource().getSrcDirs()); } } } return result; }
private Collection<File> listProjectDepsSrcDirs(Project project) { ConfigurationContainer configs = project.getConfigurations(); Configuration compileConf = configs.getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME); DependencySet depSet = compileConf.getAllDependencies(); List<File> result = Lists.newArrayList(); for (Dependency dep : depSet) { if (dep instanceof ProjectDependency) { Project projectDependency = ((ProjectDependency) dep).getDependencyProject(); if (projectDependency.getPlugins().hasPlugin(GwtLibPlugin.class)) { JavaPluginConvention javaConvention = projectDependency.getConvention().getPlugin(JavaPluginConvention.class); SourceSet mainSourceSet = javaConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME); result.addAll(mainSourceSet.getAllSource().getSrcDirs()); } } } return result; }
private Set<DependencyCandidate> findExcludedDependencies() { DependencySet allDependencies = this.configuration.getAllDependencies(); Configuration configurationCopy = this.configurationContainer.newConfiguration( this.configurationConfigurer,
private static DependencyOverwrites collectDependenciesToOverwrite(final Configuration compileClasspath, final Configuration testCompile, final XRepoConfiguration config, final Project project) { final Configuration groupDeps = dependenciesWithinProjectGroup(testCompile, project); debug(project, "Found {} dependencies with group {}", groupDeps.getAllDependencies().size(), project.getGroup()); useSuffixedVersions(groupDeps, config, project); final DependencyOverwrites result = new DependencyOverwrites(); compileClasspath.getIncoming().beforeResolve((deps) -> { groupDeps.getResolvedConfiguration().getLenientConfiguration().getAllModuleDependencies().forEach(dep -> { if (isInSameGroup(dep.getModuleGroup(), project)) { debug(project, "Found overwritten dependency {}:{}:{}", dep.getModuleGroup(), dep.getModuleName(), dep.getModuleVersion()); result.add(dep); } }); }); return result; }
compileClasspath.getAllDependencies().withType(ProjectDependency.class, new Action<ProjectDependency>() { @Override public void execute(ProjectDependency dep) {