From 1a6c67af3851748a0a604e3b3e99bd63f3f576a0 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 3 Nov 2020 06:11:09 +0100 Subject: Remove ability to use git projects as dependencies. Users can add them as git submodules instead --- src/GlobalLib.cpp | 89 ------------------------------------------------------- 1 file changed, 89 deletions(-) (limited to 'src/GlobalLib.cpp') 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 libPathResult = getHomeDir(); if (!libPathResult) @@ -116,38 +113,6 @@ namespace sibs } } } - - for(GitDependency *gitDependency : parentConfig.getGitDependencies()) - { - Result 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 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::Ok(true); } @@ -191,37 +156,6 @@ namespace sibs return GlobalLib::getLibsLinkerFlagsCommon(parentConfig, packageDir, name, staticLinkerFlagCallbackFunc, dynamicLinkerFlagCallbackFunc, globalIncludeDirCallback); } - Result GlobalLib::getLibsLinkerFlags(const SibsConfig &parentConfig, const FileString &globalLibRootDir, GitDependency *gitDependency, LinkerFlagCallbackFunc staticLinkerFlagCallbackFunc, LinkerFlagCallbackFunc dynamicLinkerFlagCallbackFunc, GlobalIncludeDirCallbackFunc globalIncludeDirCallback) - { - Result 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 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 GlobalLib::downloadDependency(GitDependency *dependency, Platform platform) - { - Result libPathResult = getHomeDir(); - if (!libPathResult) - return Result::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 createLibDirResult = createDirectoryRecursive(libPath.c_str()); - if(!createLibDirResult) - return createLibDirResult; - - libPath += TINYDIR_STRING("/"); - libPath += toFileString(dependency->revision); - - GitRepository gitRepo; - return gitRepo.clone(dependency, libPath); - } } -- cgit v1.2.3