diff options
-rw-r--r-- | android/allowlists/allowlists.go | 2 | ||||
-rw-r--r-- | android/bazel_handler.go | 4 | ||||
-rw-r--r-- | apex/androidmk.go | 12 | ||||
-rw-r--r-- | apex/apex_test.go | 20 | ||||
-rw-r--r-- | bazel/cquery/request_type.go | 8 | ||||
-rw-r--r-- | cc/cc.go | 5 | ||||
-rw-r--r-- | cc/library.go | 2 |
7 files changed, 41 insertions, 12 deletions
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go index 529285fea..16f144e93 100644 --- a/android/allowlists/allowlists.go +++ b/android/allowlists/allowlists.go @@ -1349,5 +1349,5 @@ var ( // Staging-mode allowlist. Modules in this list are only built // by Bazel with --bazel-mode-staging. This list should contain modules // which will soon be added to the prod allowlist. - StagingMixedBuildsEnabledList = []string{} + StagingMixedBuildsEnabledList = []string{"com.android.tzdata"} ) diff --git a/android/bazel_handler.go b/android/bazel_handler.go index a2e4581fb..eec78d255 100644 --- a/android/bazel_handler.go +++ b/android/bazel_handler.go @@ -571,7 +571,9 @@ func (r *builtinBazelRunner) createBazelCommand(paths *bazelPaths, runName bazel // Suppress noise "--ui_event_filters=-INFO", - "--noshow_progress"} + "--noshow_progress", + "--norun_validations", + } cmdFlags = append(cmdFlags, extraFlags...) bazelCmd := exec.Command(paths.bazelPath, cmdFlags...) diff --git a/apex/androidmk.go b/apex/androidmk.go index ea42c3ccf..3373211a0 100644 --- a/apex/androidmk.go +++ b/apex/androidmk.go @@ -339,14 +339,14 @@ func (a *apexBundle) writeRequiredModules(w io.Writer, moduleNames []string) { func (a *apexBundle) androidMkForType() android.AndroidMkData { return android.AndroidMkData{ Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) { + moduleNames := []string{} apexType := a.properties.ApexType + if a.installable() { + apexName := proptools.StringDefault(a.properties.Apex_name, name) + moduleNames = a.androidMkForFiles(w, name, apexName, moduleDir, data) + } if apexType == flattenedApex { - var moduleNames []string = nil - if a.installable() { - apexName := proptools.StringDefault(a.properties.Apex_name, name) - moduleNames = a.androidMkForFiles(w, name, apexName, moduleDir, data) - } // Only image APEXes can be flattened. fmt.Fprintln(w, "\ninclude $(CLEAR_VARS)") fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir) @@ -390,7 +390,7 @@ func (a *apexBundle) androidMkForType() android.AndroidMkData { if len(a.overridableProperties.Overrides) > 0 { fmt.Fprintln(w, "LOCAL_OVERRIDES_MODULES :=", strings.Join(a.overridableProperties.Overrides, " ")) } - a.writeRequiredModules(w, nil) + a.writeRequiredModules(w, moduleNames) fmt.Fprintln(w, "include $(BUILD_PREBUILT)") diff --git a/apex/apex_test.go b/apex/apex_test.go index 7b4371f23..985ad591f 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -527,6 +527,7 @@ func TestBasicApex(t *testing.T) { data.Custom(&builder, ab.BaseModuleName(), "TARGET_", "", data) androidMk := builder.String() + ensureContains(t, androidMk, "LOCAL_MODULE := mylib.myapex\n") ensureNotContains(t, androidMk, "LOCAL_MODULE := mylib.com.android.myapex\n") optFlags := apexRule.Args["opt_flags"] @@ -4125,6 +4126,7 @@ func TestApexName(t *testing.T) { var builder strings.Builder data.Custom(&builder, name, prefix, "", data) androidMk := builder.String() + ensureContains(t, androidMk, "LOCAL_MODULE := mylib.myapex\n") ensureNotContains(t, androidMk, "LOCAL_MODULE := mylib.com.android.myapex\n") } @@ -5623,6 +5625,12 @@ func TestApexWithTests(t *testing.T) { var builder strings.Builder data.Custom(&builder, name, prefix, "", data) androidMk := builder.String() + ensureContains(t, androidMk, "LOCAL_MODULE := mytest.myapex\n") + ensureContains(t, androidMk, "LOCAL_MODULE := mytest1.myapex\n") + ensureContains(t, androidMk, "LOCAL_MODULE := mytest2.myapex\n") + ensureContains(t, androidMk, "LOCAL_MODULE := mytest3.myapex\n") + ensureContains(t, androidMk, "LOCAL_MODULE := apex_manifest.pb.myapex\n") + ensureContains(t, androidMk, "LOCAL_MODULE := apex_pubkey.myapex\n") ensureContains(t, androidMk, "LOCAL_MODULE := myapex\n") flatBundle := ctx.ModuleForTests("myapex", "android_common_myapex_flattened").Module().(*apexBundle) @@ -6449,6 +6457,12 @@ func TestOverrideApex(t *testing.T) { var builder strings.Builder data.Custom(&builder, name, "TARGET_", "", data) androidMk := builder.String() + ensureContains(t, androidMk, "LOCAL_MODULE := override_app.override_myapex") + ensureContains(t, androidMk, "LOCAL_MODULE := overrideBpf.o.override_myapex") + ensureContains(t, androidMk, "LOCAL_MODULE := apex_manifest.pb.override_myapex") + ensureContains(t, androidMk, "LOCAL_MODULE := override_bcplib.override_myapex") + ensureContains(t, androidMk, "LOCAL_MODULE := override_systemserverlib.override_myapex") + ensureContains(t, androidMk, "LOCAL_MODULE := override_java_library.override_myapex") ensureContains(t, androidMk, "LOCAL_MODULE_STEM := override_myapex.apex") ensureContains(t, androidMk, "LOCAL_OVERRIDES_MODULES := unknownapex myapex") ensureNotContains(t, androidMk, "LOCAL_MODULE := app.myapex") @@ -7178,17 +7192,17 @@ func TestSymlinksFromApexToSystemRequiredModuleNames(t *testing.T) { } `) - apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_flattened").Module().(*apexBundle) + apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle) data := android.AndroidMkDataForTest(t, ctx, apexBundle) var builder strings.Builder data.Custom(&builder, apexBundle.BaseModuleName(), "TARGET_", "", data) androidMk := builder.String() // `myotherlib` is added to `myapex` as symlink - ensureContains(t, androidMk, "LOCAL_MODULE := mylib.myapex.flattened\n") + ensureContains(t, androidMk, "LOCAL_MODULE := mylib.myapex\n") ensureNotContains(t, androidMk, "LOCAL_MODULE := prebuilt_myotherlib.myapex\n") ensureNotContains(t, androidMk, "LOCAL_MODULE := myotherlib.myapex\n") // `myapex` should have `myotherlib` in its required line, not `prebuilt_myotherlib` - ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES += mylib.myapex.flattened:64 myotherlib:64 apex_manifest.pb.myapex.flattened apex_pubkey.myapex.flattened\n") + ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES += mylib.myapex:64 myotherlib:64 apex_manifest.pb.myapex apex_pubkey.myapex\n") } func TestApexWithJniLibs(t *testing.T) { diff --git a/bazel/cquery/request_type.go b/bazel/cquery/request_type.go index 6c4b78b51..eb44dd18d 100644 --- a/bazel/cquery/request_type.go +++ b/bazel/cquery/request_type.go @@ -30,6 +30,7 @@ type CcInfo struct { // be a subset of OutputFiles. (or shared libraries, this will be equal to OutputFiles, // but general cc_library will also have dynamic libraries in output files). RootDynamicLibraries []string + TidyFiles []string TocFile string UnstrippedOutput string } @@ -165,6 +166,12 @@ else: # NOTE: It's OK if there's no ToC, as Soong just uses it for optimization pass +tidy_files = [] +p = providers(target) +clang_tidy_info = p.get("//build/bazel/rules/cc:clang_tidy.bzl%ClangTidyInfo") +if clang_tidy_info: + tidy_files = [v.path for v in clang_tidy_info.tidy_files.to_list()] + return json_encode({ "OutputFiles": outputFiles, "CcObjectFiles": ccObjectFiles, @@ -175,6 +182,7 @@ return json_encode({ "Headers": headers, "RootStaticArchives": rootStaticArchives, "RootDynamicLibraries": rootSharedLibraries, + "TidyFiles": tidy_files, "TocFile": toc_file, "UnstrippedOutput": unstripped, })` @@ -1853,6 +1853,11 @@ func (c *Module) IsMixedBuildSupported(ctx android.BaseModuleContext) bool { func (c *Module) ProcessBazelQueryResponse(ctx android.ModuleContext) { bazelModuleLabel := c.getBazelModuleLabel(ctx) + bazelCtx := ctx.Config().BazelContext + if ccInfo, err := bazelCtx.GetCcInfo(bazelModuleLabel, android.GetConfigKey(ctx)); err == nil { + c.tidyFiles = android.PathsForBazelOut(ctx, ccInfo.TidyFiles) + } + c.bazelHandler.ProcessBazelQueryResponse(ctx, bazelModuleLabel) c.Properties.SubName = GetSubnameProperty(ctx, c) diff --git a/cc/library.go b/cc/library.go index aefb80458..ef10e7cc2 100644 --- a/cc/library.go +++ b/cc/library.go @@ -956,7 +956,7 @@ func GlobHeadersForSnapshot(ctx android.ModuleContext, paths android.Paths) andr for _, path := range paths { dir := path.String() // Skip if dir is for generated headers - if strings.HasPrefix(dir, android.PathForOutput(ctx).String()) { + if strings.HasPrefix(dir, ctx.Config().OutDir()) { continue } |