@@ -16,36 +16,45 @@ set verbosity=quiet
1616:: Show output in wild, crazy colours
1717set useColor = true
1818
19+ :: Whether or not to use the jq utility for JSON parsing
20+ set useJq = false
21+
1922:: Set this to false (or call script with --no-dotnet) to exclude .NET packages
2023:: This saves time to allow for quick packaging of the easier, non-compiled modules
2124set includeDotNet = true
2225
23- :: Basic locations
24-
25- :: The path to the directory containing the setup script. Will end in "\"
26- set setupScriptDirPath = %~dp0
26+ :: Width of lines
27+ set lineWidth = 70
2728
28- :: The path to the application root dir. This is 'src' in dev, or / in production
29- :: This setup script always lives in the app root
30- set appRootDirPath = !setupScriptDirPath!
3129
32- :: The name of the source directory
33- set srcDirName = src
30+ :: Basic locations
3431
3532:: The name of the dir, within the current directory, where install assets will
3633:: be downloaded
3734set downloadDir = downloads
3835
36+ :: The name of the dir holding the source code
37+ set srcDir = src
38+
39+ :: The name of the dir holding the SDK
40+ set sdkDir = SDK
41+
3942:: The name of the dir holding the downloaded/sideloaded modules
4043set modulesDir = modules
4144
4245:: The name of the dir holding the external modules
4346set externalModulesDir = CodeProject.AI-Modules
4447
45- set sdkPath = !appRootDirPath! SDK
4648
47- :: Whether or not to use the jq utility for JSON parsing
48- set useJq = false
49+ :: The path to the directory containing this script. Will end in "\"
50+ set thisScriptDirPath = %~dp0
51+
52+ :: We're assuming this script lives in /devops/build
53+ pushd %thisScriptDirPath% ..\..
54+ set rootDirPath = %cd%
55+ popd
56+ set sdkDirPath = %rootDirPath% \%srcDir% \%sdkDir%
57+ set sdkScriptsDirPath = %sdkDirPath% \Scripts
4958
5059
5160:: Override some values via parameters ::::::::::::::::::::::::::::::::::::::::
@@ -56,10 +65,13 @@ set useJq=false
5665 if not " !arg_name! " == " " (
5766 if not " !arg_name:--no-color =! " == " !arg_name! " set useColor = false
5867 if not " !arg_name:--no-dotnet =! " == " !arg_name! " set includeDotNet = false
59- if not " !arg_name:--path-to-setup =! " == " !arg_name! " (
60- set setupScriptDirPath = !arg_value!
61- shift
62- )
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+
6375 if not " !arg_name:--verbosity =! " == " !arg_name! " (
6476 set verbosity = !arg_value!
6577 shift
@@ -69,58 +81,18 @@ set useJq=false
6981if not " !arg_name! " == " " goto param_loop
7082
7183
72- :: This can be x86 (32-bit), AMD64 (Intel/AMD 64bit), ARM64 (Arm 64bit)
73- set architecture = %PROCESSOR_ARCHITECTURE%
74-
75- :: A NOTE ON PLATFORM.
76- :: We use the full "x86_64" for architecture, but follow the common convention
77- :: of abbreviating this to "x64" when used in conjuntion with OS. So windows-x64
78- :: rather than windows-x86_64. To simplify further, if the platform value doesn't
79- :: have a suffix then it's assumed to be -x64. This may change in the future.
80- if /i " !architecture! " == " amd64" set architecture = x86_64
81- if /i " !architecture! " == " ARM64" set architecture = arm64
82-
83- :: In Development, this script is in the /src folder. In Production there is no
84- :: /src folder; everything is in the root folder. So: go to the folder
85- :: containing this script and check the name of the parent folder to see if
86- :: we're in dev or production.
87- pushd " !setupScriptDirPath! "
88- for /f " delims=\" %%a in (" %cd% " ) do @ set setupScriptDirName = %%~nxa
89- popd
90-
91- set executionEnvironment = Production
92- if /i " %setupScriptDirName% " == " %srcDirName% " set executionEnvironment = Development
93-
94- :: The absolute path to the setup script and the root directory. Note that
95- :: this script (and the SDK folder) is either in the /src dir or the root dir
96- pushd " !setupScriptDirPath! "
97- set sdkScriptsDirPath = %cd% \SDK\Scripts
98- if /i " %executionEnvironment% " == " Development" cd ..
99- set rootDirPath = %cd%
100- popd
101-
102- set appRootDirPath = !setupScriptDirPath!
103-
104- :: Platform can define where things are located :::::::::::::::::::::::::::::::
105-
10684:: The location of directories relative to the root of the solution directory
107- set modulesDirPath = !appRootDirPath! !modulesDir!
108- set externalModulesDirPath = !appRootDirPath ! \..\!externalModulesDir!
109- set downloadDirPath = !appRootDirPath! !downloadDir!
85+ set modulesDirPath = !rootDirPath! \ %srcDir% \ !modulesDir!
86+ set externalModulesDirPath = !rootDirPath ! \..\!externalModulesDir!
87+ set downloadDirPath = !rootDirPath! \ !downloadDir!
11088
11189:: Let's go
11290if /i " !useColor! " == " true" call " !sdkScriptsDirPath! \utils.bat" setESC
113- if /i " !executionEnvironment! " == " Development" (
114- set scriptTitle = Creating CodeProject.AI Module Downloads
115- ) else (
116- writeLine " Can't run in Production. Exiting" " Red"
117- goto :eof
118- )
11991
12092set lineWidth = 70
12193
12294call " !sdkScriptsDirPath! \utils.bat" WriteLine
123- call " !sdkScriptsDirPath! \utils.bat" WriteLine " !scriptTitle! " " DarkYellow" " Default" !lineWidth!
95+ call " !sdkScriptsDirPath! \utils.bat" WriteLine " Creating CodeProject.AI Module Downloads " " DarkYellow" " Default" !lineWidth!
12496call " !sdkScriptsDirPath! \utils.bat" WriteLine
12597call " !sdkScriptsDirPath! \utils.bat" WriteLine " ========================================================================" " DarkGreen"
12698call " !sdkScriptsDirPath! \utils.bat" WriteLine
@@ -132,8 +104,7 @@ call "!sdkScriptsDirPath!\utils.bat" WriteLine
132104
133105if /i " %verbosity% " neq " quiet" (
134106 call " !sdkScriptsDirPath! \utils.bat" WriteLine
135- call " !sdkScriptsDirPath! \utils.bat" WriteLine " executionEnvironment = !executionEnvironment! " !color_mute!
136- call " !sdkScriptsDirPath! \utils.bat" WriteLine " appRootDirPath = !appRootDirPath! " !color_mute!
107+ call " !sdkScriptsDirPath! \utils.bat" WriteLine " rootDirPath = !rootDirPath! " !color_mute!
137108 call " !sdkScriptsDirPath! \utils.bat" WriteLine " setupScriptDirPath = !setupScriptDirPath! " !color_mute!
138109 call " !sdkScriptsDirPath! \utils.bat" WriteLine " sdkScriptsDirPath = !sdkScriptsDirPath! " !color_mute!
139110 call " !sdkScriptsDirPath! \utils.bat" WriteLine " modulesDirPath = !modulesDirPath! " !color_mute!
@@ -145,7 +116,7 @@ if /i "%verbosity%" neq "quiet" (
145116
146117set success = true
147118
148- pushd SDK \Utilities\ParseJSON
119+ pushd %sdkDirPath% \Utilities\ParseJSON
149120if not exist ParseJSON.exe (
150121 dotnet build /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary -c Release > NUL
151122 if exist .\bin\Release\net7.0\ move .\bin\Release\net7.0\* . > nul
0 commit comments