Skip to content

Commit

Permalink
Add mode to accept properties disable in check
Browse files Browse the repository at this point in the history
Summary:
Add a mode that accepts the `pass_manager` flag.

This is separated out so that `redex-all` can still be used to check a config that disables the checking in the pass manager, possibly pointing out that the disable is no longer necessary.

Reviewed By: jimmycFB

Differential Revision: D47460416

fbshipit-source-id: e1e72a455057e156dcbd57c4fd7677d962ab7993
  • Loading branch information
agampe authored and facebook-github-bot committed Jul 14, 2023
1 parent 4bd9feb commit 8a8270b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tools/redex-all/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ struct Arguments {
boost::optional<int> stop_pass_idx;
RedexOptions redex_options;
bool properties_check{false};
bool properties_check_allow_disabled{false};
};

UNUSED void dump_args(const Arguments& args) {
Expand Down Expand Up @@ -319,6 +320,9 @@ Arguments parse_args(int argc, char* argv[]) {
od.add_options()(
"properties-check",
"parse configuration, perform a stack properties check and exit");
od.add_options()(
"properties-check-allow-disabled",
"accept the disable flag in the configuration");
od.add_options()("apkdir,a",
// We allow overwrites to most of the options but will take
// only the last one.
Expand Down Expand Up @@ -469,6 +473,9 @@ Arguments parse_args(int argc, char* argv[]) {
if (vm.count("properties-check")) {
args.properties_check = true;
}
if (vm.count("properties-check-allow-disabled")) {
args.properties_check_allow_disabled = true;
}

if (vm.count("dex-files")) {
args.dex_files = vm["dex-files"].as<std::vector<std::string>>();
Expand Down Expand Up @@ -1584,6 +1591,12 @@ int check_pass_properties(const Arguments& args) {
"pass_manager", (Json::Value)Json::nullValue)));
}

if (!pmc.check_pass_order_properties &&
args.properties_check_allow_disabled) {
std::cout << "Properties checks are disabled, skipping." << std::endl;
return 0;
}

auto const& all_passes = PassRegistry::get().get_passes();
auto props_manager = redex_properties::Manager(
conf, redex_properties::PropertyCheckerRegistry::get().get_checkers());
Expand Down

0 comments on commit 8a8270b

Please sign in to comment.