root/main/trunk/gli/makejar.bat @ 24766

Revision 24766, 6.5 KB (checked in by ak19, 8 years ago)

Makejar needs to put the org.apache classes into GLI.jar so that everything necessary is there in SignedGatherer?.jar when running the GLIApplet. In order to get the org.apache classes into the gli\jar folder first, need to run the unjarring programs (such as to obtain the org.apache classes) from the batch file using the start command with the wait flag set, so that the batch script will wait for the unjarring programs to terminate before trying to move the resulting (unjarred) directories.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1echo off
2pushd "%CD%"
3CD /D "%~dp0"
4set GLILANG=en
5
6:: This script must be run from within the directory in which it lives
7if exist makejar.bat goto findJar
8    if "%GLILANG%" == "en" echo This script must be run from the directory in which it resides.
9    if "%GLILANG%" == "es" echo Este gui¢n deber  ejecutarse desde el directorio en el que reside.
10    if "%GLILANG%" == "fr" echo Ce script doit ˆtre ex‚cut‚ … partir du r‚pertoire dans lequel il se trouve.
11    if "%GLILANG%" == "ru" echo â®â áªàš¯â €®«Š¥­ ¡ëâì ¢§ïâ š§ €šà¥ªâ®àšš, ¢ ª®â®à®© ®­ à á¯®«®Š¥­
12    goto exit
13
14
15
16
17:findJar
18:: ---- Check jar exists ----
19set JARPATH=
20
21:: Some users may set the above line manually
22if not "%JARPATH%" == "" goto testJar
23
24    :: If it is set, use the JAVA_HOME environment variable
25    if not "%JAVA_HOME%" == "" goto javahome
26
27    :: Check if jar is on the search path
28    echo %PATH%| winutil\which.exe jar.exe | winutil\setvar.exe JARPATH > setjar.bat
29    call setjar.bat
30    del setjar.bat
31    if not "%JARPATH%" == "" goto testJar
32
33    :: Still haven't found anything, so try looking in the registry (gulp!)
34    type nul > jdk.reg
35    regedit /E jdk.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit"
36    type jdk.reg > jdk.txt
37    del jdk.reg
38
39    winutil\findjava.exe jdk.txt | winutil\setvar.exe JARPATH > setjar.bat
40    del jdk.txt
41    call setjar.bat
42    del setjar.bat
43
44    :: If nothing was found in the registry, we're stuck
45    if "%JARPATH%" == "" goto noJar
46
47    set JARPATH=%JARPATH%\bin
48    goto testJar
49
50:javahome
51    set JARPATH=%JAVA_HOME%\bin
52
53:testJar
54:: Check that a jar executable has been found
55if "%GLILANG%" == "en" echo Checking jar: %JARPATH%
56if "%GLILANG%" == "es" echo Revisando jar: %JARPATH%
57if "%GLILANG%" == "fr" echo V‚rification de jar: %JARPATH%
58if "%GLILANG%" == "ru" echo à®¢¥àª  jar: %JARPATH%
59if exist "%JARPATH%\jar.exe" goto checkCompile
60
61:noJar
62    echo.
63    if "%GLILANG%" == "en" echo Failed to locate an appropriate version of jar. You must install a
64    if "%GLILANG%" == "en" echo Java Development Kit (version 1.4 or greater) before compiling the
65    if "%GLILANG%" == "en" echo Greenstone Librarian Interface.
66
67    if "%GLILANG%" == "es" echo No se pudo localizar una versi¢n apropiada de jar. Usted deber 
68    if "%GLILANG%" == "es" echo instalar un Kit de Desarrollo de Software Java (versi¢n 1.4 o superior)
69    if "%GLILANG%" == "es" echo antes de generar la documentaci¢n para la Interfaz de la Biblioteca
70    if "%GLILANG%" == "es" echo Digital Greenstone.
71
72    if "%GLILANG%" == "fr" echo Une version appropri‚e de jar n'a pas pu ˆtre localis‚e. Vous devez
73    if "%GLILANG%" == "fr" echo installer un Kit de D‚veloppement Java (version 1.4 ou sup‚rieure)
74    if "%GLILANG%" == "fr" echo avant de produire la documentation de Greenstone Librarian Interface.
75
76    if "%GLILANG%" == "ru" echo ¥ 〠«®áì ®¯à¥€¥«šâì ¬¥áâ®­ å®Š€¥­š¥ ᮮ⢥âáâ¢ãî饩 ¢¥àášš jar.
77    if "%GLILANG%" == "ru" echo ‚ë €®«Š­ë š­áâ ««šà®¢ âì Java Development Kit (¢¥àášï 1.4 š«š ¢ëè¥)
78    if "%GLILANG%" == "ru" echo ¯à¥Š€¥, 祬 £¥­¥àšà®¢ âì €®ªã¬¥­â æšî €«ï ¡š¡«š®â¥ç­®£®
79    if "%GLILANG%" == "ru" echo š­â¥àä¥©á  Greenstone.
80    goto exit
81
82
83
84:checkCompile
85:: Check that the GLI has been compiled
86if exist classes\org\greenstone\gatherer\GathererProg.class goto makeJar
87    if "%GLILANG%" == "es"  (
88    echo Usted necesita compilar la Interfaz de la Biblioteca Digital Greenstone
89    echo ^(por medio de makegli.sh^) antes de ejecutar este guión.
90    )
91    if "%GLILANG%" == "fr" (
92    echo Vous devez compiler le Greenstone Interface ^(en utilisant makegli.sh^)
93    echo avant d'exécuter ce script.
94    )
95    if "%GLILANG%" == "ru" (
96    echo ÷Ù ÄÏÌÖÎÙ ËÏÍÐÉÌÉÒÏ×ÁÔØ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone
97    echo ^(ÉÓÐÏÌØÚÕÑ makegli.sh^) ÐÅÒÅÄ ××ÏÄÏÍ ÜÔÏÇÏ ÓËÒÉÐÔÁ
98    )
99    if "%GLILANG%" == "en" (
100    echo You need to compile the Greenstone Librarian Interface ^(using makegli.sh^)
101    echo before running this script.
102    )
103    goto exit
104fi
105
106
107:makeJar
108:: All the GLI class files and supporting libraries are put into the "jar" directory.
109:: Running programs (or commands) with start /wait will wait for each program in turn to finish.
110:: This is needed when unjarring org (com and de) pkgs below, else it doesn't exist upon moving.
111:: See http://www.computerhope.com/forum/index.php?topic=83771.0 and
112:: http://stackoverflow.com/questions/4317020/windows-batch-sleep
113echo Assuming that Java code is freshly compiled...
114
115if NOT exist jar (
116  mkdir jar
117
118  cd lib
119  start "" /wait /b "%JARPATH%\jar" xf apache.jar com
120  start "" /wait /b "%JARPATH%\jar" xf apache.jar org
121  start "" /wait /b "%JARPATH%\jar" xf qfslib.jar de
122
123  move com ..\jar\com     >NUL
124  move de ..\jar\de       >NUL
125  move org ..\jar\org     >NUL
126
127  cd ..
128)
129
130:: Copy the latest version of the GLI classes into the jar directory
131if exist jar\org\greenstone (
132  rmdir /q /s jar\org\greenstone
133)
134xcopy /i /e /q classes\org\greenstone jar\org\greenstone
135
136:: Some of the things to go into the JAR file are optional, and may not exist
137set optional=
138if exist collect.zip (
139    set optional=%optional% collect.zip
140)
141
142:: Recreate the metadata.zip file (contains the GLI metadata directory)
143if exist metadata.zip (
144  del /f metadata.zip
145)
146winutil\zip.exe -r metadata.zip metadata >NUL
147
148:: Jar everything up
149"%JARPATH%\jar" cf GLI.jar .java.policy metadata.zip %optional% help -C classes dictionary.properties -C classes dictionary_es.properties -C classes dictionary_fr.properties -C classes dictionary_ru.properties -C classes feedback.properties -C classes images -C classes xml -C jar com -C jar de -C jar org
150
151:: Tidy up
152del /f metadata.zip
153
154:: Generate the GLIServer.jar file for remote building
155"%JARPATH%\jar" cf GLIServer.jar -C classes org/greenstone/gatherer/remote
156
157:: ---- Make signed JAR file for the applet, if desired ----
158if  (%1) == (-sign) (
159
160    if not exist appletstore (
161      "%JARPATH%\keytool" -genkey -alias privateKey -keystore appletstore -storepass greenstone
162    )
163
164    if exist SignedGatherer.jar del /f SignedGatherer.jar
165    if exist appletpasswd (
166      echo Using jarsigner to make signed jar file ...
167      "%JARPATH%\jarsigner" -keystore appletstore -signedjar SignedGatherer.jar GLI.jar privateKey < appletpasswd >NUL 2>NUL
168      echo ... done.
169    ) ELSE (
170      "%JARPATH%\jarsigner" -keystore appletstore -signedjar SignedGatherer.jar GLI.jar privateKey
171    )
172    echo Installing SignedGatherer in ..\bin\java
173    move SignedGatherer.jar ..\bin\java\SignedGatherer.jar
174)
175:exit
176
177popd
Note: See TracBrowser for help on using the browser.