Search in sources :

Example 81 with Configuration

use of org.gradle.api.artifacts.Configuration in project gradle by gradle.

the class ArtifactRepositoriesPluginResolver method exists.

/*
     * Checks whether the plugin marker artifact exists in the backing artifacts repositories.
     */
private boolean exists(ModuleDependency dependency) {
    ConfigurationContainer configurations = resolution.getConfigurationContainer();
    Configuration configuration = configurations.detachedConfiguration(dependency);
    configuration.setTransitive(false);
    return !configuration.getResolvedConfiguration().hasError();
}
Also used : Configuration(org.gradle.api.artifacts.Configuration) ConfigurationContainer(org.gradle.api.artifacts.ConfigurationContainer)

Example 82 with Configuration

use of org.gradle.api.artifacts.Configuration in project gradle by gradle.

the class JavaPlugin method addDependsOnTaskInOtherProjects.

/**
 * Adds a dependency on tasks with the specified name in other projects.  The other projects are determined from
 * project lib dependencies using the specified configuration name. These may be projects this project depends on or
 * projects that depend on this project based on the useDependOn argument.
 *
 * @param task Task to add dependencies to
 * @param useDependedOn if true, add tasks from projects this project depends on, otherwise use projects that depend on this one.
 * @param otherProjectTaskName name of task in other projects
 * @param configurationName name of configuration to use to find the other projects
 */
private void addDependsOnTaskInOtherProjects(final Task task, boolean useDependedOn, String otherProjectTaskName, String configurationName) {
    Project project = task.getProject();
    final Configuration configuration = project.getConfigurations().getByName(configurationName);
    task.dependsOn(configuration.getTaskDependencyFromProjectDependency(useDependedOn, otherProjectTaskName));
}
Also used : Project(org.gradle.api.Project) Configuration(org.gradle.api.artifacts.Configuration)

Example 83 with Configuration

use of org.gradle.api.artifacts.Configuration in project gradle by gradle.

the class DefaultCppSharedLibrary method getUsages.

@Override
public Set<? extends UsageContext> getUsages() {
    Configuration linkElements = getLinkElements().get();
    Configuration runtimeElements = getRuntimeElements().get();
    return Sets.newHashSet(new DefaultUsageContext(getIdentity().getLinkUsageContext(), linkElements.getAllArtifacts(), linkElements), new DefaultUsageContext(getIdentity().getRuntimeUsageContext(), runtimeElements.getAllArtifacts(), runtimeElements));
}
Also used : Configuration(org.gradle.api.artifacts.Configuration)

Example 84 with Configuration

use of org.gradle.api.artifacts.Configuration in project gradle by gradle.

the class DefaultSwiftStaticLibrary method getUsages.

@Override
public Set<? extends UsageContext> getUsages() {
    Configuration linkElements = getLinkElements().get();
    Configuration runtimeElements = getRuntimeElements().get();
    return Sets.newHashSet(// TODO: Does a static library have runtime elements?
    new DefaultUsageContext(getIdentity().getLinkUsageContext(), linkElements.getAllArtifacts(), linkElements), new DefaultUsageContext(getIdentity().getRuntimeUsageContext(), runtimeElements.getAllArtifacts(), runtimeElements));
}
Also used : Configuration(org.gradle.api.artifacts.Configuration) DefaultUsageContext(org.gradle.language.cpp.internal.DefaultUsageContext)

Example 85 with Configuration

use of org.gradle.api.artifacts.Configuration in project meecrowave by apache.

the class MeecrowaveTask method createLoader.

private ClassLoader createLoader(final ClassLoader parent) {
    final Collection<URL> urls = new LinkedHashSet<>(64);
    addFiles(modules, urls);
    for (final Configuration cc : getProject().getConfigurations()) {
        if (applicationScopes.contains(cc.getName())) {
            addFiles(cc.getFiles(), urls);
        }
    }
    addFiles(classpath.getFiles(), urls);
    // use JVM loader to avoid the noise of gradle and its plugins
    return new URLClassLoader(urls.toArray(new URL[urls.size()]), new FilterGradleClassLoader(parent, classloaderFilteredPackages));
}
Also used : LinkedHashSet(java.util.LinkedHashSet) FilterGradleClassLoader(org.apache.meecrowave.gradle.classloader.FilterGradleClassLoader) Configuration(org.gradle.api.artifacts.Configuration) URLClassLoader(java.net.URLClassLoader) URL(java.net.URL)

Aggregations

Configuration (org.gradle.api.artifacts.Configuration)85 Project (org.gradle.api.Project)11 ConfigurationContainer (org.gradle.api.artifacts.ConfigurationContainer)11 File (java.io.File)10 Dependency (org.gradle.api.artifacts.Dependency)10 Callable (java.util.concurrent.Callable)9 ResolvedConfiguration (org.gradle.api.artifacts.ResolvedConfiguration)9 ResolvedProjectConfiguration (org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedProjectConfiguration)9 DependencySet (org.gradle.api.artifacts.DependencySet)8 DefaultLenientConfiguration (org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration)7 LinkedHashSet (java.util.LinkedHashSet)6 Usage (org.gradle.api.attributes.Usage)6 Action (org.gradle.api.Action)5 ConventionMapping (org.gradle.api.internal.ConventionMapping)5 PublishArtifact (org.gradle.api.artifacts.PublishArtifact)4 IConventionAware (org.gradle.api.internal.IConventionAware)4 ArchivePublishArtifact (org.gradle.api.internal.artifacts.publish.ArchivePublishArtifact)4 DefaultUsageContext (org.gradle.language.cpp.internal.DefaultUsageContext)4 Set (java.util.Set)3 FileCollectionDependency (org.gradle.api.artifacts.FileCollectionDependency)3