11#include " yaml_data_visibility_config_reader.h"
22
3+ #include " debuggee_labels.h"
34#include " jni_proxy_yamlconfigparser.h"
45#include " jni_utils.h"
56
@@ -18,11 +19,17 @@ static constexpr char kResourcePathDeprecated[] = "debugger-blacklist.yaml";
1819// - No config file is found. Sets config to ""
1920// Returns false (error) if there were multiple configurations found.
2021static bool ReadYamlConfig (ClassPathLookup* class_path_lookup,
21- std::string* config_file_name, std::string* config,
22+ std::string* config_file_name,
23+ std::string* blocklist_source, std::string* config,
2224 std::string* error) {
2325 std::set<std::string> files =
2426 class_path_lookup->ReadApplicationResource (kResourcePath );
2527
28+ if (!files.empty ()) {
29+ *config_file_name = kResourcePath ;
30+ *blocklist_source = DebuggeeLabels::kBlocklistSourceFile ;
31+ }
32+
2633 if (files.size () > 1 ) {
2734 LOG (ERROR) << " Multiple " << kResourcePath << " files found."
2835 << " Found " << files.size () << " files." ;
@@ -33,13 +40,18 @@ static bool ReadYamlConfig(ClassPathLookup* class_path_lookup,
3340 return false ;
3441 }
3542
36- if (files.size () == 1 ) {
37- *config_file_name = kResourcePath ;
38- } else {
39- // TODO: Finalize the conversion to blocklist, this else block
40- // can be removed.
43+ // TODO: Finalize the conversion to blocklist, this block can be
44+ // removed.
45+ if (files.empty ()) {
4146 files = class_path_lookup->ReadApplicationResource (kResourcePathDeprecated );
4247
48+ if (!files.empty ()) {
49+ *config_file_name = kResourcePathDeprecated ;
50+ *blocklist_source = DebuggeeLabels::kBlocklistSourceDeprecatedFile ;
51+ LOG (WARNING) << " The use of debugger-blacklist.yaml has been deprecated, "
52+ " please use debugger-blocklist instead" ;
53+ }
54+
4355 if (files.size () > 1 ) {
4456 LOG (ERROR) << " Multiple " << kResourcePathDeprecated << " files found."
4557 << " Found " << files.size () << " files." ;
@@ -48,18 +60,13 @@ static bool ReadYamlConfig(ClassPathLookup* class_path_lookup,
4860 " Please contact your system administrator." ;
4961 return false ;
5062 }
51-
52- if (files.size () == 1 ) {
53- *config_file_name = kResourcePathDeprecated ;
54- LOG (WARNING) << " The use of debugger-blacklist.yaml has been deprecated, "
55- " please use debugger-blocklist instead" ;
56- }
5763 }
5864
5965 if (files.empty ()) {
6066 // No configuration file was provided
6167 LOG (INFO) << kResourcePath << " was not found. Using default settings." ;
6268 *config = " " ;
69+ *blocklist_source = DebuggeeLabels::kBlocklistSourceNone ;
6370 } else {
6471 *config = *files.begin ();
6572 }
@@ -136,14 +143,14 @@ static bool ParseYamlConfig(const std::string& yaml_config,
136143}
137144
138145GlobDataVisibilityPolicy::Config ReadYamlDataVisibilityConfiguration (
139- ClassPathLookup* class_path_lookup) {
146+ ClassPathLookup* class_path_lookup, std::string* blocklist_source ) {
140147 GlobDataVisibilityPolicy::Config config;
141148
142149 std::string yaml_config;
143150 std::string config_file_name;
144151 std::string error;
145- if (!ReadYamlConfig (class_path_lookup, &config_file_name, &yaml_config,
146- &error)) {
152+ if (!ReadYamlConfig (class_path_lookup, &config_file_name,
153+ blocklist_source, &yaml_config, &error)) {
147154 config.parse_error = error;
148155 return config;
149156 }
0 commit comments