[jaxb] 06/24: Fixed the compatibility with args4j 2.x

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Thu Sep 28 21:04:17 UTC 2017


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to branch master
in repository jaxb.

commit 7475db71a4c1f5110f584eac45c0dd2dea269e60
Author: Emmanuel Bourg <ebourg at apache.org>
Date:   Thu Sep 28 12:12:34 2017 +0200

    Fixed the compatibility with args4j 2.x
---
 debian/changelog                             |   1 +
 debian/patches/02-args4j-compatibility.patch | 131 +++++++++++++++++++++++++++
 debian/patches/series                        |   1 +
 3 files changed, 133 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 4b18360..7cc191c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ jaxb (2.2.10-1) UNRELEASED; urgency=medium
   * Team upload.
   * New upstream release
     - Build with Maven instead of Ant
+    - Fixed the compatibility with args4j 2.x
   * Track and download the new releases from GitHub
   * Standards-Version updated to 4.1.0
   * Switch to debhelper level 10
diff --git a/debian/patches/02-args4j-compatibility.patch b/debian/patches/02-args4j-compatibility.patch
new file mode 100644
index 0000000..2beced6
--- /dev/null
+++ b/debian/patches/02-args4j-compatibility.patch
@@ -0,0 +1,131 @@
+Description: Fixes the compatibility with the version of args4j in Debian
+Author: Emmanuel Bourg <ebourg at apache.org>
+Forwarded: no
+--- a/jaxb-ri/txw/compiler/src/main/java/com/sun/tools/txw2/Main.java
++++ b/jaxb-ri/txw/compiler/src/main/java/com/sun/tools/txw2/Main.java
+@@ -43,10 +43,10 @@
+ import com.sun.codemodel.writer.FileCodeWriter;
+ import com.sun.codemodel.writer.SingleStreamCodeWriter;
+ import com.sun.tools.txw2.model.NodeSet;
++import org.kohsuke.args4j.Argument;
+ import org.kohsuke.args4j.CmdLineException;
+ import org.kohsuke.args4j.CmdLineParser;
+-import org.kohsuke.args4j.opts.BooleanOption;
+-import org.kohsuke.args4j.opts.StringOption;
++import org.kohsuke.args4j.Option;
+ import org.kohsuke.rngom.parse.IllegalSchemaException;
+ import org.kohsuke.rngom.parse.Parseable;
+ import org.kohsuke.rngom.parse.compact.CompactParseable;
+@@ -78,21 +78,34 @@
+     }
+ 
+     public static class Options {
+-        public StringOption output = new StringOption("-o");
+-        public StringOption pkg = new StringOption("-p");
+-        public BooleanOption compact = new BooleanOption("-c");
+-        public BooleanOption xml = new BooleanOption("-x");
+-        public BooleanOption xsd = new BooleanOption("-xsd");
+-        public BooleanOption chain = new BooleanOption("-h");
++        @Option(name="-o", metaVar="<dir>", usage="Specify the directory to place generated source files")
++        public String output;
++
++        @Option(name="-p", metaVar="<pkg>", usage="Specify the Java package to put the generated classes into")
++        public String pkg;
++
++        @Option(name="-c", usage="The input schema is written in the RELAX NG compact syntax")
++        public boolean compact;
++
++        @Option(name="-x", usage="The input schema is written in the RELAX NG XML syntax")
++        public boolean xml;
++
++        @Option(name="-xsd", usage="The input schema is written in the XML Schema")
++        public boolean xsd;
++
++        @Option(name="-h", usage="Generate code that allows method invocation chaining")
++        public boolean chain;
++
++        @Argument
++        private java.util.List<String> arguments = new java.util.ArrayList<String>();
+     }
+ 
+     public static int run(String[] args) {
+         Options opts = new Options();
+-        CmdLineParser parser = new CmdLineParser();
+-        parser.addOptionClass(opts);
++        CmdLineParser parser = new CmdLineParser(opts);
+ 
+         try {
+-            parser.parse(args);
++            parser.parseArgument(args);
+         } catch (CmdLineException e) {
+             System.out.println(e.getMessage());
+             printUsage();
+@@ -102,9 +115,9 @@
+         TxwOptions topts = new TxwOptions();
+         topts.errorListener = new ConsoleErrorReporter(System.out);
+ 
+-        if(opts.output.value!=null) {
++        if(opts.output!=null) {
+             try {
+-                topts.codeWriter = new FileCodeWriter(new File(opts.output.value));
++                topts.codeWriter = new FileCodeWriter(new File(opts.output));
+             } catch( IOException e ) {
+                 System.out.println(e.getMessage());
+                 printUsage();
+@@ -114,12 +127,12 @@
+             topts.codeWriter = new SingleStreamCodeWriter(System.out);
+         }
+ 
+-        if(opts.chain.isOn()) {
++        if(opts.chain) {
+             topts.chainMethod = true;
+         }
+ 
+-        if(opts.pkg.value!=null) {
+-            topts._package = topts.codeModel._package(opts.pkg.value);
++        if(opts.pkg!=null) {
++            topts._package = topts.codeModel._package(opts.pkg);
+         } else {
+             topts._package = topts.codeModel.rootPackage();
+         }
+@@ -146,21 +159,21 @@
+      * out of the specified schema file.
+      */
+     private static SchemaBuilder makeSourceSchema(CmdLineParser parser, Options opts, ErrorHandler eh) throws MalformedURLException {
+-        File f = new File((String)parser.getArguments().get(0));
++        File f = new File(opts.arguments.get(0));
+         final InputSource in = new InputSource(f.toURL().toExternalForm());
+ 
+-        if(opts.xsd.isOff() && opts.xml.isOff() && opts.compact.isOff()) {
++        if(!opts.xsd && !opts.xml && !opts.compact) {
+             // auto detect
+             if(in.getSystemId().endsWith(".rnc"))
+-                opts.compact.value=true;
++                opts.compact=true;
+             else
+             if(in.getSystemId().endsWith(".rng"))
+-                opts.xml.value=true;
++                opts.xml=true;
+             else
+-                opts.xsd.value=true;
++                opts.xsd=true;
+         }
+ 
+-        if(opts.xsd.isOn())
++        if(opts.xsd)
+             return new XmlSchemaLoader(in);
+ 
+         final Parseable parseable = makeRELAXNGSource(opts, in, eh, f);
+@@ -169,10 +182,10 @@
+     }
+ 
+     private static Parseable makeRELAXNGSource(Options opts, final InputSource in, ErrorHandler eh, File f) {
+-        if(opts.compact.isOn())
++        if(opts.compact)
+             return new CompactParseable(in,eh);
+ 
+-        if(opts.xml.isOn())
++        if(opts.xml)
+             return new SAXParseable(in,eh);
+ 
+         // otherwise sniff from the file extension
diff --git a/debian/patches/series b/debian/patches/series
index 79f0236..eb37ff5 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 01-reactor-dependencies.patch
+02-args4j-compatibility.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jaxb.git



More information about the pkg-java-commits mailing list