Gentoo Archives: gentoo-commits

From: James Le Cuirot <chewi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-java/stringtemplate/files/, dev-java/stringtemplate/
Date: Fri, 04 Dec 2015 23:01:52
Message-Id: 1449270098.3a57ade8bf9d44d13317237dcc8345eb522e80b4.chewi@gentoo
1 commit: 3a57ade8bf9d44d13317237dcc8345eb522e80b4
2 Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
3 AuthorDate: Fri Dec 4 22:57:32 2015 +0000
4 Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
5 CommitDate: Fri Dec 4 23:01:38 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3a57ade8
7
8 dev-java/stringtemplate: Rewrite, EAPI bump, test fixes wrt bug #405057
9
10 Package-Manager: portage-2.2.26
11
12 .../stringtemplate/files/3.2.1-test-fixes.patch | 53 ++++++++++++++++++
13 .../stringtemplate/stringtemplate-3.2.1-r1.ebuild | 62 ++++++++++++++++++++++
14 2 files changed, 115 insertions(+)
15
16 diff --git a/dev-java/stringtemplate/files/3.2.1-test-fixes.patch b/dev-java/stringtemplate/files/3.2.1-test-fixes.patch
17 new file mode 100644
18 index 0000000..fd625ab
19 --- /dev/null
20 +++ b/dev-java/stringtemplate/files/3.2.1-test-fixes.patch
21 @@ -0,0 +1,53 @@
22 +https://github.com/antlr/stringtemplate3/pull/3
23 +
24 +--- test/org/antlr/stringtemplate/test/TestStringTemplate.java.orig 2015-09-18 22:04:18.131902875 +0100
25 ++++ test/org/antlr/stringtemplate/test/TestStringTemplate.java 2015-09-18 22:04:21.651848456 +0100
26 +@@ -36,6 +36,10 @@
27 + import java.text.SimpleDateFormat;
28 + import java.util.*;
29 +
30 ++import org.junit.FixMethodOrder;
31 ++import org.junit.runners.MethodSorters;
32 ++
33 ++@FixMethodOrder(MethodSorters.NAME_ASCENDING)
34 + public class TestStringTemplate extends TestCase {
35 + static final String newline = System.getProperty("line.separator");
36 +
37 +@@ -87,7 +91,7 @@
38 + assertEquals(expecting,I.toString());
39 + }
40 +
41 +- public void testNoGroupLoader() throws Exception {
42 ++ public void testAaaNoGroupLoader() throws Exception {
43 + // this also tests the group loader
44 + StringTemplateErrorListener errors = new ErrorBuffer();
45 + String tmpdir = System.getProperty("java.io.tmpdir");
46 +@@ -2214,8 +2218,12 @@
47 + s.add("2");
48 + s.add("3");
49 + st.setAttribute("items", s);
50 +- expecting = "<li>3</li><li>2</li><li>1</li>";
51 +- assertEquals(expecting, st.toString());
52 ++ String[] split = st.toString().split("(</?li>){1,2}");
53 ++ Arrays.sort(split);
54 ++ assertEquals("", split[0]);
55 ++ assertEquals("1", split[1]);
56 ++ assertEquals("2", split[2]);
57 ++ assertEquals("3", split[3]);
58 + }
59 +
60 + public void testDumpMapAndSet() throws Exception {
61 +@@ -2235,8 +2243,11 @@
62 + s.add("2");
63 + s.add("3");
64 + st.setAttribute("items", s);
65 +- expecting = "3,2,1";
66 +- assertEquals(expecting, st.toString());
67 ++ String[] split = st.toString().split(",");
68 ++ Arrays.sort(split);
69 ++ assertEquals("1", split[0]);
70 ++ assertEquals("2", split[1]);
71 ++ assertEquals("3", split[2]);
72 + }
73 +
74 + public class Connector3 {
75
76 diff --git a/dev-java/stringtemplate/stringtemplate-3.2.1-r1.ebuild b/dev-java/stringtemplate/stringtemplate-3.2.1-r1.ebuild
77 new file mode 100644
78 index 0000000..1179a5b
79 --- /dev/null
80 +++ b/dev-java/stringtemplate/stringtemplate-3.2.1-r1.ebuild
81 @@ -0,0 +1,62 @@
82 +# Copyright 1999-2015 Gentoo Foundation
83 +# Distributed under the terms of the GNU General Public License v2
84 +# $Id$
85 +
86 +EAPI="5"
87 +
88 +JAVA_PKG_IUSE="doc source"
89 +
90 +inherit eutils java-pkg-2 java-pkg-simple
91 +
92 +DESCRIPTION="A Java template engine"
93 +HOMEPAGE="http://www.stringtemplate.org/"
94 +SRC_URI="https://github.com/antlr/${PN}3/archive/${PV}.tar.gz -> ${P}.tar.gz"
95 +LICENSE="BSD"
96 +SLOT="0"
97 +KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
98 +IUSE="test"
99 +
100 +CDEPEND=">=dev-java/antlr-2.7.7-r7:0"
101 +
102 +RDEPEND="${CDEPEND}
103 + >=virtual/jre-1.6"
104 +
105 +DEPEND="${CDEPEND}
106 + >=virtual/jdk-1.6
107 + test? ( >=dev-java/junit-4.11:4 )"
108 +
109 +S="${WORKDIR}/${P}"
110 +JAVA_GENTOO_CLASSPATH="antlr"
111 +JAVA_SRC_DIR="src"
112 +
113 +java_prepare() {
114 + # https://github.com/antlr/stringtemplate3/pull/3
115 + epatch "${FILESDIR}/${PV}-test-fixes.patch"
116 +
117 + java-pkg_clean
118 +}
119 +
120 +src_compile() {
121 + local G; for G in action template angle.bracket.template eval group interface; do # from build.xml
122 + antlr -o src/org/antlr/stringtemplate/language/{,${G}.g} || die
123 + done
124 +
125 + java-pkg-simple_src_compile
126 +}
127 +
128 +src_install() {
129 + java-pkg-simple_src_install
130 + dodoc {CHANGES,README}.txt
131 +}
132 +
133 +src_test() {
134 + cd test || die
135 + local CP=".:${S}/${PN}.jar:$(java-pkg_getjars junit-4,${JAVA_GENTOO_CLASSPATH})"
136 +
137 + local TESTS=$(find * -name "Test*.java")
138 + TESTS="${TESTS//.java}"
139 + TESTS="${TESTS//\//.}"
140 +
141 + ejavac -classpath "${CP}" $(find -name "*.java")
142 + ejunit4 -classpath "${CP}" ${TESTS}
143 +}