File jslt.spec of Package jslt

#
# spec file for package jslt
#
# 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:           jslt
Version:        0.1.14
Release:        0
Summary:        JSON query and transformation language
License:        Apache-2.0
Group:          Development/Libraries/Java
URL:            https://github.com/schibsted/%{name}
Source0:        %{url}/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        https://repo1.maven.org/maven2/com/schibsted/spt/data/%{name}/%{version}/%{name}-%{version}.pom
Source2:        %{name}.pod
BuildRequires:  fdupes
BuildRequires:  maven-local
BuildRequires:  mvn(com.fasterxml.jackson.core:jackson-databind)
BuildRequires:  mvn(net.java.dev.javacc:javacc)
BuildRequires:  mvn(org.apache.maven.plugins:maven-javadoc-plugin)
BuildArch:      noarch

%description
JSLT is a complete query and transformation language for JSON. The language
design is inspired by jq, XPath, and XQuery.

JSLT can be used as:

	• a query language to extract values from JSON (.foo.bar[0]),
	• a filter/check language to test JSON objects
	  (starts-with(.foo.bar[0], "http://")) ,
	• a transformation language to convert between JSON formats.

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

%description javadoc
API documentation for %{name}.

%prep
%setup -q
pushd core
cp %{SOURCE1} pom.xml

%pom_change_dep com.fasterxml.jackson.core:jackson-databind::runtime :::compile

%{mvn_file} : %{name}
popd

%build
pushd core
jjtree \
	-OUTPUT_DIRECTORY=src/main/java/schibsted/spt/data/jslt/parser \
	src/main/jjtree/jslt.jjt
javacc \
	-OUTPUT_DIRECTORY=src/main/java/schibsted/spt/data/jslt/parser \
	src/main/java/schibsted/spt/data/jslt/parser/jslt.jj
%{mvn_build} -f -- \
	-Dproject.build.outputTimestamp=$(date -u -d @${SOURCE_DATE_EPOCH:-$(date +%%s)} +%%Y-%%m-%%dT%%H:%%M:%%SZ)
popd

pod2man \
	--release='%{name} %{version}' \
	--section=1 \
	--center='User Commands' \
	--quotes=none \
	%{SOURCE2} \
	%{name}.1

%install
pushd core
%mvn_install
popd

%fdupes %{buildroot}%{_javadocdir}/%{name}

%jpackage_script com.schibsted.spt.data.jslt.cli.JSLT '' '' %{name}:jackson-core:jackson-databind:jackson-annotations %{name} true

install -dm0755 %{buildroot}/%{_mandir}/man1
install -m0644 %{name}.1 %{buildroot}/%{_mandir}/man1

%files -f core/.mfiles
%license LICENSE
%doc README.md docs/*.md examples ideas language-design.txt tutorial.md
%{_bindir}/%{name}
%{_mandir}/man1/%{name}.1%{?ext_man}

%files javadoc -f core/.mfiles-javadoc
%license LICENSE

%changelog
openSUSE Build Service is sponsored by