%bcond_with bootstrap

Name:           guava
Version:        33.6.0
Release:        1
Summary:        Google Core Libraries for Java
# Most of the code is under Apache-2.0
# Few classes are under CC0-1.0 grep for creativecommons
License:        Apache-2.0 AND CC0-1.0
URL:            https://github.com/google/guava
BuildArch:      noarch

Source0:        https://github.com/google/guava/archive/v%{version}/guava-%{version}.tar.gz
Patch0:         0001-Remove-NullMarked-filtering-and-annotation-collectio.patch
Patch1:         0002-Fix-invalid-Maven-attribute-values-in-compilerArgs.patch

BuildRequires:  jurand
%if %{with bootstrap}
BuildRequires:  javapackages-bootstrap
%else
BuildRequires:  maven-local
BuildRequires:  mvn(com.google.code.findbugs:jsr305)
BuildRequires:  mvn(junit:junit)
BuildRequires:  mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires:  mvn(org.apache.maven.plugins:maven-enforcer-plugin)
%endif

Obsoletes:      %{name}-help < %{version}-%{release}

%description
Guava is a suite of core and expanded libraries that include
utility classes, Google’s collections, io classes, and much
much more.
This project is a complete packaging of all the Guava libraries
into a single jar.  Individual portions of Guava can be used
by downloading the appropriate module and its dependencies.

%package testlib
Summary:        The guava-testlib artifact

%description testlib
guava-testlib provides additional functionality for conveninent unit testing

%prep
%autosetup -p1

find . -name '*.jar' -delete

%pom_disable_module guava-gwt
%pom_disable_module guava-tests

%pom_xpath_inject pom:modules "<module>futures/failureaccess</module>"
%pom_xpath_inject pom:parent "<relativePath>../..</relativePath>" futures/failureaccess
%pom_xpath_set pom:parent/pom:version %{version}-jre futures/failureaccess

%pom_remove_plugin -r :animal-sniffer-maven-plugin
%pom_remove_plugin -r :maven-source-plugin
%pom_remove_plugin -r :maven-enforcer-plugin
%pom_remove_plugin -r :central-publishing-maven-plugin

%pom_remove_plugin -r :toolchains-maven-plugin
%pom_remove_plugin -r :maven-toolchains-plugin
%pom_xpath_remove pom:jdkToolchain

%pom_remove_dep :caliper guava-tests

%mvn_package :guava-parent guava

# javadoc generation fails due to strict doclint in JDK 1.8.0_45
%pom_remove_plugin -r :maven-javadoc-plugin

%pom_remove_plugin -r :build-helper-maven-plugin

%pom_xpath_inject /pom:project/pom:build/pom:plugins/pom:plugin/pom:configuration/pom:instructions "<_nouses>true</_nouses>" guava/pom.xml

# missing error_prone_core artifact
%pom_xpath_remove pom:annotationProcessorPaths
sed -i /Xplugin:ErrorProne/d pom.xml

%pom_remove_dep -r :error_prone_annotations
%pom_remove_dep -r :j2objc-annotations
%pom_remove_dep -r :jspecify
%pom_remove_dep -r :listenablefuture

jurand -i -s -a guava guava-testlib \
  -p com[.]google[.]common[.]annotations[.] \
  -p com[.]google[.]errorprone[.]annotations[.] \
  -p com[.]google[.]j2objc[.]annotations[.] \
  -p org[.]jspecify[.]annotations[.] \
  -m com[.]google[.].*[.]annotations \
  -m org[.]jspecify


%mvn_package "com.google.guava:failureaccess" guava

%mvn_package "com.google.guava:guava-bom" __noinstall

%build
# Tests fail on Koji due to insufficient memory,
# see https://bugzilla.redhat.com/show_bug.cgi?id=1332971
%mvn_build -j -s -f

%install
%mvn_install

%files -f .mfiles-guava
%doc CONTRIBUTORS README*
%license LICENSE

%files testlib -f .mfiles-guava-testlib

%changelog
* Tue May 26 2026 Ge Wang <wang__ge@126.com> - 33.6.0-1
- Update to 33.6.0

* Wed Feb 11 2026 wangkai <13474090681@163.com> - 33.3.0-1
- Update to 33.3.0

* Fri Jan 10 2025 Ge Wang <wang__ge@126.com> - 33.2.1-1
- Upgrade to version 33.2.1

* Wed Sep 27 2023 chenchen <chen_aka_jan@163.com> - 31.1-1
- Upgrade to version 31.1

* Tue Jul 04 2023 wangkai <13474090681@163.com> - 25.0-6
- Fix CVE-2023-2976

* Fri Feb 19 2021 wangxiao <wangxiao65@huawei.com> - 25.0-5
- Fix CVE-2020-8908

* Fri Mar 6 2020 dingyiming <dingyiming3@huawei.com> - 25.0-4
- Package init