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

Revision 31649, 7.2 KB (checked in by ak19, 3 years ago)

Updated GLI's batch and bash scripts to refer to the new JNA jar files and added a description of these jar files, there purpose, their version and where to get them into the lib/README.txt file.

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