#
# spec file
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2000-2007, JPackage Project
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global base_name jetty
%global addver .v20230217
%define src_name %{base_name}.project-%{base_name}-%{version}%{addver}
Name: %{base_name}-websocket
Version: 9.4.51
Release: 0
Summary: The websocket modules for Jetty
License: Apache-2.0 OR EPL-1.0
URL: https://www.eclipse.org/jetty/
Source0: https://github.com/eclipse/%{base_name}.project/archive/%{base_name}-%{version}%{addver}.tar.gz#/%{src_name}.tar.gz
BuildRequires: fdupes
BuildRequires: java-devel >= 1.8
# Multiple providers, chose the 1.0 one over 1.1, since
# the relevant artifacts assume the API version 1.0
BuildRequires: jboss-websocket-1.0-api
BuildRequires: maven-local
BuildRequires: mvn(javax.servlet:javax.servlet-api)
BuildRequires: mvn(javax.websocket:javax.websocket-api)
BuildRequires: mvn(javax.websocket:javax.websocket-client-api)
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-shade-plugin)
BuildRequires: mvn(org.codehaus.mojo:build-helper-maven-plugin)
BuildRequires: mvn(org.eclipse.jetty:jetty-annotations) >= %{version}
BuildRequires: mvn(org.eclipse.jetty:jetty-client) >= %{version}
BuildRequires: mvn(org.eclipse.jetty:jetty-http) >= %{version}
BuildRequires: mvn(org.eclipse.jetty:jetty-io) >= %{version}
BuildRequires: mvn(org.eclipse.jetty:jetty-server) >= %{version}
BuildRequires: mvn(org.eclipse.jetty:jetty-servlet) >= %{version}
BuildRequires: mvn(org.eclipse.jetty:jetty-util) >= %{version}
BuildRequires: mvn(org.eclipse.jetty:jetty-xml) >= %{version}
Requires: jboss-websocket-1.0-api
BuildArch: noarch
# jp_minimal doesn't have main package
%description
Jetty is a 100% Java HTTP Server and Servlet Container. This means that you\
do not need to configure and run a separate web server (like Apache) in order\
to use Java, servlets and JSPs to generate dynamic content. Jetty is a fully\
featured web server for static and dynamic content. Unlike separate\
server/container solutions, this means that your web server and web\
application run in the same process, without interconnection overheads\
and complications. Furthermore, as a pure java component, Jetty can be simply\
included in your application for demonstration, distribution or deployment.\
Jetty is available on all Java supported platforms.
This package contains the websocket modules for Jetty
%package -n %{base_name}-websocket-api
Summary: The websocket-api module for Jetty
%description -n %{base_name}-websocket-api
%{extdesc} %{summary}.
%package -n %{base_name}-websocket-client
Summary: The The websocket-client module for Jetty
%description -n %{base_name}-websocket-client
%{extdesc} %{summary}.
%package -n %{base_name}-websocket-common
Summary: The websocket-common module for Jetty
%description -n %{base_name}-websocket-common
%{extdesc} %{summary}.
%package -n %{base_name}-websocket-server
Summary: The websocket-server module for Jetty
%description -n %{base_name}-websocket-server
%{extdesc} %{summary}.
%package -n %{base_name}-websocket-servlet
Summary: The websocket-servlet module for Jetty
%description -n %{base_name}-websocket-servlet
%{extdesc} %{summary}.
%package -n %{base_name}-javax-websocket-client-impl
Summary: The javax-websocket-client-impl module for Jetty
%description -n %{base_name}-javax-websocket-client-impl
%{extdesc} %{summary}.
%package -n %{base_name}-javax-websocket-server-impl
Summary: The javax-websocket-server-impl module for Jetty
%description -n %{base_name}-javax-websocket-server-impl
%{extdesc} %{summary}.
%package javadoc
Summary: Javadoc for %{name}
%description javadoc
%{summary}.
%prep
%setup -q -n %{src_name}
find . -name "*.?ar" -exec rm {} \;
find . -name "*.class" -exec rm {} \;
%pom_remove_dep :::import
# Plugins irrelevant or harmful to building the package
%pom_remove_plugin -r :maven-checkstyle-plugin
%pom_remove_plugin -r :maven-enforcer-plugin
%pom_remove_plugin -r :maven-eclipse-plugin
%pom_remove_plugin -r :license-maven-plugin
%pom_remove_plugin -r :maven-site-plugin
%pom_remove_plugin -r :maven-source-plugin
%pom_remove_plugin -r :maven-deploy-plugin
%pom_remove_plugin -r :jacoco-maven-plugin
%pom_remove_plugin -r :maven-release-plugin
%pom_remove_plugin -r :buildnumber-maven-plugin
%pom_remove_plugin -r :h2spec-maven-plugin
# Unnecessary pom flattening can be skipped
%pom_remove_plugin -r :flatten-maven-plugin jetty-bom
%pom_disable_module aggregates/jetty-all
%pom_xpath_inject "pom:configuration/pom:instructions" \
"sun.misc;resolution:=optional,com.sun.nio.file;resolution:=optional,*"
%pom_remove_dep "com.sun.net.httpserver:http" jetty-http-spi
%pom_change_dep -r org.mortbay.jasper:apache-jsp org.apache.tomcat:tomcat-jasper
%pom_add_dep 'org.junit.jupiter:junit-jupiter-engine:${junit.version}' tests/test-sessions/test-sessions-common
# provided by glassfish-jsp-api that has newer version
%pom_change_dep -r javax.servlet.jsp:jsp-api javax.servlet.jsp:javax.servlet.jsp-api
# txt artifact - not installable
%pom_remove_plugin ":jetty-version-maven-plugin"
%pom_xpath_remove "pom:artifactItem[pom:classifier='version']" jetty-home
# Disable building source release
%pom_xpath_remove 'pom:execution[pom:id="sources"]' jetty-home
# Unwanted JS in javadoc
sed -i '/^\s*\*.*