-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathicom_checker.bat
180 lines (152 loc) · 5.13 KB
/
icom_checker.bat
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
@echo off
REM start logFile
set logFile=logFile.txt
echo Script started at %date% %time% >> %logFile%
setlocal enabledelayedexpansion
REM need to further streamline, just prompt AC/GC folder. the relative folder to toFGC and toFAC can be hardcoded
:retryFolderAC
set /p buildFolderAC=Choose build folder for AC:
IF NOT EXIST "%buildFolderAC%" (
echo AC Project Folder not found. Please check misspelling.
goto :retryFolderAC
)
:retryFolderGC
set /p buildFolderGC=Choose build folder for GC:
IF NOT EXIST "%buildFolderGC%" (
echo GC Project Folder not found. Please check misspelling.
goto :retryFolderGC
)
set "file_AC=%buildFolderAC%\core\pkg\icom\icom_export.sdh"
set "file_GC=%buildFolderGC%\adapt\gen\tofac\core\pkg\icom\icom_export.sdh"
set "search_word=INTERFACEID"
set "line1="
set "line2="
REM Find the line containing the search word/phrase in AC
for /f "tokens=*" %%a in ('type "%file_AC%" ^| findstr "%search_word%"') do (
set "line1=%%a"
echo "AC: !line1!"
goto :found1
)
:found1
REM Find the line containing the search word/phrase in GC
for /f "tokens=*" %%a in ('type "%file_GC%" ^| find "%search_word%"') do (
set "line2=%%a"
echo "GCToFac: !line2!"
goto :found2
)
:found2
REM Compare the two lines
if not defined line1 (
if not defined line2 (
echo "INTERFACEID" not found in either file.
) else (
echo "INTERFACEID" not found in %file_AC%.
)
) else if not defined line2 (
echo "INTERFACEID" not found in %file_GC%.
) else (
if "!line1!"=="!line2!" (
echo "!line1! == !line2!"
)else(
if "!line3!"=="!line4!" (
echo Lines 3 and 4 are equal.
)
echo Your folders are synced. Congratulations
:retryContinueSync
set /p continueSync=Do you still want to proceed with sync? y/n
if /i "%continueSync%" == "y" (
goto :proceedWithBuild
) else if /i "%continueSync%" == "n" (
echo Script finished at %date% %time%
echo Press any key to continue...
pause > nul
exit /b
) else (
goto :retryContinueSync
)
) else (
echo Your folders are not synced. Proceeding with ICOM build syncing...
timeout /t 2 >nul
echo Please gitclean project folders before running ICOM sync
timeout /t 5
goto :proceedWithBuild
)
)
:proceedWithBuild
REM can be made more streamlined. For now this works as MVP :)
:retryBuildAC
set /p buildAC=Choose build variant for AC:
IF EXIST "%buildFolderAC%\%buildAC%.bat" (
echo You have chosen: %buildAC%.bat
) else (
echo Batch file not found.
echo Your chosen directory: "%buildFolderAC%\%buildAC%.bat"
goto :retryBuildAC
)
:retryBuildGC
set /p buildGC=Choose build variant for GC:
IF EXIST "%buildFolderGC%\%buildGC%.bat" (
echo You have chosen: %buildGC%.bat
) else (
echo Batch file not found.
echo Your chosen directory: "%buildFolderGC%\%buildGC%.bat"
goto :retryBuildGC
)
REM ---------- KIV ----------------
REM set /p ACorGC=Choose which system to run first:
REM find total time required to do whole ICOM sync
REM ---RUN AC BUILD---
echo running AC batch file: %buildAC%
echo "%buildFolderAC%\%buildAC%.bat"
REM enter project folder due to relative path within build batch
pushd %buildFolderAC%
echo Current folder: %CD%
timeout /t 5
CALL "%buildFolderAC%\%buildAC%.bat"
echo SUCCESS: Successfully run AC project build
popd
REM ---COPY AC TO GC FOLDER---
echo copying files from AC to GC
xcopy "%buildFolderAC%\adapt\gen\ToFGC\core\pkg" "%buildFolderGC%\core\pkg" /E /I /H /Y
echo SUCCESS: copied files from AC to GC
timeout /t 2
REM ---RUN GC BUILD---
echo running GC batch file: %buildGC%
echo "%buildFolderGC%\%buildGC%.bat"
REM enter project folder due to relative path within build batch
pushd "%buildFolderGC%"
echo Current folder: %CD%
timeout /t 5
CALL "%buildFolderGC%\%buildGC%.bat"
echo SUCCESS: Successfully run GC project build
popd
REM ---COPY GC TO AC FOLDER---
echo copying files from GC to AC
xcopy "%buildFolderGC%\adapt\gen\tofac\core\pkg" "%buildFolderAC%\core\pkg" /E /I /H /Y
echo SUCCESS: copied files from GC to AC
timeout /t 2
REM ---RUN AC BUILD---
echo running AC batch file: %buildAC%
echo "%buildFolderAC%\%buildAC%.bat"
REM enter project folder due to relative path within build batch
pushd "%buildFolderAC%"
echo Current folder: %CD%
timeout /t 5
CALL "%buildFolderAC%\%buildAC%.bat"
echo SUCCESS: Successfully run AC project build
popd
REM ---AC: GET_PRG, GET_SYM---
echo AC: Running get_prg and get_sym
CALL %buildFolderAC%\tool\integration\tool\deliver\core\get_prg.bat
CALL %buildFolderAC%\tool\integration\tool\deliver\core\get_sym.bat
REM ---GC: GET_PRG, GET_SYM---
echo GC: Running get_prg and get_sym
CALL %buildFolderGC%\tool\integration\tool\deliver\core\get_prg.bat
CALL %buildFolderGC%\tool\integration\tool\deliver\core\get_sym.bat
endlocal
:end
REM end logFile
echo Script finished at %date% %time% >> %logFile%
echo Press any key to continue...
pause > nul
exit /b