Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

default --jobs parameter to zero #45

Merged
merged 3 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/antler/project/populator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace antler::project {
/// Populate the directory by generating files for build and gathering the dependencies.
/// @param jobs The number of jobs used to clone or pull dependencies.
/// @return true for success; false for failure.
[[nodiscard]] bool populate(uint32_t jobs=1);
[[nodiscard]] bool populate(uint32_t jobs=0);

template <typename P>
void emit_cmake(P& pops) { emitter.emit(pops); }
Expand Down
2 changes: 1 addition & 1 deletion tools/build.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace antler {
subcommand->footer(std::string(R"(Examples:)")
+ "\n\t" + app.get_name() +R"( build -j3)");
subcommand->add_option("-p, path", path, "This is the path to the root of the project.");
subcommand->add_option("-j, --jobs", jobs, "The number of submodules fetched at the same time.")->default_val(1);
subcommand->add_option("-j, --jobs", jobs, "The number of submodules fetched at the same time. Default is 0, which means to use git default.")->default_val(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe copy the text from git --help and specify what git will do when passed 0:

Suggested change
subcommand->add_option("-j, --jobs", jobs, "The number of submodules fetched at the same time. Default is 0, which means to use git default.")->default_val(0);
subcommand->add_option("-j, --jobs", jobs, "The number of submodules cloned in parallel. Default is 0, use cpu count.")->default_val(0);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like that because of if git going to ever change it we should do the same. Also I'm not sure this is same for all git versions so I would rather leave that to git. Your statement sounds like more specific but not 100% correct in all cases. my git says:
-j <n>, --jobs <n> The number of submodules fetched at the same time. Defaults to the submodule.fetchJobs option.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point.But I'm not sure sending -j0 uses git's default either.

After more investigation, I don't think --jobs is used unless --recurse-submodules is also specified. We don't do that. I am less certain that this is the right answer for #28.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe let's just remove it at all? Any clue why it was added? It seems to me this is useless. At least in mvp.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No clue. I believe removal is appropriate. Our code will be simpler and more maintainable without jobs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I removed its usage for clone however it was also used for cmake build so I set it to processors number by default if specifying zero

subcommand->add_flag("-c, --clean", clean, "This will force a clean build.")->default_val(false);
}

Expand Down