Skip to content

Commit 08a3465

Browse files
committed
feat(cli): make build run dev and tests workflows generic
1 parent 925569c commit 08a3465

7 files changed

Lines changed: 463 additions & 336 deletions

File tree

src/build/BuildGraphExecutor.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,6 @@ namespace vix::cli::build
387387

388388
task.command = {
389389
"ninja",
390-
"-C",
391-
buildDir.string(),
392390
target};
393391

394392
return task;

src/cmake/CMakeBuild.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -177,20 +177,10 @@ namespace vix::cli::build
177177
if (jobs <= 0)
178178
jobs = default_jobs();
179179

180-
std::string target = opt.buildTarget;
181-
182-
if (target.empty())
183-
{
184-
if (!plan.defaultTargetName.empty())
185-
target = plan.defaultTargetName;
186-
else
187-
target = plan.projectDir.filename().string();
188-
}
189-
190-
if (!target.empty())
180+
if (!opt.buildTarget.empty() && opt.buildTarget != "all")
191181
{
192182
argv.push_back("--target");
193-
argv.push_back(target);
183+
argv.push_back(opt.buildTarget);
194184
}
195185

196186
argv.push_back("--");

src/commands/BuildCommand.cpp

Lines changed: 25 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,43 +1433,11 @@ namespace vix::commands::BuildCommand
14331433
const process::Plan &plan,
14341434
const build::BuildGraphScanResult &scan)
14351435
{
1436-
if (!opt.useCache)
1437-
return false;
1438-
1439-
if (opt.clean)
1440-
return false;
1441-
1442-
if (!opt.targetTriple.empty())
1443-
return false;
1444-
1445-
if (!opt.buildTarget.empty())
1446-
return false;
1447-
1448-
if (!opt.cmakeArgs.empty())
1449-
return false;
1450-
1451-
if (opt.withSqlite || opt.withMySql)
1452-
return false;
1453-
1454-
if (opt.linkStatic)
1455-
return false;
1456-
1457-
if (scan.sources == 0)
1458-
return false;
1459-
1460-
if (scan.sources > 64)
1461-
return false;
1462-
1463-
if (fs::exists(plan.projectDir / "modules"))
1464-
return false;
1465-
1466-
if (fs::exists(plan.projectDir / "examples"))
1467-
return false;
1468-
1469-
if (fs::exists(plan.projectDir / "unittests"))
1470-
return false;
1436+
(void)opt;
1437+
(void)plan;
1438+
(void)scan;
14711439

1472-
return true;
1440+
return false;
14731441
}
14741442

14751443
static fs::path graph_output_binary_path(
@@ -2182,10 +2150,14 @@ namespace vix::commands::BuildCommand
21822150
if (linkCode != 0)
21832151
return linkCode;
21842152

2185-
if (!store_project_target_artifact(projectArtifact, opt, plan) && !opt.quiet)
2186-
build::print_build_warning(
2153+
if (!store_project_target_artifact(projectArtifact, opt, plan) &&
2154+
!opt.quiet &&
2155+
opt.verbose)
2156+
{
2157+
build::print_build_info(
21872158
std::cout,
2188-
"Unable to store target artifact");
2159+
"Artifact cache store skipped");
2160+
}
21892161

21902162
const auto state =
21912163
artifact_cache::ArtifactCache::make_build_state(
@@ -3140,10 +3112,14 @@ namespace vix::commands::BuildCommand
31403112

31413113
if (graphResult.ok)
31423114
{
3143-
if (!store_project_target_artifact(projectArtifact, opt_, plan_) && !opt_.quiet)
3144-
build::print_build_warning(
3115+
if (!store_project_target_artifact(projectArtifact, opt_, plan_) &&
3116+
!opt_.quiet &&
3117+
opt_.verbose)
3118+
{
3119+
build::print_build_info(
31453120
std::cout,
3146-
"Unable to store target artifact");
3121+
"Artifact cache store skipped");
3122+
}
31473123

31483124
std::string lastBinary;
31493125

@@ -3296,11 +3272,14 @@ namespace vix::commands::BuildCommand
32963272
return (r.exitCode == 0) ? 3 : r.exitCode;
32973273
}
32983274

3299-
if (!store_project_target_artifact(projectArtifact, opt_, plan_) && !opt_.quiet)
3300-
build::print_build_warning(
3275+
if (!store_project_target_artifact(projectArtifact, opt_, plan_) &&
3276+
!opt_.quiet &&
3277+
opt_.verbose)
3278+
{
3279+
build::print_build_info(
33013280
std::cout,
3302-
"Unable to store target artifact");
3303-
3281+
"Artifact cache store skipped");
3282+
}
33043283
std::string lastBinary;
33053284

33063285
const auto exeOpt = resolve_main_executable(

0 commit comments

Comments
 (0)