TINKERPOP-2039 Bump to Groovy 2.5.2 Required some minor changes to the Console as the CliBuilder is no longer the recommended approach for Groovy - had to use picocli classes instead. Still couldn't make the command line parsing work exclusively under picocli - I think we have somewhat nonstandard options in our command line.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/80242be3 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/80242be3 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/80242be3 Branch: refs/heads/TINKERPOP-2041 Commit: 80242be387e6d3b4daa0a7b045d7a4f463123321 Parents: 1e3d4d2 Author: Stephen Mallette <sp...@genoprime.com> Authored: Wed Sep 19 10:50:20 2018 -0400 Committer: Stephen Mallette <sp...@genoprime.com> Committed: Thu Sep 27 15:38:52 2018 -0400 ---------------------------------------------------------------------- CHANGELOG.asciidoc | 1 + gremlin-console/pom.xml | 5 --- .../tinkerpop/gremlin/console/Console.groovy | 34 +++++++++++--------- gremlin-dotnet/pom.xml | 2 +- gremlin-javascript/pom.xml | 2 +- gremlin-python/pom.xml | 2 +- pom.xml | 2 +- 7 files changed, 23 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/80242be3/CHANGELOG.asciidoc ---------------------------------------------------------------------- diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index efb3e43..ae46ad4 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -37,6 +37,7 @@ This release also includes changes from <<release-3-3-3, 3.3.3>>. * Maintained order of annotations in metrics returned from `profile()`-step. * Bumped to Netty 4.1.25. * Bumped to Spark 2.3.1. +* Bumped to Groovy 2.5.2. * Modified Gremlin Server to return a "host" status attribute on responses. * Added ability to the Java, .NET and Python drivers to retrieve status attributes returned from the server. * Modified Java and Gremlin.Net `ResponseException` to include status code and status attributes. http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/80242be3/gremlin-console/pom.xml ---------------------------------------------------------------------- diff --git a/gremlin-console/pom.xml b/gremlin-console/pom.xml index 3b650ee..615af4e 100644 --- a/gremlin-console/pom.xml +++ b/gremlin-console/pom.xml @@ -41,11 +41,6 @@ limitations under the License. <artifactId>httpclient</artifactId> </dependency> <dependency> - <groupId>commons-cli</groupId> - <artifactId>commons-cli</artifactId> - <version>1.2</version> - </dependency> - <dependency> <groupId>org.apache.tinkerpop</groupId> <artifactId>gremlin-driver</artifactId> <version>${project.version}</version> http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/80242be3/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy ---------------------------------------------------------------------- diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy index d45b49a..1e05864 100644 --- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy +++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy @@ -18,10 +18,11 @@ */ package org.apache.tinkerpop.gremlin.console +import groovy.cli.picocli.CliBuilder +import groovy.cli.picocli.OptionAccessor import jline.TerminalFactory import jline.console.history.FileHistory -import org.apache.commons.cli.Option import org.apache.tinkerpop.gremlin.console.commands.GremlinSetCommand import org.apache.tinkerpop.gremlin.console.commands.InstallCommand import org.apache.tinkerpop.gremlin.console.commands.PluginCommand @@ -43,8 +44,8 @@ import org.codehaus.groovy.tools.shell.Groovysh import org.codehaus.groovy.tools.shell.IO import org.codehaus.groovy.tools.shell.InteractiveShellRunner import org.codehaus.groovy.tools.shell.commands.SetCommand -import org.codehaus.groovy.tools.shell.util.HelpFormatter import org.fusesource.jansi.Ansi +import picocli.CommandLine /** * @author Stephen Mallette (http://stephen.genoprime.com) @@ -400,21 +401,22 @@ class Console { IO io = new IO(System.in, System.out, System.err) - final CliBuilder cli = new CliBuilder(usage: 'gremlin.sh [options] [...]', formatter: new HelpFormatter(), stopAtNonOption: false) + final CliBuilder cli = new CliBuilder() + cli.stopAtNonOption = false + cli.name = "gremlin.sh" // note that the inclusion of -l is really a setting handled by gremlin.sh and not by Console class itself. // it is mainly listed here for informational purposes when the user starts things up with -h - cli.with { - h(longOpt: 'help', "Display this help message") - v(longOpt: 'version', "Display the version") - l("Set the logging level of components that use standard logging output independent of the Console") - V(longOpt: 'verbose', "Enable verbose Console output") - Q(longOpt: 'quiet', "Suppress superfluous Console output") - D(longOpt: 'debug', "Enabled debug Console output") - i(longOpt: 'interactive', argName: "SCRIPT ARG1 ARG2 ...", args: Option.UNLIMITED_VALUES, valueSeparator: ' ' as char, "Execute the specified script and leave the console open on completion") - e(longOpt: 'execute', argName: "SCRIPT ARG1 ARG2 ...", args: Option.UNLIMITED_VALUES, valueSeparator: ' ' as char, "Execute the specified script (SCRIPT ARG1 ARG2 ...) and close the console on completion") - C(longOpt: 'color', "Disable use of ANSI colors") - } + cli.h(type: Boolean, longOpt: 'help', "Display this help message") + cli.v(type: Boolean,longOpt: 'version', "Display the version") + cli.l("Set the logging level of components that use standard logging output independent of the Console") + cli.V(type: Boolean, longOpt: 'verbose', "Enable verbose Console output") + cli.Q(type: Boolean, longOpt: 'quiet', "Suppress superfluous Console output") + cli.D(type: Boolean, longOpt: 'debug', "Enabled debug Console output") + cli.i(type: List, longOpt: 'interactive', arity: "1..*", argName: "SCRIPT ARG1 ARG2 ...", "Execute the specified script and leave the console open on completion") + cli.e(type: List, longOpt: 'execute', argName: "SCRIPT ARG1 ARG2 ...", "Execute the specified script (SCRIPT ARG1 ARG2 ...) and close the console on completion") + cli.C(type: Boolean, longOpt: 'color', "Disable use of ANSI colors") + OptionAccessor options = cli.parse(args) if (options == null) { @@ -450,7 +452,7 @@ class Console { println("-i and -e options are mutually exclusive - provide one or the other") System.exit(0) } - + def scriptAndArgs = parseArgs(options.e ? ["-e", "--execute"] : ["-i", "--interactive"], args, cli) new Console(io, scriptAndArgs, !options.e) } @@ -472,7 +474,7 @@ class Console { def parsedSet = [] for (ix; ix < normalizedArgs.length; ix++) { // this is a do nothing as there's no arguments to the option or it's the start of a new option - if (cli.options.options.any { "-" + it.opt == normalizedArgs[ix] || "--" + it.longOpt == normalizedArgs[ix] }) { + if (cli.savedTypeOptions.values().any { "-" + it.opt == normalizedArgs[ix] || "--" + it.longOpt == normalizedArgs[ix] }) { // rollback the counter now that we hit the next option ix-- break http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/80242be3/gremlin-dotnet/pom.xml ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/pom.xml b/gremlin-dotnet/pom.xml index 0f66b02..5b1b400 100644 --- a/gremlin-dotnet/pom.xml +++ b/gremlin-dotnet/pom.xml @@ -52,7 +52,7 @@ limitations under the License. <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>${groovy.version}</version> - <classifier>indy</classifier> + <type>pom</type> <scope>runtime</scope> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/80242be3/gremlin-javascript/pom.xml ---------------------------------------------------------------------- diff --git a/gremlin-javascript/pom.xml b/gremlin-javascript/pom.xml index 46bfec4..403f97b 100644 --- a/gremlin-javascript/pom.xml +++ b/gremlin-javascript/pom.xml @@ -65,7 +65,7 @@ limitations under the License. <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>${groovy.version}</version> - <classifier>indy</classifier> + <type>pom</type> <scope>runtime</scope> </dependency> </dependencies> http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/80242be3/gremlin-python/pom.xml ---------------------------------------------------------------------- diff --git a/gremlin-python/pom.xml b/gremlin-python/pom.xml index d65f4cf..7dff201 100644 --- a/gremlin-python/pom.xml +++ b/gremlin-python/pom.xml @@ -464,7 +464,7 @@ limitations under the License. <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>${groovy.version}</version> - <classifier>indy</classifier> + <type>pom</type> <scope>runtime</scope> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/80242be3/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 0489eda..24e467b 100644 --- a/pom.xml +++ b/pom.xml @@ -152,7 +152,7 @@ limitations under the License. <commons.configuration.version>1.10</commons.configuration.version> <commons.lang.version>2.6</commons.lang.version> <commons.lang3.version>3.3.1</commons.lang3.version> - <groovy.version>2.4.15</groovy.version> + <groovy.version>2.5.2</groovy.version> <hadoop.version>2.7.2</hadoop.version> <java.tuples.version>1.2</java.tuples.version> <javadoc-plugin.version>2.10.4</javadoc-plugin.version>