This commit is contained in:
parent
211281fad4
commit
379e5c2028
1 changed files with 13 additions and 10 deletions
|
|
@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
module;
|
||||
#include "../lib/json.hpp"
|
||||
#include <glslang/Public/ShaderLang.h>
|
||||
#include <stdlib.h>
|
||||
module Crafter.Build:Configuration_impl;
|
||||
import :Configuration;
|
||||
import std;
|
||||
|
|
@ -250,7 +251,7 @@ namespace Crafter {
|
|||
if(path.string().ends_with(".git")) {
|
||||
fs::path name = path.filename();
|
||||
name.replace_extension();
|
||||
std::string depFolder = name.string() + "-" + configName;
|
||||
std::string depFolder = name.string();
|
||||
|
||||
// if (it.contains("commit")) {
|
||||
// depFolder += it["commit"].get<std::string>();
|
||||
|
|
@ -258,14 +259,16 @@ namespace Crafter {
|
|||
// depFolder += it["branch"].get<std::string>();
|
||||
// }
|
||||
|
||||
if (!fs::exists(project.buildDir/depFolder)) {
|
||||
fs::create_directories(project.buildDir/depFolder);
|
||||
char self[PATH_MAX];
|
||||
ssize_t count = readlink("/proc/self/exe", self, PATH_MAX);
|
||||
if (count == -1) {
|
||||
throw std::runtime_error("Failed to get executable path");
|
||||
}
|
||||
self[count] = '\0';
|
||||
const fs::path cacheDir = (fs::path(self).parent_path().parent_path() / "cloneCache").string();
|
||||
|
||||
std::string cloneCommand = std::format("cd {} && git clone {} {} && cd {}",
|
||||
project.buildDir.string(),
|
||||
path.string(),
|
||||
depFolder,
|
||||
depFolder);
|
||||
if (!fs::exists(cacheDir/depFolder)) {
|
||||
std::string cloneCommand = std::format("cd {} && git clone {} && cd {}", cacheDir.string(), path.string(), depFolder);
|
||||
|
||||
if (it.contains("branch")) {
|
||||
cloneCommand += std::format(" && git switch {}", it["branch"].get<std::string>());
|
||||
|
|
@ -276,11 +279,11 @@ namespace Crafter {
|
|||
// Execute the clone command
|
||||
system(cloneCommand.c_str());
|
||||
} else if (!it.contains("commit")) {
|
||||
system(std::format("cd {} && git pull", (project.buildDir/depFolder).string()).c_str());
|
||||
system(std::format("cd {} && git pull", (cacheDir/depFolder).string()).c_str());
|
||||
}
|
||||
|
||||
// Update path to the project.json of the dependency
|
||||
path = project.buildDir/ depFolder / "project.json";
|
||||
path = cacheDir / depFolder / "project.json";
|
||||
}
|
||||
|
||||
// Create a Project object for the dependency
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue