use of org.gradle.groovy.scripts.TextResourceScriptSource in project gradle by gradle.
the class InitScriptHandler method executeScripts.
public void executeScripts(final GradleInternal gradle) {
final List<File> initScripts = gradle.getStartParameter().getAllInitScripts();
if (initScripts.isEmpty()) {
return;
}
buildOperationExecutor.run(new RunnableBuildOperation() {
@Override
public void run(BuildOperationContext context) {
BasicTextResourceLoader resourceLoader = new BasicTextResourceLoader();
for (File script : initScripts) {
TextResource resource = resourceLoader.loadFile("initialization script", script);
processor.process(new TextResourceScriptSource(resource), gradle);
}
}
@Override
public BuildOperationDescriptor.Builder description() {
return BuildOperationDescriptor.displayName("Run init scripts").progressDisplayName("Running init scripts");
}
});
}
use of org.gradle.groovy.scripts.TextResourceScriptSource in project gradle by gradle.
the class DefaultObjectConfigurationAction method applyScript.
private void applyScript(Object script) {
URI scriptUri = resolver.resolveUri(script);
TextResource resource = resourceLoader.loadUri("script", scriptUri);
ScriptSource scriptSource = new TextResourceScriptSource(resource);
ClassLoaderScope classLoaderScopeChild = classLoaderScope.createChild("script-" + scriptUri.toString());
ScriptHandler scriptHandler = scriptHandlerFactory.create(scriptSource, classLoaderScopeChild);
ScriptPlugin configurer = configurerFactory.create(scriptSource, scriptHandler, classLoaderScopeChild, classLoaderScope, false);
for (Object target : targets) {
configurer.apply(target);
}
}
use of org.gradle.groovy.scripts.TextResourceScriptSource in project gradle by gradle.
the class ProjectFactory method createProject.
public DefaultProject createProject(ProjectDescriptor projectDescriptor, ProjectInternal parent, GradleInternal gradle, ClassLoaderScope selfClassLoaderScope, ClassLoaderScope baseClassLoaderScope) {
File buildFile = projectDescriptor.getBuildFile();
TextResource resource = resourceLoader.loadFile("build file", buildFile);
ScriptSource source = new TextResourceScriptSource(resource);
NameValidator.validate(projectDescriptor.getName(), "project name", DefaultProjectDescriptor.INVALID_NAME_IN_INCLUDE_HINT);
DefaultProject project = instantiator.newInstance(DefaultProject.class, projectDescriptor.getName(), parent, projectDescriptor.getProjectDir(), buildFile, source, gradle, gradle.getServiceRegistryFactory(), selfClassLoaderScope, baseClassLoaderScope);
if (parent != null) {
parent.addChildProject(project);
}
projectRegistry.addProject(project);
return project;
}
Aggregations