Gentoo Archives: gentoo-commits

From: Georgy Yakovlev <gyakovlev@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-java/ant-core/files/, dev-java/ant-core/
Date: Wed, 22 Jan 2020 00:23:08
Message-Id: 1579652551.a8720a4d009fcfa5a258244533a9f51a63f468b0.gyakovlev@gentoo
1 commit: a8720a4d009fcfa5a258244533a9f51a63f468b0
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 21 23:44:14 2020 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Wed Jan 22 00:22:31 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a8720a4d
7
8 dev-java/ant-core: rebvump, add cmdline handling patch
9
10 Bug: https://bugs.gentoo.org/698876
11 Package-Manager: Portage-2.3.84, Repoman-2.3.16
12 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
13
14 dev-java/ant-core/ant-core-1.10.7-r1.ebuild | 110 ++++++++++++++++++
15 dev-java/ant-core/files/1.10.7-cmdline-args.patch | 135 ++++++++++++++++++++++
16 2 files changed, 245 insertions(+)
17
18 diff --git a/dev-java/ant-core/ant-core-1.10.7-r1.ebuild b/dev-java/ant-core/ant-core-1.10.7-r1.ebuild
19 new file mode 100644
20 index 00000000000..64a382b259f
21 --- /dev/null
22 +++ b/dev-java/ant-core/ant-core-1.10.7-r1.ebuild
23 @@ -0,0 +1,110 @@
24 +# Copyright 1999-2020 Gentoo Authors
25 +# Distributed under the terms of the GNU General Public License v2
26 +
27 +EAPI=7
28 +
29 +# Don't depend on itself.
30 +JAVA_ANT_DISABLE_ANT_CORE_DEP="true"
31 +
32 +# Rewriting build.xml files for the testcases has no use at the moment.
33 +JAVA_PKG_BSFIX_ALL="no"
34 +JAVA_PKG_IUSE="doc source"
35 +
36 +inherit eutils java-pkg-2 java-ant-2 prefix
37 +
38 +MY_P="apache-ant-${PV}"
39 +
40 +DESCRIPTION="Java-based build tool similar to 'make' that uses XML configuration files"
41 +HOMEPAGE="https://ant.apache.org/"
42 +SRC_URI="https://archive.apache.org/dist/ant/source/${MY_P}-src.tar.bz2
43 + https://dev.gentoo.org/~fordfrog/distfiles/ant-${PV}-gentoo.tar.bz2"
44 +
45 +LICENSE="Apache-2.0"
46 +SLOT="0"
47 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~ppc-aix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
48 +
49 +CDEPEND=">=virtual/jdk-1.8:*"
50 +DEPEND="${CDEPEND}"
51 +RDEPEND="${CDEPEND}"
52 +
53 +S="${WORKDIR}/${MY_P}"
54 +
55 +RESTRICT="test"
56 +
57 +PATCHES=(
58 + "${FILESDIR}/${PV}"-cmdline-args.patch
59 + "${WORKDIR}/${PV}-build.patch"
60 + "${WORKDIR}/${PV}-launch.patch"
61 +)
62 +
63 +src_prepare() {
64 + default
65 +
66 + eprefixify "${S}/src/script/ant"
67 +
68 + # Fixes bug 556008.
69 + java-ant_xml-rewrite -f build.xml \
70 + -c -e javadoc \
71 + -a failonerror \
72 + -v "false"
73 +
74 + # See bug #196080 for more details.
75 + java-ant_bsfix_one build.xml
76 + java-pkg-2_src_prepare
77 +
78 + # Remove JDK9+ stuff
79 + einfo "Removing JDK9+ classes (Jmod and Link)"
80 + rm "${S}"/src/main/org/apache/tools/ant/taskdefs/modules/{Jmod,Link}.java
81 +}
82 +
83 +src_compile() {
84 + export ANT_HOME=""
85 + # Avoid error message that package ant-core was not found
86 + export ANT_TASKS="none"
87 +
88 + local bsyscp
89 +
90 + # This ensures that when building ant with bootstrapped ant,
91 + # only the source is used for resolving references, and not
92 + # the classes in bootstrapped ant but jikes in kaffe has issues with this...
93 + if ! java-pkg_current-vm-matches kaffe; then
94 + bsyscp="-Dbuild.sysclasspath=ignore"
95 + fi
96 +
97 + CLASSPATH="$(java-config -t)" ./build.sh ${bsyscp} jars dist-internal \
98 + $(use_doc javadocs) || die "build failed"
99 +}
100 +
101 +src_install() {
102 + dodir /usr/share/ant/lib
103 +
104 + for jar in ant.jar ant-bootstrap.jar ant-launcher.jar ; do
105 + java-pkg_dojar build/lib/${jar}
106 + dosym ../../${PN}/lib/${jar} /usr/share/ant/lib/${jar}
107 + done
108 +
109 + dobin src/script/ant
110 +
111 + dodir /usr/share/${PN}/bin
112 + for each in antRun antRun.pl runant.pl runant.py ; do
113 + dobin "${S}/src/script/${each}"
114 + dosym ../../../bin/${each} /usr/share/${PN}/bin/${each}
115 + done
116 + dosym ../${PN}/bin /usr/share/ant/bin
117 +
118 + insinto /usr/share/${PN}
119 + doins -r dist/etc
120 + dosym ../${PN}/etc /usr/share/ant/etc
121 +
122 + echo "ANT_HOME=\"${EPREFIX}/usr/share/ant\"" > "${T}/20ant"
123 + doenvd "${T}/20ant"
124 +
125 + dodoc NOTICE README WHATSNEW KEYS
126 +
127 + if use doc; then
128 + dodoc -r manual/*
129 + java-pkg_dojavadoc --symlink manual/api build/javadocs
130 + fi
131 +
132 + use source && java-pkg_dosrc src/main/*
133 +}
134
135 diff --git a/dev-java/ant-core/files/1.10.7-cmdline-args.patch b/dev-java/ant-core/files/1.10.7-cmdline-args.patch
136 new file mode 100644
137 index 00000000000..1be6f0bc5e7
138 --- /dev/null
139 +++ b/dev-java/ant-core/files/1.10.7-cmdline-args.patch
140 @@ -0,0 +1,135 @@
141 +From 729692d37a72c84998cfc65a6da6e078bbe0910a Mon Sep 17 00:00:00 2001
142 +From: sergiys <sergiys@××××××.com>
143 +Date: Wed, 23 Oct 2019 13:24:19 -0700
144 +Subject: [PATCH] Fix regression introduced by commit "Use commandline argument
145 + file for all options, but -J, for case javac"
146 +
147 +---
148 + .../ant/taskdefs/compilers/JavacExternal.java | 35 +++++++++-------
149 + .../taskdefs/compilers/JavacExternalTest.java | 42 +++++++++++++++++++
150 + 2 files changed, 62 insertions(+), 15 deletions(-)
151 +
152 +diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java b/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java
153 +index 9569c7fe8f..637e9bdf6c 100644
154 +--- a/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java
155 ++++ b/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java
156 +@@ -66,7 +66,7 @@ public boolean execute() throws BuildException {
157 + int firstFileName;
158 +
159 + if (assumeJava1_2Plus()) {
160 +- firstFileName = moveJOptionsToBeginning(commandLine);
161 ++ firstFileName = moveArgFileEligibleOptionsToEnd(commandLine);
162 + } else {
163 + firstFileName = -1;
164 + }
165 +@@ -77,31 +77,36 @@ public boolean execute() throws BuildException {
166 + }
167 +
168 + /**
169 +- * Moves all -J arguments to the beginning
170 +- * So that all command line arguments could be written to file, but -J
171 ++ * Moves all -J and @argfiles arguments to the beginning
172 ++ * So that all command line arguments could be written to file, but -J and @argfile
173 + * As per javac documentation:
174 + * you can specify one or more files that contain arguments to the javac command (except -J options)
175 + * @param commandLine command line to process
176 +- * @return int index of first non -J argument
177 ++ * @return int index of first argument that could be put into argfile
178 + */
179 +- private int moveJOptionsToBeginning(String[] commandLine) {
180 +- int nonJArgumentIdx = 1; // 0 for javac executable
181 +- while(nonJArgumentIdx < commandLine.length && commandLine[nonJArgumentIdx].startsWith("-J")) {
182 +- nonJArgumentIdx++;
183 ++ private int moveArgFileEligibleOptionsToEnd(String[] commandLine) {
184 ++ int nonArgFileOptionIdx = 1; // 0 for javac executable
185 ++ while(nonArgFileOptionIdx < commandLine.length &&
186 ++ !isArgFileEligible(commandLine[nonArgFileOptionIdx])) {
187 ++ nonArgFileOptionIdx++;
188 + }
189 +
190 +- for(int i = nonJArgumentIdx + 1; i < commandLine.length; i++) {
191 +- if (commandLine[i].startsWith("-J")) {
192 +- String jArgument = commandLine[i];
193 +- for(int j = i - 1; j >= nonJArgumentIdx; j--) {
194 ++ for(int i = nonArgFileOptionIdx + 1; i < commandLine.length; i++) {
195 ++ if (!isArgFileEligible(commandLine[i])) {
196 ++ String option = commandLine[i];
197 ++ for(int j = i - 1; j >= nonArgFileOptionIdx; j--) {
198 + commandLine[j + 1] = commandLine[j];
199 + }
200 +- commandLine[nonJArgumentIdx] = jArgument;
201 +- nonJArgumentIdx++;
202 ++ commandLine[nonArgFileOptionIdx] = option;
203 ++ nonArgFileOptionIdx++;
204 + }
205 + }
206 +
207 +- return nonJArgumentIdx;
208 ++ return nonArgFileOptionIdx;
209 ++ }
210 ++
211 ++ private static boolean isArgFileEligible(String option) {
212 ++ return !(option.startsWith("-J") || option.startsWith("@"));
213 + }
214 +
215 + /**
216 +diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/JavacExternalTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/JavacExternalTest.java
217 +index 53aac6377c..a893fb49c6 100644
218 +--- a/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/JavacExternalTest.java
219 ++++ b/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/JavacExternalTest.java
220 +@@ -28,6 +28,7 @@
221 + import java.io.File;
222 + import java.io.IOException;
223 + import java.util.Arrays;
224 ++import java.util.stream.Stream;
225 +
226 + import static org.junit.Assert.assertEquals;
227 + import static org.junit.Assert.assertTrue;
228 +@@ -131,6 +132,47 @@ public void allJOptionsAreMovedToBeginning() throws Exception {
229 + }
230 + }
231 +
232 ++ @Test
233 ++ public void argFileOptionIsMovedToBeginning() throws Exception {
234 ++ final File workDir = createWorkDir("testSMC");
235 ++ try {
236 ++ final File src = new File(workDir, "src");
237 ++ src.mkdir();
238 ++ createFile(src, "org/apache/ant/tests/J1.java");
239 ++ createFile(src, "org/apache/ant/tests/J2.java");
240 ++ final File modules = new File(workDir, "modules");
241 ++ modules.mkdir();
242 ++ final Project prj = new Project();
243 ++ prj.setBaseDir(workDir);
244 ++ final Javac javac = new Javac();
245 ++ javac.setProject(prj);
246 ++ final Commandline[] cmd = new Commandline[1];
247 ++ final TestJavacExternal impl = new TestJavacExternal();
248 ++ final Path srcPath = new Path(prj);
249 ++ srcPath.setLocation(src);
250 ++ javac.setSrcdir(srcPath);
251 ++ javac.createModulepath().setLocation(modules);
252 ++ javac.setSource("9");
253 ++ javac.setTarget("9");
254 ++ javac.setFork(true);
255 ++ javac.setMemoryInitialSize("80m");
256 ++ javac.setExecutable("javacExecutable");
257 ++ javac.add(impl);
258 ++ javac.createCompilerArg().setValue("-g");
259 ++ javac.createCompilerArg().setValue("@/home/my-compiler.args");
260 ++ javac.execute();
261 ++ assertEquals("javacExecutable", impl.getArgs()[0]);
262 ++ assertEquals("-J-Xms80m", impl.getArgs()[1]);
263 ++ assertEquals("@/home/my-compiler.args", impl.getArgs()[2]);
264 ++ assertTrue(Stream.of(impl.getArgs()).anyMatch(x -> x.equals("-g")));
265 ++ assertTrue(impl.getArgs()[impl.getArgs().length - 2].endsWith("J1.java"));
266 ++ assertTrue(impl.getArgs()[impl.getArgs().length - 1].endsWith("J2.java"));
267 ++ assertEquals(3, impl.getFirstFileName());
268 ++ } finally {
269 ++ delete(workDir);
270 ++ }
271 ++ }
272 ++
273 + private File createWorkDir(String testName) {
274 + final File tmp = new File(System.getProperty("java.io.tmpdir")); //NOI18N
275 + final File destDir = new File(tmp, String.format("%s%s%d",