Skip to content

Commit ff3d5e9

Browse files
committed
fix(deploy): treat schema dependencies as optional; do not report errors if missing
1 parent 61e7e2c commit ff3d5e9

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/rime/lever/deployment_tasks.cc

+10-4
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ bool WorkspaceUpdate::Run(Deployer* deployer) {
187187
the<ResourceResolver> resolver(
188188
Service::instance().CreateResourceResolver(
189189
{"schema", "", ".schema.yaml"}));
190-
auto build_schema = [&](const string& schema_id) {
190+
auto build_schema = [&](const string& schema_id, bool as_dependency = false) {
191191
if (schemas.find(schema_id) != schemas.end()) // already built
192192
return;
193193
LOG(INFO) << "schema: " << schema_id;
@@ -199,8 +199,13 @@ bool WorkspaceUpdate::Run(Deployer* deployer) {
199199
else {
200200
schema_path = schemas[schema_id];
201201
}
202-
if (schema_path.empty()) {
203-
LOG(WARNING) << "missing schema file for '" << schema_id << "'.";
202+
if (schema_path.empty() || !fs::exists(schema_path)) {
203+
if (as_dependency) {
204+
LOG(WARNING) << "missing input schema; skipped unsatisfied dependency: " << schema_id;
205+
} else {
206+
LOG(ERROR) << "missing input schema: " << schema_id;
207+
++failure;
208+
}
204209
return;
205210
}
206211
the<DeploymentTask> t(new SchemaUpdate(schema_path));
@@ -228,7 +233,8 @@ bool WorkspaceUpdate::Run(Deployer* deployer) {
228233
if (!dependency)
229234
continue;
230235
const string& dependency_id = dependency->str();
231-
build_schema(dependency_id);
236+
bool as_dependency = true;
237+
build_schema(dependency_id, as_dependency);
232238
}
233239
}
234240
}

0 commit comments

Comments
 (0)