Search in sources :

Example 1 with BasicTextResourceLoader

use of org.gradle.internal.resource.BasicTextResourceLoader 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");
        }
    });
}
Also used : BuildOperationContext(org.gradle.internal.operations.BuildOperationContext) TextResource(org.gradle.internal.resource.TextResource) TextResourceScriptSource(org.gradle.groovy.scripts.TextResourceScriptSource) BasicTextResourceLoader(org.gradle.internal.resource.BasicTextResourceLoader) File(java.io.File) RunnableBuildOperation(org.gradle.internal.operations.RunnableBuildOperation)

Aggregations

File (java.io.File)1 TextResourceScriptSource (org.gradle.groovy.scripts.TextResourceScriptSource)1 BuildOperationContext (org.gradle.internal.operations.BuildOperationContext)1 RunnableBuildOperation (org.gradle.internal.operations.RunnableBuildOperation)1 BasicTextResourceLoader (org.gradle.internal.resource.BasicTextResourceLoader)1 TextResource (org.gradle.internal.resource.TextResource)1