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

Revision 24829, 6.1 KB (checked in by ak19, 8 years ago)

Changes to bat files and perl code to deal with brackets in (Windows) filepath. Also checked winmake.bat files to see if changes were needed there. These changes go together with the commits 24826 to 24828 for gems.bat, and commit 24820 on makegs2.bat.

  • 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
119  "!JARPATH!\jar" xf ..\lib\qfslib.jar de
120
121  cd ..
122)
123
124:: Copy the latest version of the GLI classes into the jar directory
125if exist jar\org\greenstone (
126  rmdir /q /s jar\org\greenstone
127)
128xcopy /i /e /q classes\org\greenstone jar\org\greenstone
129
130:: Some of the things to go into the JAR file are optional, and may not exist
131set optional=
132if exist collect.zip (
133    set optional=%optional% collect.zip
134)
135
136:: Recreate the metadata.zip file (contains the GLI metadata directory)
137if exist metadata.zip (
138  del /f metadata.zip
139)
140winutil\zip.exe -r metadata.zip metadata >NUL
141
142:: Jar everything up
143"%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
144
145:: Tidy up
146del /f metadata.zip
147
148:: Generate the GLIServer.jar file for remote building
149"%JARPATH%\jar" cf GLIServer.jar -C classes org/greenstone/gatherer/remote
150
151:: ---- Make signed JAR file for the applet, if desired ----
152if  (%1) == (-sign) (
153
154    if not exist appletstore (
155      "!JARPATH!\keytool" -genkey -alias privateKey -keystore appletstore -storepass greenstone
156    )
157
158    if exist SignedGatherer.jar del /f SignedGatherer.jar
159    if exist appletpasswd (
160      echo Using jarsigner to make signed jar file ...
161      "!JARPATH!\jarsigner" -keystore appletstore -signedjar SignedGatherer.jar GLI.jar privateKey < appletpasswd >NUL 2>NUL
162      echo ... done.
163    ) ELSE (
164      "!JARPATH!\jarsigner" -keystore appletstore -signedjar SignedGatherer.jar GLI.jar privateKey
165    )
166    echo Installing SignedGatherer in ..\bin\java
167    move SignedGatherer.jar ..\bin\java\SignedGatherer.jar
168)
169:exit
170
171popd
172endlocal
Note: See TracBrowser for help on using the browser.