From defbc079cdd40cde7c165a22e76cb786115c4125 Mon Sep 17 00:00:00 2001 From: "David J. Allen" Date: Sun, 14 Jul 2024 21:26:43 -0600 Subject: [PATCH 1/8] Initial SConstruct build script --- SConstruct | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 SConstruct diff --git a/SConstruct b/SConstruct new file mode 100644 index 0000000..deadc3b --- /dev/null +++ b/SConstruct @@ -0,0 +1,24 @@ + +# set up variables and glob files +env = Environment( + CPPPATH = Glob('include/*.hpp'), + CPPDEFINES = [], + LIBS = [] +) +base_name = "gdpm" +include_files = Glob('include/*.hpp') +source_files = Glob('src/*.cpp') +test_files = Glob('tests/*.cpp') + +# build the main executable and tests +env.Program(f'{base_name}', source_files) +env.Program(f'{base_name}.tests', test_files) + +# build the static library +StaticLibrary(f'{base_name}-static') + +# build the shared libraries +SharedLibrary(f'{base_name}-shared') +SharedLibrary(f'{base_name}-static') +SharedLibrary(f'{base_name}-http') +SharedLibrary(f'{base_name}-restapi') From adb80a7176deb715448c7f5a2ea827ff5173b018 Mon Sep 17 00:00:00 2001 From: "David J. Allen" Date: Sat, 17 Aug 2024 21:28:02 -0600 Subject: [PATCH 2/8] Added initial SConstruct --- SConstruct | 1 + 1 file changed, 1 insertion(+) diff --git a/SConstruct b/SConstruct index deadc3b..7dac6ec 100644 --- a/SConstruct +++ b/SConstruct @@ -9,6 +9,7 @@ base_name = "gdpm" include_files = Glob('include/*.hpp') source_files = Glob('src/*.cpp') test_files = Glob('tests/*.cpp') +compile_flags = "" # build the main executable and tests env.Program(f'{base_name}', source_files) From 6199486b6894785e301870c7e8db5a5a9d219d6b Mon Sep 17 00:00:00 2001 From: "David J. Allen" Date: Mon, 15 Jul 2024 20:43:02 -0600 Subject: [PATCH 3/8] Updated README.md with updating submodules --- .gitmodules | 3 +++ README.md | 6 ++++++ modules/indicators | 1 + 3 files changed, 10 insertions(+) create mode 160000 modules/indicators diff --git a/.gitmodules b/.gitmodules index 1efeb8d..45d6005 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,3 +16,6 @@ [submodule "modules/argparse"] path = modules/argparse url = https://github.com/p-ranav/argparse +[submodule "modules/indicators"] + path = modules/indicators + url = https://github.com/p-ranav/indicators diff --git a/README.md b/README.md index 6dd6d1c..efa43dc 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,12 @@ ln -s ../modules/indicators/include/indicators include/indicators ln -s ../modules/csv2/include/csv2 include/csv2 ``` +Otherwise, you can just update the modules if they're already there and out-of-date: + +```bash +git submodule update --init --recursive +``` + And then build the binaries (check the "build" directory): ```bash diff --git a/modules/indicators b/modules/indicators new file mode 160000 index 0000000..222382c --- /dev/null +++ b/modules/indicators @@ -0,0 +1 @@ +Subproject commit 222382c3a6abbce32503792c59826063660ddb56 From 2b5c838a4ffe51602356df35c2b71b33f8664fff Mon Sep 17 00:00:00 2001 From: "David J. Allen" Date: Sun, 18 Aug 2024 13:35:21 -0600 Subject: [PATCH 4/8] Added ignore_validation flag to config --- include/config.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/config.hpp b/include/config.hpp index 3d2a135..5fc0fba 100644 --- a/include/config.hpp +++ b/include/config.hpp @@ -31,6 +31,7 @@ namespace gdpm::config{ bool enable_sync = true; bool enable_cache = true; bool skip_prompt = false; + bool ignore_validation = false; bool enable_file_logging; bool clean_temporary; From 1e92c16cdf009fe3b98e6a80dea91c51a6ab354c Mon Sep 17 00:00:00 2001 From: "David J. Allen" Date: Sun, 18 Aug 2024 13:35:51 -0600 Subject: [PATCH 5/8] Removed unused includes from main.cpp --- src/main.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 5b73e29..e0c8bc6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,10 +1,7 @@ // Godot Package Manager (GPM) -#include "constants.hpp" -#include "log.hpp" -#include "config.hpp" + #include "package_manager.hpp" -#include "result.hpp" #include From e8020aa0b0ccd87990e8287720fdbf9058b23c7c Mon Sep 17 00:00:00 2001 From: "David J. Allen" Date: Sun, 18 Aug 2024 13:41:25 -0600 Subject: [PATCH 6/8] Added log prints in main.cpp --- src/main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index e0c8bc6..0891df9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,7 +10,13 @@ int main(int argc, char **argv){ using namespace gdpm::package_manager; error error = initialize(argc, argv); - parse_arguments(argc, argv); + if(error.has_occurred()) { + log::error(error); + } + error = parse_arguments(argc, argv); + if(error.has_occurred()) { + log::error(error); + } finalize(); return EXIT_SUCCESS; From a6635b1f0275df6ff6df2cb904840b6cb073619e Mon Sep 17 00:00:00 2001 From: "David J. Allen" Date: Sun, 18 Aug 2024 13:42:02 -0600 Subject: [PATCH 7/8] Added ignore_validation flag check and CLI argument --- src/package_manager.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/package_manager.cpp b/src/package_manager.cpp index 924ff03..2713bd7 100644 --- a/src/package_manager.cpp +++ b/src/package_manager.cpp @@ -147,6 +147,13 @@ namespace gdpm::package_manager{ .help("set verbosity level") .nargs(nargs_pattern::optional); + program.add_argument("--ignore-validation") + .action([&](const auto&){ config.ignore_validation = true; }) + .default_value(false) + .implicit_value(true) + .help("ignore checking if current directory is a Godot project") + .nargs(0); + install_command.add_description("install package(s)"); install_command.add_argument("packages") .required() @@ -409,6 +416,13 @@ namespace gdpm::package_manager{ return log::error_rc(ec::ARGPARSE_ERROR, e.what()); } + /* Check if we're running in a directory with 'project.godot' file */ + if (!config.ignore_validation) { + if(!std::filesystem::exists("project.godot")){ + return error(ec::FILE_NOT_FOUND, "no 'project.godot' file found in current directory"); + } + } + if(program.is_subcommand_used(install_command)){ action = action_e::install; // if(install_command.is_used("packages")) From 9f56c0b8c7274ac400e4457b976754a44d3540c6 Mon Sep 17 00:00:00 2001 From: "David J. Allen" Date: Wed, 28 Aug 2024 23:20:04 -0600 Subject: [PATCH 8/8] Updated PKGBUILD to build from git 'main' --- PKGBUILD | 22 -------------------- dist/archlinux/PKGBUILD | 46 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 22 deletions(-) delete mode 100644 PKGBUILD create mode 100644 dist/archlinux/PKGBUILD diff --git a/PKGBUILD b/PKGBUILD deleted file mode 100644 index 80f8cdb..0000000 --- a/PKGBUILD +++ /dev/null @@ -1,22 +0,0 @@ -# Maintainer: David J. Allen -pkgname=gdpm -pkgver=0.0.1 -pkgrel=1 -pkgdesc="CLI tool to automate managing Godot game engine assets from the command-line. This includes a pre-built, static binary." -arch=('x86_64') -url="https://github.com/davidallendj/gdpm" -license=('MIT') -#groups= -depends=('glibc') -makedepends=('cmake', 'make', 'clang') -source=("https://github.com/davidallendj/gdpm/releases/download/v$pkgver/$pkgname.static.$arch.linux.static") -sha256sums=('012e3c32511d6d762ac070808e8bcae7f68dd261bf1cad3dbf4607c97aa1bb3d') - -build () { - # shouldn't need to build anything with static binary... -} - -package() { - cd "$srcdir/$pkgname-$pkgver" - make DESTDIR="$pkgdir/" install -} \ No newline at end of file diff --git a/dist/archlinux/PKGBUILD b/dist/archlinux/PKGBUILD new file mode 100644 index 0000000..a4e49b6 --- /dev/null +++ b/dist/archlinux/PKGBUILD @@ -0,0 +1,46 @@ +# Maintainer: David J. Allen +pkgname=gdpm-git +pkgver=r86.a6635b1 +pkgrel=1 +pkgdesc="CLI tool to automate managing Godot game engine assets from the command-line. This includes a pre-built, static binary." +arch=('x86_64') +url="https://github.com/davidallendj/gdpm" +license=('MIT') +depends=('glibc') +makedepends=('cmake' 'ninja' 'clang' 'gcc') +optdepends=('meson' 'make') +source=("$pkgname-$pkgver::git+https://github.com/davidallendj/gdpm") +sha256sums=('SKIP') + +pkgver() { + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" +} + +prepare() { + cd "$srcdir/$pkgname-$pkgver" + + # update and initialize submodules + git submodule update --init modules/argparse + git submodule update --init modules/tabulate + git submodule update --init modules/indicators + git submodule update --init modules/csv2 + + # link module headers to include/* + ln -s ../modules/argparse/include/argparse include/argparse + ln -s ../modules/tabulate/include/tabulate include/tabulate + ln -s ../modules/indicators/include/indicators include/indicators + ln -s ../modules/csv2/include/csv2 include/csv2 +} + +build () { + cd "$srcdir/$pkgname-$pkgver" + bin/compile.sh --all +} + +package() { + cd "$srcdir/$pkgname-$pkgver" + + # install the binary to /usr/bin + mkdir -p "${pkgdir}/usr/bin" + install -m755 build/gdpm.static "${pkgdir}/usr/bin/gdpm" +}