File graphql-java.spec of Package graphql-java

#
# spec file for package graphql-java
#
# Copyright (c) 2024 SUSE LLC
#
# 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/
#


Name:           graphql-java
Version:        21.4
Release:        0
Summary:        GraphQL Java implementation
License:        MIT
Group:          Development/Libraries/Java
URL:            https://graphql-java.com/
Source0:        https://github.com/%{name}/%{name}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        https://repo1.maven.org/maven2/com/%{name}/%{name}/%{version}/%{name}-%{version}.pom
Patch0:         java8.patch
BuildRequires:  java-devel >= 1.8
BuildRequires:  maven-local
BuildRequires:  mvn(com.google.guava:guava)
BuildRequires:  mvn(com.graphql-java:java-dataloader)
BuildRequires:  mvn(com.intellij:annotations)
BuildRequires:  mvn(org.antlr:antlr4-maven-plugin)
BuildRequires:  mvn(org.antlr:antlr4-runtime)
BuildRequires:  mvn(org.apache.maven.plugins:maven-jar-plugin)
BuildRequires:  mvn(org.reactivestreams:reactive-streams)
BuildRequires:  mvn(org.slf4j:slf4j-api)
BuildArch:      noarch

%description
This is a GraphQL Java implementation.

%package javadoc
Summary:        API documentation for %{name}
Group:          Documentation/HTML

%description javadoc
API documentation for %{name}.

%prep
%setup -q
%patch -P 0 -p1
cp %{SOURCE1} pom.xml
%pom_add_dep com.google.guava:guava
%pom_add_dep com.intellij:annotations
%pom_add_dep org.antlr:antlr4-runtime
%pom_remove_dep org.slf4j:slf4j-api
%pom_add_dep org.slf4j:slf4j-api

%pom_add_plugin org.antlr:antlr4-maven-plugin \
'<configuration>
	<includes>Graphql.g4</includes>
</configuration>
<executions>
	<execution>
		<goals>
			<goal>antlr4</goal>
		</goals>
	</execution>
</executions>'

%pom_add_plugin org.apache.maven.plugins:maven-jar-plugin \
'<configuration>
	<archive>
		<manifestEntries>
			<Automatic-Module-Name>com.graphqljava</Automatic-Module-Name>
		</manifestEntries>
	</archive>
</configuration>'

mv src/main/antlr src/main/antlr4

%build
%{mvn_build} -f -- \
	-Dproject.build.outputTimestamp=$(date -u -d @${SOURCE_DATE_EPOCH:-$(date +%%s)} +%%Y-%%m-%%dT%%H:%%M:%%SZ) \
%if %{?pkg_vcmp:%pkg_vcmp java-devel >= 9}%{!?pkg_vcmp:0}
    -Dmaven.compiler.release=8 \
%endif
    -Dmaven.compiler.{source,target}=8

%install
%mvn_install

%files -f .mfiles
%license LICENSE.md
%doc {README,CONTRIBUTING}.md

%files javadoc -f .mfiles-javadoc
%license LICENSE.md

%changelog
openSUSE Build Service is sponsored by