File jmh.spec of Package jmh

#
# spec file for package jmh
#
# 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/
#


Name:           jmh
Version:        1.34
Release:        0
Summary:        Java Microbenchmark Harness
License:        GPL-2.0-only WITH Classpath-exception-2.0
URL:            https://openjdk.java.net/projects/code-tools/jmh/
Source0:        https://github.com/openjdk/jmh/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
BuildRequires:  fdupes
BuildRequires:  java-devel >= 1.8
BuildRequires:  maven-local
BuildRequires:  mvn(junit:junit)
BuildRequires:  mvn(net.sf.jopt-simple:jopt-simple)
BuildRequires:  mvn(org.apache.commons:commons-math3)
BuildRequires:  mvn(org.ow2.asm:asm)

%description
The JMH is a Java harness for building, running, and analysing
nano/micro/macro benchmarks written in Java and other languages
targeting the JVM.

%package core-benchmarks
Summary:        JMH Core Benchmarks
License:        GPL-2.0-only WITH Classpath-exception-2.0
BuildArch:      noarch

%description core-benchmarks
JMH Core Benchmarks.

%package generator-annprocess
Summary:        JMH Generators: Annotation Processors
License:        GPL-2.0-only WITH Classpath-exception-2.0
BuildArch:      noarch

%description generator-annprocess
JMH benchmark generator, based on annotation processors.

%package generator-asm
Summary:        JMH Generators: ASM
License:        GPL-2.0-only WITH Classpath-exception-2.0
BuildArch:      noarch

%description generator-asm
JMH benchmark generator, based on ASM bytecode manipulation.

%package generator-bytecode
Summary:        JMH Generators: Bytecode
License:        GPL-2.0-only WITH Classpath-exception-2.0
BuildArch:      noarch

%description generator-bytecode
JMH benchmark generator, based on byte-code inspection.

%package generator-reflection
Summary:        JMH Generators: Reflection
License:        GPL-2.0-only WITH Classpath-exception-2.0
BuildArch:      noarch

%description generator-reflection
JMH benchmark generator, based on reflection.

%package parent
Summary:        Java Microbenchmark Harness Parent POM
License:        GPL-2.0-only WITH Classpath-exception-2.0
BuildArch:      noarch

%description parent
Java Microbenchmark Harness Parent POM.

%package samples
Summary:        JMH Samples
# BSD jmh-samples/src/main/java/*
License:        BSD-3-Clause
BuildArch:      noarch

%description samples
JMH Samples.

%package javadoc
Summary:        Javadoc for %{name}
License:        BSD-3-Clause AND GPL-2.0-only WITH Classpath-exception-2.0
BuildArch:      noarch

%description javadoc
This package contains javadoc for %{name}.

%prep
%setup -q

%pom_disable_module %{name}-archetypes
%pom_disable_module %{name}-core-ct
%pom_disable_module %{name}-core-it

# Plugins unnecessary for RPM builds
%pom_remove_plugin -r :maven-eclipse-plugin
%pom_remove_plugin -r :maven-license-plugin
%pom_remove_plugin -r :maven-shade-plugin
%pom_remove_plugin -r :maven-source-plugin
%pom_remove_plugin -r :maven-javadoc-plugin
%pom_remove_plugin -r :maven-site-plugin
%pom_remove_plugin -r :maven-enforcer-plugin

# wagon-ssh
%pom_xpath_remove "pom:build/pom:extensions" %{name}-core

%pom_xpath_set -r "pom:plugin[pom:artifactId[text()='maven-compiler-plugin']]/pom:configuration/pom:source" "1.8"
%pom_xpath_set -r "pom:plugin[pom:artifactId[text()='maven-compiler-plugin']]/pom:configuration/pom:target" "1.8"

# textTest_ROOT:218->test:134->compare:115 Mismatch expected:<...thrpt ...
rm -r %{name}-core/src/test/java/org/openjdk/jmh/results/format/ResultFormatTest.java

# http://mail.openjdk.java.net/pipermail/jmh-dev/2015-August/001997.html
sed -i "s,59,51,;s,Temple Place,Franklin Street,;s,Suite 330,Fifth Floor,;s,02111-1307,02110-1301," src/license/gpl_cpe/license.txt

%build
%{mvn_build} -sf -- -Dsource=8 -Dproject.build.sourceEncoding=UTF-8

%install
%mvn_install
%fdupes -s %{buildroot}%{_javadocdir}

%files -f .mfiles-%{name}-core
%license %{name}-core/LICENSE

%files core-benchmarks -f .mfiles-%{name}-core-benchmarks
%license %{name}-core-benchmarks/LICENSE

%files generator-annprocess -f .mfiles-%{name}-generator-annprocess
%license %{name}-generator-annprocess/LICENSE

%files generator-asm -f .mfiles-%{name}-generator-asm
%license %{name}-generator-asm/LICENSE

%files generator-bytecode -f .mfiles-%{name}-generator-bytecode
%license %{name}-generator-bytecode/LICENSE

%files generator-reflection -f .mfiles-%{name}-generator-reflection
%license %{name}-generator-reflection/LICENSE

%files parent -f .mfiles-%{name}-parent
%license LICENSE src/license/*

%files samples -f .mfiles-%{name}-samples
%license %{name}-samples/LICENSE src/license/bsd/*

%files javadoc -f .mfiles-javadoc
%license LICENSE src/license/*

%changelog
openSUSE Build Service is sponsored by