Package groovy.lang

Examples of groovy.lang.Closure


        //when starting via main set the look and feel to system
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

        final Console console = new Console(Console.class.getClassLoader());
        console.setBeforeExecution(new Closure(null) {
          public void doCall() {
            console.setShell(new GroovyShell(Console.class.getClassLoader(), new Binding()) {
              public Object run(String scriptText, String fileName, String[] args) throws org.codehaus.groovy.control.CompilationFailedException {
                return super.run(IMPORTS + scriptText, fileName, args);
              };
View Full Code Here


            } else if (dependency instanceof Task) {
                context.add(dependency);
            } else if (dependency instanceof TaskDependency) {
                context.add(dependency);
            } else if (dependency instanceof Closure) {
                Closure closure = (Closure) dependency;
                Object closureResult = closure.call(context.getTask());
                if (closureResult != null) {
                    queue.add(0, closureResult);
                }
            } else if (dependency instanceof Iterable) {
                Iterable<?> iterable = (Iterable) dependency;
View Full Code Here

                    value = callable.call();
                } catch (Exception e) {
                    throw UncheckedException.asUncheckedException(e);
                }
            } else if (value instanceof Closure) {
                Closure closure = (Closure) value;
                value = closure.call();
            } else if (value instanceof FileCollection) {
                FileCollection fileCollection = (FileCollection) value;
                return fileCollection.getFiles();
            } else {
                return value;
View Full Code Here

        assertThat(gradle.getProjectEvaluationBroadcaster(), sameInstance(broadcaster));
    }

    @Test
    public void broadcastsBeforeProjectEvaluateEventsToClosures() {
        final Closure closure = HelperUtil.TEST_CLOSURE;
        context.checking(new Expectations() {{
            one(listenerManager).addListener(ProjectEvaluationListener.class, "beforeEvaluate", closure);
        }});

        gradle.beforeProject(closure);
View Full Code Here

        gradle.beforeProject(closure);
    }

    @Test
    public void broadcastsAfterProjectEvaluateEventsToClosures() {
        final Closure closure = HelperUtil.TEST_CLOSURE;
        context.checking(new Expectations() {{
            one(listenerManager).addListener(ProjectEvaluationListener.class, "afterEvaluate", closure);
        }});

        gradle.afterProject(closure);
View Full Code Here

        gradle.afterProject(closure);
    }

    @Test
    public void broadcastsBuildStartedEventsToClosures() {
        final Closure closure = HelperUtil.TEST_CLOSURE;
        context.checking(new Expectations() {{
            one(listenerManager).addListener(BuildListener.class, "buildStarted", closure);
        }});

        gradle.buildStarted(closure);
View Full Code Here

        gradle.buildStarted(closure);
    }

    @Test
    public void broadcastsSettingsEvaluatedEventsToClosures() {
        final Closure closure = HelperUtil.TEST_CLOSURE;
        context.checking(new Expectations() {{
            one(listenerManager).addListener(BuildListener.class, "settingsEvaluated", closure);
        }});

        gradle.settingsEvaluated(closure);
View Full Code Here

        gradle.settingsEvaluated(closure);
    }

    @Test
    public void broadcastsProjectsLoadedEventsToClosures() {
        final Closure closure = HelperUtil.TEST_CLOSURE;
        context.checking(new Expectations() {{
            one(listenerManager).addListener(BuildListener.class, "projectsLoaded", closure);
        }});

        gradle.projectsLoaded(closure);
View Full Code Here

        gradle.projectsLoaded(closure);
    }

    @Test
    public void broadcastsProjectsEvaluatedEventsToClosures() {
        final Closure closure = HelperUtil.TEST_CLOSURE;
        context.checking(new Expectations() {{
            one(listenerManager).addListener(BuildListener.class, "projectsEvaluated", closure);
        }});

        gradle.projectsEvaluated(closure);
View Full Code Here

        gradle.projectsEvaluated(closure);
    }

    @Test
    public void broadcastsBuildFinishedEventsToClosures() {
        final Closure closure = HelperUtil.TEST_CLOSURE;
        context.checking(new Expectations() {{
            one(listenerManager).addListener(BuildListener.class, "buildFinished", closure);
        }});

        gradle.buildFinished(closure);
View Full Code Here

TOP

Related Classes of groovy.lang.Closure

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.