1
0
mirror of https://github.com/arkuznetsov/1CFilesConverter.git synced 2024-11-28 08:49:00 +02:00

refactor: Скрипты конвертации конфигурации в формат XML объединены в единый скрипт conf2xml.cmd.

This commit is contained in:
Artem Kuznetsov 2023-07-22 15:57:56 +03:00
parent e205f788ee
commit 85df78f79f
10 changed files with 89 additions and 147 deletions

View File

@ -1,57 +0,0 @@
@ECHO OFF
rem Convert (dump) 1C configuration file (*.cf) to 1C:Designer XML format
rem %1 - path to 1C configuration file (*.cf)
rem %2 - path to folder to save configuration files in 1C:Designer XML format
rem %3 - convertion tool to use:
rem ibcmd - ibcmd tool (default)
rem designer - batch run of 1C:Designer
IF not defined V8_VERSION set V8_VERSION=8.3.20.2290
IF not defined V8_TEMP set V8_TEMP=%TEMP%\1c
set V8_TOOL="C:\Program Files\1cv8\%V8_VERSION%\bin\1cv8.exe"
set IBCMD_TOOL="C:\Program Files\1cv8\%V8_VERSION%\bin\ibcmd.exe"
set IB_PATH=%V8_TEMP%\tmp_db
set CONFIG_FILE=%1
IF defined CONFIG_FILE set CONFIG_FILE=%CONFIG_FILE:"=%
set CONFIG_PATH=%2
IF defined CONFIG_PATH set CONFIG_PATH=%CONFIG_PATH:"=%
set CONV_TOOL=%3
IF defined CONV_TOOL (
set CONV_TOOL=%CONV_TOOL:"=%
) ELSE set CONV_TOOL=ibcmd
IF not defined CONFIG_FILE (
echo Missed parameter 1 "path to 1C configuration file"
exit /b 1
)
IF not defined CONFIG_PATH (
echo Missed parameter 2 "path to folder to save configuration files in 1C:Designer XML format"
exit /b 1
)
echo Clear temporary files...
IF exist "%V8_TEMP%" rd /S /Q "%V8_TEMP%"
md "%V8_TEMP%"
md "%IB_PATH%"
IF exist "%CONFIG_PATH%" rd /S /Q "%CONFIG_PATH%"
md "%CONFIG_PATH%"
echo Creating infobase "%IB_PATH%" from file "%CONFIG_FILE%"...
IF "%CONV_TOOL%" equ "designer" (
%V8_TOOL% CREATEINFOBASE File="%IB_PATH%"; /DisableStartupDialogs /UseTemplate "%CONFIG_FILE%"
) ELSE (
%IBCMD_TOOL% infobase create --db-path="%IB_PATH%" --create-database --load="%CONFIG_FILE%"
)
echo Export configuration from infobase "%IB_PATH%" to 1C:Designer XML format "%CONFIG_PATH%"...
IF "%CONV_TOOL%" equ "designer" (
%V8_TOOL% DESIGNER /IBConnectionString File="%IB_PATH%"; /DisableStartupDialogs /DumpConfigToFiles "%CONFIG_PATH%" -force
) ELSE (
%IBCMD_TOOL% infobase config export --db-path="%IB_PATH%" "%CONFIG_PATH%" --force
)
echo Clear temporary files...
IF exist "%V8_TEMP%" rd /S /Q "%V8_TEMP%"

83
scripts/conf2xml.cmd Normal file
View File

@ -0,0 +1,83 @@
@ECHO OFF
rem Convert (dump) 1C configuration file (*.cf) to 1C:Designer XML format
rem %1 - path to 1C configuration source (1C configuration file (*.cf), infobase or 1C:EDT project)
rem %2 - path to folder to save configuration files in 1C:Designer XML format
rem %3 - convertion tool to use:
rem ibcmd - ibcmd tool (default)
rem designer - batch run of 1C:Designer
IF not defined V8_VERSION set V8_VERSION=8.3.20.2290
IF not defined V8_TEMP set V8_TEMP=%TEMP%\1c
set V8_TOOL="C:\Program Files\1cv8\%V8_VERSION%\bin\1cv8.exe"
set IBCMD_TOOL="C:\Program Files\1cv8\%V8_VERSION%\bin\ibcmd.exe"
set IB_PATH=%V8_TEMP%\tmp_db
set WS_PATH=%V8_TEMP%\edt_ws
set CONFIG_SOURCE=%1
IF defined CONFIG_SOURCE set CONFIG_SOURCE=%CONFIG_SOURCE:"=%
set CONFIG_PATH=%2
IF defined CONFIG_PATH set CONFIG_PATH=%CONFIG_PATH:"=%
set CONV_TOOL=%3
IF defined CONV_TOOL (
set CONV_TOOL=%CONV_TOOL:"=%
) ELSE set CONV_TOOL=ibcmd
IF not defined CONFIG_SOURCE (
echo Missed parameter 1 "path to 1C configuration source (1C configuration file (*.cf), infobase or 1C:EDT project)"
exit /b 1
)
IF not defined CONFIG_PATH (
echo Missed parameter 2 "path to folder to save configuration files in 1C:Designer XML format"
exit /b 1
)
echo Clear temporary files...
IF exist "%V8_TEMP%" rd /S /Q "%V8_TEMP%"
md "%V8_TEMP%"
IF exist "%CONFIG_PATH%" rd /S /Q "%CONFIG_PATH%"
md "%CONFIG_PATH%"
echo Checking configuration source type...
IF /i "%CONFIG_SOURCE:~-3%" equ ".cf" (
md "%IB_PATH%"
echo Creating infobase "%IB_PATH%" from file "%CONFIG_SOURCE%"...
IF "%CONV_TOOL%" equ "designer" (
%V8_TOOL% CREATEINFOBASE File="%IB_PATH%"; /DisableStartupDialogs /UseTemplate "%CONFIG_SOURCE%"
) ELSE (
%IBCMD_TOOL% infobase create --db-path="%IB_PATH%" --create-database --load="%CONFIG_SOURCE%"
)
goto export
)
IF exist "%CONFIG_SOURCE%\DT-INF\" (
echo Export "%EDT_PATH%" to 1C:Designer XML format "%CONFIG_PATH%"...
set WS_PATH=%V8_TEMP%\edt_ws
md "%WS_PATH%"
call %RING_TOOL% edt workspace export --project "%CONFIG_SOURCE%" --configuration-files "%CONFIG_PATH%" --workspace-location "%WS_PATH%"
goto end
)
IF exist "%CONFIG_SOURCE%\1cv8.1cd" (
set IB_PATH=%CONFIG_SOURCE%
goto export
)
echo Error cheking type of configuration "%CONFIG_SOURCE%"!
echo Infobase, configuration file (*.cf) or 1C:EDT project expected.
exit /b 1
:export
echo Export configuration from infobase "%IB_PATH%" to 1C:Designer XML format "%CONFIG_PATH%"...
IF "%CONV_TOOL%" equ "designer" (
%V8_TOOL% DESIGNER /IBConnectionString File="%IB_PATH%"; /DisableStartupDialogs /DumpConfigToFiles "%CONFIG_PATH%" -force
) ELSE (
%IBCMD_TOOL% infobase config export --db-path="%IB_PATH%" "%CONFIG_PATH%" --force
)
:end
echo Clear temporary files...
IF exist "%V8_TEMP%" rd /S /Q "%V8_TEMP%"

View File

@ -1,42 +0,0 @@
@ECHO OFF
rem Convert 1C configuration from 1C:EDT format to 1C:Designer XML format
rem %1 - path to folder contains configuration files in 1C:EDT format
rem %2 - path to folder to save configuration files in 1C:Designer XML format
IF not defined V8_TEMP set V8_TEMP=%TEMP%\1c
FOR /F "usebackq tokens=1 delims=" %%i IN (`where ring`) DO (
set RING_TOOL="%%i"
)
set IB_PATH=%V8_TEMP%\tmp_db
set WS_PATH=%V8_TEMP%\edt_ws
set EDT_PATH=%1
IF defined EDT_PATH set EDT_PATH=%EDT_PATH:"=%
set CONFIG_PATH=%2
IF defined CONFIG_PATH set CONFIG_PATH=%CONFIG_PATH:"=%
IF not defined EDT_PATH (
echo Missed parameter 1 "path to folder contains configuration files in 1C:EDT format"
exit /b 1
)
IF not defined CONFIG_PATH (
echo Missed parameter 2 "path to folder to save configuration files in 1C:Designer XML format"
exit /b 1
)
echo Clear temporary files...
IF exist "%V8_TEMP%" rd /S /Q "%V8_TEMP%"
md "%V8_TEMP%"
md "%IB_PATH%"
md "%WS_PATH%"
IF exist "%CONFIG_PATH%" rd /S /Q "%CONFIG_PATH%"
md "%CONFIG_PATH%"
echo Export "%EDT_PATH%" to 1C:Designer XML format "%CONFIG_PATH%"...
call %RING_TOOL% edt workspace export --project "%EDT_PATH%" --configuration-files "%CONFIG_PATH%" --workspace-location "%WS_PATH%"
echo Clear temporary files...
IF exist "%V8_TEMP%" rd /S /Q "%V8_TEMP%"

View File

@ -1,42 +0,0 @@
@ECHO OFF
rem Save 1C configuration from 1C infobase (file) to files in 1C:Designer XML format
rem %1 - path to folder contains 1C infobase
rem %2 - path to 1C configuration files in 1C:Designer XML format
rem %3 - convertion tool to use:
rem ibcmd - ibcmd tool (default)
rem designer - batch run of 1C:Designer
IF not defined V8_VERSION set V8_VERSION=8.3.20.2290
set V8_TOOL="C:\Program Files\1cv8\%V8_VERSION%\bin\1cv8.exe"
set IBCMD_TOOL="C:\Program Files\1cv8\%V8_VERSION%\bin\ibcmd.exe"
set IB_PATH=%1
IF defined IB_PATH set IB_PATH=%IB_PATH:"=%
set CONFIG_PATH=%2
IF defined CONFIG_PATH set CONFIG_PATH=%CONFIG_PATH:"=%
set CONV_TOOL=%3
IF defined CONV_TOOL (
set CONV_TOOL=%CONV_TOOL:"=%
) ELSE set CONV_TOOL=ibcmd
IF not defined IB_PATH (
echo Missed parameter 1 "path to folder contains 1C infobase"
exit /b 1
)
IF not defined CONFIG_PATH (
echo Missed parameter 2 "path to 1C configuration files in 1C:Designer XML format"
exit /b 1
)
echo Clear temporary files...
IF exist "%CONFIG_PATH%" rd /S /Q "%CONFIG_PATH%"
md "%CONFIG_PATH%"
echo Export configuration from infobase "%IB_PATH%" to 1C:Designer XML format "%CONFIG_PATH%"...
IF "%CONV_TOOL%" equ "designer" (
%V8_TOOL% DESIGNER /IBConnectionString File="%IB_PATH%"; /DisableStartupDialogs /DumpConfigToFiles "%CONFIG_PATH%" -force
) ELSE (
%IBCMD_TOOL% infobase config export --db-path="%IB_PATH%" "%CONFIG_PATH%" --force
)

View File

@ -8,4 +8,4 @@ echo ===
echo Prepare %TEST_COUNT%. ^(%~n0^) %TEST_NAME%
echo ===
call %SCRIPTS_PATH%\ib2xml.cmd "%TEST_IB%" "%TEST_OUT_PATH%"
call %SCRIPTS_PATH%\conf2xml.cmd "%TEST_IB%" "%TEST_OUT_PATH%"

View File

@ -7,4 +7,4 @@ set TEST_CHECK_PATH=%TEST_OUT_PATH%\Configuration.xml
echo ===
echo Test %TEST_COUNT%. ^(%~n0^) %TEST_NAME%
echo ===
call %SCRIPTS_PATH%\cf2xml.cmd "%TEST_BINARY%\1cv8.cf" "%TEST_OUT_PATH%" ibcmd
call %SCRIPTS_PATH%\conf2xml.cmd "%TEST_BINARY%\1cv8.cf" "%TEST_OUT_PATH%" ibcmd

View File

@ -7,4 +7,4 @@ set TEST_CHECK_PATH=%TEST_OUT_PATH%\Configuration.xml
echo ===
echo Test %TEST_COUNT%. ^(%~n0^) %TEST_NAME%
echo ===
call %SCRIPTS_PATH%\cf2xml.cmd "%TEST_BINARY%\1cv8.cf" "%TEST_OUT_PATH%" designer
call %SCRIPTS_PATH%\conf2xml.cmd "%TEST_BINARY%\1cv8.cf" "%TEST_OUT_PATH%" designer

View File

@ -7,4 +7,4 @@ set TEST_CHECK_PATH=%TEST_OUT_PATH%\Configuration.xml
echo ===
echo Test %TEST_COUNT%. ^(%~n0^) %TEST_NAME%
echo ===
call %SCRIPTS_PATH%\ib2xml.cmd "%TEST_IB%" "%TEST_OUT_PATH%" ibcmd
call %SCRIPTS_PATH%\conf2xml.cmd "%TEST_IB%" "%TEST_OUT_PATH%" ibcmd

View File

@ -7,4 +7,4 @@ set TEST_CHECK_PATH=%TEST_OUT_PATH%\Configuration.xml
echo ===
echo Test %TEST_COUNT%. ^(%~n0^) %TEST_NAME%
echo ===
call %SCRIPTS_PATH%\ib2xml.cmd "%TEST_IB%" "%TEST_OUT_PATH%" designer
call %SCRIPTS_PATH%\conf2xml.cmd "%TEST_IB%" "%TEST_OUT_PATH%" designer

View File

@ -7,4 +7,4 @@ set TEST_CHECK_PATH=%TEST_OUT_PATH%\Configuration.xml
echo ===
echo Test %TEST_COUNT%. ^(%~n0^) %TEST_NAME%
echo ===
call %SCRIPTS_PATH%\edt2xml.cmd "%TEST_EDT_CF%" "%TEST_OUT_PATH%" ibcmd
call %SCRIPTS_PATH%\conf2xml.cmd "%TEST_EDT_CF%" "%TEST_OUT_PATH%" ibcmd