Skip to content

Commit

Permalink
Move out 'ide_fast_path' hadling from Build to client. Add per input_…
Browse files Browse the repository at this point in the history
…setting_pair building.
  • Loading branch information
egorpugin committed Mar 20, 2024
1 parent 5731481 commit e78e441
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 19 deletions.
39 changes: 39 additions & 0 deletions src/sw/client/common/command/build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,45 @@ SUBCOMMAND_DECL(build)
return;
}

// for ide use slightly different building
// one input per call
if (1
&& !getOptions().options_build.ide_fast_path.empty()
&& !getOptions().options_build.ide_copy_to_dir.empty()
&& !getOptions().input_settings_pairs.empty()) {
FilesSorted fast_path_files;
Strings s;
for (auto &&p : getOptions().input_settings_pairs)
{
s.push_back(p);
if (s.size() == 2)
{
LOG_INFO(logger, "Building " << s[0]);
auto b = createBuild({getInputs(), s});
b->build();
fast_path_files.merge(b->fast_path_files);
s.clear();
}
}
{
String s;
for (auto &f : fast_path_files)
s += to_string(normalize_path(f)) + "\n";
write_file(getOptions().options_build.ide_fast_path, s);

uint64_t mtime = 0;
for (auto &f : fast_path_files)
{
auto lwt = fs::last_write_time(f);
mtime ^= file_time_type2time_t(lwt);
}
path fmtime = getOptions().options_build.ide_fast_path;
fmtime += ".t";
write_file(fmtime, std::to_string(mtime));
}
return;
}

// defaults or only one of build_arg and -S specified
// -S == build_arg
// -B == fs::current_path()
Expand Down
19 changes: 0 additions & 19 deletions src/sw/core/build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -776,25 +776,6 @@ void SwBuild::execute(ExecutionPlan &p) const

if (build_settings["time_trace"] == "true")
p.saveChromeTrace(getBuildDirectory() / "misc" / "time_trace.json");

path ide_fast_path = build_settings["build_ide_fast_path"].isValue() ? build_settings["build_ide_fast_path"].getValue() : "";
if (!ide_fast_path.empty())
{
String s;
for (auto &f : fast_path_files)
s += to_string(normalize_path(f)) + "\n";
write_file(ide_fast_path, s);

uint64_t mtime = 0;
for (auto &f : fast_path_files)
{
auto lwt = fs::last_write_time(f);
mtime ^= file_time_type2time_t(lwt);
}
path fmtime = ide_fast_path;
fmtime += ".t";
write_file(fmtime, std::to_string(mtime));
}
}

Commands SwBuild::getCommands() const
Expand Down
2 changes: 2 additions & 0 deletions src/sw/core/build.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ struct SW_CORE_API SwBuild : SwBuilderContext

// other data
String name;
public:
mutable FilesSorted fast_path_files;
private:

Commands getCommands() const;
void loadPackages(const TargetMap &predefined);
Expand Down

0 comments on commit e78e441

Please sign in to comment.