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

Last change on this file since 32153 was 32136, checked in by ak19, 6 years ago

Committing the first checkpoint of getting the GLIApplet to work with Java Web Start/JNLP, along with the important gli\README_WebGLI.txt with instructions. This commit uses the Java Web Start as fallback if the GLI applet can't be displayed. Some strings are hardcoded in the version of the gli\GLIApplet.jnlp file at this point.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 7.4 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 javax
120 "!JARPATH!\jar" xf ..\lib\jna.jar com
121 "!JARPATH!\jar" xf ..\lib\jna-platform.jar com
122 "!JARPATH!\jar" xf ..\lib\qfslib.jar de
123 "!JARPATH!\jar" xf ..\lib\rsyntaxtextarea.jar org
124 cd ..
125)
126
127:: Copy the latest version of the GLI classes into the jar directory
128if exist jar\org\greenstone (
129 rmdir /q /s jar\org\greenstone
130)
131xcopy /i /e /q classes\org\greenstone jar\org\greenstone
132
133:: Some of the things to go into the JAR file are optional, and may not exist
134set optional=
135if exist collect.zip (
136 set optional=%optional% collect.zip
137)
138
139:: Recreate the metadata.zip file (contains the GLI metadata directory)
140if exist metadata.zip (
141 del /f metadata.zip
142)
143winutil\zip.exe -r metadata.zip metadata >NUL
144
145
146:: Build up a list of all the loose files in the classes directory, which includes
147:: both feedback.properties and all dictionary*.properties files, since they all need
148:: to be included in the resulting GLI.jar file.
149:: This type of FOR statement does not recurse into subdirs, which is what we want
150:: as we want to include all the loose files in the toplevel classes dir in GLI.jar
151::for %%G in (classes\*.properties) do echo file is %%G
152set propfiles=
153for %%G in (classes\*) do (call :concat %%G)
154::echo Property files list: %propfiles%
155goto :jarcmd
156
157:concat
158set propfiles=%propfiles% %1
159goto :eof
160
161:jarcmd
162:: Jar everything up
163::"%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 -C jar javax
164
165:: include all the properties (and other loose) files in the toplevel classes directory into the GLI.jar
166:: (Do something similar to get any and all folders inside the toplevel jar folder included into GLI.jar?)
167:: Note that order of manifest and jar file should match order of "mf" vs "fm" params to jar command
168"%JARPATH%\jar" cmf manifest.mf GLI.jar .java.policy metadata.zip %optional% help %propfiles% -C classes images -C classes xml -C jar com -C jar de -C jar org -C jar javax
169
170:: Not (yet) included in the new manifest.mf:
171:: Codebase: http://localhost:8383/greenstone3/applet
172
173:: Tidy up
174del /f metadata.zip
175
176:: Generate the GLIServer.jar file for remote building
177"%JARPATH%\jar" cf GLIServer.jar -C classes org/greenstone/gatherer/remote
178
179:: ---- Make signed JAR file for the applet, if desired ----
180if (%1) == (-sign) (
181
182 if not exist appletstore (
183 "!JARPATH!\keytool" -genkey -alias privateKey -keystore appletstore -storepass greenstone
184 )
185
186 if exist SignedGatherer.jar del /f SignedGatherer.jar
187 if exist appletpasswd (
188 echo Using jarsigner to make signed jar file ...
189 "!JARPATH!\jarsigner" -keystore appletstore -signedjar SignedGatherer.jar GLI.jar privateKey < appletpasswd >NUL 2>NUL
190 echo ... done.
191 ) ELSE (
192 "!JARPATH!\jarsigner" -keystore appletstore -signedjar SignedGatherer.jar GLI.jar privateKey
193 )
194 echo Installing SignedGatherer in ..\bin\java
195 move SignedGatherer.jar ..\bin\java\SignedGatherer.jar
196)
197:exit
198
199popd
200endlocal
Note: See TracBrowser for help on using the repository browser.