office-gobmx/solenv/bin/cwscheckapi.btm

206 lines
6.5 KiB
Text
Executable file

@echo off
REM **************************************************************************
REM *
REM * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
REM *
REM * Copyright 2000, 2010 Oracle and/or its affiliates.
REM *
REM * OpenOffice.org - a multi-platform office productivity suite
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 *
REM ************************************************************************/
rem echo on
call reportErrorCheckAPI.btm 0 running
iff "%PROEXT" != ".pro" THEN
echo ERROR: cwscheckapi works only on pro-versions >&2
call reportErrorCheckAPI.btm 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
SET USE_INSTALLED_OFFICE=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%" == "-u" (SET USE_INSTALLED_OFFICE=true ^ SET INSTALL=false ^ SET KEEPOFFICE=true ^ 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
call reportErrorCheckAPI.btm 2
quit %?
ENDIFF
ENDIFF
setlocal
IFF %USE_INSTALLED_OFFICE% == "false" then
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
call reportErrorCheckAPI.btm 2
quit 1
ENDIFF
ELSE
SET OFFICEBIN=soffice.exe
echo "Use already installed office."
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
call reportErrorCheckAPI.btm 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
call reportErrorCheckAPI.btm 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%
set EXITVAL=%?
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%
IFF %EXITVAL% NE 0 THEN
call reportErrorCheckAPI.btm 1
ELSE
call reportErrorCheckAPI.btm 0 ok
ENDIFF
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