source: trunk/gli/makejar.bat@ 14116

Last change on this file since 14116 was 13805, checked in by mdewsnip, 17 years ago

Now deletes the metadata.zip file after making the JAR file.

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