Skip to content

Commit

Permalink
make inja go away
Browse files Browse the repository at this point in the history
  • Loading branch information
lsproule committed Feb 5, 2024
1 parent 4a92c53 commit 391f097
Show file tree
Hide file tree
Showing 17 changed files with 73 additions and 2,982 deletions.
6 changes: 6 additions & 0 deletions .frate-local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"build_command": "cmake -build .",
"override_change_hash": "",
"run_command": "./bin/",
"test_command": "ctest"
}
17 changes: 13 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)


include (cmake/CPM.cmake)
include(cmake/CPM.cmake)


CPMAddPackage(
Expand All @@ -106,8 +106,6 @@ CPMAddPackage(
"BUILD_STATIC_LIBS ON"
"JSON_BuildTests OFF"
"JSON_Diagnostics ON"


)

CPMAddPackage(
Expand Down Expand Up @@ -153,6 +151,15 @@ CPMAddPackage(
GIT_TAG v3.3.1
)

CPMAddPackage(
NAME inja
GIT_REPOSITORY https://github.com/pantor/inja
GIT_TAG v3.4.0
OPTIONS
"INJA_USE_EMBEDDED_JSON OFF"
"BUILD_TESTING OFF"
"BUILD_BENCHMARK OFF"
)



Expand All @@ -165,6 +172,7 @@ file(GLOB_RECURSE SOURCES RELATIVE ${CMAKE_SOURCE_DIR}


include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${CMAKE_SOURCE_DIR}/_deps/inja-src/single_include)
set(HEADER_DIR ${CMAKE_SOURCE_DIR}/include)

message("Sources: ${SOURCES}")
Expand Down Expand Up @@ -209,11 +217,12 @@ target_link_options(${PROJECT_NAME} PRIVATE -static-libgcc -static-libstdc++)
#target_link_libraries(${PROJECT_NAME} PRIVATE -static-libgcc -static-libstdc++)
target_link_libraries(${PROJECT_NAME} PRIVATE libcurl)
target_link_libraries(${PROJECT_NAME} PRIVATE cxxopts)
target_link_libraries(${PROJECT_NAME} PRIVATE nlohmann_json)
target_link_libraries(${PROJECT_NAME} PUBLIC nlohmann_json)
target_link_libraries(${PROJECT_NAME} PRIVATE uv)
target_link_libraries(${PROJECT_NAME} PRIVATE termcolor)
target_link_libraries(${PROJECT_NAME} PRIVATE lua)
target_link_libraries(${PROJECT_NAME} PRIVATE sol2::sol2)
target_link_libraries(${PROJECT_NAME} PRIVATE inja)

set(SOURCE_DIR src)
set(BUILD_DIR build)
Expand Down
2 changes: 1 addition & 1 deletion include/Frate/Generators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <Frate/Project/Config.hpp>
#include <Frate/Template/Meta.hpp>
#include <Frate/Utils/CLIPrompt.hpp>
#include <inja.hpp>
#include <inja/inja.hpp>
#include <vector>

namespace Frate::Generators {
Expand Down
2 changes: 1 addition & 1 deletion include/Frate/Lua/LuaAPI.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#include "Frate/Project/Config.hpp"
#include "inja.hpp"
#include <inja/inja.hpp>
#include <filesystem>
#include <nlohmann/json.hpp>
#include <sol/forward.hpp>
Expand Down
2 changes: 1 addition & 1 deletion include/Frate/Lua/TemplateEnvironment.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include "Frate/Project/Config.hpp"
#include "Frate/Utils/Logging.hpp"
#include "inja.hpp"
#include <inja/inja.hpp>
#include <Frate/FrateException.hpp>
#include <Frate/Lua/Exceptions.hpp>
#include <sol/state.hpp>
Expand Down
8 changes: 4 additions & 4 deletions include/Frate/Package.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ namespace Frate::Command {
std::string license;
std::string owner;
std::string owner_type;
int stars;
int forks;
int open_issues;
int watchers;
int stars{};
int forks{};
int open_issues{};
int watchers{};
// int score;
bool addCallback(sol::state &lua);
friend void from_json(const json &json_obj, Package &package);
Expand Down
31 changes: 5 additions & 26 deletions include/Frate/System/Build.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,16 @@ namespace Frate::Command {

class BuildCommand {
public:
BuildCommand(std::shared_ptr<Interface> &inter) { this->inter = inter; }
BuildCommand(std::shared_ptr<Interface> &inter);
[[nodiscard]] std::string get_local_build_command() const;

[[nodiscard]] std::string get_local_build_command() const {
#ifdef DEBUG
return "cd build && cmake . && make && " + get_executable_path();
#else
return "cmake . && make && " + get_executable_path();
#endif
}

[[nodiscard]] std::string get_remote_build_command() const {
std::string remote_dest_path = get_remote_destination_path();
SSHConnection ssh(inter->config->getBuildServer());
std::string build_command =
"cd " + remote_dest_path + " && cmake . && make -j $(nproc)";
return ssh.createRsyncCommand(inter->pro->path.string(),
remote_dest_path) +
" && " + ssh.createRemoteCommand(build_command);
}
[[nodiscard]] std::string get_remote_build_command() const;

private:
std::shared_ptr<Interface> inter;

[[nodiscard]] std::string get_remote_destination_path() const {
char *dest_path = std::getenv("REMOTE_DEST_PATH");
return (dest_path != nullptr) ? dest_path : ("/tmp/" + inter->pro->name);
}
[[nodiscard]] std::string get_remote_destination_path() const;

[[nodiscard]] std::string get_executable_path() const {
return inter->pro->path.string() + "/" + inter->pro->build_dir + "/" +
inter->pro->name;
}
[[nodiscard]] std::string get_executable_path() const ;
};
} // namespace Frate::Command
1 change: 0 additions & 1 deletion include/Frate/Utils/Logging.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

namespace Frate::Utils {
extern bool verbose_mode;

class Error {
public:
template <typename T> Error &operator<<(const T &data) {
Expand Down
Loading

0 comments on commit 391f097

Please sign in to comment.