aboutsummaryrefslogtreecommitdiff
path: root/java/java_test.go
diff options
context:
space:
mode:
authorSam Delmerico <delmerico@google.com>2022-05-24 17:10:02 +0000
committerSam Delmerico <delmerico@google.com>2022-08-25 14:47:41 -0400
commit2351eacb19faed3867903e1ddfa2992f7a787d02 (patch)
tree7471023a3c2b892d6b75c0481032749df8ec18db /java/java_test.go
parent97bd12745766082ed6b1f6dc3d6f135c237eba49 (diff)
AIDL source generation accounts for Bazel paths
The AIDL source generation rule sets include flags based on the relative path of .aidl sources. For .aidl sources provided by Bazel targets, e.g. in a filegroup, the same directory could be added to the include path twice. Instead we need to ensure that if a Bazel source provides the include path, that we don't add it again from a Soong source. Bug: 229251008 Test: USE_BAZEL_ANALYSIS=1 m api-stubs-docs-non-updatable Change-Id: I4997039003242b43e0e52ccf41729acb4ad11324
Diffstat (limited to 'java/java_test.go')
-rw-r--r--java/java_test.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/java/java_test.go b/java/java_test.go
index bfd97eb0d..7f0cea718 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -1747,3 +1747,37 @@ func TestImportMixedBuild(t *testing.T) {
android.AssertDeepEquals(t, "Implementation/Resources JARs are produced", expectedOutputFiles, android.NormalizePathsForTesting(javaInfo.ImplementationAndResourcesJars))
android.AssertDeepEquals(t, "Implementation JARs are produced", expectedOutputFiles, android.NormalizePathsForTesting(javaInfo.ImplementationJars))
}
+
+func TestGenAidlIncludeFlagsForMixedBuilds(t *testing.T) {
+ bazelOutputBaseDir := filepath.Join("out", "bazel")
+ result := android.GroupFixturePreparers(
+ PrepareForIntegrationTestWithJava,
+ android.FixtureModifyConfig(func(config android.Config) {
+ config.BazelContext = android.MockBazelContext{
+ OutputBaseDir: bazelOutputBaseDir,
+ }
+ }),
+ ).RunTest(t)
+
+ ctx := &android.TestPathContext{TestResult: result}
+
+ srcDirectory := filepath.Join("frameworks", "base")
+ srcDirectoryAlreadyIncluded := filepath.Join("frameworks", "base", "core", "java")
+ bazelSrcDirectory := android.PathForBazelOut(ctx, srcDirectory)
+ bazelSrcDirectoryAlreadyIncluded := android.PathForBazelOut(ctx, srcDirectoryAlreadyIncluded)
+ srcs := android.Paths{
+ android.PathForTestingWithRel(bazelSrcDirectory.String(), "bazelAidl.aidl"),
+ android.PathForTestingWithRel(bazelSrcDirectory.String(), "bazelAidl2.aidl"),
+ android.PathForTestingWithRel(bazelSrcDirectoryAlreadyIncluded.String(), "bazelAidlExclude.aidl"),
+ android.PathForTestingWithRel(bazelSrcDirectoryAlreadyIncluded.String(), "bazelAidl2Exclude.aidl"),
+ }
+ dirsAlreadyIncluded := android.Paths{
+ android.PathForTesting(srcDirectoryAlreadyIncluded),
+ }
+
+ expectedFlags := " -Iout/bazel/execroot/__main__/frameworks/base"
+ flags := genAidlIncludeFlags(ctx, srcs, dirsAlreadyIncluded)
+ if flags != expectedFlags {
+ t.Errorf("expected flags to be %q; was %q", expectedFlags, flags)
+ }
+}