summaryrefslogtreecommitdiff
path: root/dev-java/stringtemplate
diff options
context:
space:
mode:
Diffstat (limited to 'dev-java/stringtemplate')
-rw-r--r--dev-java/stringtemplate/Manifest3
-rw-r--r--dev-java/stringtemplate/files/3.2.1-test-fixes.patch53
-rw-r--r--dev-java/stringtemplate/files/4.0.8-test-fixes.patch38
-rw-r--r--dev-java/stringtemplate/metadata.xml12
-rw-r--r--dev-java/stringtemplate/stringtemplate-3.2.1-r1.ebuild62
-rw-r--r--dev-java/stringtemplate/stringtemplate-4.0.8.ebuild71
6 files changed, 239 insertions, 0 deletions
diff --git a/dev-java/stringtemplate/Manifest b/dev-java/stringtemplate/Manifest
new file mode 100644
index 000000000000..12164f0f86e3
--- /dev/null
+++ b/dev-java/stringtemplate/Manifest
@@ -0,0 +1,3 @@
+DIST antlr-3.5.2-complete.jar 2456317 BLAKE2B d9afa08ad98dbff16d30425b97a0ddac7402055916e6a7dd290c3b9a2b26a4751c02f405d8d13c186333430c370c94bd73419b14c8e46df2971f68536cc484a0 SHA512 560f208e38759b5e626de56816e1fce9c191c526c04ca782513859d468ac444d1e8e62c03870a68f8f9d8daee0f45fca465150e2bbfc71b46e46b952519044b1
+DIST stringtemplate-3.2.1.tar.gz 1039803 BLAKE2B 6f6ab7e1d5bc1e2bb01960c0baaea0bd07267af26ff481c1e1586392e0a8938676cab3e54c22b2804bed2806befd938d4d09715de45cea12212e424e2e30fc4c SHA512 fe4c50584dd3695514034845ba7b8fa300cf582b6b302797afadce990f2665759323f6a29ece1bc07dfab244cc00455b4106fe3ad6851165edbb8736ad7ec714
+DIST stringtemplate-4.0.8.tar.gz 147305 BLAKE2B 0c09326f4eecfc86db8588a9b8db801bac8d8e128f8ef004a3691813d1dfcbd1e397acd5cad47e4c9d44d7ee8c17b8f6b66386fb897e4137df43dc46f46dc3f3 SHA512 21e4936356a6d374bf92645f09351a495a5900a408ead8dce1903ed81d7fc70eb4b44b206b587b05ed87edb2d4792c1cf72907a9cb527e18373ba2e5f31b5724
diff --git a/dev-java/stringtemplate/files/3.2.1-test-fixes.patch b/dev-java/stringtemplate/files/3.2.1-test-fixes.patch
new file mode 100644
index 000000000000..fd625abd0668
--- /dev/null
+++ b/dev-java/stringtemplate/files/3.2.1-test-fixes.patch
@@ -0,0 +1,53 @@
+https://github.com/antlr/stringtemplate3/pull/3
+
+--- test/org/antlr/stringtemplate/test/TestStringTemplate.java.orig 2015-09-18 22:04:18.131902875 +0100
++++ test/org/antlr/stringtemplate/test/TestStringTemplate.java 2015-09-18 22:04:21.651848456 +0100
+@@ -36,6 +36,10 @@
+ import java.text.SimpleDateFormat;
+ import java.util.*;
+
++import org.junit.FixMethodOrder;
++import org.junit.runners.MethodSorters;
++
++@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+ public class TestStringTemplate extends TestCase {
+ static final String newline = System.getProperty("line.separator");
+
+@@ -87,7 +91,7 @@
+ assertEquals(expecting,I.toString());
+ }
+
+- public void testNoGroupLoader() throws Exception {
++ public void testAaaNoGroupLoader() throws Exception {
+ // this also tests the group loader
+ StringTemplateErrorListener errors = new ErrorBuffer();
+ String tmpdir = System.getProperty("java.io.tmpdir");
+@@ -2214,8 +2218,12 @@
+ s.add("2");
+ s.add("3");
+ st.setAttribute("items", s);
+- expecting = "<li>3</li><li>2</li><li>1</li>";
+- assertEquals(expecting, st.toString());
++ String[] split = st.toString().split("(</?li>){1,2}");
++ Arrays.sort(split);
++ assertEquals("", split[0]);
++ assertEquals("1", split[1]);
++ assertEquals("2", split[2]);
++ assertEquals("3", split[3]);
+ }
+
+ public void testDumpMapAndSet() throws Exception {
+@@ -2235,8 +2243,11 @@
+ s.add("2");
+ s.add("3");
+ st.setAttribute("items", s);
+- expecting = "3,2,1";
+- assertEquals(expecting, st.toString());
++ String[] split = st.toString().split(",");
++ Arrays.sort(split);
++ assertEquals("1", split[0]);
++ assertEquals("2", split[1]);
++ assertEquals("3", split[2]);
+ }
+
+ public class Connector3 {
diff --git a/dev-java/stringtemplate/files/4.0.8-test-fixes.patch b/dev-java/stringtemplate/files/4.0.8-test-fixes.patch
new file mode 100644
index 000000000000..9480abe3ed3f
--- /dev/null
+++ b/dev-java/stringtemplate/files/4.0.8-test-fixes.patch
@@ -0,0 +1,38 @@
+diff -Naur test.orig/org/stringtemplate/v4/test/TestGroups.java test/org/stringtemplate/v4/test/TestGroups.java
+--- test.orig/org/stringtemplate/v4/test/TestGroups.java 2014-03-25 11:55:55.000000000 +0000
++++ test/org/stringtemplate/v4/test/TestGroups.java 2015-09-13 11:01:07.999800299 +0100
+@@ -29,6 +29,7 @@
+
+ import org.junit.Assert;
+ import org.junit.Test;
++import org.junit.Ignore;
+ import org.stringtemplate.v4.ST;
+ import org.stringtemplate.v4.STErrorListener;
+ import org.stringtemplate.v4.STGroup;
+@@ -527,6 +528,7 @@
+ assertEquals(expected, result);
+ }
+
++ @Ignore
+ @Test public void testUnknownNamedArg() throws Exception {
+ String dir = getRandomDir();
+ String groupFile =
+diff -Naur test.orig/org/stringtemplate/v4/test/TestGroupSyntaxErrors.java test/org/stringtemplate/v4/test/TestGroupSyntaxErrors.java
+--- test.orig/org/stringtemplate/v4/test/TestGroupSyntaxErrors.java 2014-03-25 11:55:55.000000000 +0000
++++ test/org/stringtemplate/v4/test/TestGroupSyntaxErrors.java 2015-09-13 11:01:05.011850826 +0100
+@@ -28,6 +28,7 @@
+ package org.stringtemplate.v4.test;
+
+ import org.junit.Test;
++import org.junit.Ignore;
+ import org.stringtemplate.v4.STErrorListener;
+ import org.stringtemplate.v4.STGroup;
+ import org.stringtemplate.v4.STGroupFile;
+@@ -36,6 +37,7 @@
+ import static org.junit.Assert.assertEquals;
+
+ public class TestGroupSyntaxErrors extends BaseTest {
++ @Ignore
+ @Test public void testMissingImportString() throws Exception {
+ String templates =
+ "import\n" +
diff --git a/dev-java/stringtemplate/metadata.xml b/dev-java/stringtemplate/metadata.xml
new file mode 100644
index 000000000000..a36a367eab14
--- /dev/null
+++ b/dev-java/stringtemplate/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>java@gentoo.org</email>
+ <name>Java</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">antlr/stringtemplate4</remote-id>
+ </upstream>
+ <origin>gentoo-staging</origin>
+</pkgmetadata>
diff --git a/dev-java/stringtemplate/stringtemplate-3.2.1-r1.ebuild b/dev-java/stringtemplate/stringtemplate-3.2.1-r1.ebuild
new file mode 100644
index 000000000000..0b96d950c8a1
--- /dev/null
+++ b/dev-java/stringtemplate/stringtemplate-3.2.1-r1.ebuild
@@ -0,0 +1,62 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+JAVA_PKG_IUSE="doc source"
+
+inherit eutils java-pkg-2 java-pkg-simple
+
+DESCRIPTION="A Java template engine"
+HOMEPAGE="https://www.stringtemplate.org/"
+SRC_URI="https://github.com/antlr/${PN}3/archive/${PV}.tar.gz -> ${P}.tar.gz"
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="amd64 ~arm ~arm64 ppc64 x86 ~amd64-linux ~x86-linux ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+CDEPEND=">=dev-java/antlr-2.7.7-r7:0"
+
+RDEPEND="${CDEPEND}
+ >=virtual/jre-1.6"
+
+DEPEND="${CDEPEND}
+ >=virtual/jdk-1.6
+ test? ( >=dev-java/junit-4.11:4 )"
+
+S="${WORKDIR}/${P}"
+JAVA_GENTOO_CLASSPATH="antlr"
+JAVA_SRC_DIR="src"
+
+java_prepare() {
+ # https://github.com/antlr/stringtemplate3/pull/3
+ epatch "${FILESDIR}/${PV}-test-fixes.patch"
+
+ java-pkg_clean
+}
+
+src_compile() {
+ local G; for G in action template angle.bracket.template eval group interface; do # from build.xml
+ antlr -o src/org/antlr/stringtemplate/language/{,${G}.g} || die
+ done
+
+ java-pkg-simple_src_compile
+}
+
+src_install() {
+ java-pkg-simple_src_install
+ dodoc {CHANGES,README}.txt
+}
+
+src_test() {
+ cd test || die
+ local CP=".:${S}/${PN}.jar:$(java-pkg_getjars junit-4,${JAVA_GENTOO_CLASSPATH})"
+
+ local TESTS=$(find * -name "Test*.java")
+ TESTS="${TESTS//.java}"
+ TESTS="${TESTS//\//.}"
+
+ ejavac -classpath "${CP}" $(find -name "*.java")
+ ejunit4 -classpath "${CP}" ${TESTS}
+}
diff --git a/dev-java/stringtemplate/stringtemplate-4.0.8.ebuild b/dev-java/stringtemplate/stringtemplate-4.0.8.ebuild
new file mode 100644
index 000000000000..f15d93c44e9f
--- /dev/null
+++ b/dev-java/stringtemplate/stringtemplate-4.0.8.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+ANTLR3="3.5.2"
+JAVA_PKG_IUSE="doc source"
+
+inherit eutils java-pkg-2 java-pkg-simple
+
+DESCRIPTION="A Java template engine"
+HOMEPAGE="https://www.stringtemplate.org/"
+SRC_URI="https://github.com/antlr/${PN}4/archive/${PV}.tar.gz -> ${P}.tar.gz
+ http://www.antlr3.org/download/antlr-${ANTLR3}-complete.jar"
+LICENSE="BSD"
+SLOT="4"
+KEYWORDS="amd64 ~arm ppc64 x86 ~amd64-linux ~x86-linux ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+RDEPEND=">=virtual/jre-1.6"
+
+DEPEND=">=virtual/jdk-1.6
+ test? ( dev-java/junit:4 )"
+
+# StringTemplate has a cyclic dependency on ANTLR 3. The runtime classes
+# are needed at build time and runtime and the tool is also needed at
+# build time. To break out of this, we use a prebuilt copy of ANTLR 3 at
+# build time and manually register a dependency on the package, which
+# will be present at runtime thanks to this PDEPEND. No prebuilt
+# software is actually installed onto the system.
+PDEPEND=">=dev-java/antlr-${ANTLR3}:3.5"
+
+S="${WORKDIR}/${PN}4-${PV}"
+JAVA_GENTOO_CLASSPATH_EXTRA="${DISTDIR}/antlr-${ANTLR3}-complete.jar"
+JAVA_SRC_DIR="src"
+
+src_unpack() {
+ unpack ${P}.tar.gz
+}
+
+java_prepare() {
+ # These tests are broken but are probably fixed in current master.
+ epatch "${FILESDIR}/${PV}-test-fixes.patch"
+
+ # Some of these tests requires a graphical display.
+ rm -v test/org/stringtemplate/v4/test/TestEarlyEvaluation.java || die
+}
+
+src_compile() {
+ java -jar "${JAVA_GENTOO_CLASSPATH_EXTRA}" -lib ${JAVA_SRC_DIR}/org/stringtemplate/v4/compiler $(find ${JAVA_SRC_DIR} -name "*.g") || die
+ java-pkg-simple_src_compile
+}
+
+src_install() {
+ java-pkg-simple_src_install
+ java-pkg_register-dependency antlr-3.5 antlr-runtime.jar
+ dodoc {CHANGES,contributors,README}.txt
+}
+
+src_test() {
+ cd test || die
+ local CP=".:${S}/${PN}.jar:$(java-pkg_getjars junit-4):${JAVA_GENTOO_CLASSPATH_EXTRA}"
+
+ local TESTS=$(find * -name "Test*.java")
+ TESTS="${TESTS//.java}"
+ TESTS="${TESTS//\//.}"
+
+ ejavac -classpath "${CP}" $(find -name "*.java")
+ ejunit4 -classpath "${CP}" ${TESTS}
+}