File byte-buddy.spec of Package byte-buddy

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


%global base_name byte-buddy
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "bootstrap"
%bcond_without bootstrap
%else
%bcond_with bootstrap
%endif
%if %{with bootstrap}
%global name %{base_name}-%{flavor}
%else
%global name %{base_name}
%endif
Name:           %{name}
Version:        1.14.4
Release:        0
Summary:        Runtime code generation for the Java virtual machine
License:        Apache-2.0
Group:          Development/Libraries/Java
URL:            https://bytebuddy.net/
Source0:        https://github.com/raphw/%{base_name}/archive/refs/tags/%{base_name}-%{version}.tar.gz
Source1:        https://repo1.maven.org/maven2/net/bytebuddy/%{base_name}-maven-plugin/%{version}/%{base_name}-maven-plugin-%{version}.jar
Source2:        https://repo1.maven.org/maven2/net/bytebuddy/%{base_name}-maven-plugin/%{version}/%{base_name}-maven-plugin-%{version}.pom
Source3:        https://repo1.maven.org/maven2/net/bytebuddy/%{base_name}/%{version}/%{base_name}-%{version}.jar
Source4:        https://repo1.maven.org/maven2/net/bytebuddy/%{base_name}/%{version}/%{base_name}-%{version}.pom
BuildRequires:  maven-local
BuildArch:      noarch
%if %{without bootstrap}
BuildRequires:  %{base_name}-bootstrap
BuildRequires:  mvn(cglib:cglib-nodep)
BuildRequires:  mvn(codes.rafael.modulemaker:modulemaker-maven-plugin)
BuildRequires:  mvn(net.java.dev.jna:jna)
BuildRequires:  mvn(net.java.dev.jna:jna-platform)
BuildRequires:  mvn(net.sourceforge.findbugs:annotations)
BuildRequires:  mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires:  mvn(org.apache.maven.plugins:maven-plugin-plugin)
BuildRequires:  mvn(org.apache.maven.plugins:maven-shade-plugin)
BuildRequires:  mvn(org.javassist:javassist)
BuildRequires:  mvn(org.openjdk.jmh:jmh-core)
BuildRequires:  mvn(org.openjdk.jmh:jmh-generator-annprocess)
%endif

%description
Byte Buddy is a code generation and manipulation library for creating and
modifying Java classes during the runtime of a Java application and without the
help of a compiler. Other than the code generation utilities that ship with the
Java Class Library, Byte Buddy allows the creation of arbitrary classes and is
not limited to implementing interfaces for the creation of runtime proxies.
Furthermore, Byte Buddy offers a convenient API for changing classes either
manually, using a Java agent or during a build.

%if %{without bootstrap}
%package javadoc
Summary:        API documentation for %{name}
Group:          Documentation/HTML

%description javadoc
API documentation for %{name}.

%endif

%prep
%if %{with bootstrap}
cp %{SOURCE2} %{SOURCE4} .
%pom_xpath_set 'pom:project/pom:artifactId' '%{base_name}-maven-plugin-bootstrap' \
	%{base_name}-maven-plugin-%{version}.pom
%pom_xpath_set 'pom:project/pom:artifactId' '%{base_name}-bootstrap' \
	%{base_name}-%{version}.pom

%pom_xpath_set 'pom:dependency/pom:artifactId[text()="%{base_name}"]' '%{base_name}-bootstrap' \
	%{base_name}-maven-plugin-%{version}.pom
%else
%setup -q -n %{name}-%{name}-%{version}

%pom_disable_module %{name}-android
%pom_disable_module %{name}-android-test
%pom_disable_module %{name}-benchmark
%pom_disable_module %{name}-gradle-plugin

%pom_remove_plugin org.sonatype.plugins:nexus-staging-maven-plugin
%pom_remove_plugin com.mycila:license-maven-plugin

%pom_remove_dep com.google.code.findbugs:findbugs-annotations
%pom_add_dep net.sourceforge.findbugs:annotations
%pom_add_dep net.sourceforge.findbugs:annotations byte-buddy-dep

%pom_xpath_set 'pom:plugin/pom:artifactId[text()="byte-buddy-maven-plugin"]' \
	'%{base_name}-maven-plugin-bootstrap' %{base_name}-dep
%pom_xpath_set 'pom:transformation/pom:artifactId[text()="byte-buddy"]' \
	'%{base_name}-bootstrap' %{base_name}-dep

%pom_xpath_remove 'pom:forShade' %{base_name}

%endif

%build
%if %{without bootstrap}
%{mvn_build} -f -- -Dsource=8
%endif

%install
%if %{with bootstrap}
%{mvn_artifact} --skip-dependencies %{base_name}-maven-plugin-%{version}.pom %{SOURCE1}
%{mvn_artifact} --skip-dependencies %{base_name}-%{version}.pom %{SOURCE3}
%endif
%mvn_install

%files -f .mfiles
%if %{without bootstrap}
%license LICENSE NOTICE
%doc README.md
%endif

%if %{without bootstrap}
%files javadoc -f .mfiles-javadoc
%license LICENSE NOTICE
%endif

%changelog
openSUSE Build Service is sponsored by