Java Code Examples for groovy.lang.GroovyShell#run()
The following examples show how to use
groovy.lang.GroovyShell#run() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StandaloneTestCaseRun.java From mdw with Apache License 2.0 | 6 votes |
/** * Standalone execution for Gradle. */ public void run() { startExecution(); CompilerConfiguration compilerConfig = new CompilerConfiguration(System.getProperties()); compilerConfig.setScriptBaseClass(TestCaseScript.class.getName()); Binding binding = new Binding(); binding.setVariable("testCaseRun", this); ClassLoader classLoader = this.getClass().getClassLoader(); GroovyShell shell = new GroovyShell(classLoader, binding, compilerConfig); shell.setProperty("out", getLog()); setupContextClassLoader(shell); try { shell.run(new GroovyCodeSource(getTestCase().file()), new String[0]); finishExecution(null); } catch (IOException ex) { throw new RuntimeException(ex.getMessage(), ex); } }
Example 2
Source File: GeoscriptConsole.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
public static void main( String[] args ) { try { if (args.length == 1) { GroovyShell shell = new GroovyShell(); shell.run(new File(args[0]), Collections.EMPTY_LIST); } else { Logger.INSTANCE.init(); SettingsController.applySettings(null); new GeoscriptConsole(); } } catch (Exception e) { e.printStackTrace(); } }
Example 3
Source File: GroovyMain.java From groovy with Apache License 2.0 | 4 votes |
/** * Process the standard, single script with args. */ private void processOnce() throws CompilationFailedException, IOException, URISyntaxException { GroovyShell groovy = new GroovyShell(Thread.currentThread().getContextClassLoader(), conf); setupContextClassLoader(groovy); groovy.run(getScriptSource(isScriptFile, script), args); }
Example 4
Source File: ClassicGroovyTestGeneratorHelper.java From groovy with Apache License 2.0 | 4 votes |
/** evaluate the source text against the classic AST with the JSR parser implementation*/ public Object evaluate(String theSrcText, String testName) throws Exception { parse(theSrcText, testName); // fail early with a direct message if possible') GroovyShell groovy = new GroovyShell(new CompilerConfiguration()); return groovy.run(theSrcText, "main", new ArrayList()); }
Example 5
Source File: MainTest.java From groovy with Apache License 2.0 | 4 votes |
public void testMainMethod() throws Exception { GroovyShell shell = new GroovyShell(); shell.run(new File("src/test/groovy/SampleMain.groovy"), new String[]{"A", "B", "C"}); }
Example 6
Source File: GroovyWrapper.java From maestro-java with Apache License 2.0 | 2 votes |
public void run(final File file, final String[] args) throws IOException { GroovyShell groovyShell = new GroovyShell(this.getClass().getClassLoader()); groovyShell.run(file, args); }