Skip to content
Permalink
Browse files

Merge pull request #2034 from daspilker/2.0-JENKINS-21249

[JENKINS-21249] Update Groovy to 2.4.6
  • Loading branch information...
kohsuke committed Mar 11, 2016
2 parents 219481a + 2370795 commit 54d1cf11c9e8cceb7cd593b81c170b2c784257d6
@@ -41,7 +41,7 @@ THE SOFTWARE.
<staplerFork>true</staplerFork>
<stapler.version>1.240</stapler.version>
<spring.version>2.5.6.SEC03</spring.version>
<groovy.version>1.8.9</groovy.version>
<groovy.version>2.4.6</groovy.version>
</properties>

<dependencies>
@@ -411,13 +411,13 @@ THE SOFTWARE.
<dependency><!-- groovy shell uses this but uses an optional dependency -->
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>1.0</version>
<version>2.12</version>
<scope>compile</scope>
</dependency>
<dependency><!-- groovy shell uses this but it doesn't declare this dependency -->
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
<version>1.9</version>
<version>1.11</version>
</dependency>
<dependency>
<!--
@@ -41,7 +41,7 @@
import java.util.ArrayList;

import jline.UnsupportedTerminal;
import jline.Terminal;
import jline.TerminalFactory;
import org.kohsuke.args4j.Argument;

/**
@@ -65,10 +65,18 @@ protected int run() {

// this being remote means no jline capability is available
System.setProperty("jline.terminal", UnsupportedTerminal.class.getName());
Terminal.resetTerminal();
TerminalFactory.reset();

StringBuilder commandLine = new StringBuilder();
for (String arg : args) {
if (commandLine.length() > 0) {
commandLine.append(" ");
}
commandLine.append(arg);
}

Groovysh shell = createShell(stdin, stdout, stderr);
return shell.run(args.toArray(new String[args.size()]));
return shell.run(commandLine.toString());
}

@SuppressWarnings({"unchecked","rawtypes"})
@@ -101,7 +109,7 @@ public Object doCall(Object[] args) {
}
};
Groovysh shell = new Groovysh(cl, binding, io, registrar);
shell.getImports().add("import hudson.model.*");
shell.getImports().add("hudson.model.*");

// defaultErrorHook doesn't re-throw IOException, so ShellRunner in
// Groovysh will keep looping forever if we don't terminate when the
@@ -39,6 +39,7 @@

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -132,7 +133,7 @@ public void parse(InputStream script, Binding binding) {
cc.setScriptBaseClass(ClosureScript.class.getName());
GroovyShell shell = new GroovyShell(classLoader,binding,cc);

ClosureScript s = (ClosureScript)shell.parse(script);
ClosureScript s = (ClosureScript)shell.parse(new InputStreamReader(script));
s.setDelegate(this);
s.run();
}
@@ -336,7 +337,7 @@ public Object call(Object... args) {

GroovyShell shell = classLoader != null ? new GroovyShell(classLoader,b) : new GroovyShell(b);
for (Resource resource : resources) {
shell.evaluate(resource.getInputStream());
shell.evaluate(new InputStreamReader(resource.getInputStream()));
}
}

22 pom.xml
@@ -323,7 +323,17 @@ THE SOFTWARE.
<artifactId>servlet-api</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.codehaus.gmaven.runtime</groupId>
<artifactId>gmaven-runtime-2.0</artifactId>
<version>1.5-jenkins-3</version>
</dependency>
</dependencies>
<configuration>
<!-- 2.4 not yet supported by plugin but 2.0 works
here so long as we provide explicit version -->
<providerSelection>2.0</providerSelection>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -724,18 +734,6 @@ THE SOFTWARE.
</goals>
</execution>
</executions>
<configuration>
<!-- 1.8 not yet supported by plugin but 1.7 works
here so long as we provide explicit version -->
<providerSelection>1.7</providerSelection>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.gmaven.runtime</groupId>
<artifactId>gmaven-runtime-1.7</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
</plugin>
</plugins>

@@ -240,15 +240,7 @@ THE SOFTWARE.
<artifactId>ant-launcher</artifactId>
<version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.gmaven.runtime</groupId>
<artifactId>gmaven-runtime-2.0</artifactId>
<version>1.5-jenkins-1</version>
</dependency>
</dependencies>
<configuration>
<providerSelection>2.0</providerSelection>
</configuration>
</plugin>
</plugins>
</build>
@@ -42,7 +42,7 @@
@Test public void authentication() throws Exception {
CLICommandInvoker.Result result = new CLICommandInvoker(r, new GroovyshCommand())
.authorizedTo(Jenkins.READ, Jenkins.RUN_SCRIPTS)
.withStdin(new StringInputStream("println(jenkins.model.Jenkins.instance.getClass().name)\nquit\n"))
.withStdin(new StringInputStream("println(jenkins.model.Jenkins.instance.getClass().name)\n:quit\n"))
.invoke();
assertThat(result, succeeded());
assertThat(result, hasNoErrorOutput());

0 comments on commit 54d1cf1

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.