[17944] | 1 | echo off
|
---|
[24829] | 2 | setlocal enabledelayedexpansion
|
---|
| 3 |
|
---|
[17944] | 4 | pushd "%CD%"
|
---|
| 5 | CD /D "%~dp0"
|
---|
| 6 | set GLILANG=en
|
---|
| 7 |
|
---|
| 8 | :: This script must be run from within the directory in which it lives
|
---|
| 9 | if 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 excut
|
---|
| 13 | partir du rpertoire dans lequel il se trouve.
|
---|
| 14 | if "%GLILANG%" == "ru" echo â®â áªàš¯â €®«Š¥ ¡ëâì ¢§ïâ š§ €šà¥ªâ®àšš, ¢ ª®â®à®© ® à ᯮ«®Š¥
|
---|
| 15 | goto exit
|
---|
| 16 |
|
---|
| 17 |
|
---|
| 18 |
|
---|
| 19 |
|
---|
| 20 | :findJar
|
---|
| 21 | :: ---- Check jar exists ----
|
---|
| 22 | set JARPATH=
|
---|
| 23 |
|
---|
| 24 | :: Some users may set the above line manually
|
---|
| 25 | if 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
|
---|
| 58 | if "%GLILANG%" == "en" echo Checking jar: %JARPATH%
|
---|
| 59 | if "%GLILANG%" == "es" echo Revisando jar: %JARPATH%
|
---|
| 60 | if "%GLILANG%" == "fr" echo Vrification de jar: %JARPATH%
|
---|
| 61 | if "%GLILANG%" == "ru" echo ஢¥àª jar: %JARPATH%
|
---|
| 62 | if 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 approprie de jar n'a pas pu tre localise. Vous devez
|
---|
| 76 | if "%GLILANG%" == "fr" echo installer un Kit de Dveloppement Java (version 1.4 ou suprieure)
|
---|
| 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
|
---|
| 89 | if exist classes\org\greenstone\gatherer\GathererProg.class goto makeJar
|
---|
| 90 | if "%GLILANG%" == "es" (
|
---|
[22096] | 91 | echo Usted necesita compilar la Interfaz de la Biblioteca Digital Greenstone
|
---|
[17944] | 92 | echo ^(por medio de makegli.sh^) antes de ejecutar este guión.
|
---|
| 93 | )
|
---|
[22096] | 94 | if "%GLILANG%" == "fr" (
|
---|
[17944] | 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" (
|
---|
[22096] | 99 | echo ÷Ù ÄÏÌÖÎÙ ËÏÍÐÉÌÉÒÏ×ÁÔØ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone
|
---|
[17944] | 100 | echo ^(ÉÓÐÏÌØÚÕÑ makegli.sh^) ÐÅÒÅÄ ××ÏÄÏÍ ÜÔÏÇÏ ÓËÒÉÐÔÁ
|
---|
| 101 | )
|
---|
[22096] | 102 | if "%GLILANG%" == "en" (
|
---|
[17944] | 103 | echo You need to compile the Greenstone Librarian Interface ^(using makegli.sh^)
|
---|
| 104 | echo before running this script.
|
---|
| 105 | )
|
---|
| 106 | goto exit
|
---|
| 107 | fi
|
---|
| 108 |
|
---|
| 109 |
|
---|
[24782] | 110 | :makeJar
|
---|
| 111 | :: All the GLI class files and supporting libraries are put into the "jar" directory
|
---|
[17944] | 112 |
|
---|
| 113 | echo Assuming that Java code is freshly compiled...
|
---|
| 114 |
|
---|
| 115 | if NOT exist jar (
|
---|
| 116 | mkdir jar
|
---|
[24782] | 117 |
|
---|
[29729] | 118 | cd jar
|
---|
[31649] | 119 | "!JARPATH!\jar" xf ..\lib\apache.jar com org javax
|
---|
| 120 | "!JARPATH!\jar" xf ..\lib\jna.jar com
|
---|
[24829] | 121 | "!JARPATH!\jar" xf ..\lib\jna-platform.jar com
|
---|
[25682] | 122 | "!JARPATH!\jar" xf ..\lib\qfslib.jar de
|
---|
[17944] | 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
|
---|
| 128 | if exist jar\org\greenstone (
|
---|
| 129 | rmdir /q /s jar\org\greenstone
|
---|
| 130 | )
|
---|
| 131 | xcopy /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
|
---|
| 134 | set optional=
|
---|
| 135 | if exist collect.zip (
|
---|
| 136 | set optional=%optional% collect.zip
|
---|
| 137 | )
|
---|
| 138 |
|
---|
[18292] | 139 | :: Recreate the metadata.zip file (contains the GLI metadata directory)
|
---|
[17944] | 140 | if exist metadata.zip (
|
---|
| 141 | del /f metadata.zip
|
---|
| 142 | )
|
---|
| 143 | winutil\zip.exe -r metadata.zip metadata >NUL
|
---|
[25947] | 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
|
---|
| 152 | set propfiles=
|
---|
| 153 | for %%G in (classes\*) do (call :concat %%G)
|
---|
| 154 | ::echo Property files list: %propfiles%
|
---|
| 155 | goto :jarcmd
|
---|
| 156 |
|
---|
| 157 | :concat
|
---|
| 158 | set propfiles=%propfiles% %1
|
---|
| 159 | goto :eof
|
---|
| 160 |
|
---|
[17944] | 161 | :jarcmd
|
---|
[29729] | 162 | :: Jar everything up
|
---|
[17944] | 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
|
---|
[25947] | 164 |
|
---|
| 165 | :: include all the properties (and other loose) files in the toplevel classes directory into the GLI.jar
|
---|
[32136] | 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
|
---|
[25947] | 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
|
---|
[32136] | 169 |
|
---|
| 170 | :: Not (yet) included in the new manifest.mf:
|
---|
[25947] | 171 | :: Codebase: http://localhost:8383/greenstone3/applet
|
---|
[17944] | 172 |
|
---|
| 173 | :: Tidy up
|
---|
| 174 | del /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 ----
|
---|
| 180 | if (%1) == (-sign) (
|
---|
| 181 |
|
---|
[24829] | 182 | if not exist appletstore (
|
---|
[17944] | 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 (
|
---|
[24829] | 188 | echo Using jarsigner to make signed jar file ...
|
---|
[17944] | 189 | "!JARPATH!\jarsigner" -keystore appletstore -signedjar SignedGatherer.jar GLI.jar privateKey < appletpasswd >NUL 2>NUL
|
---|
| 190 | echo ... done.
|
---|
[24829] | 191 | ) ELSE (
|
---|
[17944] | 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 |
|
---|
[24829] | 199 | popd
|
---|
| 200 | endlocal
|
---|