From 450a5de6f027e9f6ef6a44258adbe0b5c03b02d4 Mon Sep 17 00:00:00 2001 From: Jiri Vanek Date: Jan 10 2019 15:20:16 +0000 Subject: Initial import (#1662974). --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3dfb296 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/fernflower-183.5153.8.tar.gz diff --git a/create-sources.sh b/create-sources.sh new file mode 100644 index 0000000..d21de1d --- /dev/null +++ b/create-sources.sh @@ -0,0 +1,40 @@ +# idea soources have 280MB +# decompiler itself is 375kB now, including test classes... +VERSION=183.5153.8 +INPUT=$VERSION.tar.gz +TOP_DIR=intellij-community-idea-$VERSION +DECOMPILER_DIR=$TOP_DIR/plugins/java-decompiler +NAME=fernflower +OUT_NAME=$NAME-$VERSION +OUTPUT=$OUT_NAME.tar.gz +TEST=true; +if [ -e $OUTPUT ] ; then + echo "$OUTPUT already exists" +else + if [ -e $INPUT ] ; then + echo "$INPUT already exists, not downloading" + set -ex + else + set -ex + wget https://github.com/JetBrains/intellij-community/archive/idea/$INPUT + fi + tar tzf $INPUT | grep -e decompiler -e LICENSE + tar -xvf $INPUT $DECOMPILER_DIR/engine + tar -xvf $INPUT $TOP_DIR/LICENSE.txt + mv $TOP_DIR/LICENSE.txt $DECOMPILER_DIR/engine + pushd $DECOMPILER_DIR/ + mv engine $OUT_NAME + tar -cJf $OUTPUT $OUT_NAME + popd + mv $DECOMPILER_DIR/$OUTPUT . + rm -rf $TOP_DIR +fi +if [ $TEST == "true" ] ; then + tar -xvf $OUTPUT + pushd $OUT_NAME + gradle-local jar + find | grep $NAME.jar + popd +fi + + diff --git a/fernflower b/fernflower new file mode 100644 index 0000000..07e3d6a --- /dev/null +++ b/fernflower @@ -0,0 +1,8 @@ +#!/bin/bash +. /usr/share/java-utils/java-functions + +MAIN_CLASS=org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler + +set_classpath fernflower +run ${@} + diff --git a/fernflower.spec b/fernflower.spec new file mode 100644 index 0000000..fe5f799 --- /dev/null +++ b/fernflower.spec @@ -0,0 +1,99 @@ +#in noarch? why... +%global debug_package %{nil} +#javadoc is empty. Keep building it now with hope for bright future +%global with_javadoc 1 + +Name: fernflower +Version: 183.5153.8 +Release: 1%{?dist} +Summary: JIdea's java decompiler +Group: Development/Tools +License: ASL 2.0 +URL: https://github.com/JetBrains/intellij-community/tree/master/plugins/java-decompiler/engine +#Source0: https://github.com/JetBrains/intellij-community/archive/idea/%%{version}.tar.gz +# this source is 280MB big, so only the decompiler is repacked via create-sources.sh and has 350kB +# generated by source2; `create-sources.sh 183.5153.8` +Source0: %{name}-%{version}.tar.gz +# launcher +Source1: %{name} +Source2: create-sources.sh +Patch0: remove_main.patch +BuildArch: noarch +BuildRequires: javapackages-tools +BuildRequires: java-devel +BuildRequires: gradle-local +%if %{with_javadoc} +BuildRequires: zip +%endif +Requires: java-headless +Requires: javapackages-tools + + +%description +JIdea's decompiler is the first actually working analytical decompiler for Java and probably +for a high-level programming language in general. Naturally it is still under development, +please send your bug reports and improvement suggestions to the issue tracker. + +%if %{with_javadoc} +%package javadoc +Summary: %{name} API documentation +Group: Documentation +Requires: javapackages-filesystem +BuildArch: noarch + +%description javadoc +The %{name} 100% empty API documentation. +%endif + +%prep +%setup +# removing test classes and jars, tests are not run in rpm build anyway (but can be run out of it) +# maybe to pack them as demos? +find | grep "\\.class$" +find | grep "\\.jar$" +rm -rvf test +rm -rvf testData +rm -vf gradle/wrapper/gradle-wrapper.jar +find | grep "\\.class$" && exit 1 +find | grep "\\.jar$" && exit 1 +#removing main method from entry point jar +%patch0 + +%build +%gradle_build --skip-install jar +%if %{with_javadoc} +# this is sad. Javadoc is really 100% empty +mkdir fernflower-javadoc +cd fernflower-javadoc +javadoc `find ../src -type f` +cd .. +zip -r %{name}.zip fernflower-javadoc +%endif + + +%install +mkdir -p $RPM_BUILD_ROOT/%{_bindir}/ +cp %{SOURCE1} $RPM_BUILD_ROOT/%{_bindir}/ # cusotm launcher for main method in main jar +mkdir -p $RPM_BUILD_ROOT/%{_javadir}/ +cp build/libs/%{name}.jar $RPM_BUILD_ROOT/%{_javadir} +%if %{with_javadoc} +mkdir -p $RPM_BUILD_ROOT/%{_javadocdir}/%{name} +cp %{name}.zip $RPM_BUILD_ROOT/%{_javadocdir}/ +%endif + +%files +%license LICENSE.txt +%doc README.md +%{_javadir}/%{name}.jar +%attr(755, root, root) %{_bindir}/%{name} + +%if %{with_javadoc} +%files javadoc +%license LICENSE.txt +%doc README.md +%{_javadocdir}/%{name}.zip +%endif + +%changelog +* Wed Jan 09 2019 Jiri Vanek - 183.5153.8-1 +- initial package diff --git a/remove_main.patch b/remove_main.patch new file mode 100644 index 0000000..c144656 --- /dev/null +++ b/remove_main.patch @@ -0,0 +1,20 @@ +--- build.gradle 2018-12-24 11:27:21.000000000 +0100 ++++ build.gradle.orig 2019-01-02 15:29:35.875645761 +0100 +@@ -10,15 +10,6 @@ + test.java.srcDirs 'test' + } + +-repositories { jcenter() } +-dependencies { +- testCompile 'junit:junit:4.+' +- testCompile 'org.assertj:assertj-core:3.+' +-} +- + jar { + archiveName 'fernflower.jar' +- manifest { +- attributes 'Main-Class': 'org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler' +- } +-} +\ No newline at end of file ++} diff --git a/sources b/sources new file mode 100644 index 0000000..377aa4b --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (fernflower-183.5153.8.tar.gz) = efaa1dc107ba62e38cda59fdfddfd6f5d22d01ecbd22bdeff29ec3a57622309e5f89a7025af52f018f7250b6d840bb7ccd64a4a51dc92bbc470911d1b289372a