Skip to content

Commit

Permalink
fixed target link issue #93
Browse files Browse the repository at this point in the history
  • Loading branch information
DeaSTL committed Dec 27, 2023
1 parent 1f6d481 commit 68a81bf
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 98 deletions.
8 changes: 8 additions & 0 deletions src/Command/Helpers/Dependency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ namespace Frate::Command {
this->git = package.git;
this->git_short = package.git_short;
this->git_prefixed = package.git_prefixed;
if (package.target_link.empty()) {
this->target_link = package.name;
}
else {
this->target_link = package.target_link;
}
}

void to_json(json &json_obj, const Dependency &dep) {
Expand All @@ -20,6 +26,7 @@ namespace Frate::Command {
TO_JSON_FIELD(dep, git);
TO_JSON_FIELD(dep, git_short);
TO_JSON_FIELD(dep, git_prefixed);
TO_JSON_FIELD(dep, target_link);
}

void from_json(const json &json_obj, Dependency &dep) {
Expand All @@ -28,5 +35,6 @@ namespace Frate::Command {
FROM_JSON_FIELD(dep, git);
FROM_JSON_FIELD(dep, git_short);
FROM_JSON_FIELD(dep, git_prefixed);
FROM_JSON_FIELD(dep, target_link);
}
} // namespace Frate::Command
200 changes: 102 additions & 98 deletions src/Lua/RegisterProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,110 +7,113 @@ namespace Frate::LuaAPI {
bool registerProject(sol::state &lua, std::shared_ptr<Command::Project> pro) {

lua.set("project", pro);
// clang-format off
lua.new_usertype<Command::Package>("Package",
"new",
sol::no_constructor,
"name",
&Command::Package::name,
"git",
&Command::Package::git,
"git_short",
&Command::Package::git_short,
"git_prefixed",
&Command::Package::git_prefixed,
"versions",
&Command::Package::versions,
"target_link",
&Command::Package::target_link,
"description",
&Command::Package::description,
"git_description",
&Command::Package::git_description,
"language",
&Command::Package::language,
"license",
&Command::Package::license,
"owner",
&Command::Package::owner,
"owner_type",
&Command::Package::owner_type,
"stars",
&Command::Package::stars,
"forks",
&Command::Package::forks,
"open_issues",
&Command::Package::open_issues,
"watchers",
&Command::Package::watchers);
"new",
sol::no_constructor,
"name",
&Command::Package::name,
"git",
&Command::Package::git,
"git_short",
&Command::Package::git_short,
"git_prefixed",
&Command::Package::git_prefixed,
"versions",
&Command::Package::versions,
"target_link",
&Command::Package::target_link,
"description",
&Command::Package::description,
"git_description",
&Command::Package::git_description,
"language",
&Command::Package::language,
"license",
&Command::Package::license,
"owner",
&Command::Package::owner,
"owner_type",
&Command::Package::owner_type,
"stars",
&Command::Package::stars,
"forks",
&Command::Package::forks,
"open_issues",
&Command::Package::open_issues,
"watchers",
&Command::Package::watchers);
lua.new_usertype<Command::Dependency>("Dependency",
"new",
sol::no_constructor,
"name",
&Command::Dependency::name,
"version",
&Command::Dependency::version,
"git",
&Command::Dependency::git,
"git_short",
&Command::Dependency::git_short,
"git_prefixed",
&Command::Dependency::git_prefixed);
"new",
sol::no_constructor,
"name",
&Command::Dependency::name,
"version",
&Command::Dependency::version,
"git",
&Command::Dependency::git,
"git_short",
&Command::Dependency::git_short,
"git_prefixed",
&Command::Dependency::git_prefixed,
"target_link",
&Command::Dependency::target_link);

lua.new_usertype<Command::Mode>("Mode",
"new",
sol::no_constructor,
"name",
&Command::Mode::name,
"flags",
&Command::Mode::flags,
"dependencies",
&Command::Mode::dependencies);
"new",
sol::no_constructor,
"name",
&Command::Mode::name,
"flags",
&Command::Mode::flags,
"dependencies",
&Command::Mode::dependencies);

lua.new_usertype<Command::Project>("Project"
"new",
sol::no_constructor,
"name",
&Command::Project::name,
"version",
&Command::Project::version,
"description",
&Command::Project::description,
"authors",
&Command::Project::authors,
"dependencies",
&Command::Project::dependencies,
"toolchains",
&Command::Project::toolchains,
"flags",
&Command::Project::flags,
"modes",
&Command::Project::modes,
"libs",
&Command::Project::libs,
"license",
&Command::Project::license,
"git",
&Command::Project::git,
"cmake_version",
&Command::Project::cmake_version,
"build_command",
&Command::Project::build_command,
"build_dir",
&Command::Project::build_dir,
"src_dir",
&Command::Project::src_dir,
"include_dir",
&Command::Project::include_dir,
"lang_version",
&Command::Project::lang_version,
"lang",
&Command::Project::lang,
"project_type",
&Command::Project::type,
"keywords",
&Command::Project::keywords,
"prompts",
&Command::Project::prompts);
"new",
sol::no_constructor,
"name",
&Command::Project::name,
"version",
&Command::Project::version,
"description",
&Command::Project::description,
"authors",
&Command::Project::authors,
"dependencies",
&Command::Project::dependencies,
"toolchains",
&Command::Project::toolchains,
"flags",
&Command::Project::flags,
"modes",
&Command::Project::modes,
"libs",
&Command::Project::libs,
"license",
&Command::Project::license,
"git",
&Command::Project::git,
"cmake_version",
&Command::Project::cmake_version,
"build_command",
&Command::Project::build_command,
"build_dir",
&Command::Project::build_dir,
"src_dir",
&Command::Project::src_dir,
"include_dir",
&Command::Project::include_dir,
"lang_version",
&Command::Project::lang_version,
"lang",
&Command::Project::lang,
"project_type",
&Command::Project::type,
"keywords",
&Command::Project::keywords,
"prompts",
&Command::Project::prompts);

lua.new_usertype<Command::ProjectPrompt>(
"ProjectPrompt",
Expand All @@ -127,6 +130,7 @@ namespace Frate::LuaAPI {
"getfloat",
&Command::ProjectPrompt::get<float>);

// clang-format on
return true;
}
} // namespace Frate::LuaAPI

0 comments on commit 68a81bf

Please sign in to comment.