Changeset 7731 for trunk/projects


Ignore:
Timestamp:
08/03/11 11:13:58 (8 years ago)
Author:
hinerm
Message:

Fixes for ticket #298 and #654

Ticket #298 fixes:

  • search for a /jar subdirectory in working directory or provided classpath
  • all files in /jar are added to the classpath of the instantiated JVM

Ticket #654 fixes:

  • copying of project headers
  • copying of proxy headers
  • copying of jar dependencies to /jar
  • removal of loci_tool dependency
  • packaging improvements to remove full path references
Location:
trunk/projects/jar2lib/src/main/resources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/projects/jar2lib/src/main/resources/CMakeLists.vm

    r7727 r7731  
    4646endif(NOT DEFINED Jar2Lib_JACE_DIR) 
    4747 
     48if(NOT DEFINED Jar2Lib_PROXY_DIR) 
     49  set(Jar2Lib_PROXY_DIR ../proxies) 
     50endif(NOT DEFINED Jar2Lib_PROXY_DIR) 
     51 
     52if(NOT DEFINED Jar2Lib_INCLDE_DIR) 
     53  set(Jar2Lib_INCLDE_DIR ../include) 
     54endif(NOT DEFINED Jar2Lib_INCLDE_DIR) 
     55 
     56if(NOT DEFINED Jar2Lib_DEPS_DIR) 
     57  set(Jar2Lib_DEPS_DIR jar) 
     58endif(NOT DEFINED Jar2Lib_DEPS_DIR) 
     59 
    4860if(NOT DEFINED Jar2Lib_DIST_DIR) 
    4961  set(Jar2Lib_DIST_DIR dist/${projectId}) 
    5062endif(NOT DEFINED Jar2Lib_DIST_DIR) 
     63 
     64if(NOT DEFINED Jar2Lib_DEPS_SRC) 
     65  set(Jar2Lib_DEPS_SRC ../../dependency) 
     66endif(NOT DEFINED Jar2Lib_DEPS_SRC) 
    5167 
    5268if(NOT DEFINED J2L_BUILD_TYPE) 
     
    150166  install(FILES 
    151167    "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${J2L_LIB_PREFIX}jace${J2L_JNI_SUFFIX}" 
    152     DESTINATION "${Jar2Lib_DIST_DIR}" 
     168    DESTINATION "." 
    153169  ) 
    154170 
     
    164180  install(FILES 
    165181    "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${J2L_LIB_PREFIX}jace${J2L_SUFFIX}" 
    166     DESTINATION "${Jar2Lib_DIST_DIR}" 
     182    DESTINATION "." 
    167183  ) 
    168184endif(APPLE) 
     
    180196install(FILES 
    181197  "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${J2L_LIB_PREFIX}jace${J2L_SUFFIX}" 
    182   DESTINATION "${Jar2Lib_DIST_DIR}" 
     198  DESTINATION "." 
    183199) 
    184200 
     
    193209  VERBATIM 
    194210) 
    195 install(FILES 
    196   "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${J2L_LIB_PREFIX}${projectId}${J2L_SUFFIX}" 
    197   DESTINATION "${Jar2Lib_DIST_DIR}" 
    198 ) 
    199211 
    200212#copy jtools 
     
    208220  VERBATIM 
    209221) 
     222 
     223# copy jace_runtime.jar 
     224add_custom_command( 
     225  TARGET ${projectId} 
     226  DEPENDS "${CMAKE_BINARY_DIR}/../jace-runtime.jar" 
     227  POST_BUILD 
     228  COMMAND ${CMAKE_COMMAND} -E copy 
     229  "${CMAKE_BINARY_DIR}/../jace-runtime.jar" 
     230  "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${Jar2Lib_DEPS_DIR}/jace-runtime.jar" 
     231  VERBATIM 
     232) 
    210233install(FILES 
    211   "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${J2L_LIB_PREFIX}jtools${J2L_SUFFIX}" 
    212   DESTINATION "${Jar2Lib_DIST_DIR}" 
    213 ) 
    214  
    215 # copy jace_runtime.jar 
    216 add_custom_command( 
    217   TARGET ${projectId} 
    218   DEPENDS "${CMAKE_BINARY_DIR}/../jace-runtime.jar" 
    219   POST_BUILD 
    220   COMMAND ${CMAKE_COMMAND} -E copy 
    221   "${CMAKE_BINARY_DIR}/../jace-runtime.jar" 
    222   "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/jace-runtime.jar" 
    223   VERBATIM 
    224 ) 
    225 install(FILES 
    226   "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/jace-runtime.jar" 
    227   DESTINATION "${Jar2Lib_DIST_DIR}" 
     234  "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${Jar2Lib_DEPS_DIR}/jace-runtime.jar" 
     235  DESTINATION "./${Jar2Lib_DEPS_DIR}" 
    228236) 
    229237 
     
    237245  COMMAND ${CMAKE_COMMAND} -E copy 
    238246  "${jarFile}" 
    239   "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${jarName}" 
     247  "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${Jar2Lib_DEPS_DIR}/${jarName}" 
    240248  VERBATIM 
    241249) 
    242250install(FILES 
    243   "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${jarName}" 
    244   DESTINATION "${Jar2Lib_DIST_DIR}" 
     251  "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${Jar2Lib_DEPS_DIR}/${jarName}" 
     252  DESTINATION "./${Jar2Lib_DEPS_DIR}/" 
    245253) 
    246254 
    247255#end##foreach $sourceJars 
     256 
     257# copy and install executables 
     258#foreach ($sourceFile in $sourceFiles) 
     259#set ($execName = $q.simpleName($sourceFile)) 
     260#set ($sourceName = $sourceFile.getName()) 
     261add_custom_command( 
     262  TARGET ${execName} 
     263  DEPENDS "${CMAKE_BINARY_DIR}/${execName}" 
     264  POST_BUILD 
     265  COMMAND ${CMAKE_COMMAND} -E copy 
     266  "${CMAKE_BINARY_DIR}/${execName}" 
     267  "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${execName}" 
     268  VERBATIM 
     269) 
     270#end##foreach $sourceFile 
     271 
     272# copy and install dependencies 
     273add_custom_command( 
     274  TARGET ${projectId} 
     275  DEPENDS "${CMAKE_BINARY_DIR}/${Jar2Lib_DEPS_SRC}" 
     276  POST_BUILD 
     277  COMMAND ${CMAKE_COMMAND} -E copy_directory 
     278  "${CMAKE_BINARY_DIR}/${Jar2Lib_DEPS_SRC}" 
     279  "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${Jar2Lib_DEPS_DIR}/" 
     280  VERBATIM 
     281) 
     282 
     283install(DIRECTORY 
     284  "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/${Jar2Lib_DEPS_DIR}/" 
     285  DESTINATION "./${Jar2Lib_DEPS_DIR}/" 
     286) 
     287 
     288# copy dependency headers 
     289add_custom_command( 
     290  TARGET ${projectId} 
     291  DEPENDS "${Jar2Lib_INCLDE_DIR}" 
     292  COMMAND ${CMAKE_COMMAND} -E copy_directory 
     293  "${Jar2Lib_INCLDE_DIR}" 
     294  "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/include" 
     295  VERBATIM 
     296) 
     297 
     298# copy and install proxies 
     299add_custom_command( 
     300  TARGET ${projectId} 
     301  DEPENDS "${CMAKE_BINARY_DIR}/${Jar2Lib_PROXY_DIR}" 
     302  POST_BUILD 
     303  COMMAND ${CMAKE_COMMAND} -E copy_directory 
     304  "${CMAKE_BINARY_DIR}/${Jar2Lib_PROXY_DIR}/include" 
     305  "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/include" 
     306  VERBATIM 
     307) 
     308 
     309install(DIRECTORY 
     310  "${CMAKE_BINARY_DIR}/${Jar2Lib_DIST_DIR}/include/" 
     311  DESTINATION "./include" 
     312) 
     313 
     314# install targets 
     315install(TARGETS 
     316  jtools 
     317  ${projectId} 
     318#foreach ($sourceFile in $sourceFiles) 
     319#set ($execName = $q.simpleName($sourceFile)) 
     320  ${execName} 
     321#end##foreach $sourceFile 
     322  RUNTIME DESTINATION . 
     323  LIBRARY DESTINATION . 
     324  ARCHIVE DESTINATION . 
     325) 
    248326 
    249327SET(CPACK_PACKAGE_FILE_NAME "${projectId}") 
    250328SET(CPACK_GENERATOR "TGZ;ZIP") 
    251329INCLUDE( CPack ) 
     330 
  • trunk/projects/jar2lib/src/main/resources/project-files/jtools/include/javaTools.h

    r7718 r7731  
    4040 
    4141#include <string> 
     42#include <dirent.h> 
    4243#include <iostream> 
    4344#include "jace.h" 
  • trunk/projects/jar2lib/src/main/resources/project-files/jtools/source/javaTools.cxx

    r7718 r7731  
    109109 
    110110//TODO: Add option override java library path 
     111/** 
     112* jarlist is a semi-colon-separated list of additional jars to include 
     113**/ 
    111114void JavaTools::createJVM(string classdir, string jarlist, bool headless, int memory) 
    112115{ 
     
    126129      std::string classpath (""); 
    127130 
    128       //TODO: Add all Jar2Lib classpath jars to this list by default (by template? by txt file?) 
    129131      classpath += classdir + "jace-runtime.jar"; 
     132 
     133      DIR *d; 
     134      struct dirent *dir; 
     135 
     136      if(classdir.length() >= 1) 
     137      { 
     138        string tmp_dir(classdir); 
     139        tmp_dir += "jar"; 
     140        d = opendir(tmp_dir.c_str()); 
     141      } 
     142      else 
     143      { 
     144        d = opendir("./jar"); 
     145      } 
     146 
     147      if(d) 
     148      { 
     149        while ((dir = readdir(d)) != NULL) 
     150        { 
     151          string tmp_name(dir->d_name); 
     152 
     153          if(tmp_name.compare(".") != 0 && tmp_name.compare("..") !=0) 
     154          { 
     155            classpath += PATHSTEP; 
     156            classpath += classdir + "jar" + SLASH + dir->d_name; 
     157          } 
     158        } 
     159 
     160        closedir(d); 
     161      } 
     162 
    130163 
    131164      if(jarlist.length() >= 1) 
     
    147180      } 
    148181 
    149       std::cout << "jarlist : " << jarlist << std::endl; 
    150  
    151       std::cout << "Classpath for JVM: " << classpath << std::endl; 
     182      //std::cout << "jarlist : " << jarlist << std::endl; 
     183      //std::cout << "Classpath for JVM: " << classpath << std::endl; 
    152184 
    153185      list.push_back(jace::ClassPath( 
Note: See TracChangeset for help on using the changeset viewer.