renamed master_ini_filename() to default_ini_filename()

it's also used for the anchor dropped in the prefix
This commit is contained in:
isanae
2020-11-09 03:43:37 -05:00
parent cfa796fb41
commit 60e02da1d4
5 changed files with 42 additions and 17 deletions
+25 -11
View File
@@ -153,17 +153,7 @@ int build_command::do_run()
{
try
{
// Create a mob.ini in the build folder.
if (!exists(paths::prefix())) {
create_directory(paths::prefix());
}
auto prefix_ini = paths::prefix() / "mob.ini";
if (!exists(prefix_ini))
{
std::ofstream out(prefix_ini);
out << "[paths]\n" << "prefix = .\n";
}
create_prefix_ini();
run_all_tasks();
if (do_timings)
@@ -182,12 +172,36 @@ int build_command::do_run()
}
}
void build_command::create_prefix_ini()
{
// creating prefix
if (!exists(paths::prefix()))
op::create_directories(gcx(), paths::prefix());
const auto ini = paths::prefix() / default_ini_filename();
if (!exists(ini))
{
std::ofstream(ini)
<< "[paths]\n"
<< "prefix = .\n";
}
}
void build_command::dump_timings()
{
using namespace std::chrono;
std::ofstream out("timings.txt");
// generates a file with line being "task,start_time,end_time,step"
//
// uibase,0,1,fetch
// uibase,1,2,configure
// uibase,2,3,build
// modorganizer,4,5,fetch
// modorganizer,5,6,configure
// modorganizer,6,7,build
auto write = [&](auto&& inst)
{
for (auto&& t : inst.instrumented_tasks())
+2 -2
View File
@@ -67,7 +67,7 @@ command::command(flags f)
clipp::group command::common_options_group()
{
auto& o = common;
const auto master = master_ini_filename();
const auto master = default_ini_filename();
return
(clipp::repeatable(clipp::option("-i", "--ini")
@@ -290,7 +290,7 @@ int help_command::do_run()
#pragma warning(suppress: 4548)
auto doc = (command::common_options_group(), (clipp::value("command")));
const auto master = master_ini_filename();
const auto master = default_ini_filename();
help(doc,
"Commands:\n"
+11
View File
@@ -194,6 +194,9 @@ public:
build_command();
meta_t meta() const override;
// kills any msbuild.exe process, they like to linger and keep file locks
//
static void terminate_msbuild();
protected:
@@ -216,6 +219,14 @@ private:
bool keep_msbuild_ = false;
std::optional<bool> revert_ts_;
// creates a bare bones ini file in the prefix so mob can be invoked in any
// directory below it
//
void create_prefix_ini();
// for instrumentation
//
void dump_timings();
};
+3 -3
View File
@@ -14,7 +14,7 @@ int conf::output_log_level_ = 3;
int conf::file_log_level_ = 5;
bool conf::dry_ = false;
std::string master_ini_filename()
std::string default_ini_filename()
{
return "mob.ini";
}
@@ -938,7 +938,7 @@ std::vector<fs::path> find_inis(
u8cout << "root is " << path_to_utf8(r) << "\n";
}
master = find_in_root(master_ini_filename());
master = find_in_root(default_ini_filename());
if (verbose)
u8cout << "found master " << path_to_utf8(master) << "\n";
@@ -983,7 +983,7 @@ std::vector<fs::path> find_inis(
auto cwd = fs::current_path();
while (!cwd.empty()) {
const auto in_cwd = cwd / master_ini_filename();
const auto in_cwd = cwd / default_ini_filename();
if (fs::exists(in_cwd) && !fs::equivalent(in_cwd, master))
{
if (verbose)
+1 -1
View File
@@ -126,7 +126,7 @@ struct paths
};
std::string master_ini_filename();
std::string default_ini_filename();
std::vector<fs::path> find_inis(
bool auto_detect, const std::vector<std::string>& from_cl,