Skip to content

Commit

Permalink
Remove implicit disabling of schema const for file-relative includes
Browse files Browse the repository at this point in the history
Summary:
Require explicit annotation to reduce surprises
#buildsonlynotests #buildall

Reviewed By: createdbysk

Differential Revision: D67605693

fbshipit-source-id: eb557d2d36031a5ae542b876e94e7647780147bf
  • Loading branch information
iahs authored and facebook-github-bot committed Dec 26, 2024
1 parent 10e0583 commit 2ac58b8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -777,18 +777,7 @@ class cpp_mstch_program : public mstch_program {
// If you don't have a schema const you don't need schema includes.
::apache::thrift::compiler::has_schema(sm_, *program_) &&
// Opting out of schema const should disable all of its failure modes.
!program->find_structured_annotation_or_null(
kDisableSchemaConstUri) &&
// File-relative includes break schema const naming,
// so exclude programs with includes that don't contain a path
// separator.
std::all_of(
program->includes().begin(),
program->includes().end(),
[](const t_include* inc) {
auto path = inc->raw_path();
return std::find(path.begin(), path.end(), '/') != path.end();
});
!program->find_structured_annotation_or_null(kDisableSchemaConstUri);
return std::make_unique<strong_bool>(static_cast<strong_bool>(ret));
});
return static_cast<bool>(supports);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ ::std::string_view _fbthrift_schema_b747839c13cb3aa5() {


::folly::Range<const ::std::string_view*> _fbthrift_schema_b747839c13cb3aa5_includes() {
return {};
static const ::std::array<::std::string_view, 2> includes = {
_fbthrift_schema_b747839c13cb3aa5(),
::apache::thrift::detail::mc::readSchema(::cpp2::include_constants::_fbthrift_schema_8569dfae849b43aa),
};
return ::folly::range(includes);
}

} // namespace module_constants
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ ::std::string_view _fbthrift_schema_b747839c13cb3aa5() {


::folly::Range<const ::std::string_view*> _fbthrift_schema_b747839c13cb3aa5_includes() {
return {};
static const ::std::array<::std::string_view, 2> includes = {
_fbthrift_schema_b747839c13cb3aa5(),
::apache::thrift::detail::mc::readSchema(::cpp2::include_constants::_fbthrift_schema_8569dfae849b43aa),
};
return ::folly::range(includes);
}

} // namespace module_constants
Expand Down

0 comments on commit 2ac58b8

Please sign in to comment.