summaryrefslogtreecommitdiff
path: root/solenv/bin/cwscheckapi.btm
blob: 96e2dd7c2afcd6a4e6c843de7037b4824bb70a9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
@echo off
REM **************************************************************************
REM * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
REM * 
REM * Copyright 2008 by Sun Microsystems, Inc.
REM *
REM * OpenOffice.org - a multi-platform office productivity suite
REM *
REM * $RCSfile: cwscheckapi.btm,v $
REM *
REM * $Revision: 1.3.6.4 $
REM *
REM * This file is part of OpenOffice.org.
REM *
REM * OpenOffice.org is free software: you can redistribute it and/or modify
REM * it under the terms of the GNU Lesser General Public License version 3
REM * only, as published by the Free Software Foundation.
REM *
REM * OpenOffice.org is distributed in the hope that it will be useful,
REM * but WITHOUT ANY WARRANTY; without even the implied warranty of
REM * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
REM * GNU Lesser General Public License version 3 for more details
REM * (a copy is included in the LICENSE file that accompanied this code).
REM *
REM * You should have received a copy of the GNU Lesser General Public License
REM * version 3 along with OpenOffice.org.  If not, see
REM * <http://www.openoffice.org/license.html>
REM * for a copy of the LGPLv3 License.
REM ************************************************************************/

echo off

iff "%PROEXT" != ".pro" THEN
    echo ERROR: cwscheckapi works only on pro-versions >&2
    quit 1
endiff

SET DEBIG_I=false
SET DEBUG_T=false
SET INSTALL=true
SET ATTACH=true
SET MODULES=auto
SET OOO=false
SET KEEPOFFICE=false

for %opt in (%&%) DO (
    if "%opt%" == "-d" (SET DEBUG_I=true ^ SET DEBUG_T=true ^ shift)
    if "%opt%" == "-o" (SET OOO=true  ^ shift)
    if "%opt%" == "-k" (SET KEEPOFFICE=true  ^ shift)
    if "%opt%" == "-i" (SET DEBUG_I=true  ^ shift)
    if "%opt%" == "-m" (SET MODULES=%2  ^ shift ^ shift)
    if "%opt%" == "-t" (SET DEBUG_T=true ^ shift)
    if "%opt%" == "-s" (SET INSTALL=false ^ shift)
    if "%opt%" == "-a" (SET attach=false ^ shift)
    if "%opt%" == "-h" goto usage
    if "%opt%" == "/h" goto usage
)

set tmppath=not_set
for %LW in (e:\,d:\,c:\) DO (
    iff NOT ISDIR %tmppath% then
        iff ISDIR %LW  then
            iff ISDIR %LW%temp then
                set tmppath=%LW%temp
            elseiff ISDIR %LW%tmp then
                set tmppath=%LW%tmp
            else
                mkdir %LW%temp
                set tmppath=%LW%temp
            endiff
        endiff
    endiff
)

SET CWSCHECKAPIPATH=%tmppath%\%USERNAME%\cwscheckapi
SET LOCALINSTALLDIR=%CWSCHECKAPIPATH%\office
SET LOCALUNPACKDIR=%CWSCHECKAPIPATH%\unpack

iff "%INSTALL%" == "true" THEN
    call perl5 %SOLARENV%/bin/installoffice.pl -cwscheckapi true -dest %LOCALINSTALLDIR% -ooo %OOO% -debug %DEBUG_I%
    
    IFF %? NE 0 THEN
        echo ERROR: coud not install office  >&2
        quit %?
    ENDIFF
ENDIFF

setlocal

SET CWD=%_CWD%
cdd %LOCALINSTALLDIR%
SET ffindtxt="ffind.txt"
ffind /s /f /m soffice.exe > %ffindtxt
SET FindFile=%@FILEOPEN[%ffindtxt%, READ]
SET OfficeBin=%@FILEREAD[%FindFile]
set dummy=%@FILECLOSE[%FindFile]
DEL /q %ffindtxt
cdd %CWD

IFF NOT EXIST %OFFICEBIN% THEN
    echo could not find 'soffice.exe' in subfolders of %OFFICEBIN%  >&2
    quit 1
ENDIFF

SET JARFOLDER=%SOLARVERSION%\%INPATH%\bin%UPDMINOREXT%
SET MYCLASSPATH=%JARFOLDER%\OOoRunner.jar;%JARFOLDER%\ridl.jar;%JARFOLDER%\unoil.jar;%JARFOLDER%\jurt.jar;%JARFOLDER%\juh.jar;%JARFOLDER%\java_uno.jar

IFF "%JAVAI%" != "" THEN
    SET JAVABIN=%JAVAI%
ELSEIFF "%JAVA_HOME%" != "" THEN
    SET JAVABIN=%JAVA_HOME%\bin\java
ELSE
   echo please set environment variable JAVA_HOME  >&2
   quit 1
ENDIFF

IFF "%CWS_WORK_STAMP%" != "" THEN
    SET PARAM=-Version cws_%CWS_WORK_STAMP%
ELSEIFF "%WORK_STAMP%" != "" THEN
    echo ######  >&2
    echo CAUTION! You\'re working on the MWS  >&2
    echo ######  >&2
    SET PARAM=-Version %WORK_STAMP%_%UPDMINOR%
ELSE
    echo ######  >&2
    echo ERROR: could not determine your CWS or MWS version  >&2
    echo ######  >&2
    quit 1
ENDIFF

SET KILLCOMMAND="%SOLARVERSION%\%INPATH%\bin%UPDMINOREXT%\kill.exe -9 soffice.bin^%SOLARVERSION%\%INPATH%\bin%UPDMINOREXT%\kill.exe -9 soffice.exe"

SET PARAM=%PARAM% -cmd '\"%OFFICEBIN%\"  -nofirststartwizard -norestore -nocrashreport -nolockcheck -enableautomation -accept=pipe,name=%USERNAME%;urp;'
SET PARAM=%PARAM% -cs pipe,name=%USERNAME%
SET PARAM=%PARAM% -NoOffice true
SET PARAM=%PARAM% -SRC_ROOT %SRC_ROOT%
SET PARAM=%PARAM% -COMP_ENV %OUTPATH%
SET PARAM=%PARAM% -Shell %COMSPEC%
SET PARAM=%PARAM% -tb java_complex
SET PARAM=%PARAM% -o complex.unoapi.CheckModuleAPI::module(%MODULES%)
SET PARAM=%PARAM% -TimeOut 200000
SET PARAM=%PARAM% -AppKillCommand %KILLCOMMAND%
IF "%ATTACH%" == "false" SET PARAM=%PARAM% -nca true
IF "%DEBUG_T%" == "true" SET PARAM=%PARAM -debug true -log true

set COMMANDO=%JAVABIN% -Xmx120m -cp %MYCLASSPATH% org.openoffice.Runner %PARAM% %&

echo %COMMANDO
SET LOGFILE=%CWSCHECKAPIPATH%\cwscheckapi.log
%COMMANDO |& tee %LOGFILE%

IFF %KEEPOFFICE% == "false" THEN
    echo remove office instrallation in %LOCALINSTALLDIR%...
    DEL /E/F/Q/K/S/X/Y/Z %LOCALINSTALLDIR%
fi

echo .
echo A logfile could be found here: %LOGFILE%

endlocal

quit 0

:usage
    echo. 
    echo Usage: %0% [-m MODULE1[,MODULEn]] [-o] [-k] [-h] [-d] [-i] [-t] [-s] [-a] >&2
    echo. 
    echo [-m] list of modules to test like: '-m "sw,sc,sd"' or '-m all' for all modules >&2
    echo. >&2
    echo [-o] force OpenOffice.org installation instead of StarOffice >&2
    echo. >&2
    echo [-k] keep Office installation, otherwise it will be removed after test >&2
    echo. >&2
    echo [-d] debug installation and UnoAPI-Tests >&2
    echo. >&2
    echo [-i] debug installation >&2
    echo. >&2
    echo [-t] debug UnoAPI-Tests >&2
    echo. >&2
    echo [-s] skip installation of Office >&2
    echo. >&2
    echo [-a] NoCwsAttach: do not attach UnoAPI-Test result to EIS database >&2
    echo. >&2
    echo further informations: http://wiki.services.openoffice.org/wiki/Cwscheckapi >&2
    echo. >&2
   quit 1