Skip to content

Commit cd46f7a

Browse files
committed
fix(config/build_info_plugin): referenced but unavailable resources should also be recorded
optional dependencies, for example the auto-patched `*.custom.yaml` need to be checked for changes
1 parent c2fd0cf commit cd46f7a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/rime/config/build_info_plugin.cc

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@ bool BuildInfoPlugin::ReviewLinkOutput(
2222
auto timestamps = build_info["timestamps"];
2323
compiler->EnumerateResources([&](an<ConfigResource> resource) {
2424
if (!resource->loaded) {
25-
LOG(WARNING) << "resource '" << resource->resource_id << "' not loaded.";
25+
LOG(INFO) << "resource '" << resource->resource_id << "' not loaded.";
26+
timestamps[resource->resource_id] = 0;
2627
return;
2728
}
2829
auto file_name = resource->data->file_name();
2930
if (file_name.empty()) {
31+
LOG(WARNING) << "resource '" << resource->resource_id
32+
<< "' is not persisted.";
33+
timestamps[resource->resource_id] = 0;
3034
return;
3135
}
3236
// TODO: store as 64-bit number to avoid the year 2038 problem

src/rime/lever/deployment_tasks.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -385,14 +385,14 @@ static bool ConfigNeedsUpdate(Config* config) {
385385
for (auto entry : *timestamps.AsMap()) {
386386
fs::path source_file_path = resolver->ResolvePath(entry.first);
387387
if (!fs::exists(source_file_path)) {
388-
LOG(INFO) << "source file not exists: " << source_file_path.string();
388+
LOG(INFO) << "source file no longer exists: " << source_file_path.string();
389389
return true;
390390
}
391391
auto value = As<ConfigValue>(entry.second);
392392
int recorded_time = 0;
393393
if (!value || !value->GetInt(&recorded_time) ||
394394
recorded_time != (int) fs::last_write_time(source_file_path)) {
395-
LOG(INFO) << "timestamp mismatch: " << source_file_path.string();
395+
LOG(INFO) << "source file changed: " << source_file_path.string();
396396
return true;
397397
}
398398
}

0 commit comments

Comments
 (0)