source: main/tags/2.70/gli/makejar.bat@ 21099

Last change on this file since 21099 was 10210, checked in by davidb, 19 years ago

Script can now cope with whether or not appletpasswd (storing the password to use for
the signed jar file) is present.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 6.0 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 activation.jar com javax
116 %JARPATH%\jar xf apache.jar com org
117 %JARPATH%\jar xf mail.jar com javax
118 %JARPATH%\jar xf qfslib.jar de
119
120 move com ..\jar\com >NUL
121 move de ..\jar\de >NUL
122 move javax ..\jar\javax >NUL
123 move org ..\jar\org >NUL
124
125 cd ..
126)
127
128:: Copy the latest version of the GLI classes into the jar directory
129if exist jar\org\greenstone (
130 rmdir /q /s jar\org\greenstone
131)
132xcopy /i /e /q classes\org\greenstone jar\org\greenstone
133
134:: Some of the things to go into the JAR file are optional, and may not exist
135set optional=
136if exist collect.zip (
137 set optional=%optional% collect.zip
138)
139if exist classifiers.dat (
140 set optional=%optional% classifiers.dat
141)
142if exist plugins.dat (
143 set optional=%optional% plugins.dat
144)
145
146:: Recreate the metadata.zip file (contains the GLI metadata directory)
147if exist jar\org\greenstone (
148 del /f metadata.zip
149)
150winutil\zip.exe -r metadata.zip metadata >NUL
151
152:: Jar everything up
153%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 javax -C jar org
154
155
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
Note: See TracBrowser for help on using the repository browser.