From 4f2d7949f03e1c198bc888f2d05f421d35c57e21 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 9 Oct 2017 18:53:29 +0100 Subject: reinit the tree, so we can have metadata --- dev-java/groovy/Manifest | 6 + .../groovy/files/groovy-2.4.5-utils.gradle.patch | 116 ++++++++++++++++++ dev-java/groovy/groovy-2.4.5.ebuild | 135 +++++++++++++++++++++ dev-java/groovy/metadata.xml | 14 +++ 4 files changed, 271 insertions(+) create mode 100644 dev-java/groovy/Manifest create mode 100644 dev-java/groovy/files/groovy-2.4.5-utils.gradle.patch create mode 100644 dev-java/groovy/groovy-2.4.5.ebuild create mode 100644 dev-java/groovy/metadata.xml (limited to 'dev-java/groovy') diff --git a/dev-java/groovy/Manifest b/dev-java/groovy/Manifest new file mode 100644 index 000000000000..26b9f26fd5ab --- /dev/null +++ b/dev-java/groovy/Manifest @@ -0,0 +1,6 @@ +AUX groovy-2.4.5-utils.gradle.patch 4345 SHA256 9633b74cc151665c97d395e179cbb6d05dd9b2c7eb849ec1e85c3912a87c4051 SHA512 81d39c1f7b537260721740cc807b9ffcf16b86b170fbc2bd9697f30ed3d77e995cb8beb35d67476137246882ba6f2962051878f032fe173f56c4db1e370aa6c1 WHIRLPOOL 655f7e2fddbddceff9916533ee9ead6e91324dbcee7ecbf811ef87093ef146241acfbb9ac0a278c76568ba524bef5c04f1c4c15bba4e2d733a0f2475bd3f511d +DIST groovy-2.4.5.zip 10214173 SHA256 6fbbe2c1e16bd1c56b889cbcadff04d055a96568883f885ed904265e4e9d8780 SHA512 055b664d2bc9966f9dd5933ec89f22c28c18323b57db66eeec524c88bdc6ea1090f6f1dd866433d7232d837ca31ca83164d8894c0db1d69e72c7d41f20a8382d WHIRLPOOL c05dcb4afddc9ad217bb99d6cc9618e6a67e7f13f52b99ecc155a9b8e97079dcd8f83402cad61acdbcca4141018965320b8194a84dbf6036f2daf699a2111149 +EBUILD groovy-2.4.5.ebuild 3508 SHA256 e77eafb7e31b03b81711188111c11a0344e3611ddc451a0f89de7e334fdb6e20 SHA512 2150e3f9ca4653e60188fa6dcebabbcc7e6f36564490940279be66d00e536de815c040192df963409943200a5322b045a34575e2227e71897b66c51f769ae1bb WHIRLPOOL 8d9c1534cdddb2bfd52c4b7e06fbe3edfc78ee7599b4a899006a16f2985e6f1a17a7894c4646c9e51006e739e099da32b7ab8f2b224ccd1c8a045b0b58432528 +MISC ChangeLog 5199 SHA256 177d3c66b11eaa087c164a522a3b81546eb289d4e7dd5113567a5cce05cc48d1 SHA512 92ef5e9f4a39a2ae34f06aeb09647c225e729d840d9ad2af9178eea85e37d34dc569280e6e9d7f0283f5ace26a56b522e9de5056568ae24bcb45def1f6d96219 WHIRLPOOL 90e642bbd5be989e2c4c85964ce031e579747ddd350f49ce1204f0f7961bd9dda6a0601925db1950be2a4bebfb022de32d78f37d6e657210bb0b2137b9dea4f2 +MISC ChangeLog-2015 8790 SHA256 16f12a02bbf3d5682172315c1119f12b35ff0aa0298ddbaf7f962771de0a74d9 SHA512 2c58fd4ae677d74b323325628622bf9f84b4429bec39e1c6093b6b235846b9767ce12d66266c1a4777e3521e44ea0b4604d350401e71524c7afd3c64138d31a9 WHIRLPOOL dfe8cba4a3d1ab8fc7af0f5b25a10d80ca570b826fee031f2862a19363ee88ce56ca675e7575051312db7d0635ae28a3efa0cd84b46d2bc3c62551c95f55aa40 +MISC metadata.xml 419 SHA256 c1e60d7b54d0f0d5fdbd8b0ad6740b30c1337c4280b30eac373e7c04703b456b SHA512 c1f92fe6cd6b5d539f8fe67d0143971ae9c1a228b7b8985fac6b4723482d2770e0b3d89d71b836b487995edb2c0326cc2ca8401bd94d3462c1ea76025150f762 WHIRLPOOL 04ec34d41fcec0584684f850e44cc239d531d4a10846bb6c29713c40282cb3ebefaad5a19b5c25c73beb2455e432e2420770010e3c209967b8b28fbb19b93de9 diff --git a/dev-java/groovy/files/groovy-2.4.5-utils.gradle.patch b/dev-java/groovy/files/groovy-2.4.5-utils.gradle.patch new file mode 100644 index 000000000000..6f4638a1bf1d --- /dev/null +++ b/dev-java/groovy/files/groovy-2.4.5-utils.gradle.patch @@ -0,0 +1,116 @@ +--- gradle/utils.gradle.orig 2015-11-01 21:06:26.246486000 +0000 ++++ gradle/utils.gradle 2015-11-01 21:06:57.719486000 +0000 +@@ -16,57 +16,47 @@ + * specific language governing permissions and limitations + * under the License. + */ +-import org.codehaus.groovy.classgen.AnnotationVisitor +-import org.objectweb.asm.ClassWriter +-import org.objectweb.asm.FieldVisitor +-import org.objectweb.asm.Label +-import org.objectweb.asm.MethodVisitor +- +-import static org.objectweb.asm.Opcodes.* +- +-buildscript { +- repositories { +- mavenCentral() +- } +- dependencies { +- classpath "org.ow2.asm:asm:$asmVersion" +- } +-} ++import static org.objectweb.asm.Opcodes.ACC_PUBLIC; ++import static org.objectweb.asm.Opcodes.ACC_STATIC; ++import static org.objectweb.asm.Opcodes.ACC_SUPER; ++import static org.objectweb.asm.Opcodes.ALOAD; ++import static org.objectweb.asm.Opcodes.ATHROW; ++import static org.objectweb.asm.Opcodes.INVOKESPECIAL; ++import static org.objectweb.asm.Opcodes.RETURN; ++import static org.objectweb.asm.Opcodes.V1_5; ++ ++import java.io.File; ++import java.io.FileOutputStream; ++ ++import org.objectweb.asm.ClassWriter; ++import org.objectweb.asm.Label; ++import org.objectweb.asm.MethodVisitor; + +-/** +- * This tasks generates an utility class which allows sneaky throwing. +- */ +-task exceptionUtils { +- ext.classFiles = [ +- "${buildDir}/generated-classes/org/codehaus/groovy/runtime/ExceptionUtils.class", +- "${compileJava.destinationDir}/org/codehaus/groovy/runtime/ExceptionUtils.class"] +- outputs.files classFiles ++public class ExceptionUtils { ++ private final static String gentooClassDestination = "target/classes/org/codehaus/groovy/runtime/ExceptionUtils.class"; + +- doLast { ++ public static void main(String[] args) { + ClassWriter cw = new ClassWriter(0); +- FieldVisitor fv; + MethodVisitor mv; +- AnnotationVisitor av0; +- +- cw.visit(V1_5, ACC_PUBLIC + ACC_SUPER, 'org/codehaus/groovy/runtime/ExceptionUtils', null, 'java/lang/Object', null); + +- cw.visitSource('ExceptionUtils.java', null); ++ cw.visit(V1_5, ACC_PUBLIC + ACC_SUPER, "org/codehaus/groovy/runtime/ExceptionUtils", null, "java/lang/Object", null); ++ cw.visitSource("ExceptionUtils.java", null); + +- mv = cw.visitMethod(ACC_PUBLIC, '', '()V', null, null); ++ mv = cw.visitMethod(ACC_PUBLIC, "", "()V", null, null); + mv.visitCode(); + Label l0 = new Label(); + mv.visitLabel(l0); + mv.visitLineNumber(18, l0); + mv.visitVarInsn(ALOAD, 0); +- mv.visitMethodInsn(INVOKESPECIAL, 'java/lang/Object', '', '()V', false); ++ mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "", "()V", false); + mv.visitInsn(RETURN); + Label l1 = new Label(); + mv.visitLabel(l1); +- mv.visitLocalVariable('this', 'Lorg/codehaus/groovy/runtime/ExceptionUtils;', null, l0, l1, 0); ++ mv.visitLocalVariable("this", "Lorg/codehaus/groovy/runtime/ExceptionUtils;", null, l0, l1, 0); + mv.visitMaxs(1, 1); + mv.visitEnd(); + +- mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, 'sneakyThrow', '(Ljava/lang/Throwable;)V', null, null); ++ mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "sneakyThrow", "(Ljava/lang/Throwable;)V", null, null); + mv.visitCode(); + Label l2 = new Label(); + mv.visitLabel(l2); +@@ -75,19 +65,21 @@ + mv.visitInsn(ATHROW); + Label l3 = new Label(); + mv.visitLabel(l3); +- mv.visitLocalVariable('e', 'Ljava/lang/Throwable;', null, l2, l3, 0); ++ mv.visitLocalVariable("e", "Ljava/lang/Throwable;", null, l2, l3, 0); + mv.visitMaxs(1, 1); + mv.visitEnd(); + + cw.visitEnd(); ++ FileOutputStream fos = null; + +- logger.lifecycle('Generating ExceptionUtils') +- classFiles.each { classFile -> +- def output = file(classFile) +- output.parentFile.mkdirs() +- output.withOutputStream { +- it << cw.toByteArray() +- } +- } +- } ++ File f = new File(gentooClassDestination); ++ f.getParentFile().mkdirs(); ++ try { ++ fos = new FileOutputStream(f); ++ fos.write(cw.toByteArray()); ++ fos.close(); ++ } catch (Exception e) { ++ e.printStackTrace(); ++ } ++ } + } diff --git a/dev-java/groovy/groovy-2.4.5.ebuild b/dev-java/groovy/groovy-2.4.5.ebuild new file mode 100644 index 000000000000..1f2ee906e067 --- /dev/null +++ b/dev-java/groovy/groovy-2.4.5.ebuild @@ -0,0 +1,135 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +JAVA_PKG_IUSE="doc source" + +inherit java-pkg-2 java-pkg-simple versionator + +# Switch to ^^ when we switch to EAPI=6. +#MY_PN="${PN^^}" +MY_PN="GROOVY" +MY_PV="$(replace_all_version_separators _ ${PV})" +MY_P="${MY_PN}_${MY_PV}" + +DESCRIPTION="A multi-faceted language for the Java platform" +HOMEPAGE="http://www.groovy-lang.org/" +SRC_URI="https://github.com/apache/incubator-${PN}/archive/${MY_P}.zip -> ${P}.zip" +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="amd64 ppc64 x86" +IUSE="" + +CDEPEND=" + dev-java/jansi:0 + dev-java/xstream:0 + dev-java/commons-cli:1 + >=dev-java/asm-5.0.3:4 + >=dev-java/antlr-2.7.7-r7:0" + +RDEPEND=" + ${CDEPEND} + >=virtual/jre-1.6" + +DEPEND=" + ${CDEPEND} + >=virtual/jdk-1.6 + source? ( app-arch/zip )" + +JAVA_GENTOO_CLASSPATH=" + asm-4 + antlr + jansi + xstream + commons-cli-1 +" + +S="${WORKDIR}/incubator-${PN}-${MY_P}" + +# ExceptionUtil filename. +EU="ExceptionUtils.java" + +# List of antlr grammar files. +ANTLR_GRAMMAR_FILES=( + org/codehaus/groovy/antlr/groovy.g + org/codehaus/groovy/antlr/java/java.g +) + +# Patches utils.gradle. It basically rewrites ExceptionUtils. +PATCHES=( + "${FILESDIR}"/"${P}-utils.gradle.patch" +) + +# Add target/classes to the CP as we're generating an extra class there. +JAVA_GENTOO_CLASSPATH_EXTRA="target/classes" + +# This function cleans up the source directory. +# We're ONLY interested in the "src/main" directory content and nothing else. +# (for the time being). +groovy_cleanup_source_files() { + ebegin "Cleaning up useless files" + mv src/main "${T}" || die + mv gradle/utils.gradle "${T}" || die + rm -rf * || die + mv "${T}"/main/* . || die + rm -rf "${T}"/main || die + eend $? +} + +java_prepare() { + epatch "${PATCHES[@]}" + groovy_cleanup_source_files +} + +# This function generates the ANTLR grammar files. +generate_antlr_grammar() { + for grammar_file in "${@}"; do + local my_grammar_file=$(basename ${grammar_file}) + + einfo "Generating \"${my_grammar_file}\" grammar file" + local my_grammar_dir=$(dirname ${grammar_file}) + + cd "${S}/${my_grammar_dir}" || die + antlr ${my_grammar_file} || die + + cd "${S}" || die + done +} + +# This function generates ExceptionUtils.class. +# ExceptionUtils is a helper class needed when compiling Groovy 2.x. +# Normally, this class is generated via a Gradle task at compile time. Since we +# don't use Gradle here.. we've translated it into a plain Java file and have +# it generate the same data. +generate_exceptionutils() { + ebegin "Copying ${EU}" + mv "${T}/utils.gradle" "${EU}" || die + eend $? + + ejavac -classpath "$(java-pkg_getjar --build-only asm-4 asm.jar)" ${EU} + + ebegin "Running ${EU%.java}" + $(java-config -J) -classpath "$(java-pkg_getjar --build-only asm-4 asm.jar):." ${EU%.java} || die + eend $? +} + +src_compile() { + generate_antlr_grammar "${ANTLR_GRAMMAR_FILES[@]}" + generate_exceptionutils + java-pkg-simple_src_compile +} + +src_install() { + java-pkg_dolauncher "groovyc" --main org.codehaus.groovy.tools.FileSystemCompiler + java-pkg_dolauncher "groovy" --main groovy.ui.GroovyMain + java-pkg-simple_src_install + + # TODO: groovy console and groovy shell are parts of the "subprojects" + # directory. figure out a way to compile them. :\ + # java-pkg_dolauncher "groovysh" --main groovy.ui.InteractiveShell + # java-pkg_dolauncher "groovyConsole" --main groovy.ui.Console + + # TODO: grape is written in groovy and to compile it, you need .. groovy. + # java-pkg_dolauncher "grape" --main org.codehaus.groovy.tools.GrapeMain +} diff --git a/dev-java/groovy/metadata.xml b/dev-java/groovy/metadata.xml new file mode 100644 index 000000000000..b54150fc69c0 --- /dev/null +++ b/dev-java/groovy/metadata.xml @@ -0,0 +1,14 @@ + + + + + monsieurp@gentoo.org + + + java@gentoo.org + Java + + + apache/incubator-groovy + + -- cgit v1.2.3