diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9a636c6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/mstrobel-procyon-ee404caa9a29.zip +/v0.5.36.tar.gz +/procyon-1.0~SNAPSHOT.tar.gz +/procyon-92ba3f44b8f2b755a21efcdc05dec347ab4df552.tar.gz +/procyon-88a95fa93c58322393174f84543edc7a0a2ca44d.tar.gz diff --git a/generate-tarball.sh b/generate-tarball.sh new file mode 100755 index 0000000..817fc26 --- /dev/null +++ b/generate-tarball.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -ex + +name=procyon +version=`cat procyon.spec | grep "%global commit " | sed "s/.*commit //"` + +# RETRIEVE +rm -rf procyon +git clone "https://github.com/mstrobel/procyon.git" + +# CLEAN TARBALL +pushd procyon +git checkout "$version" + +rm -rf .git .idea docs +rm -rf gradle* +popd + +rm -rf "${name}-${version}" +mv procyon "${name}-${version}" + +tar -czf "${name}-${version}.tar.gz" "${name}-${version}" +rm -rf "${name}-${version}" diff --git a/madeToPasXlint.patch b/madeToPasXlint.patch new file mode 100644 index 0000000..c1eb252 --- /dev/null +++ b/madeToPasXlint.patch @@ -0,0 +1,30 @@ +--- a/Procyon.CompilerTools/src/main/java/com/strobel/assembler/metadata/MethodBinder.java ++++ b/Procyon.CompilerTools/src/main/java/com/strobel/assembler/metadata/MethodBinder.java2 +@@ -213,7 +213,7 @@ + + // + // Find the most specific method based on the parameters. On the first pass, prohibit +- // auto-(un)boxing and variable arity (see JLS §15.12.2.2). ++ // auto-(un)boxing and variable arity (see JLS 15.12.2.2). + // + int result = findMostSpecific( + m1.getParameters(), +@@ -229,7 +229,7 @@ + + // + // If the first attempt produced an ambiguous result, try again with boxing conversions +- // allowed (see JLS §15.12.2.3). ++ // allowed (see JLS 15.12.2.3). + // + if (result == 0) { + result = findMostSpecific( +@@ -247,7 +247,7 @@ + + // + // If the second attempt produced an ambiguous result, try again with both boxing +- // conversions and variable arity allowed (see JLS §15.12.2.4). ++ // conversions and variable arity allowed (see JLS 15.12.2.4). + // + if (result == 0) { + result = findMostSpecific( + diff --git a/procyon-decompiler b/procyon-decompiler new file mode 100755 index 0000000..e736d09 --- /dev/null +++ b/procyon-decompiler @@ -0,0 +1,8 @@ +#!/bin/bash +. /usr/share/java-utils/java-functions + +MAIN_CLASS=com.strobel.decompiler.DecompilerDriver + +set_classpath procyon-decompiler procyon-compilertools procyon-core beust-jcommander +run ${@} + diff --git a/procyon.spec b/procyon.spec new file mode 100644 index 0000000..08caf50 --- /dev/null +++ b/procyon.spec @@ -0,0 +1,217 @@ +#in noarch? why... +%define debug_package %{nil} +%global remove_tests 1 + +%global commit 88a95fa93c58322393174f84543edc7a0a2ca44d +%global shortcommit %(c=%{commit}; echo ${c:0:7}) +%global commitdate 20220221 + +Name: procyon +Version: 0.6.0 +Release: 0.11.%{commitdate}.git%{shortcommit}%{?dist} +Summary: procyon java decompiler and other tools +# Automatically converted from old format: ASL 2.0 - review is highly recommended. +License: Apache-2.0 +URL: https://github.com/mstrobel/procyon +# ./generate-tarball.sh +# This script uses a fork of the original project +Source0: %{name}-%{commit}.tar.gz +Source1: procyon-decompiler +Patch3: madeToPasXlint.patch + + +BuildArch: noarch +ExclusiveArch: %{java_arches} noarch + +BuildRequires: javapackages-tools +BuildRequires: java-25-devel +BuildRequires: dos2unix +BuildRequires: beust-jcommander +Requires: java-25-headless +Requires: javapackages-tools +# main package is just meta package for all subprojects and their artifacts +Recommends: %{name}-compilertools = %{version}-%{release} +Recommends: %{name}-core = %{version}-%{release} +Recommends: %{name}-expressions = %{version}-%{release} +Recommends: %{name}-reflection = %{version}-%{release} +Recommends: %{name}-decompiler = %{version}-%{release} + +%description +Procyon is a suite of Java metaprogramming tools focused on code generation and analysis. +It includes the following libraries: Core Framework, Reflection Framework, +Expressions Framework, Compiler Toolset (Experimental), Java Decompiler. +The Procyon libraries are available from Maven Central under group ID org.bitbucket.mstrobel. + +%package compilertools +Summary: The procyon-compilertools project +BuildArch: noarch +ExclusiveArch: %{java_arches} noarch +Requires: javapackages-tools + +%description compilertools +The procyon-compilertools project is a work in progress that includes: +Class metadata and bytecode inspection/manipulation facilities based on Mono.Cecil and +An optimization and decompiler framework based on ILSpy +The Compiler Toolset is still early in development and subject to change. + +%package core +Summary: The procyon-core framework contains common support classes +BuildArch: noarch +ExclusiveArch: %{java_arches} noarch +Requires: javapackages-tools + +%description core +The procyon-core framework contains common support classes used by the other +Procyon APIs. Its facilities include string manipulation, collection extensions, +filesystem/path utilities, freezable objects and collections, attached data stores, +and some runtime type helpers. + +%package expressions +Summary: The procyon-expressions framework provides a more natural form of Linq-like code generation +BuildArch: noarch +ExclusiveArch: %{java_arches} noarch +Requires: javapackages-tools + +%description expressions +The procyon-expressions framework provides a more natural form of code generation. +Rather than requiring bytecode to be emitted directly, as with procyon-reflection +and other popular libraries like ASM, procyon-expressions enables code composition +using declarative expression trees. These expression trees may then be compiled directly +into callbacks or coupled with a MethodBuilder. The procyon-expressions API is +almost a direct port of System.Linq.Expressions from .NET's Dynamic Language Runtime, +minus the dynamic callsite support (and with more relaxed rules regarding type conversions). + +%package decompiler +Summary: procyon-decompiler is a front-end for the Java decompiler +BuildArch: noarch +ExclusiveArch: %{java_arches} noarch +Requires: %{name}-core +Requires: %{name}-compilertools +Requires: beust-jcommander +Requires: javapackages-tools + +%description decompiler +procyon-decompiler is a front-end for the Java decompiler included in procyon-compilertools. +For more information about the decompiler, see the Java Decompiler wiki page - +https://bitbucket.org/mstrobel/procyon/wiki/Java%20Decompiler + +%package reflection +Summary: The procyon-reflection framework provides a rich reflection and code generation API +BuildArch: noarch +ExclusiveArch: %{java_arches} noarch +Requires: javapackages-tools + +%description reflection +The procyon-reflection framework provides a rich reflection and code generation API with full support for generics, +wildcards, and other high-level Java type concepts. It is based on .NET's System.Reflection and System.Reflection. +Emit APIs and is meant to address many of the shortcomings of the core Java reflection API, which offers rather +limited and cumbersome support for generic type inspection. Its code generation facilities include a TypeBuilder, +MethodBuilder, and a bytecode emitter. + +%prep +%setup -q -n %{name}-%{commit} +%if %{remove_tests} +find | grep "\\.class$" +#find | grep "\\.jar$" +rm -rvf Procyon.CompilerTools/src/test/ +find | grep "\\.class$" && exit 1 +find | grep "\\.jar$" && exit 1 +%endif +#to allow smooth patching +dos2unix Procyon.Decompiler/build.gradle +dos2unix build.gradle +dos2unix README.md +dos2unix Procyon.CompilerTools/src/main/java/com/strobel/assembler/metadata/MethodBinder.java +%patch -P3 -p1 + +%build +mkdir -p build/Procyon.CompilerTools/{libs,classes} +mkdir -p build/Procyon.Core/{libs,classes} +mkdir -p build/Procyon.Decompiler/{libs,classes} +mkdir -p build/Procyon.Expressions/{libs,classes} +mkdir -p build/Procyon.Reflection/{libs,classes} + +sourceVersion="-source 8 -target 8 -g" + +javac $sourceVersion -d build/Procyon.Core/classes/ ` find Procyon.Core/src/main/java -type f | grep "\.java"` +javac $sourceVersion -d build/Procyon.Reflection/classes/ -cp build/Procyon.Core/classes/ ` find Procyon.Reflection/src/main/java -type f | grep "\.java"` +javac $sourceVersion -d build/Procyon.Expressions/classes/ -cp build/Procyon.Core/classes/:build/Procyon.Reflection/classes/ ` find Procyon.Expressions/src/main/java -type f | grep "\.java"` +javac $sourceVersion -d build/Procyon.CompilerTools/classes/ -cp build/Procyon.Core/classes/ ` find Procyon.CompilerTools/src/main/java -type f | grep "\.java"` + +# pack the jars +for x in Procyon.CompilerTools Procyon.Core Procyon.Reflection Procyon.Expressions ; do + pushd build/$x/classes/ + project=`echo $x | sed -e "s/Procyon.//" | sed -e 's/\(.*\)/\L\1/'` + jar -cf ../../../build/$x/libs/%{name}-$project-%{version}.jar com + popd +done + +# create just launcher jar to be used in fedora +mkdir build/launcher-minimal +mkdir build/launcher-minimal/classes +javac -source 8 -target 8 -cp build/Procyon.Core/classes/:build/Procyon.CompilerTools/classes/:%{_javadir}/beust-jcommander.jar -d build/launcher-minimal/classes ` find Procyon.Decompiler/src/main/java -type f | grep "\.java"` +# pack the minimal jar +pushd build/launcher-minimal/classes/ +jar -cf ../../../build/Procyon.Decompiler/libs/%{name}-decompiler-%{version}.jar com +popd + +%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}/%{name}/ +cp build/Procyon.CompilerTools/libs/%{name}-compilertools-%{version}.jar $RPM_BUILD_ROOT/%{_javadir}/%{name}/ +cp build/Procyon.Core/libs/%{name}-core-%{version}.jar $RPM_BUILD_ROOT/%{_javadir}/%{name}/ +cp build/Procyon.Decompiler/libs/%{name}-decompiler-%{version}.jar $RPM_BUILD_ROOT/%{_javadir}/%{name}/ +cp build/Procyon.Expressions/libs/%{name}-expressions-%{version}.jar $RPM_BUILD_ROOT/%{_javadir}/%{name}/ +cp build/Procyon.Reflection/libs/%{name}-reflection-%{version}.jar $RPM_BUILD_ROOT/%{_javadir}/%{name}/ + +pushd $RPM_BUILD_ROOT/%{_javadir}/%{name}/ +ln -s %{name}-compilertools-%{version}.jar %{name}-compilertools.jar +ln -s %{name}-core-%{version}.jar %{name}-core.jar +ln -s %{name}-decompiler-%{version}.jar %{name}-decompiler.jar +ln -s %{name}-expressions-%{version}.jar %{name}-expressions.jar +ln -s %{name}-reflection-%{version}.jar %{name}-reflection.jar +popd + +%files +%license License.txt +%doc README.md + +%files compilertools +%dir %{_javadir}/%{name} +%{_javadir}/%{name}/%{name}-compilertools-%{version}.jar +%{_javadir}/%{name}/%{name}-compilertools.jar +%license License.txt +%doc README.md + +%files core +%dir %{_javadir}/%{name} +%{_javadir}/%{name}/%{name}-core-%{version}.jar +%{_javadir}/%{name}/%{name}-core.jar +%license License.txt +%doc README.md + +%files expressions +%dir %{_javadir}/%{name} +%{_javadir}/%{name}/%{name}-expressions-%{version}.jar +%{_javadir}/%{name}/%{name}-expressions.jar +%license License.txt +%doc README.md + +%files decompiler +%dir %{_javadir}/%{name} +%{_bindir}/%{name}-decompiler +%{_javadir}/%{name}/%{name}-decompiler-%{version}.jar +%{_javadir}/%{name}/%{name}-decompiler.jar +%license License.txt +%doc README.md + +%files reflection +%dir %{_javadir}/%{name}/ +%{_javadir}/%{name}/%{name}-reflection-%{version}.jar +%{_javadir}/%{name}/%{name}-reflection.jar +%license License.txt +%doc README.md + +%changelog +%autochangelog diff --git a/sources b/sources new file mode 100644 index 0000000..1dfc060 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (procyon-88a95fa93c58322393174f84543edc7a0a2ca44d.tar.gz) = 69c782cb8648f5c8f6ed1999d301df2318f64a3d3479a16ef340891deaef7a1b161d4d2808d98e70372381626dbe5488d9d0dc9b6c17feacc8e0d38f1747985e