Search in sources :

Example 51 with Configuration

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

the class DefaultConfigurationContainer method dump.

/**
     * Build a formatted representation of all Configurations in this ConfigurationContainer.
     * Configuration(s) being toStringed are likely derivations of DefaultConfiguration.
     */
public String dump() {
    StringBuilder reply = new StringBuilder();
    reply.append("Configuration of type: " + getTypeDisplayName());
    Collection<? extends Configuration> configs = getAll();
    for (Configuration c : configs) {
        reply.append("\n  " + c.toString());
    }
    return reply.toString();
}
Also used : Configuration(org.gradle.api.artifacts.Configuration)

Example 52 with Configuration

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

the class JsHintPlugin method addConfiguration.

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;
}
Also used : Configuration(org.gradle.api.artifacts.Configuration) DependencySet(org.gradle.api.artifacts.DependencySet) Dependency(org.gradle.api.artifacts.Dependency)

Example 53 with Configuration

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

the class RhinoPlugin method apply.

public void apply(Project project) {
    project.getPluginManager().apply(JavaScriptBasePlugin.class);
    JavaScriptExtension jsExtension = project.getExtensions().findByType(JavaScriptExtension.class);
    final RhinoExtension rhinoExtension = ((ExtensionAware) jsExtension).getExtensions().create(RhinoExtension.NAME, RhinoExtension.class);
    final Configuration configuration = addClasspathConfiguration(project.getConfigurations());
    configureDefaultRhinoDependency(configuration, project.getDependencies(), rhinoExtension);
    ConventionMapping conventionMapping = ((IConventionAware) rhinoExtension).getConventionMapping();
    conventionMapping.map("classpath", new Callable<Configuration>() {

        public Configuration call() {
            return configuration;
        }
    });
    conventionMapping.map("version", new Callable<String>() {

        public String call() {
            return RhinoExtension.DEFAULT_RHINO_DEPENDENCY_VERSION;
        }
    });
    project.getTasks().withType(RhinoShellExec.class, new Action<RhinoShellExec>() {

        public void execute(RhinoShellExec task) {
            task.getConventionMapping().map("classpath", new Callable<FileCollection>() {

                public FileCollection call() {
                    return rhinoExtension.getClasspath();
                }
            });
            task.getConventionMapping().map("main", new Callable<String>() {

                public String call() {
                    return RhinoExtension.RHINO_SHELL_MAIN;
                }
            });
            task.setClasspath(rhinoExtension.getClasspath());
        }
    });
}
Also used : Configuration(org.gradle.api.artifacts.Configuration) JavaScriptExtension(org.gradle.plugins.javascript.base.JavaScriptExtension) ConventionMapping(org.gradle.api.internal.ConventionMapping) IConventionAware(org.gradle.api.internal.IConventionAware) Callable(java.util.concurrent.Callable)

Example 54 with Configuration

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

the class CoffeeScriptBasePlugin method apply.

public void apply(Project project) {
    project.getPluginManager().apply(RhinoPlugin.class);
    JavaScriptExtension jsExtension = project.getExtensions().getByType(JavaScriptExtension.class);
    ExtensionContainer extensionContainer = ((ExtensionAware) jsExtension).getExtensions();
    final CoffeeScriptExtension csExtension = extensionContainer.create(CoffeeScriptExtension.NAME, CoffeeScriptExtension.class);
    final Configuration jsConfiguration = addJsConfiguration(project.getConfigurations(), project.getDependencies(), csExtension);
    ConventionMapping conventionMapping = ((IConventionAware) csExtension).getConventionMapping();
    conventionMapping.map("js", new Callable<Configuration>() {

        @Override
        public Configuration call() {
            return jsConfiguration;
        }
    });
    conventionMapping.map("version", new Callable<String>() {

        @Override
        public String call() {
            return CoffeeScriptExtension.DEFAULT_JS_DEPENDENCY_VERSION;
        }
    });
    final RhinoExtension rhinoExtension = extensionContainer.getByType(RhinoExtension.class);
    project.getTasks().withType(CoffeeScriptCompile.class, new Action<CoffeeScriptCompile>() {

        @Override
        public void execute(CoffeeScriptCompile task) {
            task.getConventionMapping().map("rhinoClasspath", new Callable<FileCollection>() {

                public FileCollection call() {
                    return rhinoExtension.getClasspath();
                }
            });
            task.getConventionMapping().map("coffeeScriptJs", new Callable<FileCollection>() {

                public FileCollection call() {
                    return csExtension.getJs();
                }
            });
        }
    });
}
Also used : Configuration(org.gradle.api.artifacts.Configuration) RhinoExtension(org.gradle.plugins.javascript.rhino.RhinoExtension) JavaScriptExtension(org.gradle.plugins.javascript.base.JavaScriptExtension) ConventionMapping(org.gradle.api.internal.ConventionMapping) ExtensionContainer(org.gradle.api.plugins.ExtensionContainer) Callable(java.util.concurrent.Callable) ExtensionAware(org.gradle.api.plugins.ExtensionAware) IConventionAware(org.gradle.api.internal.IConventionAware)

Example 55 with Configuration

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

the class EnvJsPlugin method addConfiguration.

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;
}
Also used : Configuration(org.gradle.api.artifacts.Configuration) DependencySet(org.gradle.api.artifacts.DependencySet) Dependency(org.gradle.api.artifacts.Dependency)

Aggregations

Configuration (org.gradle.api.artifacts.Configuration)65 File (java.io.File)8 Project (org.gradle.api.Project)8 ConfigurationContainer (org.gradle.api.artifacts.ConfigurationContainer)8 Dependency (org.gradle.api.artifacts.Dependency)7 DependencySet (org.gradle.api.artifacts.DependencySet)7 Callable (java.util.concurrent.Callable)6 ConventionMapping (org.gradle.api.internal.ConventionMapping)5 IConventionAware (org.gradle.api.internal.IConventionAware)5 LinkedHashSet (java.util.LinkedHashSet)4 ResolvedConfiguration (org.gradle.api.artifacts.ResolvedConfiguration)4 ResolvedProjectConfiguration (org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedProjectConfiguration)4 JavaScriptExtension (org.gradle.plugins.javascript.base.JavaScriptExtension)4 ModuleVersionIdentifier (org.gradle.api.artifacts.ModuleVersionIdentifier)3 PublishArtifact (org.gradle.api.artifacts.PublishArtifact)3 DependencyResult (org.gradle.api.artifacts.result.DependencyResult)3 FileCollection (org.gradle.api.file.FileCollection)3 ArchivePublishArtifact (org.gradle.api.internal.artifacts.publish.ArchivePublishArtifact)3 DefaultArtifactPublicationSet (org.gradle.api.internal.plugins.DefaultArtifactPublicationSet)3 DslObject (org.gradle.api.internal.plugins.DslObject)3