glassfish-jaxb package init

This commit is contained in:
jeff200902 2020-06-19 18:26:40 +08:00
parent cf0210e5f2
commit cbafd8b803
4 changed files with 359 additions and 0 deletions

208
glassfish-jaxb.spec Normal file
View File

@ -0,0 +1,208 @@
%define release_version %(echo %{version} | awk -F. '{print $1"_"$2"_"$3}')
Name: glassfish-jaxb
Version: 2.2.11
Release: 11
Summary: JAXB Reference Implementation
License: CDDL-1.1 and GPLv2 with exceptions
URL: http://jaxb.java.net
Source0: https://github.com/javaee/jaxb-v2/archive/jaxb-%{release_version}-branch.zip
Patch0000: txw2-args4j.patch
BuildRequires: maven-local mvn(args4j:args4j) mvn(com.sun.istack:istack-commons-runtime)
BuildRequires: mvn(com.sun.istack:istack-commons-tools) mvn(relaxngDatatype:relaxngDatatype)
BuildRequires: mvn(com.sun.xml.dtd-parser:dtd-parser) mvn(com.sun.xml.fastinfoset:FastInfoset)
BuildRequires: mvn(com.sun.xsom:xsom) mvn(javax.xml.bind:jaxb-api) mvn(net.java.dev.msv:msv-core)
BuildRequires: mvn(org.apache.maven.plugins:maven-dependency-plugin) mvn(org.apache.ant:ant)
BuildRequires: mvn(org.apache.maven.plugins:maven-enforcer-plugin) mvn(net.java:jvnet-parent:pom:)
BuildRequires: mvn(org.apache.maven.plugins:maven-source-plugin) mvn(org.jvnet.staxex:stax-ex)
BuildRequires: mvn(org.codehaus.mojo:build-helper-maven-plugin) mvn(com.sun:tools)
Requires: glassfish-jaxb1-impl = %{version}-%{release} glassfish-jaxb-bom = %{version}-%{release}
Requires: glassfish-jaxb-bom-ext = %{version}-%{release} glassfish-jaxb-codemodel = %{version}-%{release}
Requires: glassfish-jaxb-core = %{version}-%{release} glassfish-jaxb-jxc = %{version}-%{release}
Requires: glassfish-jaxb-parent = %{version}-%{release} glassfish-jaxb-rngom = %{version}-%{release}
Requires: glassfish-jaxb-runtime = %{version}-%{release} glassfish-jaxb-xjc = %{version}-%{release}
Requires: glassfish-jaxb-txw2 = %{version}-%{release}
BuildArch: noarch
%description
GlassFish JAXB Implementation Reference.
%package codemodel
provides: glassfish-jaxb-codemodel-parent = %{version}-%{release}
Obsoletes: glassfish-jaxb-codemodel-parent < %{version}-%{release}
provides: glassfish-jaxb-codemodel-annotation-compiler = %{version}-%{release}
Obsoletes: glassfish-jaxb-codemodel-annotation-compiler < %{version}-%{release}
Summary: Codemodel Core
%description codemodel
The CodeModel core functional library generated by java source code.
%package -n glassfish-jaxb1-impl
Summary: JAXB1 Runtime
%description -n glassfish-jaxb1-impl
JAXB1 runtime classes implementation.
%package bom
Summary: JAXB BOM
%description bom
JAXB Bill of Materials
%package bom-ext
Summary: JAXB BOM`s all dependencies
%description bom-ext
JAXB BOM`s all dependencies.
%package core
Summary: JAXB Core
%description core
Core module of JAXB. Provides sources required by JXC, XJC and Runtime modules.
%package jxc
Summary: JAXB schema generator
%description jxc
The tool based on java classes which to generate XML schema.
%package parent
provides: glassfish-jaxb-runtime-parent = %{version}-%{release}
Obsoletes: glassfish-jaxb-runtime-parent < %{version}-%{release}
Provides: glassfish-jaxb-txw-parent = %{version}-%{release}
Obsoletes: glassfish-jaxb-txw-parent < %{version}-%{release}
Provides: glassfish-jaxb-external-parent = %{version}-%{release}
Obsoletes: glassfish-jaxb-external-parent < %{version}-%{release}
Summary: JAXB parent POM
%description parent
This package include parent POM.
%package runtime
Summary: JAXB Runtime
%description runtime
The Implementation Reference of JAXB (JSR 222)
%package xjc
Summary: JAXB XJC
%description xjc
The JAXB Contains source code which bing compiler needed for binding
customization files into java sources. Means that the tool generate
java classes by the given xml representation.
%package rngom
Summary: RELAX NG Object Model/Parser
%description rngom
This package contains RELAX NG Object Model/Parser.
%package txw2
Summary: TXW2 Runtime
Provides: glassfish-jaxb-txwc2 = %{version}-%{release}
Obsoletes: glassfish-jaxb-txwc2 < %{version}-%{release}
%description txw2
TXW is a library that allows you to write XML documents.
%package help
Summary: Javadocs for glassfish-jaxb
Provides: glassfish-jaxb-javadoc = %{version}-%{release}
Obsoletes: glassfish-jaxb-javadoc < %{version}-%{release}
%description help
This package contains the API documentation for glassfish-jaxb.
%prep
%autosetup -c -n glassfish-jaxb-%{version} -p1
mv jaxb-v2-jaxb-%{release_version}-branch/jaxb-ri/* .
rm -rf jaxb-v2-jaxb-%{release_version}-branch
%pom_disable_module bundles
%pom_remove_dep com.sun:tools
%pom_add_dep_mgmt com.sun:tools
%pom_remove_dep com.sun:tools jxc
%pom_add_dep com.sun:tools jxc
%pom_remove_dep com.sun.xml.bind:jaxb-release-documentation bundles/ri
%pom_remove_dep com.sun.xml.bind:jaxb-samples bundles/ri
%pom_remove_plugin :gfnexus-maven-plugin
%pom_remove_plugin :maven-site-plugin
%pom_remove_plugin :buildnumber-maven-plugin
%mvn_alias org.glassfish.jaxb:jaxb-runtime "com.sun.xml.bind:jaxb-impl"
%mvn_alias org.glassfish.jaxb:jaxb-xjc "com.sun.xml.bind:jaxb-xjc"
%build
%mvn_build -f -s -- -Ddev -DbuildNumber=unknown
%install
%mvn_install
%files
%doc License.txt licenceheader.txt License.html
%files codemodel -f .mfiles-codemodel
%dir %{_javadir}/glassfish-jaxb
%doc License.txt licenceheader.txt License.html
%{_datadir}/java/glassfish-jaxb/codemodel-annotation-compiler.jar
%{_datadir}/maven-metadata/glassfish-jaxb-codemodel-annotation-compiler.xml
%{_datadir}/maven-metadata/glassfish-jaxb-jaxb-codemodel-parent.xml
%{_datadir}/maven-poms/glassfish-jaxb/codemodel-annotation-compiler.pom
%{_datadir}/maven-poms/glassfish-jaxb/jaxb-codemodel-parent.pom
%files -n glassfish-jaxb1-impl -f .mfiles-jaxb1-impl
%dir %{_javadir}/glassfish-jaxb
%files bom -f .mfiles-jaxb-bom
%doc License.txt licenceheader.txt License.html
%files bom-ext -f .mfiles-jaxb-bom-ext
%files core -f .mfiles-jaxb-core
%dir %{_javadir}/glassfish-jaxb
%doc License.txt licenceheader.txt License.html
%files jxc -f .mfiles-jaxb-jxc
%dir %{_javadir}/glassfish-jaxb
%doc License.txt licenceheader.txt License.html
%files parent -f .mfiles-jaxb-parent
%{_datadir}/maven-metadata/glassfish-jaxb-jaxb-external-parent.xml
%{_datadir}/maven-metadata/glassfish-jaxb-jaxb-runtime-parent.xml
%{_datadir}/maven-metadata/glassfish-jaxb-jaxb-txw-parent.xml
%{_datadir}/maven-poms/glassfish-jaxb/jaxb-external-parent.pom
%{_datadir}/maven-poms/glassfish-jaxb/jaxb-runtime-parent.pom
%{_datadir}/maven-poms/glassfish-jaxb/jaxb-txw-parent.pom
%files runtime -f .mfiles-jaxb-runtime
%dir %{_javadir}/glassfish-jaxb
%doc License.txt licenceheader.txt License.html
%files xjc -f .mfiles-jaxb-xjc
%dir %{_javadir}/glassfish-jaxb
%files rngom -f .mfiles-rngom
%dir %{_javadir}/glassfish-jaxb
%doc License.txt licenceheader.txt License.html
%files txw2 -f .mfiles-txw2
%dir %{_javadir}/glassfish-jaxb
%doc License.txt licenceheader.txt License.html
%{_datadir}/java/glassfish-jaxb/txwc2.jar
%{_datadir}/maven-metadata/glassfish-jaxb-txwc2.xml
%{_datadir}/maven-poms/glassfish-jaxb/txwc2.pom
%files help -f .mfiles-javadoc
%doc License.txt licenceheader.txt License.html
%changelog
* Wed Apr 15 2020 Jeffery.Gao <gaojianxing@huawei.com> - 2.2.11-11
- Package init

4
glassfish-jaxb.yaml Normal file
View File

@ -0,0 +1,4 @@
version-control: github
src_repo: javaee/jaxb-v2
tag_prefix: ^
seperator: .

BIN
jaxb-2_2_11-branch.zip Normal file

Binary file not shown.

147
txw2-args4j.patch Normal file
View File

@ -0,0 +1,147 @@
diff --git a/jaxb-v2-jaxb-2_2_11-branch/jaxb-ri/txw/compiler/src/main/java/com/sun/tools/txw2/Main.java b/jaxb-v2-jaxb-2_2_11-branch/jaxb-ri/txw/compiler/src/main/java/com/sun/tools/txw2/Main.java
index 3c8cc84..3f1a092 100644
--- a/jaxb-v2-jaxb-2_2_11-branch/jaxb-ri/txw/compiler/src/main/java/com/sun/tools/txw2/Main.java
+++ b/jaxb-v2-jaxb-2_2_11-branch/jaxb-ri/txw/compiler/src/main/java/com/sun/tools/txw2/Main.java
@@ -43,10 +43,10 @@ package com.sun.tools.txw2;
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.Option;
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.rngom.parse.IllegalSchemaException;
import org.kohsuke.rngom.parse.Parseable;
import org.kohsuke.rngom.parse.compact.CompactParseable;
@@ -60,6 +60,8 @@ import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Properties;
+import java.util.List;
+import java.util.ArrayList;
/**
* Programatic entry point to the TXW compiler.
@@ -73,26 +75,39 @@ public class Main {
this.opts = opts;
}
- public static void main(String[] args) {
- System.exit(run(args));
+ public static class Options {
+ @Argument
+ public List<String> arguments = new ArrayList<String>();
+
+ @Option(name="-o")
+ public String output;
+
+ @Option(name="-p")
+ public String pkg;
+
+ @Option(name="-c")
+ public boolean compact;
+
+ @Option(name="-x")
+ public boolean xml;
+
+ @Option(name="-xsd")
+ public boolean xsd;
+
+ @Option(name="-h")
+ public boolean chain;
}
- 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");
+ public static void main(String[] args) {
+ System.exit(run(args));
}
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 +117,9 @@ public class Main {
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 +129,12 @@ public class Main {
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 +161,21 @@ public class Main {
* 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 +184,10 @@ public class Main {
}
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