Loading android/bazel.go +12 −0 Original line number Diff line number Diff line Loading @@ -526,3 +526,15 @@ func GetMainClassInManifest(c Config, filepath string) (string, error) { return "", errors.New("Main-Class is not found.") } func AttachValidationActions(ctx ModuleContext, outputFilePath Path, validations Paths) ModuleOutPath { validatedOutputFilePath := PathForModuleOut(ctx, "validated", outputFilePath.Base()) ctx.Build(pctx, BuildParams{ Rule: CpNoPreserveSymlink, Description: "run validations " + outputFilePath.Base(), Output: validatedOutputFilePath, Input: outputFilePath, Validations: validations, }) return validatedOutputFilePath } android/defs.go +8 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,14 @@ var ( }, "cpFlags", "extraCmds") // A copy rule that doesn't preserve symlinks. CpNoPreserveSymlink = pctx.AndroidStaticRule("CpNoPreserveSymlink", blueprint.RuleParams{ Command: "rm -f $out && cp $cpFlags $in $out$extraCmds", Description: "cp $out", }, "cpFlags", "extraCmds") // A copy rule that only updates the output if it changed. CpIfChanged = pctx.AndroidStaticRule("CpIfChanged", blueprint.RuleParams{ Loading apex/apex.go +5 −0 Original line number Diff line number Diff line Loading @@ -1966,6 +1966,11 @@ func (a *apexBundle) ProcessBazelQueryResponse(ctx android.ModuleContext) { } a.outputFile = a.outputApexFile if len(outputs.TidyFiles) > 0 { tidyFiles := android.PathsForBazelOut(ctx, outputs.TidyFiles) a.outputFile = android.AttachValidationActions(ctx, a.outputFile, tidyFiles) } // TODO(b/257829940): These are used by the apex_keys_text singleton; would probably be a clearer // interface if these were set in a provider rather than the module itself a.publicKeyFile = android.PathForBazelOut(ctx, outputs.BundleKeyInfo[0]) Loading bazel/cquery/request_type.go +16 −2 Original line number Diff line number Diff line Loading @@ -180,7 +180,7 @@ else: tidy_files = [] 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()] tidy_files = [v.path for v in clang_tidy_info.transitive_tidy_files.to_list()] abi_diff_files = [] abi_diff_info = p.get("//build/bazel/rules/abi:abi_dump.bzl%AbiDiffInfo") Loading @@ -207,7 +207,7 @@ return json_encode({ "Headers": headers, "RootStaticArchives": rootStaticArchives, "RootDynamicLibraries": rootSharedLibraries, "TidyFiles": tidy_files, "TidyFiles": [t for t in tidy_files], "TocFile": toc_file, "UnstrippedOutput": unstripped, "AbiDiffFiles": abi_diff_files, Loading Loading @@ -261,6 +261,11 @@ mk_info = providers(target).get("//build/bazel/rules/apex:apex_info.bzl%ApexMkIn if not mk_info: fail("%s did not provide ApexMkInfo" % id_string) tidy_files = [] clang_tidy_info = providers(target).get("//build/bazel/rules/cc:clang_tidy.bzl%ClangTidyInfo") if clang_tidy_info: tidy_files = [v.path for v in clang_tidy_info.transitive_tidy_files.to_list()] return json_encode({ "signed_output": info.signed_output.path, "signed_compressed_output": signed_compressed_output, Loading @@ -276,6 +281,7 @@ return json_encode({ "bundle_file": info.base_with_config_zip.path, "installed_files": info.installed_files.path, "make_modules_to_install": mk_info.make_modules_to_install, "tidy_files": [t for t in tidy_files], })` } Loading @@ -294,6 +300,7 @@ type ApexInfo struct { BackingLibs string `json:"backing_libs"` BundleFile string `json:"bundle_file"` InstalledFiles string `json:"installed_files"` TidyFiles []string `json:"tidy_files"` // From the ApexMkInfo provider MakeModulesToInstall []string `json:"make_modules_to_install"` Loading Loading @@ -338,12 +345,18 @@ if androidmk_tag in p: local_whole_static_libs = androidmk_info.local_whole_static_libs local_shared_libs = androidmk_info.local_shared_libs tidy_files = [] 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.transitive_tidy_files.to_list()] return json_encode({ "OutputFile": output_path, "UnstrippedOutput": unstripped, "LocalStaticLibs": [l for l in local_static_libs], "LocalWholeStaticLibs": [l for l in local_whole_static_libs], "LocalSharedLibs": [l for l in local_shared_libs], "TidyFiles": [t for t in tidy_files], }) ` } Loading @@ -361,6 +374,7 @@ type CcUnstrippedInfo struct { CcAndroidMkInfo OutputFile string UnstrippedOutput string TidyFiles []string } // splitOrEmpty is a modification of strings.Split() that returns an empty list Loading cc/binary.go +5 −1 Original line number Diff line number Diff line Loading @@ -588,7 +588,11 @@ func (handler *ccBinaryBazelHandler) ProcessBazelQueryResponse(ctx android.Modul return } outputFilePath := android.PathForBazelOut(ctx, info.OutputFile) var outputFilePath android.Path = android.PathForBazelOut(ctx, info.OutputFile) if len(info.TidyFiles) > 0 { handler.module.tidyFiles = android.PathsForBazelOut(ctx, info.TidyFiles) outputFilePath = android.AttachValidationActions(ctx, outputFilePath, handler.module.tidyFiles) } handler.module.outputFile = android.OptionalPathForPath(outputFilePath) handler.module.linker.(*binaryDecorator).unstrippedOutputFile = android.PathForBazelOut(ctx, info.UnstrippedOutput) Loading Loading
android/bazel.go +12 −0 Original line number Diff line number Diff line Loading @@ -526,3 +526,15 @@ func GetMainClassInManifest(c Config, filepath string) (string, error) { return "", errors.New("Main-Class is not found.") } func AttachValidationActions(ctx ModuleContext, outputFilePath Path, validations Paths) ModuleOutPath { validatedOutputFilePath := PathForModuleOut(ctx, "validated", outputFilePath.Base()) ctx.Build(pctx, BuildParams{ Rule: CpNoPreserveSymlink, Description: "run validations " + outputFilePath.Base(), Output: validatedOutputFilePath, Input: outputFilePath, Validations: validations, }) return validatedOutputFilePath }
android/defs.go +8 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,14 @@ var ( }, "cpFlags", "extraCmds") // A copy rule that doesn't preserve symlinks. CpNoPreserveSymlink = pctx.AndroidStaticRule("CpNoPreserveSymlink", blueprint.RuleParams{ Command: "rm -f $out && cp $cpFlags $in $out$extraCmds", Description: "cp $out", }, "cpFlags", "extraCmds") // A copy rule that only updates the output if it changed. CpIfChanged = pctx.AndroidStaticRule("CpIfChanged", blueprint.RuleParams{ Loading
apex/apex.go +5 −0 Original line number Diff line number Diff line Loading @@ -1966,6 +1966,11 @@ func (a *apexBundle) ProcessBazelQueryResponse(ctx android.ModuleContext) { } a.outputFile = a.outputApexFile if len(outputs.TidyFiles) > 0 { tidyFiles := android.PathsForBazelOut(ctx, outputs.TidyFiles) a.outputFile = android.AttachValidationActions(ctx, a.outputFile, tidyFiles) } // TODO(b/257829940): These are used by the apex_keys_text singleton; would probably be a clearer // interface if these were set in a provider rather than the module itself a.publicKeyFile = android.PathForBazelOut(ctx, outputs.BundleKeyInfo[0]) Loading
bazel/cquery/request_type.go +16 −2 Original line number Diff line number Diff line Loading @@ -180,7 +180,7 @@ else: tidy_files = [] 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()] tidy_files = [v.path for v in clang_tidy_info.transitive_tidy_files.to_list()] abi_diff_files = [] abi_diff_info = p.get("//build/bazel/rules/abi:abi_dump.bzl%AbiDiffInfo") Loading @@ -207,7 +207,7 @@ return json_encode({ "Headers": headers, "RootStaticArchives": rootStaticArchives, "RootDynamicLibraries": rootSharedLibraries, "TidyFiles": tidy_files, "TidyFiles": [t for t in tidy_files], "TocFile": toc_file, "UnstrippedOutput": unstripped, "AbiDiffFiles": abi_diff_files, Loading Loading @@ -261,6 +261,11 @@ mk_info = providers(target).get("//build/bazel/rules/apex:apex_info.bzl%ApexMkIn if not mk_info: fail("%s did not provide ApexMkInfo" % id_string) tidy_files = [] clang_tidy_info = providers(target).get("//build/bazel/rules/cc:clang_tidy.bzl%ClangTidyInfo") if clang_tidy_info: tidy_files = [v.path for v in clang_tidy_info.transitive_tidy_files.to_list()] return json_encode({ "signed_output": info.signed_output.path, "signed_compressed_output": signed_compressed_output, Loading @@ -276,6 +281,7 @@ return json_encode({ "bundle_file": info.base_with_config_zip.path, "installed_files": info.installed_files.path, "make_modules_to_install": mk_info.make_modules_to_install, "tidy_files": [t for t in tidy_files], })` } Loading @@ -294,6 +300,7 @@ type ApexInfo struct { BackingLibs string `json:"backing_libs"` BundleFile string `json:"bundle_file"` InstalledFiles string `json:"installed_files"` TidyFiles []string `json:"tidy_files"` // From the ApexMkInfo provider MakeModulesToInstall []string `json:"make_modules_to_install"` Loading Loading @@ -338,12 +345,18 @@ if androidmk_tag in p: local_whole_static_libs = androidmk_info.local_whole_static_libs local_shared_libs = androidmk_info.local_shared_libs tidy_files = [] 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.transitive_tidy_files.to_list()] return json_encode({ "OutputFile": output_path, "UnstrippedOutput": unstripped, "LocalStaticLibs": [l for l in local_static_libs], "LocalWholeStaticLibs": [l for l in local_whole_static_libs], "LocalSharedLibs": [l for l in local_shared_libs], "TidyFiles": [t for t in tidy_files], }) ` } Loading @@ -361,6 +374,7 @@ type CcUnstrippedInfo struct { CcAndroidMkInfo OutputFile string UnstrippedOutput string TidyFiles []string } // splitOrEmpty is a modification of strings.Split() that returns an empty list Loading
cc/binary.go +5 −1 Original line number Diff line number Diff line Loading @@ -588,7 +588,11 @@ func (handler *ccBinaryBazelHandler) ProcessBazelQueryResponse(ctx android.Modul return } outputFilePath := android.PathForBazelOut(ctx, info.OutputFile) var outputFilePath android.Path = android.PathForBazelOut(ctx, info.OutputFile) if len(info.TidyFiles) > 0 { handler.module.tidyFiles = android.PathsForBazelOut(ctx, info.TidyFiles) outputFilePath = android.AttachValidationActions(ctx, outputFilePath, handler.module.tidyFiles) } handler.module.outputFile = android.OptionalPathForPath(outputFilePath) handler.module.linker.(*binaryDecorator).unstrippedOutputFile = android.PathForBazelOut(ctx, info.UnstrippedOutput) Loading