aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-01-04 01:01:35 +0100
committerdec05eba <dec05eba@protonmail.com>2018-01-04 01:01:42 +0100
commita548abb5a6a83c9318e9db3cf71170a7610e2758 (patch)
treee8556530f15102054f6175dc7a3438aaaaf8d77e /backend
parente862bb76a2f4c9c293fe2638c7fb034de2af709c (diff)
Use packages list to find packages
Diffstat (limited to 'backend')
-rw-r--r--backend/ninja/Ninja.cpp51
1 files changed, 2 insertions, 49 deletions
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp
index def62fa..1990926 100644
--- a/backend/ninja/Ninja.cpp
+++ b/backend/ninja/Ninja.cpp
@@ -236,20 +236,6 @@ namespace backend
return false;
}
-#if OS_FAMILY == OS_FAMILY_POSIX
- Result<bool> validatePkgConfigPackageVersionExists(const Dependency &dependency)
- {
- Result<bool> dependencyValidationResult = PkgConfig::validatePackageExists(dependency.name);
- if(dependencyValidationResult.isErr())
- return Result<bool>::Err(dependencyValidationResult.getErrMsg());
-
- Result<bool> dependencyVersionValidationResult = PkgConfig::validatePackageVersionAtLeast(dependency.name, dependency.version);
- if(dependencyVersionValidationResult.isErr())
- return Result<bool>::Err(dependencyVersionValidationResult.getErrMsg());
-
- return Result<bool>::Ok(true);
- }
-#endif
// TODO: First check if pkg-config is installed. If it's not, only check dependencies that exists in the dependencies sub directory.
// If pkg-config is installed and dependency is not installed, check in dependencies sub directory.
Result<bool> Ninja::getLinkerFlags(const SibsConfig &config, LinkerFlagCallbackFunc staticLinkerFlagCallbackFunc, LinkerFlagCallbackFunc dynamicLinkerFlagCallback, GlobalIncludeDirCallbackFunc globalIncludeDirCallback) const
@@ -271,7 +257,7 @@ namespace backend
vector<Dependency> pkgConfigDependencies;
for(const Dependency &dependency : dependencies)
{
- Result<bool> pkgConfigDependencyValidation = validatePkgConfigPackageVersionExists(dependency);
+ Result<bool> pkgConfigDependencyValidation = PkgConfig::validatePkgConfigPackageVersionExists(dependency);
if(pkgConfigDependencyValidation.isOk())
{
pkgConfigDependencies.push_back(dependency);
@@ -305,40 +291,7 @@ namespace backend
}
#endif
- for(const Dependency &globalLibDependency : globalLibDependencies)
- {
- printf("Dependency %s is missing from pkg-config, trying global lib\n", globalLibDependency.name.c_str());
- Result<bool> globalLibLinkerFlagsResult = GlobalLib::getLibsLinkerFlags(config, globalLibDir, globalLibDependency.name, globalLibDependency.version, staticLinkerFlagCallbackFunc, dynamicLinkerFlagCallback, globalIncludeDirCallback);
- if(globalLibLinkerFlagsResult.isErr())
- {
- if(globalLibLinkerFlagsResult.getErrorCode() == GlobalLib::DependencyError::DEPENDENCY_NOT_FOUND || globalLibLinkerFlagsResult.getErrorCode() == GlobalLib::DependencyError::DEPENDENCY_VERSION_NO_MATCH)
- {
- printf("Dependency not found in global lib, trying to download from github\n");
- // TODO: Download several dependencies at the same time by adding them to a list
- // and then iterate them and download them all using several threads.
- // All dependecies should be downloaded at the same time, this includes dependencies of dependencies.
- // If a dependency is missing, fail build BEFORE downloading dependencies and before compiling anything.
- // You do not want to possibly wait several minutes only for build to fail when there is no compilation error.
-
- // TODO: If return error is invalid url, then the message should be converted to
- // invalid package name/version. A check should be done if it is the name or version
- // that is invalid.
- Result<bool> downloadDependencyResult = GlobalLib::downloadDependency(globalLibDependency);
- if(downloadDependencyResult.isErr())
- return downloadDependencyResult;
-
- globalLibLinkerFlagsResult = GlobalLib::getLibsLinkerFlags(config, globalLibDir, globalLibDependency.name, globalLibDependency.version, staticLinkerFlagCallbackFunc, dynamicLinkerFlagCallback, globalIncludeDirCallback);
- if(globalLibLinkerFlagsResult.isErr())
- return Result<bool>::Err(globalLibLinkerFlagsResult);
- }
- else
- {
- return Result<bool>::Err(globalLibLinkerFlagsResult);
- }
- }
- }
-
- return Result<bool>::Ok(true);
+ return GlobalLib::getLibs(globalLibDependencies, config, globalLibDir, staticLinkerFlagCallbackFunc, dynamicLinkerFlagCallback, globalIncludeDirCallback);
}
Result<bool> Ninja::build(const SibsConfig &config, const _tinydir_char_t *savePath, LinkerFlagCallbackFunc staticLinkerFlagCallbackFunc, LinkerFlagCallbackFunc dynamicLinkerFlagCallback, GlobalIncludeDirCallbackFunc globalIncludeDirCallback)