Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Greatly simplify the full jar generation
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 21 Sep 2015 23:19:12 +0000 (01:19 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 22 Sep 2015 00:10:41 +0000 (02:10 +0200)
src/bindings/java/MANIFEST.MF.in
tools/cmake/MakeJava.cmake
tools/cmake/scripts/java_bundle.sh

index fc7cbba..bb1ca2b 100644 (file)
@@ -1,4 +1,3 @@
-Manifest-Version: 1.0
 Built-By: Da SimGrid team
 Main-Class: org.simgrid.msg.Msg
 Class-Path: .
 Built-By: Da SimGrid team
 Main-Class: org.simgrid.msg.Msg
 Class-Path: .
index d2fbac3..899907a 100644 (file)
@@ -64,14 +64,6 @@ set(LIBSIMGRID_JAVA_SO
 set(LIBSURF_JAVA_SO
   ${CMAKE_SHARED_LIBRARY_PREFIX}surf-java${CMAKE_SHARED_LIBRARY_SUFFIX})
 
 set(LIBSURF_JAVA_SO
   ${CMAKE_SHARED_LIBRARY_PREFIX}surf-java${CMAKE_SHARED_LIBRARY_SUFFIX})
 
-## Don't strip libraries if not in release mode
-##
-if(release)
-  set(STRIP_COMMAND "${CMAKE_STRIP}")
-else()
-  set(STRIP_COMMAND "true")
-endif()
-
 ## Here is how to build simgrid.jar
 ##
 if(CMAKE_VERSION VERSION_LESS "2.8.12")
 ## Here is how to build simgrid.jar
 ##
 if(CMAKE_VERSION VERSION_LESS "2.8.12")
@@ -87,29 +79,32 @@ set(JAVA_BUNDLE_SO_FILES
   ${CMAKE_BINARY_DIR}/lib/${LIBSIMGRID_JAVA_SO}
   ${CMAKE_BINARY_DIR}/lib/${LIBSURF_JAVA_SO}
   )
   ${CMAKE_BINARY_DIR}/lib/${LIBSIMGRID_JAVA_SO}
   ${CMAKE_BINARY_DIR}/lib/${LIBSURF_JAVA_SO}
   )
-set(JAVA_BUNDLE_TXT_FILES
-  ${CMAKE_HOME_DIRECTORY}/COPYING
-  ${CMAKE_HOME_DIRECTORY}/ChangeLog
-  ${CMAKE_HOME_DIRECTORY}/ChangeLog.SimGrid-java
-  ${CMAKE_HOME_DIRECTORY}/LICENSE-LGPL-2.1
-  )
 add_custom_command(
   COMMENT "Finalize simgrid.jar..."
   OUTPUT ${SIMGRID_JAR}_finalized
   DEPENDS simgrid simgrid-java simgrid-java_pre_jar
           ${SIMGRID_JAR} ${MANIFEST_IN_FILE}
 add_custom_command(
   COMMENT "Finalize simgrid.jar..."
   OUTPUT ${SIMGRID_JAR}_finalized
   DEPENDS simgrid simgrid-java simgrid-java_pre_jar
           ${SIMGRID_JAR} ${MANIFEST_IN_FILE}
-          ${JAVA_BUNDLE_SO_FILES} ${JAVA_BUNDLE_TXT_FILES}
-  COMMAND sh ${JAVA_BUNDLE} "${SIMGRID_JAR}" "${Java_JAVA_EXECUTABLE}" "${STRIP_COMMAND}" -so ${JAVA_BUNDLE_SO_FILES} -txt ${JAVA_BUNDLE_TXT_FILES}
+          ${JAVA_BUNDLE_SO_FILES}
+         ${CMAKE_HOME_DIRECTORY}/COPYING
+         ${CMAKE_HOME_DIRECTORY}/ChangeLog
+         ${CMAKE_HOME_DIRECTORY}/ChangeLog.SimGrid-java
+         ${CMAKE_HOME_DIRECTORY}/LICENSE-LGPL-2.1
+         
+  COMMAND ${JAVA_ARCHIVE} -uvf ${SIMGRID_JAR} -C ${CMAKE_HOME_DIRECTORY} COPYING ChangeLog ChangeLog.SimGrid-java LICENSE-LGPL-2.1
+  
   COMMAND ${CMAKE_COMMAND} -E copy ${MANIFEST_IN_FILE} ${MANIFEST_FILE}
   COMMAND ${CMAKE_COMMAND} -E echo "Specification-Version: \\\"${SIMGRID_VERSION_MAJOR}.${SIMGRID_VERSION_MINOR}.${SIMGRID_VERSION_PATCH}\\\"" >> ${MANIFEST_FILE}
   COMMAND ${CMAKE_COMMAND} -E echo "Implementation-Version: \\\"${GIT_VERSION}\\\"" >> ${MANIFEST_FILE}
   COMMAND ${JAVA_ARCHIVE} -uvmf ${MANIFEST_FILE} ${SIMGRID_JAR}
   COMMAND ${CMAKE_COMMAND} -E copy ${MANIFEST_IN_FILE} ${MANIFEST_FILE}
   COMMAND ${CMAKE_COMMAND} -E echo "Specification-Version: \\\"${SIMGRID_VERSION_MAJOR}.${SIMGRID_VERSION_MINOR}.${SIMGRID_VERSION_PATCH}\\\"" >> ${MANIFEST_FILE}
   COMMAND ${CMAKE_COMMAND} -E echo "Implementation-Version: \\\"${GIT_VERSION}\\\"" >> ${MANIFEST_FILE}
   COMMAND ${JAVA_ARCHIVE} -uvmf ${MANIFEST_FILE} ${SIMGRID_JAR}
+
   COMMAND ${CMAKE_COMMAND} -E copy ${SIMGRID_JAR} ${SIMGRID_FULL_JAR}
   COMMAND ${CMAKE_COMMAND} -E copy ${SIMGRID_JAR} ${SIMGRID_FULL_JAR}
+  COMMAND sh ${JAVA_BUNDLE} "${Java_JAVA_EXECUTABLE}" "${SIMGRID_JAR}" ${JAVA_BUNDLE_SO_FILES}
   COMMAND ${JAVA_ARCHIVE} -uvf ${SIMGRID_FULL_JAR} "NATIVE"
   COMMAND ${JAVA_ARCHIVE} -uvf ${SIMGRID_FULL_JAR} "NATIVE"
-  COMMAND ${CMAKE_COMMAND} -E remove ${SIMGRID_JAR}_finalized
-  COMMAND ${CMAKE_COMMAND} -E touch ${SIMGRID_JAR}_finalized
   COMMAND ${Java_JAVADOC_EXECUTABLE} -quiet -d doc/javadoc ${CMAKE_HOME_DIRECTORY}/src/bindings/java/org/simgrid/*.java ${CMAKE_HOME_DIRECTORY}/src/bindings/java/org/simgrid/*/*.java
   COMMAND ${JAVA_ARCHIVE} -uvf ${SIMGRID_FULL_JAR} doc/javadoc
   COMMAND ${Java_JAVADOC_EXECUTABLE} -quiet -d doc/javadoc ${CMAKE_HOME_DIRECTORY}/src/bindings/java/org/simgrid/*.java ${CMAKE_HOME_DIRECTORY}/src/bindings/java/org/simgrid/*/*.java
   COMMAND ${JAVA_ARCHIVE} -uvf ${SIMGRID_FULL_JAR} doc/javadoc
+  
+  COMMAND ${CMAKE_COMMAND} -E remove ${SIMGRID_JAR}_finalized
+  COMMAND ${CMAKE_COMMAND} -E touch ${SIMGRID_JAR}_finalized
   )
 add_custom_target(simgrid-java_jar ALL DEPENDS ${SIMGRID_JAR}_finalized)
 
   )
 add_custom_target(simgrid-java_jar ALL DEPENDS ${SIMGRID_JAR}_finalized)
 
@@ -122,7 +117,6 @@ if(enable_maintainer_mode)
   set_source_files_properties(${JSURF_SWIG_SRC} PROPERTIES CPLUSPLUS 1)
 
   swig_add_module(surf-java java ${JSURF_SWIG_SRC} ${JSURF_JAVA_C_SRC})
   set_source_files_properties(${JSURF_SWIG_SRC} PROPERTIES CPLUSPLUS 1)
 
   swig_add_module(surf-java java ${JSURF_SWIG_SRC} ${JSURF_JAVA_C_SRC})
-
   swig_link_libraries(surf-java simgrid)
 else()
   add_library(surf-java SHARED ${JSURF_C_SRC})
   swig_link_libraries(surf-java simgrid)
 else()
   add_library(surf-java SHARED ${JSURF_C_SRC})
index 38f663f..d531058 100755 (executable)
@@ -1,60 +1,27 @@
 #!/bin/sh
 
 set -e
 #!/bin/sh
 
 set -e
-#set -x
+set -x
 
 
-if [ $# -lt 3 ]; then
+if [ $# -lt 2 ]; then
     cat >&2 <<EOF
     cat >&2 <<EOF
-Usage: $0 simgrid.jar java_command strip_command [-so file.so...] [-txt file.txt...]
-    simgrid.jar    SimGrid jar file
+Usage: $0 simgrid.jar java_command strip_command [file.so...]
     java_command   path to the Java runtime
     java_command   path to the Java runtime
-    strip_command  path to the command used to strip libraries
+    simgrid.jar    SimGrid jar file
     file.so        library file to strip and bundle into the archive
     file.so        library file to strip and bundle into the archive
-    file.txt       other file to bundle into the archive
 EOF
     exit 1
 fi
 
 EOF
     exit 1
 fi
 
+JAVA=$1
+shift
 SIMGRID_JAR=$1
 SIMGRID_JAR=$1
-JAVA=$2
-STRIP=$3
-shift 3
+shift
 
 JSG_BUNDLE=$("$JAVA" -classpath "$SIMGRID_JAR" org.simgrid.NativeLib --quiet)
 
 
 JSG_BUNDLE=$("$JAVA" -classpath "$SIMGRID_JAR" org.simgrid.NativeLib --quiet)
 
-# sanity check
-case "$JSG_BUNDLE" in
-    NATIVE/*)
-        cat >&2 <<EOF
--- [Java] Native libraries bundled into: ${JSG_BUNDLE}
-EOF
-        ;;
-    *)
-        cat >&2 <<EOF
--- [Java] Native libraries NOT bundled into invalid directory: ${JSG_BUNDLE}
-EOF
-        exit 1
-        ;;
-esac
-
 # prepare directory
 rm -fr NATIVE
 mkdir -p "$JSG_BUNDLE"
 # prepare directory
 rm -fr NATIVE
 mkdir -p "$JSG_BUNDLE"
+cp $* "$JSG_BUNDLE"
 
 
-if [ "$1" = "-so" ]; then
-    shift
-    for file; do
-        [ "$file" != "-txt" ] || break
-        cp -f "$file" "$JSG_BUNDLE"
-        "$STRIP" -S "$JSG_BUNDLE/${file##*/}"
-        shift
-    done
-fi
-
-if [ "$1" = "-txt" ]; then
-    shift
-    for file; do
-        cp -f "$file" "$JSG_BUNDLE"
-        shift
-    done
-fi