Skip to content

Commit 9c75350

Browse files
committed
feat(cli): add sqlite/mysql and local-cache support for script mode and fix config signature
- add --with-sqlite and --with-mysql flags to check and run - add --local-cache support to check - extend Options with database flags - propagate flags to CMake generation - include db flags in script config signature to avoid cache mismatch - keep run and check behavior consistent
1 parent 3a9b3aa commit 9c75350

6 files changed

Lines changed: 37 additions & 6 deletions

File tree

include/vix/cli/commands/check/CheckDetail.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ namespace vix::commands::CheckCommand::detail
8787
/// Enable UBSan only.
8888
bool enableUbsanOnly = false;
8989

90+
/// Enable SQLite backend.
91+
bool withSqlite = false;
92+
93+
/// Enable MySQL backend.
94+
bool withMySql = false;
95+
9096
/** @} */
9197

9298
/**

include/vix/cli/commands/run/RunScriptHelpers.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ namespace vix::commands::RunCommand::detail
3030
bool useVixRuntime,
3131
bool enableSanitizers,
3232
bool enableUbsanOnly,
33-
const std::vector<std::string> &scriptFlags);
33+
const std::vector<std::string> &scriptFlags,
34+
bool withSqlite,
35+
bool withMySql);
3436

3537
void watch_spinner_start(std::string label);
3638
void watch_spinner_stop();

src/commands/check/CheckFlow.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,18 @@ namespace vix::commands::CheckCommand::detail
170170
{
171171
o.tests = true;
172172
}
173+
else if (a == "--with-sqlite")
174+
{
175+
o.withSqlite = true;
176+
}
177+
else if (a == "--with-mysql")
178+
{
179+
o.withMySql = true;
180+
}
181+
else if (a == "--local-cache")
182+
{
183+
o.localCache = true;
184+
}
173185
else if (a == "--build-preset")
174186
{
175187
if (i + 1 < args.size())

src/commands/check/CheckScript.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ namespace vix::commands::CheckCommand::detail
227227
useVixRuntime,
228228
enableSan,
229229
enableUbsanOnly,
230-
/*scriptFlags=*/{});
230+
/*scriptFlags=*/{},
231+
opt.withSqlite,
232+
opt.withMySql);
231233

232234
bool needConfigure = true;
233235
{

src/commands/run/RunScript.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,9 @@ namespace vix::commands::RunCommand::detail
997997
plan.useVixRuntime,
998998
opt.enableSanitizers,
999999
opt.enableUbsanOnly,
1000-
opt.scriptFlags);
1000+
opt.scriptFlags,
1001+
opt.withSqlite,
1002+
opt.withMySql);
10011003

10021004
plan.shouldConfigure = true;
10031005
plan.shouldBuild = true;

src/commands/run/RunScriptHelpers.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,12 @@ namespace vix::commands::RunCommand::detail
141141
bool useVixRuntime,
142142
bool enableSanitizers,
143143
bool enableUbsanOnly,
144-
const std::vector<std::string> &scriptFlags)
144+
const std::vector<std::string> &scriptFlags,
145+
bool withSqlite,
146+
bool withMySql)
145147
{
146148
std::string sig;
147-
sig.reserve(128);
149+
sig.reserve(160);
148150

149151
sig += "useVix=";
150152
sig += useVixRuntime ? "1" : "0";
@@ -155,6 +157,12 @@ namespace vix::commands::RunCommand::detail
155157
sig += ";mode=";
156158
sig += sanitizer_mode_string(enableSanitizers, enableUbsanOnly);
157159

160+
sig += ";sqlite=";
161+
sig += withSqlite ? "1" : "0";
162+
163+
sig += ";mysql=";
164+
sig += withMySql ? "1" : "0";
165+
158166
sig += ";flags=";
159167
for (const auto &f : scriptFlags)
160168
{
@@ -164,7 +172,6 @@ namespace vix::commands::RunCommand::detail
164172

165173
return sig;
166174
}
167-
168175
std::string join_quoted_args_local(const std::vector<std::string> &a)
169176
{
170177
std::string s;

0 commit comments

Comments
 (0)