File purefun.spec of Package purefun
#
# spec file for package purefun
#
# 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: purefun
Version: 4.2
Release: 0
Summary: Functional Programming library for Java
License: MIT
Group: Development/Libraries/Java
URL: https://github.com/tonivade/%{name}
Source0: %{url}/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: https://repo1.maven.org/maven2/com/github/tonivade/%{name}-annotation/%{version}/%{name}-annotation-%{version}.pom
Source2: https://repo1.maven.org/maven2/com/github/tonivade/%{name}-core/%{version}/%{name}-core-%{version}.pom
Source3: https://repo1.maven.org/maven2/com/github/tonivade/%{name}-instances/%{version}/%{name}-instances-%{version}.pom
Source4: https://repo1.maven.org/maven2/com/github/tonivade/%{name}-control/%{version}/%{name}-control-%{version}.pom
Source5: https://repo1.maven.org/maven2/com/github/tonivade/%{name}-processor/%{version}/%{name}-processor-%{version}.pom
Source6: https://repo1.maven.org/maven2/com/github/tonivade/%{name}-transformer/%{version}/%{name}-transformer-%{version}.pom
Source7: https://repo1.maven.org/maven2/com/github/tonivade/%{name}-monad/%{version}/%{name}-monad-%{version}.pom
Source8: https://repo1.maven.org/maven2/com/github/tonivade/%{name}-optics/%{version}/%{name}-optics-%{version}.pom
Source9: https://repo1.maven.org/maven2/com/github/tonivade/%{name}-stream/%{version}/%{name}-stream-%{version}.pom
Source10: https://repo1.maven.org/maven2/com/github/tonivade/%{name}-typeclasses/%{version}/%{name}-typeclasses-%{version}.pom
Source11: https://repo1.maven.org/maven2/com/github/tonivade/%{name}-generic/%{version}/%{name}-generic-%{version}.pom
Source12: https://repo1.maven.org/maven2/com/github/tonivade/%{name}-effect/%{version}/%{name}-effect-%{version}.pom
Source13: https://repo1.maven.org/maven2/com/github/tonivade/%{name}-free/%{version}/%{name}-free-%{version}.pom
BuildRequires: fdupes
BuildRequires: java-devel >= 17
BuildRequires: maven-local
BuildRequires: mvn(org.pcollections:pcollections)
BuildArch: noarch
%description
Functional Programming library for Java.
%package javadoc
Summary: API documentation for %{name}
Group: Documentation/HTML
%description javadoc
API documentation for %{name}.
%prep
%setup -q
cp %{SOURCE1} annotation/pom.xml
cp %{SOURCE2} core/pom.xml
cp %{SOURCE3} instances/pom.xml
cp %{SOURCE4} control/pom.xml
cp %{SOURCE5} processor/pom.xml
cp %{SOURCE6} transformer/pom.xml
cp %{SOURCE7} monad/pom.xml
cp %{SOURCE8} optics/pom.xml
cp %{SOURCE9} stream/pom.xml
cp %{SOURCE10} typeclasses/pom.xml
cp %{SOURCE11} generic/pom.xml
cp %{SOURCE12} effect/pom.xml
cp %{SOURCE13} free/pom.xml
%pom_xpath_remove 'pom:scope[.="runtime"]' processor instances
%pom_add_plugin org.apache.maven.plugins:maven-compiler-plugin processor \
'<configuration>
<compilerArgument>-proc:none</compilerArgument>
<compilerArgs>
<arg>--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
<arg>--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
<arg>--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
</compilerArgs>
</configuration>'
%pom_add_dep com.github.tonivade:%{name}-processor:%{version} core instances
%pom_add_plugin org.apache.maven.plugins:maven-compiler-plugin core instances \
'<configuration>
<annotationProcessorPaths>
<annotationProcessorPath>
<groupId>com.github.tonivade</groupId>
<artifactId>%{name}-processor</artifactId>
<version>%{version}</version>
</annotationProcessorPath>
</annotationProcessorPaths>
</configuration>'
cat >pom.xml <<__POM__
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.tonivade</groupId>
<artifactId>%{name}-parent</artifactId>
<version>%{version}</version>
<packaging>pom</packaging>
<modules>
<module>annotation</module>
<module>processor</module>
<module>core</module>
<module>instances</module>
<module>control</module>
<module>transformer</module>
<module>typeclasses</module>
<module>monad</module>
<module>optics</module>
<module>stream</module>
<module>generic</module>
<module>effect</module>
<module>free</module>
</modules>
</project>
__POM__
%build
%{mvn_build} -f -- \
-Dproject.build.outputTimestamp=$(date -u -d @${SOURCE_DATE_EPOCH:-$(date +%%s)} +%%Y-%%m-%%dT%%H:%%M:%%SZ) \
-Dmaven.compiler.{source,target}=17
%install
%{mvn_package} :%{name}-parent __noinstall
%mvn_install
%fdupes %{buildroot}%{_javadocdir}/%{name}
%files -f .mfiles
%license LICENSE
%doc README.md
%files javadoc -f .mfiles-javadoc
%license LICENSE
%changelog