diff --git a/phoenix-shaded-commons-cli/pom.xml b/phoenix-shaded-commons-cli/pom.xml new file mode 100644 index 0000000..e5061e6 --- /dev/null +++ b/phoenix-shaded-commons-cli/pom.xml @@ -0,0 +1,169 @@ + + + + 4.0.0 + + org.apache.phoenix.thirdparty + phoenix-thirdparty + 1.1.0-SNAPSHOT + + hbase-shaded-commons-cli + Apache HBase Patched and Relocated (Shaded) Commons-CLI + + Pulls down commons-cli, patches it, compiles, and then relocates/shades. + + + + + + maven-clean-plugin + + + pre-generate-sources + generate-sources + + clean + + + + + + + ${basedir}/src/main/java + + **/** + + false + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.1.1 + + + unpack + generate-sources + + unpack + + + + + commons-cli + commons-cli + ${commons-cli.version} + sources + jar + true + ${basedir}/src/main/java + **/** + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + org.apache.maven.plugins + maven-patch-plugin + 1.2 + + ${basedir} + false + + + + patch + process-sources + + apply + + + 0 + ${basedir}/src/main/patches + ${project.build.directory}/patches-applied.txt + true + + + + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar-no-fork + + + + + + + org.apache.maven.plugins + maven-shade-plugin + + + package + + shade + + + true + true + + + apache.commons.cli + ${rename.offset}.apache.commons.cli + + + + + + + + + + + commons-cli + commons-cli + ${commons-cli.version} + + + \ No newline at end of file diff --git a/phoenix-shaded-commons-cli/src/main/patches/CLI-254-1.4.patch b/phoenix-shaded-commons-cli/src/main/patches/CLI-254-1.4.patch new file mode 100644 index 0000000..4616fab --- /dev/null +++ b/phoenix-shaded-commons-cli/src/main/patches/CLI-254-1.4.patch @@ -0,0 +1,72 @@ +diff --git src/main/java/org/apache/commons/cli/DefaultParser.java src/main/java/org/apache/commons/cli/DefaultParser.java +index d762a3e..ebc324f 100644 +--- src/main/java/org/apache/commons/cli/DefaultParser.java ++++ src/main/java/org/apache/commons/cli/DefaultParser.java +@@ -54,7 +54,44 @@ public class DefaultParser implements CommandLineParser + + /** The required options and groups expected to be found when parsing the command line. */ + protected List expectedOpts; +- ++ ++ public DefaultParser() { ++ this.stripLeadingAndTrailingQuotes = true; ++ } ++ ++ /** Flag indicating if balanced leading and trailing double quotes should be stripped from option arguments. */ ++ private final boolean stripLeadingAndTrailingQuotes; ++ ++ /** ++ * Create a new DefaultParser instance with the specified partial matching and quote ++ * stripping policy. ++ * ++ * By "partial matching" we mean that given the following code: ++ *
++     *     {@code
++     *          final Options options = new Options();
++     *      options.addOption(new Option("d", "debug", false, "Turn on debug."));
++     *      options.addOption(new Option("e", "extract", false, "Turn on extract."));
++     *      options.addOption(new Option("o", "option", true, "Turn on option with argument."));
++     *      }
++     * 
++ * with "partial matching" turned on, -de only matches the ++ * "debug" option. However, with "partial matching" disabled, ++ * -de would enable both debug as well as ++ * extract options. ++ * with "stripping of balanced leading and trailing double quotes from option arguments" turned ++ * on, the outermost balanced double quotes of option arguments values will be removed. ++ * ie. ++ * for -o '"x"' getValue() will return x, instead of "x" ++ * @param allowPartialMatching if partial matching of long options shall be enabled ++ * @param stripLeadingAndTrailingQuotes if balanced outer double quoutes should be stripped ++ */ ++ public DefaultParser(final boolean allowPartialMatching, ++ final boolean stripLeadingAndTrailingQuotes) { ++ // We do not care about allowPartialMatching in this patch ++ this.stripLeadingAndTrailingQuotes = stripLeadingAndTrailingQuotes; ++ } ++ + public CommandLine parse(Options options, String[] arguments) throws ParseException + { + return parse(options, arguments, null); +@@ -232,7 +269,7 @@ public class DefaultParser implements CommandLineParser + } + else if (currentOption != null && currentOption.acceptsArg() && isArgument(token)) + { +- currentOption.addValueForProcessing(Util.stripLeadingAndTrailingQuotes(token)); ++ currentOption.addValueForProcessing(conditionallyStripLeadingAndTrailingQuotes(token)); + } + else if (token.startsWith("--")) + { +@@ -704,4 +741,12 @@ public class DefaultParser implements CommandLineParser + } + } + } ++ ++ protected String conditionallyStripLeadingAndTrailingQuotes(final String token) { ++ if(stripLeadingAndTrailingQuotes) { ++ return Util.stripLeadingAndTrailingQuotes(token); ++ } else { ++ return token; ++ } ++ } + } diff --git a/phoenix-shaded-guava/pom.xml b/phoenix-shaded-guava/pom.xml index dba90c6..9b5ebd6 100644 --- a/phoenix-shaded-guava/pom.xml +++ b/phoenix-shaded-guava/pom.xml @@ -24,7 +24,7 @@ org.apache.phoenix.thirdparty phoenix-thirdparty - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT phoenix-shaded-guava diff --git a/pom.xml b/pom.xml index b72bffb..ce1ca05 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ org.apache.phoenix.thirdparty phoenix-thirdparty - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom Apache Phoenix Third-Party Libs Packaging of relocated (renamed, shaded) third-party libraries used by Phoenix. @@ -50,6 +50,7 @@ phoenix-shaded-guava + phoenix-shaded-commons-cli @@ -68,6 +69,7 @@ org.apache.phoenix.thirdparty 29.0-android + 1.4