Skip to content

Commit

Permalink
mkn run -- arg0 / formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipDeegan committed Nov 19, 2023
1 parent 13e7510 commit 04d1549
Show file tree
Hide file tree
Showing 37 changed files with 137 additions and 135 deletions.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ IndentWidth: 2
BasedOnStyle: 'google'
ColumnLimit: 100
SortIncludes: false
QualifierAlignment: Right
UseTab: Never
DerivePointerAlignment: false
PointerAlignment: Left
5 changes: 3 additions & 2 deletions README.noformat
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@ mkn clean build -dtKa -DARG - clean/compile with optimal threads passin
mkn clean build -dtKa "-DARG -DARG1" - clean/compile with optimal threads passing -DARG and -DARG1/link everything statically
mkn clean build -d 1 -t 2 -u - update/clean/compile with two threads/link project and immediate dependencies
mkn -ds - Display "${scm} status" for everything
mkn run -- arg0 arg1 arg2 - Execute binary passing arguments to main as argc/argv

6. Environment Variables

Expand Down Expand Up @@ -628,13 +629,13 @@ Type bool
Default false
Description Windows only: when attempting automatic settings.yaml creation, use cl even if clang/gcc are found

Key MKN_LIB_EXT_DEF
Key MKN_LIB_EXT
Type string
Default #ifdef _WIN32 evs["MKN_LIB_EXT"] = "dll";
#else evs["MKN_LIB_EXT"] = "so";
Description The file extention of shared objects being created.

Key MKN_LIB_PRE_DEF
Key MKN_LIB_PRE
Type string
Default #ifdef _WIN32 evs["MKN_LIB_PRE"] = "";
#else evs["MKN_LIB_PRE"] = "lib";
Expand Down
34 changes: 17 additions & 17 deletions inc/maiken/app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ class KUL_PUBLISH Application : public Constants {

void scmStatus(bool const& deps = false) KTHROW(mkn::kul::scm::Exception);
void scmUpdate(bool const& f) KTHROW(mkn::kul::scm::Exception);
void scmUpdate(bool const& f, const mkn::kul::SCM* scm, std::string const& repo)
void scmUpdate(bool const& f, mkn::kul::SCM const* scm, std::string const& repo)
KTHROW(mkn::kul::scm::Exception);

void setup() KTHROW(mkn::kul::Exception);
void setSuper();
void showConfig(bool force = 0);
void showTree() const;
void showTreeRecursive(uint8_t i) const;
void cyclicCheck(const std::vector<std::pair<std::string, std::string>>& apps) const
void cyclicCheck(std::vector<std::pair<std::string, std::string>> const& apps) const
KTHROW(mkn::kul::Exception);
void showProfiles();

Expand All @@ -142,7 +142,7 @@ class KUL_PUBLISH Application : public Constants {

void populateMapsFromDependencies() KTHROW(mkn::kul::Exception);

void loadDepOrMod(YAML::Node const& node, const mkn::kul::Dir& depOrMod, bool module)
void loadDepOrMod(YAML::Node const& node, mkn::kul::Dir const& depOrMod, bool module)
KTHROW(mkn::kul::Exception);
mkn::kul::Dir resolveDepOrModDirectory(YAML::Node const& d, bool module);
void popDepOrMod(YAML::Node const& n, std::vector<Application*>& vec, std::string const& s,
Expand Down Expand Up @@ -226,35 +226,35 @@ class KUL_PUBLISH Application : public Constants {

auto& main() const { return main_; }
virtual void process() KTHROW(mkn::kul::Exception);
const mkn::kul::Dir& buildDir() const { return bd; }
mkn::kul::Dir const& buildDir() const { return bd; }
std::string const& binary() const { return bin; }
std::string const& profile() const { return p; }
maiken::Project const& project() const { return proj; }
const std::vector<Application*>& dependencies() const { return deps; }
const std::vector<Application*>& revendencies() const { return rdeps; }
const std::vector<Application*>& moduleDependencies() const { return modDeps; }
const std::vector<std::shared_ptr<ModuleLoader>>& modules() const { return mods; }
const mkn::kul::hash::map::S2T<mkn::kul::hash::map::S2S>& files() const { return fs; }
std::vector<Application*> const& dependencies() const { return deps; }
std::vector<Application*> const& revendencies() const { return rdeps; }
std::vector<Application*> const& moduleDependencies() const { return modDeps; }
std::vector<std::shared_ptr<ModuleLoader>> const& modules() const { return mods; }
mkn::kul::hash::map::S2T<mkn::kul::hash::map::S2S> const& files() const { return fs; }
std::vector<std::string> const& libraries() const { return libs; }
const std::vector<std::pair<Source, bool>>& sources() const { return srcs; }
const std::vector<std::pair<std::string, bool>>& includes() const { return incs; }
std::vector<std::pair<Source, bool>> const& sources() const { return srcs; }
std::vector<std::pair<std::string, bool>> const& includes() const { return incs; }
std::vector<std::string> const& libraryPaths() const { return paths; }
const mkn::kul::hash::map::S2S& properties() const { return ps; }
const mkn::kul::hash::map::S2T<mkn::kul::hash::set::String>& arguments() const { return args; }
mkn::kul::hash::map::S2S const& properties() const { return ps; }
mkn::kul::hash::map::S2T<mkn::kul::hash::set::String> const& arguments() const { return args; }

auto& mode() const { return m; }
void mode(compiler::Mode mode) { m = mode; }

std::vector<mkn::kul::cli::EnvVar>& envVars() { return evs; }
const std::vector<mkn::kul::cli::EnvVar>& envVars() const { return evs; }
std::vector<mkn::kul::cli::EnvVar> const& envVars() const { return evs; }

void add_def(std::string const& def) { defs.emplace_back(def); }
std::vector<std::string> const& defines() const { return defs; }

void addInclude(std::string const& s, bool p = 1) {
auto it = std::find_if(
incs.begin(), incs.end(),
[&](const std::pair<std::string, bool>& element) { return element.first == s; });
[&](std::pair<std::string, bool> const& element) { return element.first == s; });
if (it == incs.end()) incs.emplace_back(s, p);
}
void addLibpath(std::string const& s) { paths.push_back(s); }
Expand Down Expand Up @@ -296,7 +296,7 @@ class KUL_PUBLISH Application : public Constants {
std::optional<Source> main_;
std::string const p;
mkn::kul::Dir bd, inst;
std::unordered_map<const This*, YAML::Node> modIArgs, modCArgs, modLArgs, modTArgs, modPArgs;
std::unordered_map<This const*, YAML::Node> modIArgs, modCArgs, modLArgs, modTArgs, modPArgs;
maiken::Project const& proj;
mkn::kul::hash::map::S2T<mkn::kul::hash::map::S2S> fs;
mkn::kul::hash::map::S2S cArg, cLnk, includeStamps, itss, ps, tests;
Expand All @@ -308,7 +308,7 @@ class KUL_PUBLISH Application : public Constants {
std::vector<std::string> defs, libs, paths;
std::vector<std::pair<maiken::Source, bool>> srcs;
std::vector<std::pair<std::string, bool>> incs;
const mkn::kul::SCM* scm = 0;
mkn::kul::SCM const* scm = 0;
};

class Applications : public Constants {
Expand Down
2 changes: 1 addition & 1 deletion inc/maiken/compiler/compilers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Compilers {

private:
Compilers();
std::string key(std::string comp, const mkn::kul::hash::map::S2T<Compiler*>& map);
std::string key(std::string comp, mkn::kul::hash::map::S2T<Compiler*> const& map);
};
} // namespace maiken
#endif /* _MAIKEN_CODE_COMPILERS_HPP_ */
18 changes: 9 additions & 9 deletions inc/maiken/dist.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class DistLinker {
static void send([[maybe_unused]] mkn::kul::File const& bin) {
#if defined(_MKN_WITH_MKN_RAM_) && defined(_MKN_WITH_IO_CEREAL_)
std::vector<std::shared_ptr<maiken::dist::Post>> posts;
auto post_lambda = [](const dist::Host& host, mkn::kul::File const& bin) {
auto post_lambda = [](dist::Host const& host, mkn::kul::File const& bin) {
mkn::kul::io::BinaryReader br(bin);
dist::Blob b;
b.files_left = 1;
Expand Down Expand Up @@ -148,7 +148,7 @@ class Post {
explicit Post(ARequest* _msg) : msg(std::unique_ptr<ARequest>(_msg)) {}

explicit Post(std::unique_ptr<ARequest> _msg) : msg(std::move(_msg)) {}
void send(const Host& host) KTHROW(Exception) {
void send(Host const& host) KTHROW(Exception) {
send(host.host(), "res", host.port(), {{"session", host.session_id()}});
}
void send(std::string const& host, std::string const& res, uint16_t const& port,
Expand All @@ -162,10 +162,10 @@ class Post {

private:
Post() {}
Post(const Post&) = delete;
Post(const Post&&) = delete;
Post& operator=(const Post&) = delete;
Post& operator=(const Post&&) = delete;
Post(Post const&) = delete;
Post(Post const&&) = delete;
Post& operator=(Post const&) = delete;
Post& operator=(Post const&&) = delete;
template <class Archive>
void serialize(Archive& ar) {
ar(::cereal::make_nvp("msg", msg));
Expand All @@ -188,13 +188,13 @@ class RemoteCommandManager {

std::unique_ptr<CompileRequest> build_compile_request(
std::string const& directory,
const std::vector<std::pair<std::string, std::string>>& src_obj);
std::vector<std::pair<std::string, std::string>> const& src_obj);

std::unique_ptr<DownloadRequest> build_download_request();

std::unique_ptr<LinkRequest> build_link_request(std::string const& b);

void build_hosts(const Settings& settings) KTHROW(mkn::kul::Exception) {
void build_hosts(Settings const& settings) KTHROW(mkn::kul::Exception) {
if (settings.root()["dist"]) {
if (settings.root()["dist"]["nodes"]) {
for (auto const& node : settings.root()["dist"]["nodes"]) {
Expand All @@ -204,7 +204,7 @@ class RemoteCommandManager {
}
}
}
const std::vector<Host>& hosts() const { return m_hosts; }
std::vector<Host> const& hosts() const { return m_hosts; }

private:
std::vector<Host> m_hosts;
Expand Down
52 changes: 26 additions & 26 deletions inc/maiken/dist/message.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class ARequest : public AMessage {
ar(::cereal::make_nvp("AMessage", ::cereal::base_class<AMessage>(this)));
}

virtual void do_response_for(const mkn::kul::http::A1_1Request& req, Sessions& sessions,
virtual void do_response_for(mkn::kul::http::A1_1Request const& req, Sessions& sessions,
mkn::kul::http::_1_1Response& resp) = 0;
};

Expand All @@ -89,14 +89,14 @@ class SetupRequest : public ARequest {
mkn::kul::cli::Args const& args)
: m_project_yaml(project), m_settings_yaml(settings), m_args(args) {}

void do_response_for(const mkn::kul::http::A1_1Request& req, Sessions& sessions,
void do_response_for(mkn::kul::http::A1_1Request const& req, Sessions& sessions,
mkn::kul::http::_1_1Response& resp) override;

private:
SetupRequest(const SetupRequest&) = delete;
SetupRequest(const SetupRequest&&) = delete;
SetupRequest& operator=(const SetupRequest&) = delete;
SetupRequest& operator=(const SetupRequest&&) = delete;
SetupRequest(SetupRequest const&) = delete;
SetupRequest(SetupRequest const&&) = delete;
SetupRequest& operator=(SetupRequest const&) = delete;
SetupRequest& operator=(SetupRequest const&&) = delete;
template <class Archive>
void serialize(Archive& ar) {
ar(::cereal::make_nvp("ARequest", ::cereal::base_class<ARequest>(this)));
Expand All @@ -118,17 +118,17 @@ class CompileRequest : public ARequest {
public:
CompileRequest() {}
CompileRequest(std::string const& directory,
const std::vector<std::pair<std::string, std::string>>& src_obj)
std::vector<std::pair<std::string, std::string>> const& src_obj)
: m_directory(directory), m_src_obj(src_obj) {}

void do_response_for(const mkn::kul::http::A1_1Request& req, Sessions& sessions,
void do_response_for(mkn::kul::http::A1_1Request const& req, Sessions& sessions,
mkn::kul::http::_1_1Response& resp) override;

private:
CompileRequest(const CompileRequest&) = delete;
CompileRequest(const CompileRequest&&) = delete;
CompileRequest& operator=(const CompileRequest&) = delete;
CompileRequest& operator=(const CompileRequest&&) = delete;
CompileRequest(CompileRequest const&) = delete;
CompileRequest(CompileRequest const&&) = delete;
CompileRequest& operator=(CompileRequest const&) = delete;
CompileRequest& operator=(CompileRequest const&&) = delete;

template <class Archive>
void serialize(Archive& ar) {
Expand All @@ -149,14 +149,14 @@ class DownloadRequest : public ARequest {

public:
DownloadRequest() {}
void do_response_for(const mkn::kul::http::A1_1Request& req, Sessions& sessions,
void do_response_for(mkn::kul::http::A1_1Request const& req, Sessions& sessions,
mkn::kul::http::_1_1Response& resp) override;

private:
DownloadRequest(const DownloadRequest&) = delete;
DownloadRequest(const DownloadRequest&&) = delete;
DownloadRequest& operator=(const DownloadRequest&) = delete;
DownloadRequest& operator=(const DownloadRequest&&) = delete;
DownloadRequest(DownloadRequest const&) = delete;
DownloadRequest(DownloadRequest const&&) = delete;
DownloadRequest& operator=(DownloadRequest const&) = delete;
DownloadRequest& operator=(DownloadRequest const&&) = delete;

template <class Archive>
void serialize(Archive& ar) {
Expand All @@ -172,14 +172,14 @@ class LinkRequest : public ARequest {
public:
LinkRequest() {}
LinkRequest(std::string const& b) { str = b; }
void do_response_for(const mkn::kul::http::A1_1Request& req, Sessions& sessions,
void do_response_for(mkn::kul::http::A1_1Request const& req, Sessions& sessions,
mkn::kul::http::_1_1Response& resp) override;

private:
LinkRequest(const LinkRequest&) = delete;
LinkRequest(const LinkRequest&&) = delete;
LinkRequest& operator=(const LinkRequest&) = delete;
LinkRequest& operator=(const LinkRequest&&) = delete;
LinkRequest(LinkRequest const&) = delete;
LinkRequest(LinkRequest const&&) = delete;
LinkRequest& operator=(LinkRequest const&) = delete;
LinkRequest& operator=(LinkRequest const&&) = delete;

template <class Archive>
void serialize(Archive& ar) {
Expand All @@ -205,10 +205,10 @@ class Blob {
}

private:
Blob(const Blob&) = delete;
Blob(const Blob&&) = delete;
Blob& operator=(const Blob&) = delete;
Blob& operator=(const Blob&&) = delete;
Blob(Blob const&) = delete;
Blob(Blob const&&) = delete;
Blob& operator=(Blob const&) = delete;
Blob& operator=(Blob const&&) = delete;
};
} // end namespace dist
} // end namespace maiken
Expand Down
14 changes: 7 additions & 7 deletions inc/maiken/dist/server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ServerSession {
ServerSession() : start_time(mkn::kul::Now::MILLIS()) {}
void reset_setup(SetupRequest* request) { setup.reset(request); }
SetupRequest* setup_ptr() { return setup.get(); }
void set_apps(const std::vector<Application*>& _apps) { this->apps = std::move(_apps); }
void set_apps(std::vector<Application*> const& _apps) { this->apps = std::move(_apps); }
std::vector<Application*> apps_vector() { return apps; };

public:
Expand All @@ -69,15 +69,15 @@ class Server : public mkn::kul::http::MultiServer, public Constants {
friend class mkn::kul::Thread;

public:
Server(uint16_t const port, const mkn::kul::Dir& _home, uint16_t threads)
Server(uint16_t const port, mkn::kul::Dir const& _home, uint16_t threads)
: mkn::kul::http::MultiServer(port, 1, threads), busy(false), m_home(_home) {}
virtual ~Server() {}
mkn::kul::http::_1_1Response respond(const mkn::kul::http::A1_1Request& req) override;
mkn::kul::http::_1_1Response respond(mkn::kul::http::A1_1Request const& req) override;

Server(const Server&) = delete;
Server(const Server&&) = delete;
Server& operator=(const Server&) = delete;
Server& operator=(const Server&&) = delete;
Server(Server const&) = delete;
Server(Server const&&) = delete;
Server& operator=(Server const&) = delete;
Server& operator=(Server const&&) = delete;

protected:
void onConnect(char const* cip, uint16_t const& port) override {
Expand Down
12 changes: 6 additions & 6 deletions inc/maiken/global.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class AppVars : public Constants {
std::string const& runArgs() const { return ra; }
void runArgs(std::string const& ra) { this->ra = ra; }

const mkn::kul::hash::map::S2S& jargs() const { return jas; }
mkn::kul::hash::map::S2S const& jargs() const { return jas; }
void jargs(std::string const& a, std::string const& b) { jas[a] = b; }

std::string const& linker() const { return la; }
Expand Down Expand Up @@ -137,10 +137,10 @@ class AppVars : public Constants {
uint16_t const& threads() const { return ts; }
void threads(uint16_t const& t) { this->ts = t; }

const mkn::kul::hash::map::S2S& properkeys() const { return pks; }
mkn::kul::hash::map::S2S const& properkeys() const { return pks; }
void properkeys(std::string const& k, std::string const& v) { pks[k] = v; }

const mkn::kul::hash::map::S2S& envVars() const { return evs; }
mkn::kul::hash::map::S2S const& envVars() const { return evs; }
std::string envVar(std::string const&& k) const { return (*evs.find(k)).second; }
void envVar(std::string const& k, std::string const& v) { evs[k] = v; }

Expand Down Expand Up @@ -184,7 +184,7 @@ class AppVars : public Constants {
return ret;
};
auto convert_to_std_map =
[](const mkn::kul::hash::map::S2S& s) -> std::unordered_map<std::string, std::string> {
[](mkn::kul::hash::map::S2S const& s) -> std::unordered_map<std::string, std::string> {
std::unordered_map<std::string, std::string> ret;
for (auto const& p : s) ret.emplace(p.first, p.second);
return ret;
Expand All @@ -203,13 +203,13 @@ class AppVars : public Constants {
ar(no);

auto convert_to_kul_set =
[](const std::unordered_set<std::string>& s) -> mkn::kul::hash::set::String {
[](std::unordered_set<std::string> const& s) -> mkn::kul::hash::set::String {
mkn::kul::hash::set::String ret;
for (auto const& p : s) ret.insert(p);
return ret;
};
auto convert_to_kul_map =
[](const std::unordered_map<std::string, std::string>& s) -> mkn::kul::hash::map::S2S {
[](std::unordered_map<std::string, std::string> const& s) -> mkn::kul::hash::map::S2S {
mkn::kul::hash::map::S2S ret;
for (auto const& p : s) ret.insert(p.first, p.second);
return ret;
Expand Down
Loading

0 comments on commit 04d1549

Please sign in to comment.