Skip to content

Commit

Permalink
fix(deploy): treat schema dependencies as optional; do not report err…
Browse files Browse the repository at this point in the history
…ors if missing
  • Loading branch information
lotem committed Jun 6, 2019
1 parent 61e7e2c commit ff3d5e9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/rime/lever/deployment_tasks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ bool WorkspaceUpdate::Run(Deployer* deployer) {
the<ResourceResolver> resolver(
Service::instance().CreateResourceResolver(
{"schema", "", ".schema.yaml"}));
auto build_schema = [&](const string& schema_id) {
auto build_schema = [&](const string& schema_id, bool as_dependency = false) {
if (schemas.find(schema_id) != schemas.end()) // already built
return;
LOG(INFO) << "schema: " << schema_id;
Expand All @@ -199,8 +199,13 @@ bool WorkspaceUpdate::Run(Deployer* deployer) {
else {
schema_path = schemas[schema_id];
}
if (schema_path.empty()) {
LOG(WARNING) << "missing schema file for '" << schema_id << "'.";
if (schema_path.empty() || !fs::exists(schema_path)) {
if (as_dependency) {
LOG(WARNING) << "missing input schema; skipped unsatisfied dependency: " << schema_id;
} else {
LOG(ERROR) << "missing input schema: " << schema_id;
++failure;
}
return;
}
the<DeploymentTask> t(new SchemaUpdate(schema_path));
Expand Down Expand Up @@ -228,7 +233,8 @@ bool WorkspaceUpdate::Run(Deployer* deployer) {
if (!dependency)
continue;
const string& dependency_id = dependency->str();
build_schema(dependency_id);
bool as_dependency = true;
build_schema(dependency_id, as_dependency);
}
}
}
Expand Down

0 comments on commit ff3d5e9

Please sign in to comment.