Files
json-path/json-path.spec

145 lines
4.6 KiB
RPMSpec

#
# 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
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>%{name}-parent</artifactId>
<version>%{version}</version>
<packaging>pom</packaging>
<name>Java JsonPath implementation</name>
<modules>
<module>%{name}</module>
<module>%{name}-assert</module>
</modules>
</project>
EOF
# add OSGi support
for p in %{name} %{name}-assert ;do
%pom_xpath_inject "pom:project" "<packaging>bundle</packaging>" ${p}
%pom_add_plugin "org.apache.maven.plugins:maven-jar-plugin:2.4" ${p} "
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>"
%pom_add_plugin org.apache.felix:maven-bundle-plugin:2.3.7 ${p} '
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.name}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
</instructions>
</configuration>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>'
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