Package org.gradle.groovy.scripts

Examples of org.gradle.groovy.scripts.StringScriptSource


     *
     * @param buildScriptText The script to use as the build file.
     * @return this
     */
    public StartParameter useEmbeddedBuildFile(String buildScriptText) {
        return setBuildScriptSource(new StringScriptSource("embedded build file", buildScriptText));
    }
View Full Code Here


     * @param buildScript The script to use as the build file.
     * @return this
     */
    public StartParameter setBuildScriptSource(ScriptSource buildScript) {
        buildScriptSource = buildScript;
        settingsScriptSource = new StringScriptSource("empty settings file", "");
        searchUpwards = false;
        return this;
    }
View Full Code Here

        SettingsInternal settings = findSettingsAndLoadIfAppropriate(gradle, startParameter, gradlePropertiesLoader);
        if (!startParameter.getDefaultProjectSelector().containsProject(settings.getProjectRegistry())) {
            // The settings we found did not include the desired default project. Try again with an empty settings file.

            StartParameter noSearchParameter = startParameter.newInstance();
            noSearchParameter.setSettingsScriptSource(new StringScriptSource("empty settings file", ""));
            settings = findSettingsAndLoadIfAppropriate(gradle, noSearchParameter, gradlePropertiesLoader);
            if (settings == null) // not using an assert to make sure it is not disabled
            {
                throw new InternalError("Empty settings file does not contain expected project.");
            }
View Full Code Here

        File buildFile = projectDescriptor.getBuildFile();
        ScriptSource source;
        if (embeddedScript != null) {
            source = embeddedScript;
        } else if (!buildFile.exists()) {
            source = new StringScriptSource("empty build file", "");
        } else {
            source = new UriScriptSource("build file", buildFile);
        }

        DefaultProject project = classGenerator.newInstance(DefaultProject.class,
View Full Code Here

                break;
            }
        }
        if (settingsFile == null) {
            return new SettingsLocation(startParameter.getCurrentDir(),
                                       new StringScriptSource("empty settings file", ""));
        } else {
            return new SettingsLocation(settingsFile.getParentFile(),
                                       new UriScriptSource("settings file", settingsFile));
        }
    }
View Full Code Here

                startParameter.getCurrentDir()).invalidateOnVersionChange().open().openStateCache();
        boolean rebuild = stateCache.get() == null;

        if (!new File(startParameter.getCurrentDir(), Project.DEFAULT_BUILD_FILE).isFile()) {
            LOGGER.debug("Gradle script file does not exist. Using default one.");
            ScriptSource source = new StringScriptSource("default buildSrc build script", getDefaultScript());
            startParameterArg.setBuildScriptSource(source);
        }

        GradleLauncher gradleLauncher = gradleLauncherFactory.newInstance(startParameterArg);
        BuildSrcBuildListener listener = new BuildSrcBuildListener(rebuild);
View Full Code Here

        assertThat(project.getBuildScriptSource().getResource().getText(), equalTo(""));
    }

    @Test
    public void testConstructsRootProjectWithEmbeddedBuildScript() {
        ScriptSource expectedScriptSource = new StringScriptSource("script", "content");

        ProjectFactory projectFactory = new ProjectFactory(expectedScriptSource, classGeneratorMock);

        DefaultProject project = projectFactory.createProject(descriptor("somename"), null, gradle);
View Full Code Here

    public DefaultProject createProject(ProjectDescriptor projectDescriptor, ProjectInternal parent, GradleInternal gradle, ClassLoaderScope selfClassLoaderScope, ClassLoaderScope baseClassLoaderScope) {
        File buildFile = projectDescriptor.getBuildFile();
        ScriptSource source;
        if (!buildFile.exists()) {
            source = new StringScriptSource("empty build file", "");
        } else {
            source = new UriScriptSource("build file", buildFile);
        }

        DefaultProject project = instantiator.newInstance(DefaultProject.class,
View Full Code Here

        }
    }

    @Test
    public void testCompileToDirWithSyntaxError() {
        ScriptSource source = new StringScriptSource("script.gradle", "\n\nnew HHHHJSJSJ jsj");
        try {
            scriptCompilationHandler.compileToDir(source, classLoader, scriptCacheDir, null, expectedScriptClass, verifier);
            fail();
        } catch (ScriptCompilationException e) {
            assertThat(e.getScriptSource(), sameInstance(source));
View Full Code Here

        DefaultProject project = CLASS_GENERATOR.newInstance(
                DefaultProject.class,
                name,
                parentProject,
                (projectDir != null) ? projectDir.getAbsoluteFile() : new File(parentProject.getProjectDir(), name),
                new StringScriptSource("test build file", null),
                parentProject.getGradle(),
                parentProject.getGradle().getServiceRegistryFactory(),
                parentProject.getClassLoaderScope().createChild(),
                parentProject.getBaseClassLoaderScope()
        );
View Full Code Here

TOP

Related Classes of org.gradle.groovy.scripts.StringScriptSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.