File toolfactory-narcissus.spec of Package toolfactory-narcissus

#
# spec file
#
# 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 short_name narcissus
Name:           toolfactory-%{short_name}
Version:        1.0.7
Release:        0
Summary:        A library for bypassing all of Java’s security mechanisms
License:        MIT
Group:          Development/Libraries/Java
URL:            https://github.com/toolfactory
Source0:        %{url}/%{short_name}/archive/refs/tags/%{short_name}-%{version}.tar.gz
BuildRequires:  java-devel >= 1.8
BuildRequires:  maven-local
BuildRequires:  mvn(org.apache.maven.plugins:maven-antrun-plugin)
BuildRequires:  mvn(org.codehaus.mojo:native-maven-plugin)

%description
Narcissus is a JNI native code library that provides a small subset of the Java
reflection API, while bypassing all of Java’s access/visibility checks,
security manager restrictions, and module strong encapsulation enforcement, by
calling methods and accessing fields through the JNI API. This allows code that
relies on reflective access to non-public classes, fields, and methods to keep
working even now that strong encapsulation is being enforced in JDK 16+.

Narcissus works on JDK 7+, however it is most useful for suppressing reflective
access warnings in JDK 9-15, and for circumventing strong encapsulation for JDK
16+, in order to keep legacy software running (for example, when legacy
software depends upon setAccessible to access a needed private field of a class
in some library).

%package javadoc
Summary:        API documentation for %{name}
Group:          Documentation/HTML
BuildArch:      noarch

%description javadoc
API documentation for %{name}.

%prep
%setup -q -n %{short_name}-%{short_name}-%{version}

rm lib/*

sed -i -e 's#\<tasks>#target>#' pom.xml

%pom_remove_plugin org.sonatype.plugins:nexus-staging-maven-plugin
%pom_remove_plugin :maven-source-plugin

%pom_xpath_remove 'pom:plugin[pom:artifactId="maven-javadoc-plugin"]/pom:executions'

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

%ifarch %{arm} aarch64 riscv64
%pom_xpath_remove 'pom:compilerEndOption[.="-m${sun.arch.data.model}"]'
%endif

%{mvn_file} : toolfactory/%{name}

%build
%{mvn_build} -f -- -Punix

%install
%mvn_install

%files -f .mfiles
%license LICENSE
%doc README.md

%files javadoc -f .mfiles-javadoc
%license LICENSE

%changelog
openSUSE Build Service is sponsored by