Merge changes Ic85de603,I57311234,I28fd8637
* changes:
gn2bp: Use startswith instead of regex
gn2bp: Remove unused condition for src path filtering
gn2bp: Use "out" prefix for src path filtering
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index deb8f8a..bc429f5 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -1247,8 +1247,7 @@
# aosp / soong builds and b) the include directory should already be
# configured via library dependency.
module.local_include_dirs.update([gn_utils.label_to_path(d)
- for d in include_dirs
- if not re.match('^//out/.*', d)])
+ for d in include_dirs if not d.startswith('//out')])
# Remove prohibited include directories
module.local_include_dirs = [d for d in module.local_include_dirs
if d not in local_include_dirs_denylist]
@@ -1310,17 +1309,13 @@
blueprint.add_module(module)
module.init_rc = target_initrc.get(target.name, [])
- module.srcs.update(
- gn_utils.label_to_path(src)
- for src in target.sources
- if is_supported_source_file(src) and not src.startswith("//out/test"))
+ module.srcs.update(gn_utils.label_to_path(src)
+ for src in target.sources if is_supported_source_file(src))
# Add arch-specific properties
for arch_name, arch in target.arch.items():
- module.target[arch_name].srcs.update(
- gn_utils.label_to_path(src)
- for src in arch.sources
- if is_supported_source_file(src) and not src.startswith("//out/test"))
+ module.target[arch_name].srcs.update(gn_utils.label_to_path(src)
+ for src in arch.sources if is_supported_source_file(src))
module.rtti = target.rtti
diff --git a/tools/gn2bp/gn_utils.py b/tools/gn2bp/gn_utils.py
index e5d2bf4..3d709e5 100644
--- a/tools/gn2bp/gn_utils.py
+++ b/tools/gn2bp/gn_utils.py
@@ -78,7 +78,7 @@
return name
def _is_java_source(src):
- return os.path.splitext(src)[1] == '.java' and not src.startswith("//out/test/gen/")
+ return os.path.splitext(src)[1] == '.java' and not src.startswith("//out/")
def is_java_action(script, outputs):
return (script != "" and script not in JAVA_BANNED_SCRIPTS) and any(