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

Last change on this file since 25800 was 25682, checked in by davidb, 12 years ago

Changed to using RSyntaxTextArea to get coloured highlighting and other goodies for the Greenstone3 format manager

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 6.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:: 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:exit
171
172popd
173endlocal
Note: See TracBrowser for help on using the repository browser.