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

项目:gradle-project-config    文件:GroovyConfigPlugin.java   
/**
 * @see me.seeber.gradle.plugin.AbstractProjectConfigPlugin#initialize()
 */
@Override
protected void initialize() {
    getProject().getPluginManager().apply(GroovyPlugin.class);
    getProject().getPluginManager().apply(JavaConfigPlugin.class);

    DependencyHandler dependencies = getProject().getDependencies();
    ExternalDependency spock = (ExternalDependency) dependencies.add("testCompile",
            ImmutableMap.of("group", "org.spockframework", "name", "spock-core", "version", "1.0-groovy-2.4"));
    spock.exclude(ImmutableMap.of("group", "org.codehaus.groovy", "module", "groovy-all"));

    String name = Validate.notNull(getProject().getName());
    Configuration archives = getProject().getConfigurations().getByName("archives");

    Jar groovydocJar = getProject().getTasks().create("groovydocJar", Jar.class);
    PublishArtifact groovydocArtifact = Projects.createJarPublishArtifact(getProject(), name, "groovydoc", "jar",
            "jar", groovydocJar);
    archives.getArtifacts().add(groovydocArtifact);
}
项目:Reer    文件:ModuleFactoryHelper.java   
public static void addExplicitArtifactsIfDefined(ExternalDependency moduleDependency, String artifactType, String classifier) {
    String actualArtifactType = artifactType;
    if (actualArtifactType == null) {
        if (classifier != null) {
            actualArtifactType = DependencyArtifact.DEFAULT_TYPE;
        }
    } else {
        moduleDependency.setTransitive(false);
    }
    if (actualArtifactType != null) {
        moduleDependency.addArtifact(new DefaultDependencyArtifact(moduleDependency.getName(),
                actualArtifactType, actualArtifactType, classifier, null));
    }
}
项目:gradle-plugins    文件:WarOverlayPlugin.java   
private void configureOverlay(WarOverlay overlay) {

        if (overlay.isDeferProvidedConfiguration()) {
            //Delay this to trick IntelliJ
            overlay.getWarTask().doFirst(w -> overlay.getWarCopySpec().exclude(element -> overlay.isProvided()));
        } else {
            overlay.getWarCopySpec().exclude(element -> overlay.isProvided());
        }

        Object source = overlay.getSource();

        if (source instanceof AbstractArchiveTask) {
            configureOverlay(overlay, (AbstractArchiveTask) source);
        } else if (source instanceof Project && overlay.getConfigureClosure() == null) {
            configureOverlay(overlay, (Project) source);
        } else {
            Closure configClosure = overlay.getConfigureClosure();
            Dependency dependency;
            if (configClosure == null) {
                dependency = project.getDependencies().create(source);
            } else {
                dependency = project.getDependencies().create(source, configClosure);
            }

            if (dependency instanceof ProjectDependency) {
                configureOverlay(overlay, ((ProjectDependency) dependency).getDependencyProject());
            } else if (dependency instanceof ExternalDependency) {
                configureOverlay(overlay, (ExternalDependency) dependency);
            } else {
                throw new GradleException("Unsupported dependency type: " + dependency.getClass().getName());
            }
        }
    }
项目:gradle-plugins    文件:WarOverlayPlugin.java   
private void configureOverlay(WarOverlay overlay) {

        if (overlay.isDeferProvidedConfiguration()) {
            //Delay this to trick IntelliJ
            overlay.getWarTask().doFirst(w -> overlay.getWarCopySpec().exclude(element -> overlay.isProvided()));
        } else {
            overlay.getWarCopySpec().exclude(element -> overlay.isProvided());
        }

        Object source = overlay.getSource();

        if (source instanceof AbstractArchiveTask) {
            configureOverlay(overlay, (AbstractArchiveTask) source);
        } else if (source instanceof Project && overlay.getConfigureClosure() == null) {
            configureOverlay(overlay, (Project) source);
        } else {
            Closure configClosure = overlay.getConfigureClosure();
            Dependency dependency;
            if (configClosure == null) {
                dependency = project.getDependencies().create(source);
            } else {
                dependency = project.getDependencies().create(source, configClosure);
            }

            if (dependency instanceof ProjectDependency) {
                configureOverlay(overlay, ((ProjectDependency) dependency).getDependencyProject());
            } else if (dependency instanceof ExternalDependency) {
                configureOverlay(overlay, (ExternalDependency) dependency);
            } else {
                throw new GradleException("Unsupported dependency type: " + dependency.getClass().getName());
            }
        }
    }
项目:Pushjet-Android    文件:ModuleFactoryHelper.java   
public static void addExplicitArtifactsIfDefined(ExternalDependency moduleDependency, String artifactType, String classifier) {
    String actualArtifactType = artifactType;
    if (actualArtifactType == null) {
        if (classifier != null) {
            actualArtifactType = DependencyArtifact.DEFAULT_TYPE;
        }
    } else {
        moduleDependency.setTransitive(false);
    }
    if (actualArtifactType != null) {
        moduleDependency.addArtifact(new DefaultDependencyArtifact(moduleDependency.getName(),
                actualArtifactType, actualArtifactType, classifier, null));
    }
}
项目:Pushjet-Android    文件:ModuleFactoryHelper.java   
public static void addExplicitArtifactsIfDefined(ExternalDependency moduleDependency, String artifactType, String classifier) {
    String actualArtifactType = artifactType;
    if (actualArtifactType == null) {
        if (classifier != null) {
            actualArtifactType = DependencyArtifact.DEFAULT_TYPE;
        }
    } else {
        moduleDependency.setTransitive(false);
    }
    if (actualArtifactType != null) {
        moduleDependency.addArtifact(new DefaultDependencyArtifact(moduleDependency.getName(),
                actualArtifactType, actualArtifactType, classifier, null));
    }
}
项目:Pushjet-Android    文件:AbstractExternalDependency.java   
protected boolean isContentEqualsFor(ExternalDependency dependencyRhs) {
    if (!isKeyEquals(dependencyRhs) || !isCommonContentEquals(dependencyRhs)) {
        return false;
    }
    return isForce() == dependencyRhs.isForce();
}
项目:gradle-plugins    文件:WarOverlayPlugin.java   
private void configureOverlay(WarOverlay overlay, ExternalDependency dependency) {

        War warTask = overlay.getWarTask();

        String capitalizedWarTaskName = StringGroovyMethods.capitalize((CharSequence) warTask.getName());
        String capitalizedOverlayName = StringGroovyMethods.capitalize((CharSequence) overlay.getName());

        dependency.setTransitive(false);

        Configuration configuration = project.getConfigurations().create(overlay.getConfigurationName());
        configuration.setDescription(String.format("Contents of the overlay '%s' for the task '%s'.", overlay.getName(), warTask.getName()));
        configuration.getDependencies().add(dependency);

        File destinationDir = new File(project.getBuildDir(), String.format("overlays/%s/%s", warTask.getName(), overlay.getName()));
        Action<CopySpec> extractOverlay = copySpec -> {
            copySpec.into(destinationDir);
            copySpec.from((Callable<FileTree>) () -> project.zipTree(configuration.getSingleFile()));
        };

        Sync extractOverlayTask = project.getTasks().create(String.format("extract%s%sOverlay", capitalizedOverlayName, capitalizedWarTaskName), Sync.class, extractOverlay);

        overlay.getWarCopySpec().from(extractOverlayTask);

        if (overlay.isEnableCompilation()) {

            project.sync(extractOverlay);

            project.getTasks().getByName(CLEAN_TASK_NAME).finalizedBy(extractOverlayTask);

            ConfigurableFileCollection classes = project.files(new File(destinationDir, "WEB-INF/classes"))
                    .builtBy(extractOverlayTask);

            project.getDependencies().add(COMPILE_CLASSPATH_CONFIGURATION_NAME, classes);
            project.getDependencies().add(TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME, classes);

            FileTree libs = project.files(extractOverlayTask).builtBy(extractOverlayTask).getAsFileTree()
                    .matching(patternFilterable -> patternFilterable.include("WEB-INF/lib/**"));

            project.getDependencies().add(COMPILE_CLASSPATH_CONFIGURATION_NAME, libs);
            project.getDependencies().add(TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME, libs);
        }
    }
项目:gradle-plugins    文件:WarOverlayPlugin.java   
private void configureOverlay(WarOverlay overlay, ExternalDependency dependency) {

        War warTask = overlay.getWarTask();

        String capitalizedWarTaskName = StringGroovyMethods.capitalize((CharSequence) warTask.getName());
        String capitalizedOverlayName = StringGroovyMethods.capitalize((CharSequence) overlay.getName());

        dependency.setTransitive(false);

        Configuration configuration = project.getConfigurations().create(overlay.getConfigurationName());
        configuration.setDescription(String.format("Contents of the overlay '%s' for the task '%s'.", overlay.getName(), warTask.getName()));
        configuration.getDependencies().add(dependency);

        File destinationDir = new File(project.getBuildDir(), String.format("overlays/%s/%s", warTask.getName(), overlay.getName()));
        Action<CopySpec> extractOverlay = copySpec -> {
            copySpec.into(destinationDir);
            copySpec.from((Callable<FileTree>) () -> project.zipTree(configuration.getSingleFile()));
        };

        Sync extractOverlayTask = project.getTasks().create(String.format("extract%s%sOverlay", capitalizedOverlayName, capitalizedWarTaskName), Sync.class, extractOverlay);

        overlay.getWarCopySpec().from(extractOverlayTask);

        if (overlay.isEnableCompilation()) {

            project.sync(extractOverlay);

            project.getTasks().getByName(CLEAN_TASK_NAME).finalizedBy(extractOverlayTask);

            ConfigurableFileCollection classes = project.files(new File(destinationDir, "WEB-INF/classes"))
                    .builtBy(extractOverlayTask);

            project.getDependencies().add(COMPILE_CLASSPATH_CONFIGURATION_NAME, classes);
            project.getDependencies().add(TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME, classes);

            FileTree libs = project.files(extractOverlayTask).builtBy(extractOverlayTask).getAsFileTree()
                    .matching(patternFilterable -> patternFilterable.include("WEB-INF/lib/**"));

            project.getDependencies().add(COMPILE_CLASSPATH_CONFIGURATION_NAME, libs);
            project.getDependencies().add(TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME, libs);
        }
    }
项目:Reer    文件:ExternalModuleDependencyTranslator.java   
List<ExternalDependency> translate(Set<ResolvedDependency> resolvedDependencies);
项目:Pushjet-Android    文件:ExternalModuleDependencyTranslator.java   
List<ExternalDependency> translate(Set<ResolvedDependency> resolvedDependencies);
项目:Pushjet-Android    文件:ExternalModuleDependencyTranslator.java   
List<ExternalDependency> translate(Set<ResolvedDependency> resolvedDependencies);