use of org.gradle.plugins.javascript.rhino.RhinoExtension in project gradle by gradle.
the class JsHintPlugin method apply.
public void apply(Project project) {
project.getPluginManager().apply(RhinoPlugin.class);
project.getPluginManager().apply(ReportingBasePlugin.class);
JavaScriptExtension jsExtension = project.getExtensions().getByType(JavaScriptExtension.class);
final JsHintExtension jsHintExtension = ((ExtensionAware) jsExtension).getExtensions().create(JsHintExtension.NAME, JsHintExtension.class);
final Configuration configuration = addConfiguration(project.getConfigurations(), project.getDependencies(), jsHintExtension);
ConventionMapping conventionMapping = ((IConventionAware) jsHintExtension).getConventionMapping();
conventionMapping.map("js", new Callable<Configuration>() {
public Configuration call() {
return configuration;
}
});
conventionMapping.map("version", new Callable<String>() {
public String call() {
return JsHintExtension.DEFAULT_DEPENDENCY_VERSION;
}
});
final RhinoExtension rhinoExtension = ((ExtensionAware) jsExtension).getExtensions().getByType(RhinoExtension.class);
final ReportingExtension reportingExtension = project.getExtensions().getByType(ReportingExtension.class);
project.getTasks().withType(JsHint.class, new Action<JsHint>() {
public void execute(final JsHint task) {
task.getConventionMapping().map("rhinoClasspath", new Callable<FileCollection>() {
public FileCollection call() {
return rhinoExtension.getClasspath();
}
});
task.getConventionMapping().map("jsHint", new Callable<FileCollection>() {
public FileCollection call() {
return jsHintExtension.getJs();
}
});
task.getConventionMapping().map("jsonReport", new Callable<File>() {
public File call() {
return reportingExtension.file(task.getName() + "/report.json");
}
});
}
});
}
use of org.gradle.plugins.javascript.rhino.RhinoExtension in project gradle by gradle.
the class EnvJsPlugin method apply.
public void apply(final Project project) {
project.getPluginManager().apply(RhinoPlugin.class);
project.getPluginManager().apply(ReportingBasePlugin.class);
JavaScriptExtension jsExtension = project.getExtensions().getByType(JavaScriptExtension.class);
final EnvJsExtension envJsExtension = ((ExtensionAware) jsExtension).getExtensions().create(EnvJsExtension.NAME, EnvJsExtension.class);
final Configuration configuration = addConfiguration(project.getConfigurations(), project.getDependencies(), envJsExtension);
final ConventionMapping conventionMapping = ((IConventionAware) envJsExtension).getConventionMapping();
conventionMapping.map("js", new Callable<Configuration>() {
public Configuration call() {
return configuration;
}
});
conventionMapping.map("version", new Callable<String>() {
public String call() {
return EnvJsExtension.DEFAULT_DEPENDENCY_VERSION;
}
});
final RhinoExtension rhinoExtension = ((ExtensionAware) jsExtension).getExtensions().getByType(RhinoExtension.class);
project.getTasks().withType(BrowserEvaluate.class, new Action<BrowserEvaluate>() {
public void execute(BrowserEvaluate task) {
((IConventionAware) task).getConventionMapping().map("evaluator", new Callable<EnvJsBrowserEvaluator>() {
public EnvJsBrowserEvaluator call() {
RhinoWorkerHandleFactory handleFactory = new DefaultRhinoWorkerHandleFactory(workerProcessBuilderFactory);
File workDir = project.getProjectDir();
Factory<File> envJsFactory = new Factory<File>() {
public File create() {
return envJsExtension.getJs().getSingleFile();
}
};
return new EnvJsBrowserEvaluator(handleFactory, rhinoExtension.getClasspath(), envJsFactory, project.getGradle().getStartParameter().getLogLevel(), workDir);
}
});
}
});
}
use of org.gradle.plugins.javascript.rhino.RhinoExtension 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();
}
});
}
});
}
Aggregations