[oe] [PATCH 2/2] ant-native: only use classpath tools if no JDK

Kyle Russell bkylerussell at gmail.com
Tue Feb 5 15:53:25 UTC 2019


If ant gets invoked with a $JAVA_HOME that points to a JDK (for example,
from an 'inherit java-native'), use the tools.jar from the JDK instead
of the classpath-initial tools.

Once a native JDK has been bootstrapped, other Java recipes should be
able to use a more featureful set of classes if needed.

Signed-off-by: Kyle Russell <bkylerussell at gmail.com>
---
 recipes-core/ant/ant-native_1.8.1.bb | 2 +-
 recipes-core/ant/files/ant           | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/recipes-core/ant/ant-native_1.8.1.bb b/recipes-core/ant/ant-native_1.8.1.bb
index 7839abd..67cb5fc 100644
--- a/recipes-core/ant/ant-native_1.8.1.bb
+++ b/recipes-core/ant/ant-native_1.8.1.bb
@@ -53,7 +53,7 @@ do_compile() {
   fastjar cf ${JARFILENAME} -C build .
 
   oe_makeclasspath cp -s ecj-bootstrap jsch bsf xalan2 xercesImpl resolver gnumail gnujaf bcel regexp log4j1.2 antlr oro junit jdepend commons-net commons-logging
-  cp=${STAGING_DATADIR_JAVA_NATIVE}/ant.jar:${STAGING_DATADIR}/classpath/tools.zip:$cp
+  sed -i -e"s|@ANT_JAR@|${STAGING_DATADIR_JAVA_NATIVE}/ant.jar|" ${WORKDIR}/ant
   sed -i -e"s|@JAR_FILE@|$cp|" ${WORKDIR}/ant
 }
 
diff --git a/recipes-core/ant/files/ant b/recipes-core/ant/files/ant
index bb282a9..939f3ec 100755
--- a/recipes-core/ant/files/ant
+++ b/recipes-core/ant/files/ant
@@ -1,6 +1,15 @@
 #!/bin/sh
 
 export CLASSPATH
+
+CLASSPATH=$CLASSPATH:@ANT_JAR@
+
+if [ -f "$JAVA_HOME/lib/tools.jar" ] ; then
+        CLASSPATH="$CLASSPATH:$JAVA_HOME/lib/tools.jar"
+else
+        CLASSPATH="$CLASSPATH:${STAGING_DATADIR}/classpath/tools.zip"
+fi
+
 CLASSPATH=$CLASSPATH:@JAR_FILE@
 
 if [ ! $JAVA ];then
-- 
2.20.1



More information about the Openembedded-devel mailing list