Java 类org.gradle.api.artifacts.DependencySet 实例源码

项目:Reer    文件:DefaultConfiguration.java   
@Override
public void triggerWhenEmptyActionsIfNecessary() {
    if (!defaultDependencyActions.isEmpty()) {
        for (Action<? super DependencySet> action : defaultDependencyActions) {
            if (!dependencies.isEmpty()) {
                break;
            }
            action.execute(dependencies);
        }
    }
    // Discard actions
    defaultDependencyActions.clear();
    for (Configuration superConfig : extendsFrom) {
        ((ConfigurationInternal) superConfig).triggerWhenEmptyActionsIfNecessary();
    }
}
项目:Reer    文件:JacocoPlugin.java   
/**
 * Configures the classpath for Jacoco tasks using the 'jacocoAnt' configuration. Uses the version information declared in 'toolVersion' of the Jacoco extension if no dependencies are explicitly
 * declared.
 *
 * @param extension the JacocoPluginExtension
 */
private void configureTaskClasspathDefaults(final JacocoPluginExtension extension) {
    final Configuration config = this.project.getConfigurations().getAt(ANT_CONFIGURATION_NAME);
    project.getTasks().withType(JacocoBase.class, new Action<JacocoBase>() {
        @Override
        public void execute(JacocoBase task) {
            ((IConventionAware) task).getConventionMapping().map("jacocoClasspath", Callables.returning(config));
        }
    });
    config.defaultDependencies(new Action<DependencySet>() {
        @Override
        public void execute(DependencySet dependencies) {
            dependencies.add(project.getDependencies().create("org.jacoco:org.jacoco.ant:" + extension.getToolVersion()));
        }
    });
}
项目:putnami-gradle-plugin    文件:CodeServerBuilder.java   
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;
}
项目:Pushjet-Android    文件:SonarRunnerPlugin.java   
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);
                    }
                }
            });
}
项目:ARCHIVE-wildfly-swarm    文件:GradleArtifactResolvingHelper.java   
private Set<ResolvedDependency> doResolve(final Collection<ArtifactSpec> deps) {
    final Configuration config = this.project.getConfigurations().detachedConfiguration();
    final DependencySet dependencySet = config.getDependencies();

    deps.forEach(spec -> {
        final DefaultExternalModuleDependency d =
                new DefaultExternalModuleDependency(spec.groupId(), spec.artifactId(), spec.version());
        final DefaultDependencyArtifact da =
                new DefaultDependencyArtifact(spec.artifactId(), spec.type(), spec.type(), spec.classifier(), null);
        d.addArtifact(da);
        d.getExcludeRules().add(new DefaultExcludeRule());
        dependencySet.add(d);
    });

    return config.getResolvedConfiguration().getFirstLevelModuleDependencies();
}
项目:gradle-defaults    文件:MavenPublishPublications.java   
private static void dependencies(Node node, Project project) {
    final Configuration runtime = project.getConfigurations().findByName("runtime");
    if (runtime != null) {
        final DependencySet allDependencies = runtime.getAllDependencies();
        if (!allDependencies.isEmpty()) {
            final Node dependenciesNode = node.appendNode("dependencies");
            for (Dependency dependency : allDependencies) {
                if (dependency.getGroup() != null) {
                    final Node dependencyNode = dependenciesNode.appendNode("dependency");
                    dependencyNode.appendNode("groupId", dependency.getGroup());
                    dependencyNode.appendNode("artifactId", dependency.getName());
                    dependencyNode.appendNode("version", dependency.getVersion());
                }
                else {
                    LOG.warn("There is a \"null\" dependency (likely pointing directly to a file): ignoring it for the POM generation for {}", project);
                }
            }
        }
        else {
            LOG.info("There are no dependencies in the \"runtime\" configuration for {}", project);
        }
    }
    else {
        LOG.info("There is no \"runtime\" configuration, so not adding any dependencies to the generated POM for {}", project);
    }
}
项目:Reer    文件:JDependPlugin.java   
private void configureDefaultDependencies(Configuration configuration) {
    configuration.defaultDependencies(new Action<DependencySet>() {
        @Override
        public void execute(DependencySet dependencies) {
            dependencies.add(project.getDependencies().create("jdepend:jdepend:" + extension.getToolVersion()));
            dependencies.add(project.getDependencies().create("org.apache.ant:ant-jdepend:1.9.6"));
        }
    });
}
项目:Reer    文件:PmdPlugin.java   
private void configureDefaultDependencies(Configuration configuration) {
    configuration.defaultDependencies(new Action<DependencySet>() {
        @Override
        public void execute(DependencySet dependencies) {
            VersionNumber version = VersionNumber.parse(extension.getToolVersion());
            String dependency = calculateDefaultDependencyNotation(version);
            dependencies.add(project.getDependencies().create(dependency));
        }
    });
}
项目:Reer    文件:FindBugsPlugin.java   
private void configureDefaultDependencies(Configuration configuration) {
    configuration.defaultDependencies(new Action<DependencySet>() {
        @Override
        public void execute(DependencySet dependencies) {
            dependencies.add(project.getDependencies().create("com.google.code.findbugs:findbugs:" + extension.getToolVersion()));
        }
    });
}
项目:Reer    文件:CheckstylePlugin.java   
private void configureDefaultDependencies(Configuration configuration) {
    configuration.defaultDependencies(new Action<DependencySet>() {
        @Override
        public void execute(DependencySet dependencies) {
            dependencies.add(project.getDependencies().create("com.puppycrawl.tools:checkstyle:" + extension.getToolVersion()));
        }
    });
}
项目:Reer    文件:CodeNarcPlugin.java   
private void configureDefaultDependencies(Configuration configuration) {
    configuration.defaultDependencies(new Action<DependencySet>() {
        @Override
        public void execute(DependencySet dependencies) {
            dependencies.add(project.getDependencies().create("org.codenarc:CodeNarc:" + extension.getToolVersion()));
        }
    });
}
项目:Reer    文件:RhinoPlugin.java   
public void configureDefaultRhinoDependency(Configuration configuration, final DependencyHandler dependencyHandler, final RhinoExtension extension) {
    configuration.defaultDependencies(new Action<DependencySet>() {
        public void execute(DependencySet dependencies) {
            Dependency dependency = dependencyHandler.create(RhinoExtension.DEFAULT_RHINO_DEPENDENCY_GROUP + ":" + RhinoExtension.DEFAULT_RHINO_DEPENDENCY_MODULE + ":" + extension.getVersion());
            dependencies.add(dependency);
        }
    });
}
项目:Reer    文件:JsHintPlugin.java   
public Configuration addConfiguration(ConfigurationContainer configurations, final DependencyHandler dependencies, final JsHintExtension extension) {
    Configuration configuration = configurations.create(JsHintExtension.CONFIGURATION_NAME);
    configuration.defaultDependencies(new Action<DependencySet>() {
        @Override
        public void execute(DependencySet configDependencies) {
            String notation = JsHintExtension.DEFAULT_DEPENDENCY_GROUP + ":" + JsHintExtension.DEFAULT_DEPENDENCY_MODULE + ":" + extension.getVersion() + "@js";
            Dependency dependency = dependencies.create(notation);
            configDependencies.add(dependency);
        }
    });
    return configuration;
}
项目:Reer    文件:EnvJsPlugin.java   
public Configuration addConfiguration(ConfigurationContainer configurations, final DependencyHandler dependencies, final EnvJsExtension extension) {
    Configuration configuration = configurations.create(EnvJsExtension.CONFIGURATION_NAME);
    configuration.defaultDependencies(new Action<DependencySet>() {
        @Override
        public void execute(DependencySet configDependencies) {
            String notation = EnvJsExtension.DEFAULT_DEPENDENCY_GROUP + ":" + EnvJsExtension.DEFAULT_DEPENDENCY_MODULE + ":" + extension.getVersion() + "@js";
            Dependency dependency = dependencies.create(notation);
            configDependencies.add(dependency);
        }

    });
    return configuration;
}
项目:Reer    文件:CoffeeScriptBasePlugin.java   
private Configuration addJsConfiguration(ConfigurationContainer configurations, final DependencyHandler dependencies, final CoffeeScriptExtension extension) {
    Configuration configuration = configurations.create(CoffeeScriptExtension.JS_CONFIGURATION_NAME);
    configuration.defaultDependencies(new Action<DependencySet>() {
        @Override
        public void execute(DependencySet configDependencies) {
            String notation = CoffeeScriptExtension.DEFAULT_JS_DEPENDENCY_GROUP + ":" + CoffeeScriptExtension.DEFAULT_JS_DEPENDENCY_MODULE + ":" + extension.getVersion() + "@js";
            Dependency dependency = dependencies.create(notation);
            configDependencies.add(dependency);
        }
    });
    return configuration;
}
项目:Reer    文件:JacocoPlugin.java   
/**
 * Configures the agent dependencies using the 'jacocoAnt' configuration. Uses the version declared in 'toolVersion' of the Jacoco extension if no dependencies are explicitly declared.
 *
 * @param extension the extension that has the tool version to use
 */
private void configureAgentDependencies(JacocoAgentJar jacocoAgentJar, final JacocoPluginExtension extension) {
    Configuration config = project.getConfigurations().getAt(AGENT_CONFIGURATION_NAME);
    ((IConventionAware) jacocoAgentJar).getConventionMapping().map("agentConf", Callables.returning(config));
    config.defaultDependencies(new Action<DependencySet>() {
        @Override
        public void execute(DependencySet dependencies) {
            dependencies.add(project.getDependencies().create("org.jacoco:org.jacoco.agent:" + extension.getToolVersion()));
        }
    });
}
项目:atlas    文件:UpdatePomTask.java   
private Map<String, DependencyExtraInfo> getExtraMap() {

        Map<String, DependencyExtraInfo> dependencyExtraInfoMap = new HashMap<>();

        DependencySet dependencies = project.getConfigurations().getByName("compile").getDependencies();

        dependencies.forEach(new Consumer<Dependency>() {
            @Override
            public void accept(Dependency dependency) {

                String group = dependency.getGroup();
                String name = dependency.getName();
                String scope = "compile";
                String type = "";
                if (dependency instanceof DefaultProjectDependency) {
                    DefaultProjectDependency projectDependency = (DefaultProjectDependency)dependency;
                    if (projectDependency.getDependencyProject().getPlugins().hasPlugin(LibraryPlugin.class)) {
                        type = "aar";
                    }
                }

                dependencyExtraInfoMap.put(group + ":" + name, new DependencyExtraInfo(type, scope));

            }
        });

        return dependencyExtraInfoMap;

    }
项目:wildfly-swarm    文件:GradleArtifactResolvingHelper.java   
private Collection<ResolvedArtifact> doResolve(final Collection<ArtifactSpec> deps, boolean transitive) {
    final Configuration config = this.project.getConfigurations().detachedConfiguration().setTransitive(transitive);
    final DependencySet dependencySet = config.getDependencies();

    deps.forEach(spec -> {
        if (projects.containsKey(spec.groupId() + ":" + spec.artifactId() + ":" + spec.version())) {
            dependencySet.add(new DefaultProjectDependency((ProjectInternal) projects.get(spec.groupId() + ":" + spec.artifactId() + ":" + spec.version()), new DefaultProjectAccessListener(), false));
        } else {
            final DefaultExternalModuleDependency d =
                    new DefaultExternalModuleDependency(spec.groupId(), spec.artifactId(), spec.version());
            final DefaultDependencyArtifact da =
                    new DefaultDependencyArtifact(spec.artifactId(), spec.type(), spec.type(), spec.classifier(), null);
            d.addArtifact(da);
            dependencySet.add(d);
        }
    });

    if (transitive) {
        return config
                .getResolvedConfiguration()
                .getResolvedArtifacts();
    }

    return config
            .getResolvedConfiguration()
            .getFirstLevelModuleDependencies()
            .stream()
            .map(dep -> dep.getModuleArtifacts())
            .flatMap(artifacts -> artifacts.stream())
            .collect(Collectors.toList());
}
项目:javaccPlugin    文件:JavaccPlugin.java   
private void configureDefaultJavaccDependency(final Project project, Configuration configuration) {
    configuration.defaultDependencies(new Action<DependencySet>() {
        @Override
        public void execute(DependencySet dependencies) {
            dependencies.add(project.getDependencies().create("net.java.dev.javacc:javacc:6.1.2"));
        }
    });
}
项目:Reer    文件:TasksFromProjectDependencies.java   
public TasksFromProjectDependencies(String taskName, DependencySet dependencies, ProjectAccessListener projectAccessListener) {
    this.taskName = taskName;
    this.dependencies = dependencies;
    this.projectAccessListener = projectAccessListener;
}
项目:Reer    文件:DefaultConfiguration.java   
@Override
public Configuration defaultDependencies(Action<? super DependencySet> action) {
    validateMutation(MutationType.DEPENDENCIES);
    this.defaultDependencyActions.add(action);
    return this;
}
项目:Reer    文件:DefaultConfiguration.java   
public DependencySet getDependencies() {
    return dependencies;
}
项目:Reer    文件:DefaultConfiguration.java   
public DependencySet getAllDependencies() {
    return allDependencies;
}
项目:Reer    文件:DefaultConfiguration.java   
public DependencySet getDependencies() {
    return getAllDependencies();
}
项目:Reer    文件:UnresolvableConfigurationResult.java   
@Override
public Set<? extends RenderableDependency> getChildren() {
    final DependencySet dependencies = configuration.getDependencies();
    if (dependencies.isEmpty()) {
        return Collections.emptySet();
    }
    Set<RenderableDependency> children = Sets.newLinkedHashSet();
    for (final Dependency dependency : dependencies) {
        children.add(new RenderableDependency() {
            @Override
            public Object getId() {
                return dependency;
            }

            @Override
            public String getName() {
                String label;
                if (dependency instanceof ProjectDependency) {
                    label = "project " + dependency.getName();
                } else {
                    label = Joiner.on(":").join(Iterables.filter(Arrays.asList(dependency.getGroup(), dependency.getName(), dependency.getVersion()), Predicates.<String>notNull()));
                }
                return label;
            }

            @Override
            public String getDescription() {
                return null;
            }

            @Override
            public ResolutionState getResolutionState() {
                return ResolutionState.UNRESOLVED;
            }

            @Override
            public Set<? extends RenderableDependency> getChildren() {
                return Collections.emptySet();
            }
        });
    }
    return children;
}
项目:Reer    文件:JavaLibrary.java   
public JavaLibrary(PublishArtifact jarArtifact, DependencySet runtimeDependencies) {
    artifacts.add(jarArtifact);
    this.runtimeDependencies = runtimeDependencies;
}
项目:atlas    文件:AndroidComponent.java   
public AndroidComponent(Configuration compileConfiguration, DependencySet compileDependencies) {
    this.compileConfiguration = compileConfiguration;
    this.compileDependencies = compileDependencies;
}
项目:Pushjet-Android    文件:TasksFromProjectDependencies.java   
public TasksFromProjectDependencies(String taskName, DependencySet dependencies) {
    this.taskName = taskName;
    this.dependencies = dependencies;
}
项目:Pushjet-Android    文件:JavaLibrary.java   
public JavaLibrary(PublishArtifact jarArtifact, DependencySet runtimeDependencies) {
    artifacts.add(jarArtifact);
    this.runtimeDependencies = runtimeDependencies;
}
项目:Pushjet-Android    文件:JavaLibrary.java   
public JavaLibrary(PublishArtifact jarArtifact, DependencySet runtimeDependencies) {
    artifacts.add(jarArtifact);
    this.runtimeDependencies = runtimeDependencies;
}
项目:atlas    文件:AtlasProjectDependencyManager.java   
public static void addProjectDependency(Project project, String variantName) {

        Task task = project.getTasks().findByName("prepare" + variantName + "Dependencies");

        if (null == task){
            return;
        }

        DependencySet dependencies = project.getConfigurations().getByName(
            AtlasPlugin.BUNDLE_COMPILE).getDependencies();

        if (null == dependencies){
            return;
        }

        dependencies.forEach(new Consumer<Dependency>() {
            @Override
            public void accept(Dependency dependency) {
                if (dependency instanceof  DefaultProjectDependency){

                    Project subProject = ((DefaultProjectDependency)dependency).getDependencyProject();

                    Task assembleTask = subProject.getTasks().findByName("assembleRelease");

                    task.dependsOn(assembleTask);

                }
            }
        });

    }