Search in sources :

Example 1 with ScriptPlugin

use of org.gradle.configuration.ScriptPlugin in project gradle by gradle.

the class ScriptEvaluatingSettingsProcessor method applySettingsScript.

private void applySettingsScript(SettingsLocation settingsLocation, final SettingsInternal settings) {
    ScriptSource settingsScriptSource = settingsLocation.getSettingsScriptSource();
    ClassLoaderScope settingsClassLoaderScope = settings.getClassLoaderScope();
    ScriptPlugin configurer = configurerFactory.create(settingsScriptSource, settings.getBuildscript(), settingsClassLoaderScope, settings.getRootClassLoaderScope(), true);
    configurer.apply(settings);
}
Also used : ClassLoaderScope(org.gradle.api.internal.initialization.ClassLoaderScope) ScriptPlugin(org.gradle.configuration.ScriptPlugin) ScriptSource(org.gradle.groovy.scripts.ScriptSource)

Example 2 with ScriptPlugin

use of org.gradle.configuration.ScriptPlugin in project gradle by gradle.

the class DefaultObjectConfigurationAction method applyScript.

private void applyScript(Object script) {
    URI scriptUri = resolver.resolveUri(script);
    TextResource resource;
    if (script instanceof TextResource) {
        resource = (TextResource) script;
    } else {
        HttpRedirectVerifier redirectVerifier = createHttpRedirectVerifier(scriptUri);
        resource = textUriFileResourceLoaderFactory.create(redirectVerifier).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);
    }
}
Also used : TextResource(org.gradle.internal.resource.TextResource) HttpRedirectVerifier(org.gradle.internal.verifier.HttpRedirectVerifier) TextResourceScriptSource(org.gradle.groovy.scripts.TextResourceScriptSource) ClassLoaderScope(org.gradle.api.internal.initialization.ClassLoaderScope) ScriptPlugin(org.gradle.configuration.ScriptPlugin) URI(java.net.URI) TextResourceScriptSource(org.gradle.groovy.scripts.TextResourceScriptSource) ScriptSource(org.gradle.groovy.scripts.ScriptSource) ScriptHandler(org.gradle.api.initialization.dsl.ScriptHandler)

Example 3 with ScriptPlugin

use of org.gradle.configuration.ScriptPlugin in project gradle by gradle.

the class BuildScriptProcessor method execute.

@Override
public void execute(final ProjectInternal project) {
    if (LOGGER.isInfoEnabled()) {
        LOGGER.info("Evaluating {} using {}.", project, project.getBuildScriptSource().getDisplayName());
    }
    final Timer clock = Time.startTimer();
    try {
        final ScriptPlugin configurer = configurerFactory.create(project.getBuildScriptSource(), project.getBuildscript(), project.getClassLoaderScope(), project.getBaseClassLoaderScope(), true);
        project.getOwner().applyToMutableState(configurer::apply);
    } finally {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Timing: Running the build script took {}", clock.getElapsed());
        }
    }
}
Also used : Timer(org.gradle.internal.time.Timer) ScriptPlugin(org.gradle.configuration.ScriptPlugin)

Example 4 with ScriptPlugin

use of org.gradle.configuration.ScriptPlugin in project gradle by gradle.

the class ScriptEvaluatingSettingsProcessor method applySettingsScript.

private void applySettingsScript(TextResourceScriptSource settingsScript, final SettingsInternal settings) {
    ScriptPlugin configurer = configurerFactory.create(settingsScript, settings.getBuildscript(), settings.getClassLoaderScope(), settings.getBaseClassLoaderScope(), true);
    configurer.apply(settings);
}
Also used : ScriptPlugin(org.gradle.configuration.ScriptPlugin)

Aggregations

ScriptPlugin (org.gradle.configuration.ScriptPlugin)4 ClassLoaderScope (org.gradle.api.internal.initialization.ClassLoaderScope)2 ScriptSource (org.gradle.groovy.scripts.ScriptSource)2 URI (java.net.URI)1 ScriptHandler (org.gradle.api.initialization.dsl.ScriptHandler)1 TextResourceScriptSource (org.gradle.groovy.scripts.TextResourceScriptSource)1 TextResource (org.gradle.internal.resource.TextResource)1 Timer (org.gradle.internal.time.Timer)1 HttpRedirectVerifier (org.gradle.internal.verifier.HttpRedirectVerifier)1