aboutsummaryrefslogtreecommitdiff
path: root/src/GlobalLib.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/GlobalLib.cpp')
-rw-r--r--src/GlobalLib.cpp89
1 files changed, 0 insertions, 89 deletions
diff --git a/src/GlobalLib.cpp b/src/GlobalLib.cpp
index 9ad3d77..8ad1678 100644
--- a/src/GlobalLib.cpp
+++ b/src/GlobalLib.cpp
@@ -7,7 +7,6 @@
#include "../include/Archive.hpp"
#include "../include/CmakeModule.hpp"
#include "../include/Dependency.hpp"
-#include "../include/GitRepository.hpp"
#include "../include/VersionParser.hpp"
using namespace std;
@@ -50,8 +49,6 @@ namespace sibs
// We also need to verify that the archive was removed after extracting it, otherwise the extracted
// package could be corrupted. The archive is only removed after extracting is done.
- // TODO: Find a way to verify that the git repo was cloned fully without interruption, or add .finished files
- // for every download
Result<FileString> libPathResult = getHomeDir();
if (!libPathResult)
@@ -116,38 +113,6 @@ namespace sibs
}
}
}
-
- for(GitDependency *gitDependency : parentConfig.getGitDependencies())
- {
- Result<bool> gitLibLinkerFlagsResult = GlobalLib::getLibsLinkerFlags(parentConfig, globalLibRootDir, gitDependency, staticLinkerFlagCallbackFunc, dynamicLinkerFlagCallbackFunc, globalIncludeDirCallback);
- if(!gitLibLinkerFlagsResult)
- {
- if(gitLibLinkerFlagsResult.getErrorCode() == GlobalLib::DependencyError::DEPENDENCY_NOT_FOUND)
- {
- printf("Dependency %s not found in global lib, trying to download from git\n", gitDependency->name.c_str());
- // 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(gitDependency, parentConfig.platform);
- if(!downloadDependencyResult)
- return downloadDependencyResult;
-
- gitLibLinkerFlagsResult = GlobalLib::getLibsLinkerFlags(parentConfig, globalLibRootDir, gitDependency, staticLinkerFlagCallbackFunc, dynamicLinkerFlagCallbackFunc, globalIncludeDirCallback);
- if(!gitLibLinkerFlagsResult)
- return gitLibLinkerFlagsResult;
- }
- else
- {
- return gitLibLinkerFlagsResult;
- }
- }
- }
return Result<bool>::Ok(true);
}
@@ -191,37 +156,6 @@ namespace sibs
return GlobalLib::getLibsLinkerFlagsCommon(parentConfig, packageDir, name, staticLinkerFlagCallbackFunc, dynamicLinkerFlagCallbackFunc, globalIncludeDirCallback);
}
- Result<bool> GlobalLib::getLibsLinkerFlags(const SibsConfig &parentConfig, const FileString &globalLibRootDir, GitDependency *gitDependency, LinkerFlagCallbackFunc staticLinkerFlagCallbackFunc, LinkerFlagCallbackFunc dynamicLinkerFlagCallbackFunc, GlobalIncludeDirCallbackFunc globalIncludeDirCallback)
- {
- Result<bool> packageExistsResult = validatePackageExists(globalLibRootDir, gitDependency->name);
- if (packageExistsResult.isErr())
- return packageExistsResult;
-
-#if OS_FAMILY == OS_FAMILY_POSIX
- FileString namePlatformNative = gitDependency->name;
- FileString versionPlatformNative = gitDependency->revision;
-#else
- FileString namePlatformNative = utf8To16(gitDependency->name);
- FileString versionPlatformNative = utf8To16(gitDependency->revision);
-#endif
-
- FileString packageDir = globalLibRootDir + TINYDIR_STRING("/");
- packageDir += namePlatformNative;
- packageDir += TINYDIR_STRING("/");
- packageDir += versionPlatformNative;
-
- // TODO: Check path is valid git repository by using git_repository_open_ext
-
- // TODO: Pull if revision == HEAD, fail build if there are conflicts.
- // TODO: When building a sibs project, put a symlink in libs directory.
- // This allows you to have dependency on a project and make changes to it without pushing
- // to remote before the dependant project can see the changes.
- //GitRepository gitRepo;
- //gitRepo.pull(gitDependency, packageDir);
-
- return GlobalLib::getLibsLinkerFlagsCommon(parentConfig, packageDir, gitDependency->name, staticLinkerFlagCallbackFunc, dynamicLinkerFlagCallbackFunc, globalIncludeDirCallback);
- }
-
Result<bool> GlobalLib::getLibsLinkerFlagsCommon(const SibsConfig &parentConfig, const FileString &packageDir, const string &dependencyName, LinkerFlagCallbackFunc staticLinkerFlagCallbackFunc, LinkerFlagCallbackFunc dynamicLinkerFlagCallbackFunc, GlobalIncludeDirCallbackFunc globalIncludeDirCallback)
{
FileString projectConfFilePath = packageDir;
@@ -352,27 +286,4 @@ namespace sibs
#endif
return archiveExtractResult;
}
-
- Result<bool> GlobalLib::downloadDependency(GitDependency *dependency, Platform platform)
- {
- Result<FileString> libPathResult = getHomeDir();
- if (!libPathResult)
- return Result<bool>::Err(libPathResult);
- FileString libPath = libPathResult.unwrap();
- libPath += TINYDIR_STRING("/.cache/sibs/lib/");
- libPath += toFileString(asString(platform));
- libPath += TINYDIR_STRING("/");
- libPath += toFileString(dependency->name);
-
- // We dont care if the directory already exists. Nothing will happen if it does
- Result<bool> createLibDirResult = createDirectoryRecursive(libPath.c_str());
- if(!createLibDirResult)
- return createLibDirResult;
-
- libPath += TINYDIR_STRING("/");
- libPath += toFileString(dependency->revision);
-
- GitRepository gitRepo;
- return gitRepo.clone(dependency, libPath);
- }
}