Blame SPECS/prometheus-simpleclient-java.spec

414b33
%global version_id parent
414b33
%global upstream_name client_java
414b33
414b33
Name:          prometheus-simpleclient-java
414b33
Version:       0.6.0
414b33
Release:       5%{?dist}
414b33
Summary:       Prometheus JVM Client
414b33
414b33
License:       ASL 2.0 and CC0
414b33
URL:           https://github.com/prometheus/client_java/
414b33
414b33
Source0:       https://github.com/prometheus/client_java/archive/%{version_id}-%{version}.tar.gz
414b33
414b33
BuildArch:     noarch
414b33
414b33
BuildRequires: maven-local
414b33
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
414b33
BuildRequires: mvn(junit:junit)
414b33
414b33
%description
414b33
Prometheus instrumentation library for JVM applications.
414b33
414b33
%package        tests
414b33
Summary:        Tests jar for %{name}
414b33
414b33
%description    tests
414b33
This package contains %{summary}.
414b33
414b33
%prep
414b33
%setup -q -n %{upstream_name}-%{version_id}-%{version}
414b33
414b33
# Remove included jar files
414b33
find . -name \*.jar -print0 | xargs -0 rm
414b33
414b33
# Only build the following artefacts as these are actually dependencies
414b33
# of prometheus_jmxexporter
414b33
# 
414b33
# io.prometheus:simpleclient
414b33
# io.prometheus:simpleclient_hotspot
414b33
# io.prometheus:simpleclient_httpserver
414b33
# io.prometheus:simpleclient_common
414b33
for m in simpleclient_caffeine \
414b33
         simpleclient_dropwizard \
414b33
         simpleclient_graphite_bridge \
414b33
         simpleclient_hibernate \
414b33
         simpleclient_guava \
414b33
         simpleclient_log4j \
414b33
         simpleclient_log4j2 \
414b33
         simpleclient_logback \
414b33
         simpleclient_pushgateway \
414b33
         simpleclient_servlet \
414b33
         simpleclient_spring_web \
414b33
         simpleclient_spring_boot \
414b33
         simpleclient_jetty \
414b33
         simpleclient_jetty_jdk8 \
414b33
         simpleclient_vertx \
414b33
         benchmark; do
414b33
%pom_disable_module $m
414b33
done
414b33
414b33
# Remove test dependencies for hotspot
414b33
%pom_remove_dep io.prometheus:simpleclient_servlet simpleclient_hotspot
414b33
%pom_remove_dep org.mockito:mockito-core simpleclient_hotspot
414b33
%pom_remove_dep org.eclipse.jetty:jetty-servlet simpleclient_hotspot
414b33
# Remove test dependencies for httpserver
414b33
%pom_remove_dep org.assertj:assertj-core simpleclient_httpserver
414b33
414b33
# Don't depend on obsolete sonatype-oss-parent
414b33
# See: https://github.com/prometheus/client_java/pull/497
414b33
%pom_xpath_remove pom:project/pom:parent
414b33
414b33
# Remove tests which wouldn't compile with removed deps
414b33
for i in $(find simpleclient_hotspot/src/test/java/io/prometheus/client/hotspot -name \*.java); do
414b33
  if ! echo $i | grep -q -E 'VersionInfoExportsTest\.java|MemoryAllocationExportsTest\.java'; then
414b33
    rm $i
414b33
  fi
414b33
done
414b33
rm -rf simpleclient_httpserver/src/test/java
414b33
414b33
for i in simpleclient simpleclient_hotspot simpleclient_httpserver simpleclient_common; do
414b33
%pom_xpath_inject pom:project '<build>
414b33
    <plugins>
414b33
      <plugin>
414b33
        <groupId>org.apache.maven.plugins</groupId>
414b33
        <artifactId>maven-jar-plugin</artifactId>
414b33
        <version>3.1.2</version>
414b33
        <executions>
414b33
          <execution>
414b33
            <goals>
414b33
              <goal>test-jar</goal>
414b33
            </goals>
414b33
          </execution>
414b33
        </executions>
414b33
      </plugin>
414b33
    </plugins>
414b33
  </build>' $i
414b33
%mvn_package io.prometheus:$i:jar:tests:%{version} tests
414b33
done
414b33
414b33
%build
414b33
%mvn_build -j
414b33
414b33
%install
414b33
%mvn_install
414b33
414b33
%files -f .mfiles
414b33
%license LICENSE
414b33
%doc NOTICE
414b33
414b33
%files tests -f .mfiles-tests
414b33
414b33
%changelog
414b33
* Tue Oct 08 2019 Severin Gehwolf <sgehwolf@redhat.com> - 0.6.0-5
414b33
- Add CC0 in License tag
414b33
414b33
* Mon Oct 07 2019 Severin Gehwolf <sgehwolf@redhat.com> - 0.6.0-4
414b33
- Rebuild
414b33
414b33
* Thu Oct 03 2019 Severin Gehwolf <sgehwolf@redhat.com> - 0.6.0-3
414b33
- Add tests sub-package.
414b33
414b33
* Thu Oct 03 2019 Severin Gehwolf <sgehwolf@redhat.com> - 0.6.0-2
414b33
- Enable some tests during build.
414b33
414b33
* Mon Aug 12 2019 Severin Gehwolf <sgehwolf@redhat.com> - 0.6.0-1
414b33
- Initial package.
414b33