Skip to content

Instantly share code, notes, and snippets.

@dsmiley
Forked from michalbcz/gist:3916997
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsmiley/4c5d316707cf05e2cb82 to your computer and use it in GitHub Desktop.
Save dsmiley/4c5d316707cf05e2cb82 to your computer and use it in GitHub Desktop.
Embedding groovy Console
def c = new groovy.ui.Console(getClass().classLoader, new Binding(project:project))
c.run()
def doneLatch = new java.util.concurrent.CountDownLatch(1)
c.frame.windowClosed = {doneLatch.countDown()}
doneLatch.await()
@dsmiley
Copy link
Author

dsmiley commented Aug 26, 2014

I added the above to a gradle project to debug gradle build file making:

//For debugging gradle:
buildscript {
    dependencies {
        classpath localGroovy()
    }
}
task gradleConsole << {
    def c = new groovy.ui.Console(getClass().classLoader, new Binding(project:project))
    c.run()
    def doneLatch = new java.util.concurrent.CountDownLatch(1)
    c.frame.windowClosed = {doneLatch.countDown()}
    doneLatch.await()
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment