Slide 19
Slide 19 text
© 2017 CloudBees, Inc. All Rights Reserved. 19
Groovy-движок на 1,2,3…
protected void runGroovy(@Nonnull File f) {
if (f.exists()) { throw new Error("File does not exist: ${f}") }
def compilerConf = CompilerConfiguration.DEFAULT
compilerConf.classpath = new File(home, "init.groovy.d/").absolutePath
def useConfCP = true
def cl = new GroovyClassLoader(System.classLoader, compilerConf, useConfCP)
try {
def bindings = new Binding()
new GroovyShell(cl, bindings).evaluate(new GroovyCodeSource(f))
} catch (IOException e) {
throw new Error("Failed to execute " + f, e)
}
}