Files
jabel/jabel.spec

91 lines
2.7 KiB
RPMSpec

#
# spec file for package jabel
#
# Copyright (c) 2025 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: jabel
Version: 1.0.1
Release: 0
Summary: Unlock Javac 9+ syntax when targeting Java 8
License: Apache-2.0
Group: Development/Libraries/Java
URL: https://github.com/bsideup/%{name}
Source0: %{url}/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: https://repo1.maven.org/maven2/com/github/bsideup/%{name}/%{name}-javac-plugin/1.0.0/%{name}-javac-plugin-1.0.0.pom
Patch0: jabel-bytebuddy-noasm.patch
BuildRequires: fdupes
BuildRequires: maven-local
BuildRequires: mvn(net.bytebuddy:byte-buddy)
BuildRequires: mvn(net.bytebuddy:byte-buddy-agent)
BuildRequires: mvn(net.java.dev.jna:jna)
BuildArch: noarch
%description
While Java is evolving and introduces new language features, the majority of
OSS libraries are still using Java 8 as their target because it still
dominates.
But, since most of features after Java 8 did not require a change in the
bytecode, javac could emit Java 8 bytecode even when compiling Java 12 sources.
%package javadoc
Summary: API documentation for %{name}
Group: Documentation/HTML
%description javadoc
API documentation for %{name}.
%prep
%setup -q
%patch -P 0 -p1
cp %{SOURCE1} %{name}-javac-plugin/pom.xml
%pom_xpath_set pom:project/pom:version %{version} %{name}-javac-plugin
%pom_remove_dep net.bytebuddy:byte-buddy-parent %{name}-javac-plugin
%pom_xpath_remove 'pom:scope[.="runtime"]' %{name}-javac-plugin
%build
pushd %{name}-javac-plugin
# Work around an error with service not being loaded
mv src/main/resources src/main/whatever
%{mvn_build} -fj -- \
-Dmaven.compiler.source=8 -Dmaven.compiler.target=8
rm .xmvn* -rf
mv src/main/whatever src/main/resources
%{mvn_build} -f -- \
-Dmaven.compiler.source=8 -Dmaven.compiler.target=8
%{mvn_file} ':{*}' @1
popd
%install
pushd %{name}-javac-plugin
%mvn_install
%fdupes %{buildroot}%{_javadocdir}/%{name}
popd
%files -f %{name}-javac-plugin/.mfiles
%license LICENSE
%doc README.md
%files javadoc -f %{name}-javac-plugin/.mfiles-javadoc
%license LICENSE
%changelog