aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-04-15 23:48:37 +0200
committerdec05eba <dec05eba@protonmail.com>2018-04-15 23:49:27 +0200
commitd9f0e34a8dbbdbfc93162f0297ff9330b86d3c01 (patch)
tree0ed7f22a6c9712c34016f50325432fac654783c1 /backend
parent93abdfacc3814345ada7c756eeed982f6de09732 (diff)
Do not build project twice if project is an executable
and running 'sibs test'
Diffstat (limited to 'backend')
-rw-r--r--backend/ninja/Ninja.cpp15
1 files changed, 1 insertions, 14 deletions
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp
index 814f190..d311110 100644
--- a/backend/ninja/Ninja.cpp
+++ b/backend/ninja/Ninja.cpp
@@ -921,20 +921,7 @@ namespace backend
if(testSourceDirs.empty() || !config.shouldBuildTests())
return Result<bool>::Ok(true);
- // Tests need parent project as dependency. Executables can't be included as dependency so we build it as dynamic library.
- // `build` also builds tests
- if(getNinjaLibraryType(config.getPackageType()) == LibraryType::EXECUTABLE)
- {
- SibsConfig parentProjConfigLib = config;
- parentProjConfigLib.setPackageType(PackageType::DYNAMIC);
- // HACK: We can build a package that is defined as executable and contains main function by redefining `main`
- // as something else.
- // TODO: Do not allow defining `main` in project.conf or as program argument to sibs (when sibs supports defines).
- // It's ok if `define` fails. It could fail if `main` has already been replaced by other tests somehow.
- parentProjConfigLib.define("main", "sibs_lib_ignore_main");
- parentProjConfigLib.define("wmain", "sibs_lib_ignore_wmain");
- return build(parentProjConfigLib, savePath, nullptr, nullptr);
- }
+ assert(getNinjaLibraryType(config.getPackageType()) != LibraryType::EXECUTABLE);
string parentProjectPathUtf8 = toUtf8(config.getProjectPath());
string parentExportIncludeDirs = parentDependencyExportIncludeDirs;