Skip to content

Commit

Permalink
Back out "Remove implicit disabling of schema const for file-relative…
Browse files Browse the repository at this point in the history
… includes"

Summary: This diff breaks fbcode and specifically multiway/multiway conveyor. REverting it.

Differential Revision: D67692977

fbshipit-source-id: 6e64a08f42eaab0f38d508e897ddc14eb5a0a4d2
  • Loading branch information
Alex Kosau authored and facebook-github-bot committed Dec 29, 2024
1 parent bcbe2af commit f1d7916
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
13 changes: 12 additions & 1 deletion thrift/compiler/generate/t_mstch_cpp2_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,18 @@ 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);
!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();
});
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,11 +21,7 @@ ::std::string_view _fbthrift_schema_b747839c13cb3aa5() {


::folly::Range<const ::std::string_view*> _fbthrift_schema_b747839c13cb3aa5_includes() {
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);
return {};
}

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


::folly::Range<const ::std::string_view*> _fbthrift_schema_b747839c13cb3aa5_includes() {
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);
return {};
}

} // namespace module_constants
Expand Down

0 comments on commit f1d7916

Please sign in to comment.