#
# spec file for package json-path
#
# Copyright (c) 2022 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: json-path
Version: 2.1.0
Release: 0
Summary: Java JsonPath implementation
License: Apache-2.0
Group: Development/Libraries/Java
URL: https://github.com/jayway/JsonPath
Source0: https://github.com/jayway/JsonPath/archive/%{name}-%{version}.tar.gz
Source1: http://central.maven.org/maven2/com/jayway/jsonpath/json-path/%{version}/json-path-%{version}.pom
Source2: http://central.maven.org/maven2/com/jayway/jsonpath/json-path-assert/%{version}/json-path-assert-%{version}.pom
# PATCH-FIX-ALT-LINUX
Patch0: %{name}-2.1.0-JsonOrg.patch
Patch1: %{name}-hamcrest22.patch
BuildRequires: java-devel >= 1.8
BuildRequires: maven-local
BuildRequires: mvn(com.fasterxml.jackson.core:jackson-databind)
BuildRequires: mvn(com.google.code.gson:gson)
BuildRequires: mvn(net.minidev:json-smart)
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires: mvn(org.hamcrest:hamcrest-core)
BuildRequires: mvn(org.hamcrest:hamcrest-library)
BuildRequires: mvn(org.slf4j:slf4j-api)
BuildArch: noarch
%description
Java DSL for reading and testing JSON documents.
%package javadoc
Summary: Javadoc for %{name}
BuildArch: noarch
%description javadoc
This package contains javadoc for %{name}.
%prep
%setup -q -n JsonPath-%{name}-%{version}
find -type f -name *.jar -print -delete
find -type f -name *.class -print -delete
cp -p %{SOURCE1} %{name}/pom.xml
cp -p %{SOURCE2} %{name}-assert/pom.xml
%patch -P 0 -p1
rm -rf %{name}/src/main/java/com/jayway/jsonpath/spi/json/JsonOrg*.java \
%{name}/src/main/java/com/jayway/jsonpath/spi/mapper/JsonOrg*.java \
%{name}/src/test/java/com/jayway/jsonpath/JsonOrg*.java
%pom_remove_dep org.json:json %{name}
%patch -P 1 -p1
# This is a dummy POM added just to ease building in the RPM platforms.
cat > pom.xml << EOF
4.0.0
com.jayway.jsonpath
%{name}-parent
%{version}
pom
Java JsonPath implementation
%{name}
%{name}-assert
EOF
# add OSGi support
for p in %{name} %{name}-assert ;do
%pom_xpath_inject "pom:project" "bundle" ${p}
%pom_add_plugin "org.apache.maven.plugins:maven-jar-plugin:2.4" ${p} "
true
"
%pom_add_plugin org.apache.felix:maven-bundle-plugin:2.3.7 ${p} '
true
${project.groupId}.${project.artifactId}
${project.name}
${project.version}
bundle-manifest
process-classes
manifest
'
done
# fix test deps
%pom_add_dep junit:junit:4.12:test %{name}
%pom_add_dep org.assertj:assertj-core:2.1.0:test %{name}
%pom_add_dep org.hamcrest:hamcrest-library:1.3:test %{name}
%pom_add_dep junit:junit:4.12:test %{name}-assert
%{mvn_file} :%{name} %{name}
%{mvn_file} :%{name}-assert %{name}-assert
%{mvn_package} :%{name}-parent __noinstall
%build
%{mvn_build} -f -- \
-Dproject.build.outputTimestamp=$(date -u -d @${SOURCE_DATE_EPOCH:-$(date +%%s)} +%%Y-%%m-%%dT%%H:%%M:%%SZ) \
-Dproject.build.sourceEncoding=UTF-8 -Dsource=8
%install
%mvn_install
%files -f .mfiles
%doc README.md
%license LICENSE
%files javadoc -f .mfiles-javadoc
%changelog