#
# spec file for package guava
#
# 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: guava
Version: 30.1.1
Release: 1.73.uyuni2
Summary: Google Core Libraries for Java
License: Apache-2.0 AND CC0-1.0
Group: Development/Libraries/Java
URL: https://github.com/google/guava
Source0: https://github.com/google/guava/archive/v%{version}.tar.gz
Source1: %{name}-build.tar.xz
Patch0: donotmock.patch
BuildRequires: ant
BuildRequires: fdupes
BuildRequires: javapackages-local
BuildRequires: jsr-305
BuildRequires: junit
Requires: mvn(com.google.code.findbugs:jsr305)
BuildArch: noarch
%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 javadoc
Summary: Javadoc for %{name}
Group: Documentation/HTML
%description javadoc
API documentation for %{name}.
%package testlib
Summary: The guava-testlib artifact
Group: Development/Libraries/Java
Requires: mvn(com.google.code.findbugs:jsr305)
Requires: mvn(com.google.guava:guava)
Requires: mvn(junit:junit)
%description testlib
guava-testlib provides additional functionality for conveninent unit testing
%prep
%setup -q -a1
%patch0 -p1
find . -name '*.jar' -delete
%pom_disable_module guava-gwt
%pom_disable_module guava-tests
%pom_remove_plugin -r :animal-sniffer-maven-plugin
# Downloads JDK source for doc generation
%pom_remove_plugin :maven-dependency-plugin guava
%pom_xpath_inject /pom:project/pom:build/pom:plugins/pom:plugin/pom:configuration/pom:instructions "<_nouses>true" guava/pom.xml
%pom_remove_dep -r :error_prone_annotations
%pom_remove_dep -r :j2objc-annotations
%pom_remove_dep -r org.checkerframework:
%pom_remove_dep -r :listenablefuture
%pom_remove_dep -r :failureaccess
annotations=$(
find -name '*.java' \
| xargs grep -F -h \
-e 'import com.google.j2objc.annotations' \
-e 'import com.google.errorprone.annotation' \
-e 'import org.codehaus.mojo.animal_sniffer' \
-e 'import org.checkerframework' \
| sort -u \
| sed 's/.*\.\([^.]*\);/\1/' \
| paste -sd\|
)
# guava started using quite a few annotation libraries for code quality, which
# we don't have. This ugly regex is supposed to remove their usage from the code
find -name '*.java' | xargs sed -ri \
"s/^import .*\.($annotations);//;s/@($annotations)"'\>\s*(\((("[^"]*")|([^)]*))\))?//g'
for mod in guava guava-testlib futures/failureaccess; do
%pom_remove_parent ${mod}
%pom_xpath_inject pom:project '
com.google.guava
%{version}' ${mod}
done
%pom_change_dep -r -f ::::: :::::
%build
mkdir -p lib
build-jar-repository -s lib junit jsr-305
%{ant} -Dtest.skip=true package javadoc
%install
# jars
install -dm 0755 %{buildroot}%{_javadir}/%{name}
install -pm 0644 %{name}/target/%{name}-%{version}*.jar %{buildroot}%{_javadir}/%{name}/%{name}.jar
install -pm 0644 %{name}-testlib/target/%{name}-testlib-%{version}*.jar %{buildroot}%{_javadir}/%{name}/%{name}-testlib.jar
# poms
install -dm 0755 %{buildroot}%{_mavenpomdir}/%{name}
install -pm 0644 %{name}/pom.xml %{buildroot}%{_mavenpomdir}/%{name}/%{name}.pom
%add_maven_depmap %{name}/%{name}.pom %{name}/%{name}.jar
# We integrated this artifact in our main package
install -pm 0644 futures/failureaccess/pom.xml %{buildroot}%{_mavenpomdir}/%{name}/failureaccess.pom
%add_maven_depmap %{name}/failureaccess.pom %{name}/%{name}.jar
install -pm 0644 %{name}-testlib/pom.xml %{buildroot}%{_mavenpomdir}/%{name}/%{name}-testlib.pom
%add_maven_depmap %{name}/%{name}-testlib.pom %{name}/%{name}-testlib.jar -f %{name}-testlib
# javadoc
install -dm 0755 %{buildroot}%{_javadocdir}/%{name}
cp -r %{name}/target/site/apidocs %{buildroot}%{_javadocdir}/%{name}/%{name}
cp -r %{name}-testlib/target/site/apidocs %{buildroot}%{_javadocdir}/%{name}/%{name}-testlib
%fdupes -s %{buildroot}%{_javadocdir}
%files -f .mfiles
%doc CONTRIBUTORS README*
%license COPYING
%files javadoc
%{_javadocdir}/%{name}
%license COPYING
%files testlib -f .mfiles-guava-testlib
%changelog
* Fri Mar 11 2022 Fridrich Strba
- Upgrade to guava 30.1.1
* fixes bsc#1179926, CVE-2020-8908: temp directory creation
vulnerability in Guava versions prior to 30.0
- Remove parent reference from ALL distributed pom files
- Avoid version-less dependencies that can cause problems with
some tools
- Build the package with ant in order to prevent build cycles
* using a generated and customized ant build system
- Added patch:
* donotmock.patch
+ patch @DoNotMock annotation occurrences in order to put them
in a format that our regex is able to identify and kill
* Thu Feb 10 2022 Thomas Florio
- Enable aarch64
* Sat Nov 28 2020 Michael Calmer
- build always with java 11 or higher
* Tue Mar 5 2019 Frantisek Kobzik
- Updated from 13.0.1 to 27.0.1
- Changes between 13.0.1 and 23.0:
https://github.com/google/guava/wiki/Release14
https://github.com/google/guava/wiki/Release15
https://github.com/google/guava/wiki/Release16
https://github.com/google/guava/wiki/Release17
https://github.com/google/guava/wiki/Release18
https://github.com/google/guava/wiki/Release19
https://github.com/google/guava/wiki/Release23
- Changes between 23.0 and 27.0.1:
see https://github.com/google/guava/releases
- Added:
* v27.0.1.tar.gz
- Removed:
* guava-13.0.1-jdk9.patch
* guava-13.0.1.tar.gz
* Thu Nov 9 2017 jgonzalez@suse.com
- Fix build for JDK9
- Add:
* guava-13.0.1-jdk9.patch
* Mon Nov 9 2015 fkobzik@suse.com
- initial release