diff --git a/VERSION b/VERSION index 8e03717..a73b432 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.1 \ No newline at end of file +1.5.2 \ No newline at end of file diff --git a/examples/conf_ib2xml.cmd b/examples/conf_ib2xml.cmd index cacfed7..fe1ed94 100644 --- a/examples/conf_ib2xml.cmd +++ b/examples/conf_ib2xml.cmd @@ -11,6 +11,8 @@ set RELATIVE_SRC_PATH=src set RELATIVE_SRC_CF_PATH=cf set RELATIVE_SRC_CFE_PATH=cfe +IF not defined V8_TEMP set V8_TEMP=%TEMP%\%~n0 + FOR /F "usebackq tokens=1 delims=" %%i IN (`FORFILES /P "%RELATIVE_REPO_PATH%" /M "%RELATIVE_SRC_PATH%" /C "cmd /c echo @path"`) DO set SRC_PATH=%%i IF not defined SRC_PATH ( echo [ERROR] Path to source files "%RELATIVE_REPO_PATH%\%RELATIVE_SRC_PATH%" not found @@ -57,21 +59,48 @@ echo ====== echo Export main configuration echo ====== -call %REPO_PATH%\tools\1CFilesConverter\scripts\conf2xml.cmd "%V8_CONNECTION_STRING%" "%CONF_PATH%" - -if exist "%REPO_PATH%\.git" ( - set "GIT_COMMAND=git status --short -- "%CONF_PATH%"" - FOR /f "tokens=1,2 delims= " %%a in (' "!GIT_COMMAND!" ') do ( - IF "%%a" equ "D" ( - set PATH_TO_RESTORE=%%b - set PATH_TO_RESTORE=!PATH_TO_RESTORE:/=\! - set RESTORE_FILE=0 - FOR %%i IN (%V8_FILES_TO_KEEP%) DO IF "!PATH_TO_RESTORE!" equ "%RELATIVE_SRC_PATH%\%RELATIVE_SRC_CF_PATH%\%%i" set RESTORE_FILE=1 - IF "!RESTORE_FILE!" equ "1" git checkout HEAD "!PATH_TO_RESTORE!" > nul 2>&1 +set TEMP_CONF_PATH=%V8_TEMP%\src +IF exist "%TEMP_CONF_PATH%" ( + del /f /s /q "%TEMP_CONF_PATH%\*.*" > nul + rd /S /Q "%TEMP_CONF_PATH%" +) +IF not exist "%TEMP_CONF_PATH%" md "%TEMP_CONF_PATH%" + +call %REPO_PATH%\tools\1CFilesConverter\scripts\conf2xml.cmd "%V8_CONNECTION_STRING%" "%TEMP_CONF_PATH%" + +IF ERRORLEVEL == 0 ( + IF exist "%TEMP_CONF_PATH%\ConfigDumpInfo.xml" del /Q /F "%TEMP_CONF_PATH%\ConfigDumpInfo.xml" + + echo [INFO] Clear destination folder: %CONF_PATH% + IF exist "%CONF_PATH%" IF "%V8_CONF_XML_CLEAN_DST%" equ "1" ( + del /f /s /q "%CONF_PATH%\*.*" > nul + rd /S /Q "%CONF_PATH%" + ) + IF not exist "%CONF_PATH%" md "%CONF_PATH%" + + echo [INFO] Moving sources from temporary path "%TEMP_CONF_PATH%" to "%CONF_PATH%" + FOR /f "usebackq delims=" %%f in (`dir /b "%TEMP_CONF_PATH%"`) DO move /Y "%TEMP_CONF_PATH%\%%f" "%CONF_PATH%" > nul + + IF exist "%REPO_PATH%\.git" ( + set "GIT_COMMAND=git status --short -- "%CONF_PATH%"" + FOR /f "tokens=1,2 delims= " %%a in (' "!GIT_COMMAND!" ') do ( + IF "%%a" equ "D" ( + set PATH_TO_RESTORE=%%b + set PATH_TO_RESTORE=!PATH_TO_RESTORE:/=\! + set RESTORE_FILE=0 + FOR %%i IN (%V8_FILES_TO_KEEP%) DO IF "!PATH_TO_RESTORE!" equ "%RELATIVE_SRC_PATH%\%RELATIVE_SRC_CF_PATH%\%%i" set RESTORE_FILE=1 + IF "!RESTORE_FILE!" equ "1" ( + echo [INFO] Restoring special file "!PATH_TO_RESTORE!" + git checkout HEAD "!PATH_TO_RESTORE!" > nul 2>&1 + ) + ) ) ) ) -IF exist "%CONF_PATH%\ConfigDumpInfo.xml" del /Q /F "%CONF_PATH%\ConfigDumpInfo.xml" +IF exist "%TEMP_CONF_PATH%" ( + del /f /s /q "%TEMP_CONF_PATH%\*.*" > nul + rd /S /Q "%TEMP_CONF_PATH%" +) echo FINISH: %date% %time% diff --git a/examples/ext_ib2xml.cmd b/examples/ext_ib2xml.cmd index 8e92050..35b5f3c 100644 --- a/examples/ext_ib2xml.cmd +++ b/examples/ext_ib2xml.cmd @@ -11,6 +11,8 @@ set RELATIVE_SRC_PATH=src set RELATIVE_SRC_CF_PATH=cf set RELATIVE_SRC_CFE_PATH=cfe +IF not defined V8_TEMP set V8_TEMP=%TEMP%\%~n0 + FOR /F "usebackq tokens=1 delims=" %%i IN (`FORFILES /P "%RELATIVE_REPO_PATH%" /M "%RELATIVE_SRC_PATH%" /C "cmd /c echo @path"`) DO set SRC_PATH=%%i IF not defined SRC_PATH ( echo [ERROR] Path to source files "%RELATIVE_REPO_PATH%\%RELATIVE_SRC_PATH%" not found @@ -57,21 +59,48 @@ echo ====== echo Export extension "%V8_EXT_NAME%" echo ====== -call %REPO_PATH%\tools\1CFilesConverter\scripts\ext2xml.cmd "%V8_CONNECTION_STRING%" "%EXT_PATH%\%V8_EXT_NAME%" "%V8_EXT_NAME%" - -if exist "%REPO_PATH%\.git" ( - set "GIT_COMMAND=git status --short -- "%EXT_PATH%\%V8_EXT_NAME%"" - FOR /f "tokens=1,2 delims= " %%a in (' "!GIT_COMMAND!" ') do ( - IF "%%a" equ "D" ( - set PATH_TO_RESTORE=%%b - set PATH_TO_RESTORE=!PATH_TO_RESTORE:/=\! - set RESTORE_FILE=0 - FOR %%i IN (%V8_FILES_TO_KEEP%) DO IF "!PATH_TO_RESTORE!" equ "%RELATIVE_SRC_PATH%\%RELATIVE_SRC_CFE_PATH%\%V8_EXT_NAME%\%%i" set RESTORE_FILE=1 - IF "!RESTORE_FILE!" equ "1" git checkout HEAD "!PATH_TO_RESTORE!" > nul 2>&1 +set TEMP_CONF_PATH=%V8_TEMP%\src +IF exist "%TEMP_CONF_PATH%" ( + del /f /s /q "%TEMP_CONF_PATH%\*.*" > nul + rd /S /Q "%TEMP_CONF_PATH%" +) +IF not exist "%TEMP_CONF_PATH%" md "%TEMP_CONF_PATH%" + +call %REPO_PATH%\tools\1CFilesConverter\scripts\ext2xml.cmd "%V8_CONNECTION_STRING%" "%TEMP_CONF_PATH%" "%V8_EXT_NAME%" + +IF ERRORLEVEL == 0 ( + IF exist "%TEMP_CONF_PATH%\ConfigDumpInfo.xml" del /Q /F "%TEMP_CONF_PATH%\ConfigDumpInfo.xml" + + echo [INFO] Clear destination folder "%EXT_PATH%\%V8_EXT_NAME%" + IF exist "%EXT_PATH%\%V8_EXT_NAME%" IF "%V8_EXT_XML_CLEAN_DST%" equ "1" ( + del /f /s /q "%EXT_PATH%\%V8_EXT_NAME%\*.*" > nul + rd /S /Q "%EXT_PATH%\%V8_EXT_NAME%" + ) + IF not exist "%EXT_PATH%\%V8_EXT_NAME%" md "%EXT_PATH%\%V8_EXT_NAME%" + + echo [INFO] Moving sources from temporary path "%TEMP_CONF_PATH%" to "%EXT_PATH%\%V8_EXT_NAME%" + FOR /f "usebackq delims=" %%f in (`dir /b "%TEMP_CONF_PATH%"`) DO move /Y "%TEMP_CONF_PATH%\%%f" "%EXT_PATH%\%V8_EXT_NAME%" > nul + + IF exist "%REPO_PATH%\.git" ( + set "GIT_COMMAND=git status --short -- "%EXT_PATH%\%V8_EXT_NAME%"" + FOR /f "tokens=1,2 delims= " %%a in (' "!GIT_COMMAND!" ') do ( + IF "%%a" equ "D" ( + set PATH_TO_RESTORE=%%b + set PATH_TO_RESTORE=!PATH_TO_RESTORE:/=\! + set RESTORE_FILE=0 + FOR %%i IN (%V8_FILES_TO_KEEP%) DO IF "!PATH_TO_RESTORE!" equ "%RELATIVE_SRC_PATH%\%RELATIVE_SRC_CFE_PATH%\%V8_EXT_NAME%\%%i" set RESTORE_FILE=1 + IF "!RESTORE_FILE!" equ "1" ( + echo [INFO] Restoring special file "!PATH_TO_RESTORE!" + git checkout HEAD "!PATH_TO_RESTORE!" > nul 2>&1 + ) + ) ) ) ) -IF exist "%EXT_PATH%\%%j\ConfigDumpInfo.xml" del /Q /F "%EXT_PATH%\%V8_EXT_NAME%\ConfigDumpInfo.xml" +IF exist "%TEMP_CONF_PATH%" ( + del /f /s /q "%TEMP_CONF_PATH%\*.*" > nul + rd /S /Q "%TEMP_CONF_PATH%" +) echo FINISH: %date% %time% diff --git a/examples/ib2xml.cmd b/examples/ib2xml.cmd index 265f310..39cef11 100644 --- a/examples/ib2xml.cmd +++ b/examples/ib2xml.cmd @@ -11,6 +11,8 @@ set RELATIVE_SRC_PATH=src set RELATIVE_SRC_CF_PATH=cf set RELATIVE_SRC_CFE_PATH=cfe +IF not defined V8_TEMP set V8_TEMP=%TEMP%\%~n0 + FOR /F "usebackq tokens=1 delims=" %%i IN (`FORFILES /P "%RELATIVE_REPO_PATH%" /M "%RELATIVE_SRC_PATH%" /C "cmd /c echo @path"`) DO set SRC_PATH=%%i IF not defined SRC_PATH ( echo [ERROR] Path to source files "%RELATIVE_REPO_PATH%\%RELATIVE_SRC_PATH%" not found @@ -70,23 +72,45 @@ echo ====== echo Export main configuration echo ====== -call %REPO_PATH%\tools\1CFilesConverter\scripts\conf2xml.cmd "%V8_CONNECTION_STRING%" "%CONF_PATH%" - -if exist "%REPO_PATH%\.git" ( - set "GIT_COMMAND=git status --short -- "%CONF_PATH%"" - FOR /f "tokens=1,2 delims= " %%a in (' "!GIT_COMMAND!" ') do ( - IF "%%a" equ "D" ( - set PATH_TO_RESTORE=%%b - set PATH_TO_RESTORE=!PATH_TO_RESTORE:/=\! - set RESTORE_FILE=0 - FOR %%i IN (%V8_FILES_TO_KEEP%) DO IF "!PATH_TO_RESTORE!" equ "%RELATIVE_SRC_PATH%\%RELATIVE_SRC_CF_PATH%\%%i" set RESTORE_FILE=1 - IF "!RESTORE_FILE!" equ "1" git checkout HEAD "!PATH_TO_RESTORE!" > nul 2>&1 +set TEMP_CONF_PATH=%V8_TEMP%\src +IF exist "%TEMP_CONF_PATH%" ( + del /f /s /q "%TEMP_CONF_PATH%\*.*" > nul + rd /S /Q "%TEMP_CONF_PATH%" +) +IF not exist "%TEMP_CONF_PATH%" md "%TEMP_CONF_PATH%" + +call %REPO_PATH%\tools\1CFilesConverter\scripts\conf2xml.cmd "%V8_CONNECTION_STRING%" "%TEMP_CONF_PATH%" + +IF ERRORLEVEL == 0 ( + IF exist "%TEMP_CONF_PATH%\ConfigDumpInfo.xml" del /Q /F "%TEMP_CONF_PATH%\ConfigDumpInfo.xml" + + echo [INFO] Clear destination folder: %CONF_PATH% + IF exist "%CONF_PATH%" IF "%V8_CONF_XML_CLEAN_DST%" equ "1" ( + del /f /s /q "%CONF_PATH%\*.*" > nul + rd /S /Q "%CONF_PATH%" + ) + IF not exist "%CONF_PATH%" md "%CONF_PATH%" + + echo [INFO] Moving sources from temporary path "%TEMP_CONF_PATH%" to "%CONF_PATH%" + FOR /f "usebackq delims=" %%f in (`dir /b "%TEMP_CONF_PATH%"`) DO move /Y "%TEMP_CONF_PATH%\%%f" "%CONF_PATH%" > nul + + IF exist "%REPO_PATH%\.git" ( + set "GIT_COMMAND=git status --short -- "%CONF_PATH%"" + FOR /f "tokens=1,2 delims= " %%a in (' "!GIT_COMMAND!" ') do ( + IF "%%a" equ "D" ( + set PATH_TO_RESTORE=%%b + set PATH_TO_RESTORE=!PATH_TO_RESTORE:/=\! + set RESTORE_FILE=0 + FOR %%i IN (%V8_FILES_TO_KEEP%) DO IF "!PATH_TO_RESTORE!" equ "%RELATIVE_SRC_PATH%\%RELATIVE_SRC_CF_PATH%\%%i" set RESTORE_FILE=1 + IF "!RESTORE_FILE!" equ "1" ( + echo [INFO] Restoring special file "!PATH_TO_RESTORE!" + git checkout HEAD "!PATH_TO_RESTORE!" > nul 2>&1 + ) + ) ) ) ) -IF exist "%CONF_PATH%\ConfigDumpInfo.xml" del /Q /F "%CONF_PATH%\ConfigDumpInfo.xml" - FOR %%j IN (%V8_EXTENSIONS%) DO ( set EXT_NAME=%%j @@ -95,22 +119,48 @@ FOR %%j IN (%V8_EXTENSIONS%) DO ( echo Export extension "!EXT_NAME!" echo ====== - call %REPO_PATH%\tools\1CFilesConverter\scripts\ext2xml.cmd "%V8_CONNECTION_STRING%" "%EXT_PATH%\!EXT_NAME!" "!EXT_NAME!" + IF exist "%TEMP_CONF_PATH%" ( + del /f /s /q "%TEMP_CONF_PATH%\*.*" > nul + rd /S /Q "%TEMP_CONF_PATH%" + ) + IF not exist "%TEMP_CONF_PATH%" md "%TEMP_CONF_PATH%" + + call %REPO_PATH%\tools\1CFilesConverter\scripts\ext2xml.cmd "%V8_CONNECTION_STRING%" "%TEMP_CONF_PATH%" "!EXT_NAME!" - if exist "%REPO_PATH%\.git" ( - set "GIT_COMMAND=git status --short -- "%EXT_PATH%\!EXT_NAME!"" - FOR /f "tokens=1,2 delims= " %%a in (' "!GIT_COMMAND!" ') do ( - IF "%%a" equ "D" ( - set PATH_TO_RESTORE=%%b - set PATH_TO_RESTORE=!PATH_TO_RESTORE:/=\! - set RESTORE_FILE=0 - FOR %%i IN (%V8_FILES_TO_KEEP%) DO IF "!PATH_TO_RESTORE!" equ "%RELATIVE_SRC_PATH%\%RELATIVE_SRC_CFE_PATH%\!EXT_NAME!\%%i" set RESTORE_FILE=1 - IF "!RESTORE_FILE!" equ "1" git checkout HEAD "!PATH_TO_RESTORE!" > nul 2>&1 + IF ERRORLEVEL == 0 ( + IF exist "%TEMP_CONF_PATH%\ConfigDumpInfo.xml" del /Q /F "%TEMP_CONF_PATH%\ConfigDumpInfo.xml" + + echo [INFO] Clear destination folder "%EXT_PATH%\!EXT_NAME!" + IF exist "%EXT_PATH%\!EXT_NAME!" IF "%V8_EXT_XML_CLEAN_DST%" equ "1" ( + del /f /s /q "%EXT_PATH%\!EXT_NAME!\*.*" > nul + rd /S /Q "%EXT_PATH%\!EXT_NAME!" + ) + IF not exist "%EXT_PATH%\!EXT_NAME!" md "%EXT_PATH%\!EXT_NAME!" + + echo [INFO] Moving sources from temporary path "%TEMP_CONF_PATH%" to "%EXT_PATH%\!EXT_NAME!" + FOR /f "usebackq delims=" %%f in (`dir /b "%TEMP_CONF_PATH%"`) DO move /Y "%TEMP_CONF_PATH%\%%f" "%EXT_PATH%\!EXT_NAME!%" > nul + + IF exist "%REPO_PATH%\.git" ( + set "GIT_COMMAND=git status --short -- "%EXT_PATH%\!EXT_NAME!"" + FOR /f "tokens=1,2 delims= " %%a in (' "!GIT_COMMAND!" ') do ( + IF "%%a" equ "D" ( + set PATH_TO_RESTORE=%%b + set PATH_TO_RESTORE=!PATH_TO_RESTORE:/=\! + set RESTORE_FILE=0 + FOR %%i IN (%V8_FILES_TO_KEEP%) DO IF "!PATH_TO_RESTORE!" equ "%RELATIVE_SRC_PATH%\%RELATIVE_SRC_CFE_PATH%\!EXT_NAME!\%%i" set RESTORE_FILE=1 + IF "!RESTORE_FILE!" equ "1" ( + echo [INFO] Restoring special file "!PATH_TO_RESTORE!" + git checkout HEAD "!PATH_TO_RESTORE!" > nul 2>&1 + ) + ) ) ) ) +) - IF exist "%EXT_PATH%\!EXT_NAME!\ConfigDumpInfo.xml" del /Q /F "%EXT_PATH%\!EXT_NAME!\ConfigDumpInfo.xml" +IF exist "%TEMP_CONF_PATH%" ( + del /f /s /q "%TEMP_CONF_PATH%\*.*" > nul + rd /S /Q "%TEMP_CONF_PATH%" ) echo FINISH: %date% %time% diff --git a/scripts/edt-validate.cmd b/scripts/edt-validate.cmd index 3a22aa5..09f978f 100644 --- a/scripts/edt-validate.cmd +++ b/scripts/edt-validate.cmd @@ -95,7 +95,7 @@ IF /i "%V8_SRC_PATH:~-4%" equ ".cfe" ( goto validate ) IF exist "%V8_SRC_PATH%\Configuration.xml" ( - FOR /F "delims=" %%t IN ('findstr /r /i "" "%V8_SRC_PATH%\Configuration.xml"') DO ( + FOR /F "delims=" %%t IN ('find /i "" "%V8_SRC_PATH%\Configuration.xml"') DO ( call %~dp0ext2edt.cmd "%V8_SRC_PATH%" "%VALIDATE_PATH%" goto validate ) diff --git a/scripts/ext2cfe.cmd b/scripts/ext2cfe.cmd index 74d5054..45417d2 100644 --- a/scripts/ext2cfe.cmd +++ b/scripts/ext2cfe.cmd @@ -105,7 +105,7 @@ echo [INFO] Checking 1C extension source type... IF exist "%V8_SRC_PATH%\DT-INF\" ( IF exist "%V8_SRC_PATH%\src\Configuration\Configuration.mdo" ( - FOR /F "delims=" %%t IN ('findstr /r /i "" "%V8_SRC_PATH%\src\Configuration\Configuration.mdo"') DO ( + FOR /F "delims=" %%t IN ('find /i "" "%V8_SRC_PATH%\src\Configuration\Configuration.mdo"') DO ( echo [INFO] Source type: 1C:EDT project md "%XML_PATH%" md "%WS_PATH%" @@ -115,7 +115,7 @@ IF exist "%V8_SRC_PATH%\DT-INF\" ( ) ) IF exist "%V8_SRC_PATH%\Configuration.xml" ( - FOR /F "delims=" %%t IN ('findstr /r /i "" "%V8_SRC_PATH%\Configuration.xml"') DO ( + FOR /F "delims=" %%t IN ('find /i "" "%V8_SRC_PATH%\Configuration.xml"') DO ( echo [INFO] Source type: 1C:Designer XML files set XML_PATH=%V8_SRC_PATH% set V8_SRC_TYPE=xml diff --git a/scripts/ext2edt.cmd b/scripts/ext2edt.cmd index 5b3aa7e..0784c0b 100644 --- a/scripts/ext2edt.cmd +++ b/scripts/ext2edt.cmd @@ -111,7 +111,7 @@ IF /i "%V8_SRC_PATH:~-4%" equ ".cfe" ( goto base_ib ) IF exist "%V8_SRC_PATH%\Configuration.xml" ( - FOR /F "delims=" %%t IN ('findstr /r /i "" "%V8_SRC_PATH%\Configuration.xml"') DO ( + FOR /F "delims=" %%t IN ('find /i "" "%V8_SRC_PATH%\Configuration.xml"') DO ( echo [INFO] Source type: 1C:Designer XML files set XML_PATH=%V8_SRC_PATH% set V8_SRC_TYPE=xml diff --git a/scripts/ext2ib.cmd b/scripts/ext2ib.cmd index fa4e69b..6f01ba8 100644 --- a/scripts/ext2ib.cmd +++ b/scripts/ext2ib.cmd @@ -144,7 +144,7 @@ echo [INFO] Checking 1C extension source type... IF exist "%V8_SRC_PATH%\DT-INF\" ( IF exist "%V8_SRC_PATH%\src\Configuration\Configuration.mdo" ( - FOR /F "delims=" %%t IN ('findstr /r /i "" "%V8_SRC_PATH%\src\Configuration\Configuration.mdo"') DO ( + FOR /F "delims=" %%t IN ('find /i "" "%V8_SRC_PATH%\src\Configuration\Configuration.mdo"') DO ( echo [INFO] Source type: 1C:EDT project md "%XML_PATH%" md "%WS_PATH%" @@ -153,7 +153,7 @@ IF exist "%V8_SRC_PATH%\DT-INF\" ( ) ) IF exist "%V8_SRC_PATH%\Configuration.xml" ( - FOR /F "delims=" %%t IN ('findstr /r /i "" "%V8_SRC_PATH%\Configuration.xml"') DO ( + FOR /F "delims=" %%t IN ('find /i "" "%V8_SRC_PATH%\Configuration.xml"') DO ( echo [INFO] Source type: 1C:Designer XML files set XML_PATH=%V8_SRC_PATH% goto export_xml diff --git a/scripts/ext2xml.cmd b/scripts/ext2xml.cmd index 4d8eae8..d383c37 100644 --- a/scripts/ext2xml.cmd +++ b/scripts/ext2xml.cmd @@ -111,7 +111,7 @@ IF /i "%V8_SRC_PATH:~-4%" equ ".cfe" ( ) IF exist "%V8_SRC_PATH%\DT-INF\" ( IF exist "%V8_SRC_PATH%\src\Configuration\Configuration.mdo" ( - FOR /F "delims=" %%t IN ('findstr /r /i "" "%V8_SRC_PATH%\src\Configuration\Configuration.mdo"') DO ( + FOR /F "delims=" %%t IN ('find /i "" "%V8_SRC_PATH%\src\Configuration\Configuration.mdo"') DO ( echo [INFO] Source type: 1C:EDT project set V8_SRC_TYPE=edt goto base_ib