org.gradle.api.artifacts.ArtifactCollection Java Examples

The following examples show how to use org.gradle.api.artifacts.ArtifactCollection. 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: AtlasDependencyGraph.java    From atlas with Apache License 2.0 6 votes vote down vote up
@NonNull
private static ArtifactCollection computeArtifactList(
        @NonNull VariantScope variantScope,
        @NonNull AtlasAndroidArtifacts.ConsumedConfigType consumedConfigType,
        @NonNull AndroidArtifacts.ArtifactScope scope,
        @NonNull AtlasAndroidArtifacts.AtlasArtifactType type) {
    ArtifactCollection artifacts =
            computeArtifactCollection(variantScope,consumedConfigType, scope, type);

    // because the ArtifactCollection could be a collection over a test variant which ends
    // up being a ArtifactCollectionWithExtraArtifact, we need to get the actual list
    // without the tested artifact.
    if (artifacts instanceof ArtifactCollectionWithExtraArtifact) {
        return ((ArtifactCollectionWithExtraArtifact) artifacts).getParentArtifacts();
    }

    return artifacts;
}
 
Example #2
Source File: MergeResources.java    From javafxmobile-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
void setLibraries(ArtifactCollection libraries) {
    this.libraries = libraries;
}
 
Example #3
Source File: PlayDistributionPlugin.java    From playframework with Apache License 2.0 4 votes vote down vote up
Set<ResolvedArtifactResult> getResolvedArtifacts() {
    ArtifactCollection artifacts = configuration.getIncoming().getArtifacts();
    return artifacts.getArtifacts();
}
 
Example #4
Source File: MainArtifactsCollection.java    From atlas with Apache License 2.0 4 votes vote down vote up
public MainArtifactsCollection(ArtifactCollection fullArtifacts, Project project,String variantName) {
    this.fullArtifacts = fullArtifacts.getArtifacts();
    this.project = project;
    this.variantName = variantName;
}
 
Example #5
Source File: AppendMainArtifactsCollection.java    From atlas with Apache License 2.0 4 votes vote down vote up
public AppendMainArtifactsCollection(Project project, ArtifactCollection artifactResults, AwbBundle awbBundle, AndroidArtifacts.ArtifactType artifactType) {
    this.artifactResults = artifactResults;
    this.awbBundle = awbBundle;
    this.project = project;
    this.artifactType = artifactType;
}
 
Example #6
Source File: AtlasDependencyGraph.java    From atlas with Apache License 2.0 4 votes vote down vote up
public static ArtifactCollection computeArtifactCollection(
        VariantScope variantScope,
        @NonNull AtlasAndroidArtifacts.ConsumedConfigType configType,
        @NonNull AndroidArtifacts.ArtifactScope scope,
        @NonNull AtlasAndroidArtifacts.AtlasArtifactType artifactType) {

    Configuration configuration;
    switch (configType) {
        case COMPILE_CLASSPATH:
            configuration = variantScope.getVariantData().getVariantDependency().getCompileClasspath();
            break;
        case RUNTIME_CLASSPATH:
            configuration = variantScope.getVariantData().getVariantDependency().getRuntimeClasspath();
            break;
        case BUNDLECOMPILE_CLASSPATH:
            configuration = variantScope.getGlobalScope().getProject().getConfigurations().maybeCreate(AtlasPlugin.BUNDLE_COMPILE);
            break;
        case ANNOTATION_PROCESSOR:
            configuration = variantScope.getVariantData()
                    .getVariantDependency()
                    .getAnnotationProcessorConfiguration();
            break;
        case METADATA_VALUES:
            configuration =
                    variantScope.getVariantData().getVariantDependency().getMetadataValuesConfiguration();
            break;
        default:
            throw new RuntimeException("unknown ConfigType value");
    }

    Action<AttributeContainer> attributes =
            container -> container.attribute(ARTIFACT_TYPE, artifactType.getType());

    Spec<ComponentIdentifier> filter = getComponentFilter(scope);

    boolean lenientMode =
            Boolean.TRUE.equals(
                    variantScope.getGlobalScope().getProjectOptions().get(BooleanOption.IDE_BUILD_MODEL_ONLY));

    ArtifactCollection artifacts =  configuration
            .getIncoming()
            .artifactView(
                    config -> {
                        config.attributes(attributes);
                        if (filter != null) {
                            config.componentFilter(filter);
                        }
                        // TODO somehow read the unresolved dependencies?
                        config.lenient(lenientMode);
                    })
            .getArtifacts();

    if (configType == AtlasAndroidArtifacts.ConsumedConfigType.RUNTIME_CLASSPATH
            && variantScope.getVariantConfiguration().getType() == VariantType.FEATURE
            && artifactType != AtlasAndroidArtifacts.AtlasArtifactType.FEATURE_TRANSITIVE_DEPS) {
        artifacts =
                new FilteredArtifactCollection(
                        variantScope.getGlobalScope().getProject(),
                        artifacts,
                        computeArtifactCollection(variantScope,
                                AtlasAndroidArtifacts.ConsumedConfigType.RUNTIME_CLASSPATH,
                                scope,
                                AtlasAndroidArtifacts.AtlasArtifactType.FEATURE_TRANSITIVE_DEPS)
                                .getArtifactFiles());
    }
    return artifacts;
}