-
Notifications
You must be signed in to change notification settings - Fork 556
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(config): add config compiler plugin that includes default:/menu …
…into schema
- Loading branch information
Showing
4 changed files
with
39 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// Copyright RIME Developers | ||
// Distributed under the BSD License | ||
// | ||
#include <boost/algorithm/string.hpp> | ||
#include <rime/config/config_compiler_impl.h> | ||
#include <rime/config/config_cow_ref.h> | ||
#include <rime/config/plugins.h> | ||
|
||
namespace rime { | ||
|
||
bool DefaultConfigPlugin::ReviewCompileOutput( | ||
ConfigCompiler* compiler, an<ConfigResource> resource) { | ||
return true; | ||
} | ||
|
||
bool DefaultConfigPlugin::ReviewLinkOutput( | ||
ConfigCompiler* compiler, an<ConfigResource> resource) { | ||
if (!boost::ends_with(resource->resource_id, ".schema")) | ||
return true; | ||
auto target = Cow(resource, "menu"); | ||
Reference reference{"default", "menu", true}; | ||
if (!IncludeReference{reference} | ||
.TargetedAt(target).Resolve(compiler)) { | ||
LOG(ERROR) << "failed to include section " << reference; | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
} // namespace rime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters