Added subpackage built by jdk8 to allow looking into jdk8 apps

- for some reason, jdk8 vm can not look into jdk11 vm, even if agent is correctly jdk8 version
- the config is still share, which is stupid, but I doubt there is another target audeince then me
This commit is contained in:
Jiri 2020-12-08 18:54:53 +01:00
commit 628b22e7d5
3 changed files with 241 additions and 10 deletions

View file

@ -1,13 +1,15 @@
Summary: Application for extraction and decompilation of JVM byte code
Name: java-runtime-decompiler
Version: 4.0
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv3
URL: https://github.com/pmikova/java-runtime-decompiler
Source0: https://github.com/pmikova/%{name}/archive/%{name}-%{version}.tar.gz
Source1: java-runtime-decompiler
Source2: java-runtime-decompiler.1
Source3: jrd.desktop
Source4: java-runtime-decompiler8
Patch0: remove_rsyntaxtextarea.patch
Patch1: systemFernflower.patch
Patch2: systemProcyon.patch
Patch3: rsyntaxVersion.patch
@ -23,8 +25,10 @@ BuildRequires: maven-surefire-provider-junit
BuildRequires: maven-surefire-provider-junit5
BuildRequires: maven-surefire
BuildRequires: maven-surefire-plugin
# depends on devel, not runtime (needs tools.jar)
BuildRequires: maven-clean-plugin
# depends on devel, not runtime (needs tools.jar, javap attach and manyn others)
BuildRequires: java-11-devel
BuildRequires: java-1.8.0-devel
BuildRequires: google-gson
BuildRequires: desktop-file-utils
Requires: java-11-devel
@ -34,28 +38,50 @@ Recommends: procyon-decompiler
%description
This application can access JVM memory at runtime,
extract byte code from the JVM and decompile it.
%package javadoc
Summary: Javadoc for %{name}
Requires: %{name} = %{version}-%{release}
%description javadoc
This package contains the API documentation for %{name}.
%package jdk8
Summary: jdk8 comaptible version of %{name}, may miss sme features
Requires: java-1.8.0-devel
Recommends: fernflower
Recommends: procyon-decompiler
%description jdk8
jdk8 comaptible version of %{name}, may miss sme features.
Eg rich text area is missng or the agent need to be adjusted manually
%prep
%setup -q -n %{name}-%{name}-%{version}
%patch0 -p1
%patch1 -p0
%patch2 -p0
%patch3 -p0
%build
pushd runtime-decompiler
# not manipuling com.sun:tools in jdk11 phases
#%%pom_remove_dep com.sun:tools
#%%pom_add_dep com.sun:tools
%pom_remove_plugin :maven-jar-plugin
popd
# seting up build jdk, as most likely we will build separate binary by jdk8
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
pushd runtime-decompiler
%pom_add_dep com.sun:tools
popd
%mvn_build --xmvn-javadoc --skip-javadoc --skip-install -- -Plegacy
find | grep .jar$
mv -v ./decompiler_agent/target/decompiler-agent-%{version}.0-SNAPSHOT.jar ../decompiler-agent8.jarx #to avoid being mvn installed
mv -v ./runtime-decompiler/target/runtime-decompiler-%{version}.0-SNAPSHOT.jar ../runtime-decompiler8.jarx #to avoid being mvn installed
xmvn clean
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk
patch -p1 -R < %{PATCH0}
patch -p0 < %{PATCH3}
pushd runtime-decompiler
%pom_remove_dep com.sun:tools
popd
%mvn_build --xmvn-javadoc
%install
@ -65,6 +91,7 @@ install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man1/
install -d -m 755 $RPM_BUILD_ROOT%{_bindir}
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/
install -m 755 %{SOURCE4} $RPM_BUILD_ROOT%{_bindir}/
install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/
cp -r %{_builddir}/%{name}-%{name}-%{version}/runtime-decompiler/src/plugins/ $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/
@ -72,11 +99,15 @@ install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/applications
desktop-file-install --vendor="fedora" \
--dir=${RPM_BUILD_ROOT}%{_datadir}/applications %{SOURCE3}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/java/%{name}-jdk8
cp -v %{_builddir}/decompiler-agent8.jarx $RPM_BUILD_ROOT%{_datadir}/java/%{name}-jdk8/decompiler-agent8.jar
cp -v %{_builddir}/runtime-decompiler8.jarx $RPM_BUILD_ROOT%{_datadir}/java/%{name}-jdk8/runtime-decompiler8.jar
%files -f .mfiles
%attr(755, root, -) %{_bindir}/java-runtime-decompiler
%{_mandir}/man1/java-runtime-decompiler.1*
# wrappers for decompilers
# wrappers for decompilers shared with jdk8 subpackage
%dir %{_sysconfdir}/%{name}
%dir %{_sysconfdir}/%{name}/plugins
%config %{_sysconfdir}/%{name}/plugins/FernflowerDecompilerWrapper.java
@ -91,7 +122,26 @@ desktop-file-install --vendor="fedora" \
%files javadoc -f .mfiles-javadoc
%license LICENSE
%files jdk8
%attr(755, root, -) %{_bindir}/java-runtime-decompiler8
%dir %{_datadir}/java/%{name}-jdk8
%{_datadir}/java/%{name}-jdk8/runtime-decompiler8.jar
%{_datadir}/java/%{name}-jdk8/decompiler-agent8.jar
# wrappers for decompilers shared with main
%dir %{_sysconfdir}/%{name}
%dir %{_sysconfdir}/%{name}/plugins
%config %{_sysconfdir}/%{name}/plugins/FernflowerDecompilerWrapper.java
%config(noreplace) %{_sysconfdir}/%{name}/plugins/FernflowerDecompilerWrapper.json
%config %{_sysconfdir}/%{name}/plugins/ProcyonDecompilerWrapper.java
%config(noreplace) %{_sysconfdir}/%{name}/plugins/ProcyonDecompilerWrapper.json
%license LICENSE
%changelog
* Tue Dec 08 2020 Jiri Vanek <jvanek@redhat.com> - 4.0-2
- Added subpackage built by jdk8 to allow looking into jdk8 apps
- for some reason, jdk8 vm can not look into jdk11 vm, even if agent is correctly jdk8 version
- the config is still share, which is stupid, but I doubt there is another target audeince then me
* Tue Dec 08 2020 Jiri Vanek <jvanek@redhat.com> - 4.0-1
- built by jdk11