File immutables.spec of Package immutables

#
# spec file for package immutables
#
# Copyright (c) 2023 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/
#


%global base_name immutables
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "bootstrap"
%bcond_without bootstrap
%else
%bcond_with bootstrap
%endif
%if %{with bootstrap}
%global name %{base_name}-%{flavor}
%else
%global name %{base_name}
%endif
Name:           %{name}
Version:        2.10.0
Release:        0
Summary:        Annotation processor to create immutable objects and builders
License:        Apache-2.0
Group:          Development/Libraries/Java
URL:            http://immutables.org/
Source0:        https://github.com/%{base_name}/%{base_name}/archive/refs/tags/%{version}.tar.gz#/%{base_name}-%{version}.tar.gz
Source1:        https://repo1.maven.org/maven2/org/%{base_name}/value/%{version}/value-%{version}.jar
Source2:        https://repo1.maven.org/maven2/org/%{base_name}/value/%{version}/value-%{version}.pom
Source3:        https://repo1.maven.org/maven2/org/%{base_name}/value-processor/%{version}/value-processor-%{version}.jar
Source4:        https://repo1.maven.org/maven2/org/%{base_name}/value-processor/%{version}/value-processor-%{version}.pom
Source5:        https://repo1.maven.org/maven2/org/%{base_name}/metainf/%{version}/metainf-%{version}.jar
Source6:        https://repo1.maven.org/maven2/org/%{base_name}/metainf/%{version}/metainf-%{version}.pom
Source7:        https://repo1.maven.org/maven2/org/%{base_name}/trees/%{version}/trees-%{version}.jar
Source8:        https://repo1.maven.org/maven2/org/%{base_name}/trees/%{version}/trees-%{version}.pom
Source9:        https://repo1.maven.org/maven2/org/%{base_name}/mirror/%{version}/mirror-%{version}.jar
Source10:       https://repo1.maven.org/maven2/org/%{base_name}/mirror/%{version}/mirror-%{version}.pom
BuildRequires:  javapackages-local
BuildRequires:  xmvn-install
BuildArch:      noarch
%if %{without bootstrap}
BuildRequires:  %{base_name}-bootstrap
BuildRequires:  fdupes
BuildRequires:  maven-local
BuildRequires:  mvn(com.fasterxml.jackson.core:jackson-databind)
BuildRequires:  mvn(javax.ws.rs:javax.ws.rs-api)
BuildRequires:  mvn(org.apache.maven.plugins:maven-enforcer-plugin)
BuildRequires:  mvn(org.codehaus.mojo:build-helper-maven-plugin)
BuildRequires:  mvn(org.eclipse.jdt:ecj)
BuildRequires:  mvn(org.junit.jupiter:junit-jupiter-api)
BuildRequires:  mvn(org.mockito:mockito-core)
BuildRequires:  mvn(org.parboiled:parboiled-java)
Obsoletes:      %{base_name}-bootstrap <= %{version}
%endif

%description
Annotation processor to create immutable objects and builders. Feels like
Guava’s immutable collections but for regular value objects. JSON, Jackson,
Gson, JAX-RS integrations included.

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

%description javadoc
API documentation for %{name}.

%prep
%if "%{flavor}" != "bootstrap"
%setup -q -n %{base_name}-%{version}

%pom_remove_dep -r com.google.errorprone:javac

%pom_remove_plugin -r org.immutables.tools:maven-shade-plugin
%pom_remove_plugin -r :maven-source-plugin

%pom_xpath_remove 'pom:dependency[pom:classifier="annotations"]' value-processor

%pom_disable_module android-stub
%pom_disable_module criteria
#%%pom_disable_module common criteria
#%%pom_disable_module inmemory criteria
#%%pom_disable_module mongo criteria
#%%pom_disable_module elasticsearch criteria
#%%pom_disable_module geode criteria
#%%pom_disable_module sql criteria
#%%pom_disable_module rxjava2 criteria
#%%pom_disable_module reactor criteria
%pom_disable_module mongo
%pom_disable_module processor-testlib
%pom_disable_module value-fixture
%pom_disable_module gson

%endif

%build
%if %{with bootstrap}
%{mvn_artifact} --skip-dependencies %{SOURCE2} %{SOURCE1}
%{mvn_artifact} --skip-dependencies %{SOURCE4} %{SOURCE3}
%{mvn_artifact} --skip-dependencies %{SOURCE6} %{SOURCE5}
%{mvn_artifact} --skip-dependencies %{SOURCE8} %{SOURCE7}
%{mvn_artifact} --skip-dependencies %{SOURCE10} %{SOURCE9}
%else
%{mvn_build} -f -- \
	-Dproject.build.outputTimestamp=$(date -u -d @${SOURCE_DATE_EPOCH:-$(date +%%s)} +%%Y-%%m-%%dT%%H:%%M:%%SZ)
%endif

%install
%mvn_install
%if %{without bootstrap}
%fdupes %{buildroot}%{_javadocdir}/%{name}
%endif

%files -f .mfiles
%if %{without bootstrap}
%license LICENSE
%doc README.md
%endif

%if %{without bootstrap}
%files javadoc -f .mfiles-javadoc
%license LICENSE
%endif

%changelog
openSUSE Build Service is sponsored by