%global namedreltag .Final
%global namedversion %{version}%{namedreltag}
Name:                resteasy
Version:             3.0.19
Release:             1
Summary:             Framework for RESTful Web services and Java applications
License:             ASL 2.0 and CDDL
URL:                 https://github.com/resteasy/Resteasy/
Source0:             https://github.com/resteasy/Resteasy/archive/%{namedversion}/%{name}-%{namedversion}.tar.gz
Patch0:              resteasy-3.0.19-Mime4j-0.7.2-support.patch
Patch1:              resteasy-3.0.19-port-resteasy-netty-to-netty-3.10.6.patch
BuildArch:           noarch
BuildRequires:       maven-local mvn(com.beust:jcommander) mvn(com.fasterxml:classmate)
BuildRequires:       mvn(com.fasterxml.jackson.core:jackson-annotations)
BuildRequires:       mvn(com.fasterxml.jackson.core:jackson-core)
BuildRequires:       mvn(com.fasterxml.jackson.core:jackson-databind)
BuildRequires:       mvn(com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider)
BuildRequires:       mvn(com.google.inject:guice) mvn(com.sun.mail:javax.mail)
BuildRequires:       mvn(com.sun.xml.bind:jaxb-impl) mvn(com.sun.xml.fastinfoset:FastInfoset)
BuildRequires:       mvn(commons-io:commons-io) mvn(io.netty:netty:3) mvn(io.netty:netty-all)
BuildRequires:       mvn(io.undertow:undertow-core) mvn(io.undertow:undertow-servlet)
BuildRequires:       mvn(javax.enterprise:cdi-api) mvn(javax.json:javax.json-api)
BuildRequires:       mvn(javax.validation:validation-api) mvn(junit:junit) mvn(log4j:log4j:12)
BuildRequires:       mvn(net.jcip:jcip-annotations) mvn(net.oauth.core:oauth-provider)
BuildRequires:       mvn(org.apache.httpcomponents:httpclient)
BuildRequires:       mvn(org.apache.james:apache-mime4j-core)
BuildRequires:       mvn(org.apache.james:apache-mime4j-dom)
BuildRequires:       mvn(org.apache.james:apache-mime4j-storage)
BuildRequires:       mvn(org.apache.maven.plugins:maven-source-plugin)
BuildRequires:       mvn(org.bouncycastle:bcmail-jdk15on) mvn(org.bouncycastle:bcprov-jdk15on)
BuildRequires:       mvn(org.codehaus.jackson:jackson-core-asl)
BuildRequires:       mvn(org.codehaus.jackson:jackson-jaxrs)
BuildRequires:       mvn(org.codehaus.jackson:jackson-mapper-asl)
BuildRequires:       mvn(org.codehaus.jackson:jackson-xc) mvn(org.codehaus.jettison:jettison)
BuildRequires:       mvn(org.eclipse.jetty:jetty-server) mvn(org.glassfish:javax.el)
BuildRequires:       mvn(org.glassfish:javax.json) mvn(org.hibernate:hibernate-validator)
BuildRequires:       mvn(org.hibernate.javax.persistence:hibernate-jpa-2.0-api)
BuildRequires:       mvn(org.infinispan:infinispan-core) mvn(org.jboss:jboss-parent:pom:)
BuildRequires:       mvn(org.jboss.jandex:jandex-maven-plugin) mvn(org.jboss.logging:jboss-logging)
BuildRequires:       mvn(org.jboss.logging:jboss-logging-annotations)
BuildRequires:       mvn(org.jboss.logging:jboss-logging-processor)
BuildRequires:       mvn(org.jboss.spec.javax.annotation:jboss-annotations-api_1.2_spec)
BuildRequires:       mvn(org.jboss.spec.javax.ejb:jboss-ejb-api_3.1_spec)
BuildRequires:       mvn(org.jboss.spec.javax.el:jboss-el-api_3.0_spec)
BuildRequires:       mvn(org.jboss.spec.javax.servlet:jboss-servlet-api_2.5_spec)
BuildRequires:       mvn(org.jboss.spec.javax.servlet:jboss-servlet-api_3.1_spec)
BuildRequires:       mvn(org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.0_spec)
BuildRequires:       mvn(org.jboss.weld:weld-api) mvn(org.picketbox:picketbox)
BuildRequires:       mvn(org.slf4j:slf4j-api) mvn(org.yaml:snakeyaml)
Requires:            resteasy-core = %{version}-%{release}
Requires:            resteasy-atom-provider = %{version}-%{release}
Requires:            resteasy-jackson-provider = %{version}-%{release}
Requires:            resteasy-jackson2-provider = %{version}-%{release}
Requires:            resteasy-jaxb-provider = %{version}-%{release}
Requires:            resteasy-jettison-provider = %{version}-%{release}
Requires:            resteasy-json-p-provider = %{version}-%{release}
Requires:            resteasy-multipart-provider = %{version}-%{release}
Requires:            resteasy-validator-provider-11 = %{version}-%{release}
Requires:            resteasy-yaml-provider = %{version}-%{release}
Requires:            resteasy-client = %{version}-%{release}
Requires:            resteasy-optional = %{version}-%{release} resteasy-test = %{version}-%{release}
Requires:            resteasy-netty3 = %{version}-%{release}
%description
%global desc \
RESTEasy contains a JBoss project that provides frameworks to help\
build RESTful Web Services and RESTful Java applications. It is a fully\
certified and portable implementation of the JAX-RS specification.
%{desc}
%global extdesc %{desc}\
\
This package contains

%package        javadoc
Summary:             Javadoc for %{name}
%description    javadoc
This package contains the API documentation for %{name}.

%package        core
Summary:             Core modules for %{name}
Obsoletes:           resteasy-jaxrs-api < 3.0.7
%description    core
%{extdesc} %{summary}.

%package        atom-provider
Summary:             Module atom-provider for %{name}
%description    atom-provider
%{extdesc} %{summary}.

%package        jackson-provider
Summary:             Module jackson-provider for %{name}
%description    jackson-provider
%{extdesc} %{summary}.

%package        jackson2-provider
Summary:             Module jackson2-provider for %{name}
%description    jackson2-provider
%{extdesc} %{summary}.

%package        jaxb-provider
Summary:             Module jaxb-provider for %{name}
%description    jaxb-provider
%{extdesc} %{summary}.

%package        jettison-provider
Summary:             Module jettison-provider for %{name}
%description    jettison-provider
%{extdesc} %{summary}.

%package        json-p-provider
Summary:             Module json-p-provider for %{name}
%description    json-p-provider
%{extdesc} %{summary}.

%package        multipart-provider
Summary:             Module multipart-provider for %{name}
%description    multipart-provider
%{extdesc} %{summary}.

%package        netty3
Summary:             Netty 3 Integration for %{name}
%description    netty3
%{extdesc} %{summary}.

%package        validator-provider-11
Summary:             Module validate-provider-11 for %{name}
%description    validator-provider-11
%{extdesc} %{summary}.

%package        yaml-provider
Summary:             Module yaml-provider for %{name}
%description    yaml-provider
%{extdesc} %{summary}.

%package        client
Summary:             Client for %{name}
%description    client
%{extdesc} %{summary}.

%package        optional
License:             ASL 2.0 and BSD and LGPLv2+
Summary:             Optional modules for %{name}
%description    optional
%{extdesc} %{summary}.

%package        test
Summary:             Test modules for %{name}
%description    test
%{extdesc} %{summary}.

%prep
%setup -q -n Resteasy-%{namedversion}
%mvn_package ":resteasy-jaxrs" core
%mvn_package ":providers-pom" core
%mvn_package ":resteasy-jaxrs-all" core
%mvn_package ":resteasy-pom" core
%mvn_package ":resteasy-atom-provider" atom-provider
%mvn_package ":resteasy-jackson-provider" jackson-provider
%mvn_package ":resteasy-jackson2-provider" jackson2-provider
%mvn_package ":resteasy-jaxb-provider" jaxb-provider
%mvn_package ":resteasy-jettison-provider" jettison-provider
%mvn_package ":resteasy-json-p-provider" json-p-provider
%mvn_package ":resteasy-multipart-provider" multipart-provider
%mvn_package ":resteasy-validator-provider-11" validator-provider-11
%mvn_package ":resteasy-yaml-provider" yaml-provider
%mvn_package ":resteasy-client" client
%mvn_package ":test-resteasy-html" test
%mvn_package ":test-all-jaxb" test
%mvn_package ":test-jackson-jaxb-coexistence" test
%mvn_package ":resteasy-jaxrs-testsuite" test
%mvn_package ":async-http-servlet-3.0" optional
%mvn_package ":asynch-http-servlet-3.0-pom" optional
%mvn_package ":http-adapter-pom" optional
%mvn_package ":jose-jwt" optional
%mvn_package ":resteasy-bom" optional
%mvn_package ":resteasy-cache-core" optional
%mvn_package ":resteasy-cache-pom" optional
%mvn_package ":resteasy-cdi" optional
%mvn_package ":resteasy-crypto" optional
%mvn_package ":resteasy-guice" optional
%mvn_package ":resteasy-html" optional
%mvn_package ":resteasy-jdk-http" optional
%mvn_package ":resteasy-jsapi" optional
%mvn_package ":resteasy-keystone-core" optional
%mvn_package ":resteasy-links" optional
%mvn_package ":resteasy-netty4" optional
%mvn_package ":resteasy-netty4-cdi" optional
%mvn_package ":resteasy-oauth" optional
%mvn_package ":resteasy-servlet-initializer" optional
%mvn_package ":resteasy-undertow" optional
%mvn_package ":resteasy-wadl" optional
%mvn_package ":security-pom" optional
%mvn_package ":tjws" optional
%mvn_package ":resteasy-netty" netty3
find -name '*.jar' -print -delete
%patch0 -p1
%patch1 -p1
%pom_disable_module resteasy-spring jaxrs
%pom_disable_module fastinfoset jaxrs/providers
%pom_disable_module examples jaxrs
%pom_disable_module profiling-tests jaxrs
%pom_disable_module resteasy-test-data jaxrs
%pom_disable_module war-tests jaxrs
%pom_disable_module jboss-modules jaxrs
%pom_disable_module login-module-authenticator jaxrs/security
%pom_disable_module skeleton-key-idm jaxrs/security
%pom_disable_module keystone/keystone-as7 jaxrs/security
%pom_disable_module keystone/keystone-as7-modules jaxrs/security
%pom_disable_module test-jackson-jaxb-coexistence jaxrs/providers
%pom_disable_module test-resteasy-html jaxrs/providers
%pom_disable_module arquillian jaxrs
%pom_disable_module async-http-servlet-3.0-test jaxrs/async-http-servlet-3.0
%pom_disable_module callback-test jaxrs/async-http-servlet-3.0
%pom_disable_module resteasy-hibernatevalidator-provider jaxrs/providers
%pom_remove_plugin com.atlassian.maven.plugins:maven-clover2-plugin jaxrs
%pom_remove_plugin com.atlassian.maven.plugins:maven-clover2-plugin jaxrs/resteasy-jaxrs
%pom_change_dep "javax.servlet:servlet-api" "org.jboss.spec.javax.servlet:jboss-servlet-api_2.5_spec" jaxrs/tjws
%pom_xpath_set pom:properties/pom:dep.netty.version 3 jaxrs
%pom_remove_dep -r javax.activation:activation jaxrs jaxrs/resteasy-jaxrs jaxrs/resteasy-test-data
%pom_remove_dep :tjws::test jaxrs/resteasy-jaxrs-testsuite
files='
jaxrs/resteasy-jaxrs/src/main/java/org/jboss/resteasy/annotations/Query.java
jaxrs/resteasy-jaxrs/src/main/java/org/jboss/resteasy/core/QueryInjector.java
jaxrs/resteasy-jsapi/src/main/java/org/jboss/resteasy/jsapi/JSAPIWriter.java
jaxrs/resteasy-jsapi/src/main/java/org/jboss/resteasy/jsapi/JSAPIServlet.java
jaxrs/resteasy-jsapi/src/main/java/org/jboss/resteasy/jsapi/ServiceRegistry.java
jaxrs/resteasy-links/src/main/java/org/jboss/resteasy/links/AddLinks.java
jaxrs/resteasy-links/src/main/java/org/jboss/resteasy/links/ELProvider.java
jaxrs/resteasy-links/src/main/java/org/jboss/resteasy/links/LinkELProvider.java
jaxrs/resteasy-links/src/main/java/org/jboss/resteasy/links/LinkResource.java
jaxrs/resteasy-links/src/main/java/org/jboss/resteasy/links/LinkResources.java
jaxrs/resteasy-links/src/main/java/org/jboss/resteasy/links/ParentResource.java
jaxrs/resteasy-links/src/main/java/org/jboss/resteasy/links/RESTServiceDiscovery.java
jaxrs/resteasy-links/src/main/java/org/jboss/resteasy/links/ResourceFacade.java
jaxrs/resteasy-links/src/main/java/org/jboss/resteasy/links/ResourceID.java
jaxrs/resteasy-links/src/main/java/org/jboss/resteasy/links/ResourceIDs.java
jaxrs/security/resteasy-oauth/src/main/java/org/jboss/resteasy/auth/oauth/OAuthConsumer.java
jaxrs/security/resteasy-oauth/src/main/java/org/jboss/resteasy/auth/oauth/OAuthException.java
jaxrs/security/resteasy-oauth/src/main/java/org/jboss/resteasy/auth/oauth/OAuthFilter.java
jaxrs/security/resteasy-oauth/src/main/java/org/jboss/resteasy/auth/oauth/OAuthMemoryProvider.java
jaxrs/security/resteasy-oauth/src/main/java/org/jboss/resteasy/auth/oauth/OAuthProvider.java
jaxrs/security/resteasy-oauth/src/main/java/org/jboss/resteasy/auth/oauth/OAuthProviderChecker.java
jaxrs/security/resteasy-oauth/src/main/java/org/jboss/resteasy/auth/oauth/OAuthRequestToken.java
jaxrs/security/resteasy-oauth/src/main/java/org/jboss/resteasy/auth/oauth/OAuthServlet.java
jaxrs/security/resteasy-oauth/src/main/java/org/jboss/resteasy/auth/oauth/OAuthToken.java
jaxrs/security/resteasy-oauth/src/main/java/org/jboss/resteasy/auth/oauth/OAuthValidator.java
'
for f in ${files}; do
native2ascii -encoding UTF8 ${f} ${f}
done
%pom_add_plugin org.apache.maven.plugins:maven-source-plugin jaxrs '
<configuration>
 <skipSource>true</skipSource>
</configuration>'

%build
%mvn_build -f
find -name 'resteasy-*-%{namedversion}.jar' | while read f; do
  java -cp $(build-classpath jandex) org.jboss.jandex.Main -j ${f}
done

%install
%mvn_install
find -name "resteasy-*-jandex.jar" | while read f; do
  install -pm 644 ${f} %{buildroot}%{_javadir}/%{name}/$(basename -s "-%{namedversion}-jandex.jar" $f)-jandex.jar
done

%files
%doc README.md jaxrs/README.html
%license jaxrs/License.html

%files core -f .mfiles-core
%{_javadir}/%{name}/resteasy-jaxrs-jandex.jar

%files atom-provider -f .mfiles-atom-provider
%{_javadir}/%{name}/resteasy-atom-provider-jandex.jar

%files jackson-provider -f .mfiles-jackson-provider
%{_javadir}/%{name}/resteasy-jackson-provider-jandex.jar

%files jackson2-provider -f .mfiles-jackson2-provider
%{_javadir}/%{name}/resteasy-jackson2-provider-jandex.jar

%files jaxb-provider -f .mfiles-jaxb-provider
%{_javadir}/%{name}/resteasy-jaxb-provider-jandex.jar

%files jettison-provider -f .mfiles-jettison-provider
%{_javadir}/%{name}/resteasy-jettison-provider-jandex.jar

%files json-p-provider -f .mfiles-json-p-provider
%{_javadir}/%{name}/resteasy-json-p-provider-jandex.jar

%files multipart-provider -f .mfiles-multipart-provider
%{_javadir}/%{name}/resteasy-multipart-provider-jandex.jar

%files netty3 -f .mfiles-netty3
%{_javadir}/%{name}/resteasy-netty-jandex.jar

%files validator-provider-11 -f .mfiles-validator-provider-11
%{_javadir}/%{name}/resteasy-validator-provider-11-jandex.jar

%files yaml-provider -f .mfiles-yaml-provider
%{_javadir}/%{name}/resteasy-yaml-provider-jandex.jar

%files client -f .mfiles-client
%{_javadir}/%{name}/resteasy-client-jandex.jar

%files optional -f .mfiles-optional
%{_javadir}/%{name}/resteasy-cache-core-jandex.jar
%{_javadir}/%{name}/resteasy-cdi-jandex.jar
%{_javadir}/%{name}/resteasy-crypto-jandex.jar
%{_javadir}/%{name}/resteasy-guice-jandex.jar
%{_javadir}/%{name}/resteasy-html-jandex.jar
%{_javadir}/%{name}/resteasy-jdk-http-jandex.jar
%{_javadir}/%{name}/resteasy-jsapi-jandex.jar
%{_javadir}/%{name}/resteasy-keystone-core-jandex.jar
%{_javadir}/%{name}/resteasy-links-jandex.jar
%{_javadir}/%{name}/resteasy-netty4-cdi-jandex.jar
%{_javadir}/%{name}/resteasy-netty4-jandex.jar
%{_javadir}/%{name}/resteasy-oauth-jandex.jar
%{_javadir}/%{name}/resteasy-servlet-initializer-jandex.jar
%{_javadir}/%{name}/resteasy-undertow-jandex.jar
%{_javadir}/%{name}/resteasy-wadl-jandex.jar

%files test -f .mfiles-test
%{_javadir}/%{name}/resteasy-jaxrs-testsuite-jandex.jar

%files javadoc -f .mfiles-javadoc
%license jaxrs/License.html

%changelog
* Wed Oct 28 2020 baizhonggui <baizhonggui@huawei.com> - 3.0.19-1
- package init
