From 79ff08f12c2368ba8358ea0eab57816100808172 Mon Sep 17 00:00:00 2001 From: Liz Kammer Date: Wed, 27 Sep 2023 14:43:45 -0400 Subject: [PATCH] Expand regex for likely aidl filegroups Test: go test soong tests Change-Id: Iab7abea8e2d11583cb4a8ecd4b27368f61dd40e0 --- android/filegroup.go | 2 +- bp2build/java_library_conversion_test.go | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/android/filegroup.go b/android/filegroup.go index 5a8c4b9bc..1e2edcb2d 100644 --- a/android/filegroup.go +++ b/android/filegroup.go @@ -51,7 +51,7 @@ var ( // ignoring case, checks for proto or protos as an independent word in the name, whether at the // beginning, end, or middle. e.g. "proto.foo", "bar-protos", "baz_proto_srcs" would all match filegroupLikelyProtoPattern = regexp.MustCompile("(?i)(^|[^a-z])proto(s)?([^a-z]|$)") - filegroupLikelyAidlPattern = regexp.MustCompile("(?i)(^|[^a-z])aidl([^a-z]|$)") + filegroupLikelyAidlPattern = regexp.MustCompile("(?i)(^|[^a-z])aidl(s)?([^a-z]|$)") ProtoSrcLabelPartition = bazel.LabelPartition{ Extensions: []string{".proto"}, diff --git a/bp2build/java_library_conversion_test.go b/bp2build/java_library_conversion_test.go index 7e4e44ec8..38571d4cc 100644 --- a/bp2build/java_library_conversion_test.go +++ b/bp2build/java_library_conversion_test.go @@ -567,12 +567,20 @@ filegroup { "b.aidl", ], } +filegroup { + name: "aidls_files", + srcs: [ + "a.aidl", + "b.aidl", + ], +} java_library { name: "example_lib", srcs: [ "a.java", "b.java", ":aidl_files", + ":aidls_files", ":random_other_files", ], sdk_version: "current", @@ -583,11 +591,21 @@ java_library { "srcs": `[ "a.aidl", "b.aidl", + ]`, + "tags": `["apex_available=//apex_available:anyapex"]`, + }), + MakeBazelTargetNoRestrictions("aidl_library", "aidls_files", AttrNameToString{ + "srcs": `[ + "a.aidl", + "b.aidl", ]`, "tags": `["apex_available=//apex_available:anyapex"]`, }), MakeBazelTarget("java_aidl_library", "example_lib_java_aidl_library", AttrNameToString{ - "deps": `[":aidl_files"]`, + "deps": `[ + ":aidl_files", + ":aidls_files", + ]`, }), MakeBazelTarget("java_library", "example_lib", AttrNameToString{ "deps": `[":example_lib_java_aidl_library"]`,