source: main/trunk/gli/makejar.bat@ 25947

Last change on this file since 25947 was 25947, checked in by ak19, 9 years ago

Makejar.bat now includes all the dictionary.properties files. The earlier omission (where only a few language properties files were included) was only noticeable when you move the classes folder out of the way so that the old GLI.jar generated did not find the additional properties files in the classes folder when these were missing in the GLI.jar file itself.

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