@@ -26,6 +26,8 @@ set includeDotNet=true
2626:: Width of lines
2727set lineWidth = 70
2828
29+ :: set debug_json_parse=true
30+
2931
3032:: Basic locations
3133
@@ -53,32 +55,41 @@ set thisScriptDirPath=%~dp0
5355pushd %thisScriptDirPath% ..\..
5456set rootDirPath = %cd%
5557popd
56- set sdkDirPath = %rootDirPath% \%srcDir% \%sdkDir%
57- set sdkScriptsDirPath = %sdkDirPath% \Scripts
58-
58+ set sdkPath = %rootDirPath% \%srcDir% \%sdkDir%
59+ set sdkScriptsDirPath = %sdkPath% \Scripts
5960
6061:: Override some values via parameters ::::::::::::::::::::::::::::::::::::::::
6162
6263:param_loop
63- set arg_name = %~1
64- set arg_value = %~2
65- if not " !arg_name! " == " " (
66- if not " !arg_name:--no-color =! " == " !arg_name! " set useColor = false
67- if not " !arg_name:--no-dotnet =! " == " !arg_name! " set includeDotNet = false
68-
69- REM No longer supporting this scenario
70- REM if not "!arg_name:--path-to-setup=!" == "!arg_name!" (
71- REM set setupScriptDirPath=!arg_value!
72- REM shift
73- REM )
74-
75- if not " !arg_name:--verbosity =! " == " !arg_name! " (
76- set verbosity = !arg_value!
77- shift
64+ if " %~1 " == " " goto :end_param_loop
65+ if " %~1 " == " --verbosity" (
66+ set " verbosity = %~2 "
67+ if /i " !verbosity! " neq " loud" if /i " !verbosity! " neq " info" if /i " !verbosity! " neq " quiet" (
68+ set verbosity = quiet
7869 )
70+ shift
71+ shift
72+ goto :param_loop
73+ )
74+ if " %~1 " == " --no-dotnet" (
75+ set includeDotNet = false
76+ shift
77+ goto :param_loop
7978 )
79+ if " %~1 " == " --no-color" (
80+ set useColor = false
81+ shift
82+ goto :param_loop
83+ )
84+ REM No longer supporting this scenario
85+ REM if "%~1"=="--path-to-setup" (
86+ REM set "setupScriptDirPath=%~2"
87+ REM shift
88+ REM shift
89+ REM goto :param_loop
90+ REM )
8091 shift
81- if not " !arg_name! " == " " goto param_loop
92+ : end_param_loop
8293
8394
8495:: The location of directories relative to the root of the solution directory
@@ -104,8 +115,9 @@ call "!sdkScriptsDirPath!\utils.bat" WriteLine
104115
105116if /i " %verbosity% " neq " quiet" (
106117 call " !sdkScriptsDirPath! \utils.bat" WriteLine
107- call " !sdkScriptsDirPath! \utils.bat" WriteLine " rootDirPath = !rootDirPath! " !color_mute!
108- call " !sdkScriptsDirPath! \utils.bat" WriteLine " setupScriptDirPath = !setupScriptDirPath! " !color_mute!
118+ call " !sdkScriptsDirPath! \utils.bat" WriteLine " rootDirPath = !rootDirPath! " !color_mute!
119+ call " !sdkScriptsDirPath! \utils.bat" WriteLine " thisScriptDirPath = !thisScriptDirPath! " !color_mute!
120+ call " !sdkScriptsDirPath! \utils.bat" WriteLine " sdkPath = !sdkPath! " !color_mute!
109121 call " !sdkScriptsDirPath! \utils.bat" WriteLine " sdkScriptsDirPath = !sdkScriptsDirPath! " !color_mute!
110122 call " !sdkScriptsDirPath! \utils.bat" WriteLine " modulesDirPath = !modulesDirPath! " !color_mute!
111123 call " !sdkScriptsDirPath! \utils.bat" WriteLine " externalModulesDirPath = !externalModulesDirPath! " !color_mute!
@@ -116,10 +128,16 @@ if /i "%verbosity%" neq "quiet" (
116128
117129set success = true
118130
119- pushd %sdkDirPath% \Utilities\ParseJSON
131+ pushd " !rootDirPath! \utils\ParseJSON"
132+ cd
120133if not exist ParseJSON.exe (
121- dotnet build /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary -c Release > NUL
122- if exist .\bin\Release\net7.0\ move .\bin\Release\net7.0\* . > nul
134+ if /i " %verbosity% " neq " quiet" (
135+ dotnet build /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary -c Release
136+ if exist .\bin\Release\net7.0\ move .\bin\Release\net7.0\* .
137+ ) else (
138+ dotnet build /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary -c Release > NUL
139+ if exist .\bin\Release\net7.0\ move .\bin\Release\net7.0\* . > nul
140+ )
123141)
124142popd
125143
@@ -131,12 +149,11 @@ for /f "delims=" %%D in ('dir /a:d /b "!modulesDirPath!"') do (
131149 set packageModuleDirName = %%~nxD
132150 set packageModuleDirPath = !modulesDirPath! \!packageModuleDirName!
133151
134- REM Bad assumption: A module's ID is same as the name of folder in which it lives.
135- REM set packageModuleId=!packageModuleDirName!
136-
137152 call " !sdkScriptsDirPath! \utils.bat" GetModuleIdFromModuleSettingsFile " !packageModuleDirPath! \modulesettings.json"
138153 set packageModuleId = !moduleSettingValue!
139154
155+ if /i " %verbosity% " neq " quiet" call " !sdkScriptsDirPath! \utils.bat" WriteLine " Processing !packageModuleDirName! (!packageModuleId! )"
156+
140157 if " !packageModuleId! " neq " " (
141158 call :DoModulePackage " !packageModuleId! " " !packageModuleDirName! " " !packageModuleDirPath! " errors
142159 if " !moduleInstallErrors! " NEQ " " set success = false
@@ -146,14 +163,13 @@ for /f "delims=" %%D in ('dir /a:d /b "!modulesDirPath!"') do (
146163for /f " delims=" %%D in ('dir /a:d /b " !externalModulesDirPath! " ') do (
147164
148165 set packageModuleDirName = %%~nxD
149- set packageModuleDirPath = !modulesDirPath! \!packageModuleDirName!
150-
151- REM Bad assumption: A module's ID is same as the name of folder in which it lives.
152- REM set packageModuleId=!packageModuleDirName!
166+ set packageModuleDirPath = !externalModulesDirPath! \!packageModuleDirName!
153167
154168 call " !sdkScriptsDirPath! \utils.bat" GetModuleIdFromModuleSettingsFile " !packageModuleDirPath! \modulesettings.json"
155169 set packageModuleId = !moduleSettingValue!
156170
171+ if /i " %verbosity% " neq " quiet" call " !sdkScriptsDirPath! \utils.bat" WriteLine " Processing !packageModuleDirName! (!packageModuleId! )"
172+
157173 if " !packageModuleId! " neq " " (
158174 call :DoModulePackage " !packageModuleId! " " !packageModuleDirName! " " !packageModuleDirPath! " errors
159175 if " !moduleInstallErrors! " NEQ " " set success = false
@@ -199,38 +215,38 @@ REM Creates a package for a module
199215 call " !sdkScriptsDirPath! \utils.bat" Write " Preparing !packageModuleId! ..."
200216 call " !sdkScriptsDirPath! \utils.bat" GetValueFromModuleSettingsFile " !packageModuleDirPath! " , " !packageModuleId! " , " Version"
201217 set packageVersion = !moduleSettingsFileValue!
202- )
203218
204- if " !packageVersion! " == " " (
205- call " !sdkScriptsDirPath! \utils.bat" WriteLine " Unable to read version from modulesettings file. Skipping" " Red"
206- ) else if " !doPackage! " == " true " (
219+ if " !packageVersion! " == " " (
220+ call " !sdkScriptsDirPath! \utils.bat" WriteLine " Unable to read version from modulesettings file. Skipping" " Red"
221+ ) else (
207222
208- pushd " !packageModuleDirPath! "
209- if /i " %verbosity% " == " loud" cd
223+ pushd " !packageModuleDirPath! "
224+ if /i " %verbosity% " == " loud" cd
210225
211- rem Create module download package
212- if exist package.bat (
213- call " !sdkScriptsDirPath! \utils.bat" Write " Packaging !packageModuleId! !packageVersion! ..." " White"
214- call package.bat !packageModuleId! !packageVersion!
215- if errorlevel 1 call " !sdkScriptsDirPath! \utils.bat" WriteLine " Error in package.bat for !packageModuleDirName! " " Red"
226+ rem Create module download package
227+ if exist package.bat (
228+ call " !sdkScriptsDirPath! \utils.bat" Write " Packaging !packageModuleId! !packageVersion! ..." " White"
229+ call package.bat !packageModuleId! !packageVersion!
230+ if errorlevel 1 call " !sdkScriptsDirPath! \utils.bat" WriteLine " Error in package.bat for !packageModuleDirName! " " Red"
216231
217- rem Move package into modules download cache
232+ rem Move package into modules download cache
218233
219- rem echo Moving !packageModuleDirPath!\!packageModuleId!-!version!.zip to !downloadDirPath!\!modulesDir!\
220- move /Y !packageModuleDirPath! \!packageModuleId! -!packageVersion! .zip !downloadDirPath! \!modulesDir! \ > NUL
234+ rem echo Moving !packageModuleDirPath!\!packageModuleId!-!version!.zip to !downloadDirPath!\!modulesDir!\
235+ move /Y !packageModuleDirPath! \!packageModuleId! -!packageVersion! .zip !downloadDirPath! \!modulesDir! \ > NUL
221236
222- if errorlevel 1 (
223- call " !sdkScriptsDirPath! \utils.bat" WriteLine " Error" " Red"
224- set success = false
237+ if errorlevel 1 (
238+ call " !sdkScriptsDirPath! \utils.bat" WriteLine " Error" " Red"
239+ set success = false
240+ ) else (
241+ call " !sdkScriptsDirPath! \utils.bat" WriteLine " done" " DarkGreen"
242+ )
225243 ) else (
226- call " !sdkScriptsDirPath! \utils.bat" WriteLine " done " " DarkGreen "
244+ call " !sdkScriptsDirPath! \utils.bat" WriteLine " No package.bat file found... " " Red "
227245 )
228- ) else (
229- call " !sdkScriptsDirPath! \utils.bat" WriteLine " No package.bat file found..." " Red"
230- )
231246
232- popd
233- )
247+ popd
248+ )
249+ )
234250 )
235251
236252 exit /b
0 commit comments