Skip to content

Commit

Permalink
fix(config/build_info_plugin): referenced but unavailable resources s…
Browse files Browse the repository at this point in the history
…hould also be recorded

optional dependencies, for example the auto-patched `*.custom.yaml` need to be checked for changes
  • Loading branch information
lotem committed Feb 19, 2018
1 parent c2fd0cf commit cd46f7a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/rime/config/build_info_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@ bool BuildInfoPlugin::ReviewLinkOutput(
auto timestamps = build_info["timestamps"];
compiler->EnumerateResources([&](an<ConfigResource> resource) {
if (!resource->loaded) {
LOG(WARNING) << "resource '" << resource->resource_id << "' not loaded.";
LOG(INFO) << "resource '" << resource->resource_id << "' not loaded.";
timestamps[resource->resource_id] = 0;
return;
}
auto file_name = resource->data->file_name();
if (file_name.empty()) {
LOG(WARNING) << "resource '" << resource->resource_id
<< "' is not persisted.";
timestamps[resource->resource_id] = 0;
return;
}
// TODO: store as 64-bit number to avoid the year 2038 problem
Expand Down
4 changes: 2 additions & 2 deletions src/rime/lever/deployment_tasks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -385,14 +385,14 @@ static bool ConfigNeedsUpdate(Config* config) {
for (auto entry : *timestamps.AsMap()) {
fs::path source_file_path = resolver->ResolvePath(entry.first);
if (!fs::exists(source_file_path)) {
LOG(INFO) << "source file not exists: " << source_file_path.string();
LOG(INFO) << "source file no longer exists: " << source_file_path.string();
return true;
}
auto value = As<ConfigValue>(entry.second);
int recorded_time = 0;
if (!value || !value->GetInt(&recorded_time) ||
recorded_time != (int) fs::last_write_time(source_file_path)) {
LOG(INFO) << "timestamp mismatch: " << source_file_path.string();
LOG(INFO) << "source file changed: " << source_file_path.string();
return true;
}
}
Expand Down

0 comments on commit cd46f7a

Please sign in to comment.