@@ -18,12 +18,12 @@ def cc_toolchain_test_suite(name):
1818 test_suite (
1919 name = name ,
2020 tests = [
21- _test_cc_toolchain_uses_full_protoc_when_prefer_prebuilt_flag_set ,
22- _test_cc_toolchain_uses_protoc_minimal_by_default ,
21+ _test_cc_toolchain_uses_protoc_minimal_when_prefer_prebuilt_flag_unset ,
22+ _test_cc_toolchain_uses_full_protoc_by_default ,
2323 ],
2424 )
2525
26- def _test_cc_toolchain_uses_full_protoc_when_prefer_prebuilt_flag_set (name ):
26+ def _test_cc_toolchain_uses_protoc_minimal_when_prefer_prebuilt_flag_unset (name ):
2727 util .helper_target (
2828 proto_library ,
2929 name = name + "_proto" ,
@@ -39,21 +39,19 @@ def _test_cc_toolchain_uses_full_protoc_when_prefer_prebuilt_flag_set(name):
3939 analysis_test (
4040 name = name ,
4141 target = name + "_compile" ,
42- impl = _test_cc_toolchain_uses_full_protoc_when_prefer_prebuilt_flag_set_impl ,
43- config_settings = {_PREFER_PREBUILT_PROTOC : True },
42+ impl = _test_cc_toolchain_uses_protoc_minimal_when_prefer_prebuilt_flag_unset_impl ,
43+ config_settings = {_PREFER_PREBUILT_PROTOC : False },
4444 )
4545
46- def _test_cc_toolchain_uses_full_protoc_when_prefer_prebuilt_flag_set_impl (env , target ):
46+ def _test_cc_toolchain_uses_protoc_minimal_when_prefer_prebuilt_flag_unset_impl (env , target ):
4747 # Find the compile action
4848 action = env .expect .that_target (target ).action_named ("GenProto" )
4949
50- # When prefer_prebuilt_protoc is True, protoc_minimal_do_not_use is None,
51- # so the cc_toolchain should use the full protoc (not protoc_minimal).
52- # The protoc path should end with "/protoc" not contain "protoc_minimal"
53- action .argv ().contains_predicate (matching .str_matches ("*/protoc" ))
54- action .argv ().not_contains_predicate (matching .str_matches ("*protoc_minimal*" ))
50+ # When prefer_prebuilt_protoc is False, protoc_minimal_do_not_use is set,
51+ # so the cc_toolchain should use protoc_minimal.
52+ action .argv ().contains_predicate (matching .str_matches ("*protoc_minimal*" ))
5553
56- def _test_cc_toolchain_uses_protoc_minimal_by_default (name ):
54+ def _test_cc_toolchain_uses_full_protoc_by_default (name ):
5755 util .helper_target (
5856 proto_library ,
5957 name = name + "_proto" ,
@@ -69,13 +67,15 @@ def _test_cc_toolchain_uses_protoc_minimal_by_default(name):
6967 analysis_test (
7068 name = name ,
7169 target = name + "_compile" ,
72- impl = _test_cc_toolchain_uses_protoc_minimal_by_default_impl ,
70+ impl = _test_cc_toolchain_uses_full_protoc_by_default_impl ,
7371 )
7472
75- def _test_cc_toolchain_uses_protoc_minimal_by_default_impl (env , target ):
73+ def _test_cc_toolchain_uses_full_protoc_by_default_impl (env , target ):
7674 # Find the compile action
7775 action = env .expect .that_target (target ).action_named ("GenProto" )
7876
79- # By default (prefer_prebuilt_protoc is False), protoc_minimal_do_not_use is set,
80- # so the cc_toolchain should use protoc_minimal.
81- action .argv ().contains_predicate (matching .str_matches ("*protoc_minimal*" ))
77+ # By default (prefer_prebuilt_protoc is True), protoc_minimal_do_not_use is None,
78+ # so the cc_toolchain should use the full protoc (not protoc_minimal).
79+ # The protoc path should end with "/protoc" not contain "protoc_minimal"
80+ action .argv ().contains_predicate (matching .str_matches ("*/protoc" ))
81+ action .argv ().not_contains_predicate (matching .str_matches ("*protoc_minimal*" ))
0 commit comments