# depend on guava 20.0 RHBZ#1307246
%bcond_with guava
%bcond_with jcache
Name: caffeine
Version: 2.3.5
Release: 13%{?dist}
Summary: High performance, near optimal caching library based on Java 8
License: ASL 2.0
URL: https://github.com/ben-manes/%{name}
Source0: https://github.com/ben-manes/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
Source1: https://repo1.maven.org/maven2/com/github/ben-manes/%{name}/%{name}/%{version}/%{name}-%{version}.pom
Source2: %{name}-gen.pom
%if %{with guava}
Source3: http://repo1.maven.org/maven2/com/github/ben-manes/%{name}/guava/%{version}/guava-%{version}.pom
%endif
%if %{with jcache}
Source4: http://repo1.maven.org/maven2/com/github/ben-manes/%{name}/jcache/%{version}/jcache-%{version}.pom
%endif
BuildArch: noarch
BuildRequires: maven-local
BuildRequires: mvn(com.google.code.findbugs:jsr305)
BuildRequires: mvn(com.google.guava:guava)
BuildRequires: mvn(org.apache.commons:commons-lang3)
BuildRequires: mvn(org.codehaus.mojo:exec-maven-plugin)
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires: mvn(com.squareup:javapoet)
%description
A Cache is similar to ConcurrentMap, but not quite the same. The most
fundamental difference is that a ConcurrentMap persists all elements that are
added to it until they are explicitly removed. A Cache on the other hand is
generally configured to evict entries automatically, in order to constrain its
memory footprint. In some cases a LoadingCache or AsyncLoadingCache can be
useful even if it doesn't evict entries, due to its automatic cache loading.
Caffeine provide flexible construction to create a cache with a combination
of the following features:
automatic loading of entries into the cache, optionally asynchronously
size-based eviction when a maximum is exceeded based on frequency and recency
time-based expiration of entries, measured since last access or last write
asynchronously refresh when the first stale request for an entry occurs
keys automatically wrapped in weak references
values automatically wrapped in weak or soft references
notification of evicted (or otherwise removed) entries
writes propagated to an external resource
accumulation of cache access statistics
%if %{with guava}
%package guava
Summary: Caffeine Guava extension
%description guava
An adapter to expose a Caffeine cache through the Guava interfaces.
%endif
%if %{with jcache}
%package jcache
Summary: Caffeine JSR-107 JCache extension
%description jcache
An adapter to expose a Caffeine cache through the JCache interfaces.
%endif
%package javadoc
Summary: Javadoc for %{name}
%description javadoc
This package contains the API documentation for %{name}.
%prep
%setup -q
find -name "*.jar" -print -delete
# This is a dummy POM added just to ease building in the RPM platforms
cat > pom.xml << EOF
4.0.0com.github.ben-manes.caffeine%{name}-parent%{version}pomCaffeine Parent%{name}
EOF
cp -p %{SOURCE1} %{name}/pom.xml
cp -p %{SOURCE2} %{name}/gen.pom
%if %{with guava}
cp -p %{SOURCE3} guava/pom.xml
%endif
%if %{with jcache}
cp -p %{SOURCE4} jcache/pom.xml
%endif
(
for p in guava \
jcache; do
%if %{with $p}
%pom_xpath_inject "pom:project/pom:modules" "${p}"
%pom_xpath_inject "pom:project" "
UTF-8" ${p}
%pom_xpath_inject "pom:project" "
org.apache.maven.pluginsmaven-compiler-plugin2.3.21.8true" ${p}
%pom_xpath_set "pom:project/pom:name" "Caffeine ${p} extension" ${p}
%pom_xpath_inject "pom:project" "bundle" ${p}
%pom_add_plugin org.apache.felix:maven-bundle-plugin ${p} "
true\${project.groupId}.${p}\${project.groupId}.${p}\${project.version}bundle-manifestprocess-classesmanifest"
%pom_remove_dep com.google.errorprone:error_prone_annotations ${p}
%endif
echo hello
done
)
%pom_xpath_inject "pom:project" "UTF-8" %{name}
%pom_xpath_inject "pom:project" "
org.apache.maven.pluginsmaven-compiler-plugin2.3.21.8true" %{name}
%pom_xpath_inject "pom:project" "bundle" %{name}
%pom_add_plugin org.apache.felix:maven-bundle-plugin %{name} "
truetruecom.github.ben-manes.caffeinecom.github.ben-manes.caffeine\${project.version}bundle-manifestprocess-classesmanifest"
# remove missing dependency
%pom_remove_dep com.google.errorprone:error_prone_annotations %{name}
%if %{with jcache}
# Use open source JSR-107 apis
%pom_change_dep javax.cache:cache-api org.apache.geronimo.specs:geronimo-jcache_1.0_spec jcache
%endif
%mvn_package :%{name}-parent __noinstall
%build
(
cd %name
for class in com.github.benmanes.caffeine.cache.LocalCacheFactoryGenerator \
com.github.benmanes.caffeine.cache.NodeFactoryGenerator; do
xmvn -B --offline -f gen.pom compile exec:java -Dexec.mainClass=$class -Dexec.args=src/main/java
done
)
# tests are skipped due to missing dependencies
%mvn_build -sf
%install
%mvn_install
%files -f .mfiles-%{name}
%doc README.md
%license LICENSE
%if %{with guava}
%files guava -f .mfiles-guava
%endif
%if %{with jcache}
%files jcache -f .mfiles-jcache
%endif
%files javadoc -f .mfiles-javadoc
%license LICENSE
%changelog
* Wed Jan 19 2022 Fedora Release Engineering - 2.3.5-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Wed Jul 21 2021 Fedora Release Engineering - 2.3.5-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Jan 26 2021 Fedora Release Engineering - 2.3.5-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Mon Jul 27 2020 Fedora Release Engineering - 2.3.5-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Jul 10 2020 Jiri Vanek - 2.3.5-9
- Rebuilt for JDK-11, see https://fedoraproject.org/wiki/Changes/Java11
* Tue Jan 28 2020 Fedora Release Engineering - 2.3.5-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Wed Jul 24 2019 Fedora Release Engineering - 2.3.5-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Thu Jan 31 2019 Fedora Release Engineering - 2.3.5-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Jul 12 2018 Fedora Release Engineering - 2.3.5-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed Feb 07 2018 Fedora Release Engineering - 2.3.5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering - 2.3.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Fri Feb 10 2017 Fedora Release Engineering - 2.3.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Mon Nov 21 2016 Tomas Repik - 2.3.5-1
- initial package