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();
}
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;
}
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());
}
});
}
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();
}
});
}
});
}
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;
}
Aggregations