diff options
-rw-r--r-- | android/allowlists/allowlists.go | 3 | ||||
-rw-r--r-- | android/config.go | 8 | ||||
-rw-r--r-- | android/module.go | 6 | ||||
-rw-r--r-- | android/paths.go | 18 | ||||
-rw-r--r-- | android/rule_builder.go | 2 | ||||
-rw-r--r-- | android/test_suites.go | 4 | ||||
-rw-r--r-- | bazel/aquery.go | 44 | ||||
-rw-r--r-- | bp2build/build_conversion.go | 6 | ||||
-rw-r--r-- | cc/afdo.go | 3 | ||||
-rw-r--r-- | cc/library_headers.go | 3 | ||||
-rw-r--r-- | java/aar.go | 30 | ||||
-rw-r--r-- | java/app_test.go | 37 | ||||
-rw-r--r-- | ui/build/paths/config.go | 1 |
13 files changed, 84 insertions, 81 deletions
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go index 014b3cc00..6306ae11d 100644 --- a/android/allowlists/allowlists.go +++ b/android/allowlists/allowlists.go @@ -211,6 +211,7 @@ var ( "external/python/setuptools": Bp2BuildDefaultTrueRecursively, "external/python/six": Bp2BuildDefaultTrueRecursively, "external/rappor": Bp2BuildDefaultTrueRecursively, + "external/rust/crates/rustc-demangle": Bp2BuildDefaultTrueRecursively, "external/scudo": Bp2BuildDefaultTrueRecursively, "external/selinux/checkpolicy": Bp2BuildDefaultTrueRecursively, "external/selinux/libselinux": Bp2BuildDefaultTrueRecursively, @@ -437,7 +438,7 @@ var ( "system/libprocinfo": Bp2BuildDefaultTrue, "system/libvintf": Bp2BuildDefaultTrue, "system/libziparchive": Bp2BuildDefaultTrueRecursively, - "system/linkerconfig": Bp2BuildDefaultTrueRecursively, + "system/linkerconfig": Bp2BuildDefaultTrueRecursively, "system/logging": Bp2BuildDefaultTrueRecursively, "system/media": Bp2BuildDefaultTrue, "system/media/alsa_utils": Bp2BuildDefaultTrueRecursively, diff --git a/android/config.go b/android/config.go index 8f72239b9..66c0e6de3 100644 --- a/android/config.go +++ b/android/config.go @@ -789,7 +789,7 @@ func (c *config) HostToolDir() string { } func (c *config) HostToolPath(ctx PathContext, tool string) Path { - path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "bin", false, tool) + path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "bin", tool) return path } @@ -798,12 +798,12 @@ func (c *config) HostJNIToolPath(ctx PathContext, lib string) Path { if runtime.GOOS == "darwin" { ext = ".dylib" } - path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "lib64", false, lib+ext) + path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "lib64", lib+ext) return path } func (c *config) HostJavaToolPath(ctx PathContext, tool string) Path { - path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "framework", false, tool) + path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "framework", tool) return path } @@ -812,7 +812,7 @@ func (c *config) HostCcSharedLibPath(ctx PathContext, lib string) Path { if ctx.Config().BuildArch.Multilib == "lib64" { libDir = "lib64" } - return pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, libDir, false, lib+".so") + return pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, libDir, lib+".so") } // PrebuiltOS returns the name of the host OS used in prebuilts directories. diff --git a/android/module.go b/android/module.go index ce6c78d35..b73f449fc 100644 --- a/android/module.go +++ b/android/module.go @@ -380,7 +380,6 @@ type BaseModuleContext interface { Device() bool Darwin() bool Windows() bool - Debug() bool PrimaryArch() bool } @@ -2675,7 +2674,6 @@ type baseModuleContext struct { target Target multiTargets []Target targetPrimary bool - debug bool walkPath []Module tagPath []blueprint.DependencyTag @@ -3306,10 +3304,6 @@ func (b *baseModuleContext) Windows() bool { return b.os == Windows } -func (b *baseModuleContext) Debug() bool { - return b.debug -} - func (b *baseModuleContext) PrimaryArch() bool { if len(b.config.Targets[b.target.Os]) <= 1 { return true diff --git a/android/paths.go b/android/paths.go index 325a953c4..7658299b4 100644 --- a/android/paths.go +++ b/android/paths.go @@ -480,7 +480,7 @@ func (p OutputPaths) Strings() []string { // PathForGoBinary returns the path to the installed location of a bootstrap_go_binary module. func PathForGoBinary(ctx PathContext, goBinary bootstrap.GoBinaryTool) Path { - goBinaryInstallDir := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "bin", false) + goBinaryInstallDir := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "bin") rel := Rel(ctx, goBinaryInstallDir.String(), goBinary.InstallPath()) return goBinaryInstallDir.Join(ctx, rel) } @@ -1684,19 +1684,19 @@ func (p InstallPath) ToMakePath() InstallPath { func PathForModuleInstall(ctx ModuleInstallPathContext, pathComponents ...string) InstallPath { os, arch := osAndArch(ctx) partition := modulePartition(ctx, os) - return makePathForInstall(ctx, os, arch, partition, ctx.Debug(), pathComponents...) + return pathForInstall(ctx, os, arch, partition, pathComponents...) } // PathForHostDexInstall returns an InstallPath representing the install path for the // module appended with paths... func PathForHostDexInstall(ctx ModuleInstallPathContext, pathComponents ...string) InstallPath { - return makePathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "", ctx.Debug(), pathComponents...) + return pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "", pathComponents...) } // PathForModuleInPartitionInstall is similar to PathForModuleInstall but partition is provided by the caller func PathForModuleInPartitionInstall(ctx ModuleInstallPathContext, partition string, pathComponents ...string) InstallPath { os, arch := osAndArch(ctx) - return makePathForInstall(ctx, os, arch, partition, ctx.Debug(), pathComponents...) + return pathForInstall(ctx, os, arch, partition, pathComponents...) } func osAndArch(ctx ModuleInstallPathContext) (OsType, ArchType) { @@ -1712,12 +1712,7 @@ func osAndArch(ctx ModuleInstallPathContext) (OsType, ArchType) { return os, arch } -func makePathForInstall(ctx ModuleInstallPathContext, os OsType, arch ArchType, partition string, debug bool, pathComponents ...string) InstallPath { - ret := pathForInstall(ctx, os, arch, partition, debug, pathComponents...) - return ret -} - -func pathForInstall(ctx PathContext, os OsType, arch ArchType, partition string, debug bool, +func pathForInstall(ctx PathContext, os OsType, arch ArchType, partition string, pathComponents ...string) InstallPath { var partitionPaths []string @@ -1747,9 +1742,6 @@ func pathForInstall(ctx PathContext, os OsType, arch ArchType, partition string, } partitionPaths = []string{"host", osName + "-" + archName, partition} } - if debug { - partitionPaths = append([]string{"debug"}, partitionPaths...) - } partitionPath, err := validatePath(partitionPaths...) if err != nil { diff --git a/android/rule_builder.go b/android/rule_builder.go index 245b759ca..5c6dffec1 100644 --- a/android/rule_builder.go +++ b/android/rule_builder.go @@ -871,7 +871,7 @@ func (c *RuleBuilderCommand) PathForOutput(path WritablePath) string { func sboxPathForToolRel(ctx BuilderContext, path Path) string { // Errors will be handled in RuleBuilder.Build where we have a context to report them - toolDir := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "", false) + toolDir := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "") relOutSoong, isRelOutSoong, _ := maybeRelErr(toolDir.String(), path.String()) if isRelOutSoong { // The tool is in the Soong output directory, it will be copied to __SBOX_OUT_DIR__/tools/out diff --git a/android/test_suites.go b/android/test_suites.go index 63a709fb7..9ded99832 100644 --- a/android/test_suites.go +++ b/android/test_suites.go @@ -60,7 +60,7 @@ func robolectricTestSuite(ctx SingletonContext, files map[string]InstallPaths) W for _, module := range SortedKeys(files) { installedPaths = append(installedPaths, files[module]...) } - testCasesDir := pathForInstall(ctx, ctx.Config().BuildOS, X86, "testcases", false) + testCasesDir := pathForInstall(ctx, ctx.Config().BuildOS, X86, "testcases") outputFile := PathForOutput(ctx, "packaging", "robolectric-tests.zip") rule := NewRuleBuilder(pctx, ctx) @@ -69,7 +69,7 @@ func robolectricTestSuite(ctx SingletonContext, files map[string]InstallPaths) W FlagWithArg("-P ", "host/testcases"). FlagWithArg("-C ", testCasesDir.String()). FlagWithRspFileInputList("-r ", outputFile.ReplaceExtension(ctx, "rsp"), installedPaths.Paths()). - Flag("-sha256") + Flag("-sha256") rule.Build("robolectric_tests_zip", "robolectric-tests.zip") return outputFile diff --git a/bazel/aquery.go b/bazel/aquery.go index 641f16bf2..27ccb20c8 100644 --- a/bazel/aquery.go +++ b/bazel/aquery.go @@ -37,19 +37,6 @@ type artifactId int type depsetId int type pathFragmentId int -// artifact contains relevant portions of Bazel's aquery proto, Artifact. -// Represents a single artifact, whether it's a source file or a derived output file. -type artifact struct { - Id artifactId - PathFragmentId pathFragmentId -} - -type pathFragment struct { - Id pathFragmentId - Label string - ParentId pathFragmentId -} - // KeyValuePair represents Bazel's aquery proto, KeyValuePair. type KeyValuePair struct { Key string @@ -70,37 +57,6 @@ type AqueryDepset struct { TransitiveDepSetHashes []string } -// depSetOfFiles contains relevant portions of Bazel's aquery proto, DepSetOfFiles. -// Represents a data structure containing one or more files. Depsets in Bazel are an efficient -// data structure for storing large numbers of file paths. -type depSetOfFiles struct { - Id depsetId - DirectArtifactIds []artifactId - TransitiveDepSetIds []depsetId -} - -// action contains relevant portions of Bazel's aquery proto, Action. -// Represents a single command line invocation in the Bazel build graph. -type action struct { - Arguments []string - EnvironmentVariables []KeyValuePair - InputDepSetIds []depsetId - Mnemonic string - OutputIds []artifactId - TemplateContent string - Substitutions []KeyValuePair - FileContents string -} - -// actionGraphContainer contains relevant portions of Bazel's aquery proto, ActionGraphContainer. -// An aquery response from Bazel contains a single ActionGraphContainer proto. -type actionGraphContainer struct { - Artifacts []artifact - Actions []action - DepSetOfFiles []depSetOfFiles - PathFragments []pathFragment -} - // BuildStatement contains information to register a build statement corresponding (one to one) // with a Bazel action from Bazel's action graph. type BuildStatement struct { diff --git a/bp2build/build_conversion.go b/bp2build/build_conversion.go index 53c37b90e..ed6e2dd1c 100644 --- a/bp2build/build_conversion.go +++ b/bp2build/build_conversion.go @@ -830,11 +830,9 @@ func GenerateBazelTargets(ctx *CodegenContext, generateFilegroups bool) (convers depLabels.Add(&depLabel) } a := struct { - Deps bazel.LabelListAttribute - System_dynamic_deps bazel.LabelListAttribute + Deps bazel.LabelListAttribute }{ - Deps: bazel.MakeLabelListAttribute(bazel.UniqueSortedBazelLabelList(depLabels)), - System_dynamic_deps: bazel.MakeLabelListAttribute(bazel.MakeLabelList([]bazel.Label{})), + Deps: bazel.MakeLabelListAttribute(bazel.UniqueSortedBazelLabelList(depLabels)), } ndkSysroot := bTarget{ targetName: "ndk_sysroot", diff --git a/cc/afdo.go b/cc/afdo.go index 5c587c0b0..ac210d44a 100644 --- a/cc/afdo.go +++ b/cc/afdo.go @@ -84,7 +84,10 @@ func (afdo *afdo) flags(ctx ModuleContext, flags Flags) Flags { // 3. Make the profile searchable by the build system. So it's used the next time the binary // is built. flags.Local.CFlags = append([]string{"-funique-internal-linkage-names"}, flags.Local.CFlags...) + // Flags for Flow Sensitive AutoFDO flags.Local.CFlags = append([]string{"-mllvm", "-enable-fs-discriminator=true"}, flags.Local.CFlags...) + // TODO(b/266595187): Remove the following feature once it is enabled in LLVM by default. + flags.Local.CFlags = append([]string{"-mllvm", "-improved-fs-discriminator=true"}, flags.Local.CFlags...) } if path := afdo.Properties.FdoProfilePath; path != nil { // The flags are prepended to allow overriding. diff --git a/cc/library_headers.go b/cc/library_headers.go index 4da2b48ca..3f8be467b 100644 --- a/cc/library_headers.go +++ b/cc/library_headers.go @@ -122,8 +122,6 @@ type bazelCcLibraryHeadersAttributes struct { Export_absolute_includes bazel.StringListAttribute Export_system_includes bazel.StringListAttribute Deps bazel.LabelListAttribute - Implementation_deps bazel.LabelListAttribute - System_dynamic_deps bazel.LabelListAttribute sdkAttributes } @@ -139,7 +137,6 @@ func libraryHeadersBp2Build(ctx android.Bp2buildMutatorContext, module *Module) Export_absolute_includes: exportedIncludes.AbsoluteIncludes, Export_system_includes: exportedIncludes.SystemIncludes, Deps: linkerAttrs.deps, - System_dynamic_deps: linkerAttrs.systemDynamicDeps, Hdrs: baseAttributes.hdrs, sdkAttributes: bp2BuildParseSdkAttributes(module), } diff --git a/java/aar.go b/java/aar.go index 85a6fbb96..368f2416a 100644 --- a/java/aar.go +++ b/java/aar.go @@ -66,6 +66,9 @@ type aaptProperties struct { // ones. Aapt_include_all_resources *bool + // list of files to use as assets. + Assets []string `android:"path"` + // list of directories relative to the Blueprints file containing assets. // Defaults to ["assets"] if a directory called assets exists. Set to [] // to disable the default. @@ -192,6 +195,11 @@ func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkContext android.SdkConte linkFlags = append(linkFlags, a.aaptProperties.Aaptflags...) // Find implicit or explicit asset and resource dirs + assets := android.PathsRelativeToModuleSourceDir(android.SourceInput{ + Context: ctx, + Paths: a.aaptProperties.Assets, + IncludeDirs: false, + }) assetDirs := android.PathsWithOptionalDefaultForModuleSrc(ctx, a.aaptProperties.Asset_dirs, "assets") resourceDirs := android.PathsWithOptionalDefaultForModuleSrc(ctx, a.aaptProperties.Resource_dirs, "res") resourceZips := android.PathsForModuleSrc(ctx, a.aaptProperties.Resource_zips) @@ -226,6 +234,28 @@ func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkContext android.SdkConte assetDirStrings = append(assetDirStrings, filepath.Dir(a.noticeFile.Path().String())) assetDeps = append(assetDeps, a.noticeFile.Path()) } + if len(assets) > 0 { + // aapt2 doesn't support adding individual asset files. Create a temp directory to hold asset + // files and pass it to aapt2. + tmpAssetDir := android.PathForModuleOut(ctx, "tmp_asset_dir") + + rule := android.NewRuleBuilder(pctx, ctx) + rule.Command(). + Text("rm -rf").Text(tmpAssetDir.String()). + Text("&&"). + Text("mkdir -p").Text(tmpAssetDir.String()) + + for _, asset := range assets { + output := tmpAssetDir.Join(ctx, asset.Rel()) + assetDeps = append(assetDeps, output) + rule.Command().Text("mkdir -p").Text(filepath.Dir(output.String())) + rule.Command().Text("cp").Input(asset).Output(output) + } + + rule.Build("tmp_asset_dir", "tmp_asset_dir") + + assetDirStrings = append(assetDirStrings, tmpAssetDir.String()) + } linkFlags = append(linkFlags, "--manifest "+manifestPath.String()) linkDeps = append(linkDeps, manifestPath) diff --git a/java/app_test.go b/java/app_test.go index e38a7247b..4d3b2dc4d 100644 --- a/java/app_test.go +++ b/java/app_test.go @@ -608,6 +608,15 @@ func TestLibraryAssets(t *testing.T) { asset_dirs: ["assets_b"], } + android_library { + name: "lib5", + sdk_version: "current", + assets: [ + "path/to/asset_file_1", + "path/to/asset_file_2", + ], + } + android_library_import { name: "import", sdk_version: "current", @@ -616,9 +625,11 @@ func TestLibraryAssets(t *testing.T) { ` testCases := []struct { - name string - assetFlag string - assetPackages []string + name string + assetFlag string + assetPackages []string + tmpAssetDirInputs []string + tmpAssetDirOutputs []string }{ { name: "foo", @@ -644,6 +655,18 @@ func TestLibraryAssets(t *testing.T) { name: "lib4", assetFlag: "-A assets_b", }, + { + name: "lib5", + assetFlag: "-A out/soong/.intermediates/lib5/android_common/tmp_asset_dir", + tmpAssetDirInputs: []string{ + "path/to/asset_file_1", + "path/to/asset_file_2", + }, + tmpAssetDirOutputs: []string{ + "out/soong/.intermediates/lib5/android_common/tmp_asset_dir/path/to/asset_file_1", + "out/soong/.intermediates/lib5/android_common/tmp_asset_dir/path/to/asset_file_2", + }, + }, } ctx := testApp(t, bp) @@ -671,6 +694,14 @@ func TestLibraryAssets(t *testing.T) { mergeAssets := m.Output("package-res.apk") android.AssertPathsRelativeToTopEquals(t, "mergeAssets inputs", test.assetPackages, mergeAssets.Inputs) } + + if len(test.tmpAssetDirInputs) > 0 { + rule := m.Rule("tmp_asset_dir") + inputs := rule.Implicits + outputs := append(android.WritablePaths{rule.Output}, rule.ImplicitOutputs...).Paths() + android.AssertPathsRelativeToTopEquals(t, "tmp_asset_dir inputs", test.tmpAssetDirInputs, inputs) + android.AssertPathsRelativeToTopEquals(t, "tmp_asset_dir outputs", test.tmpAssetDirOutputs, outputs) + } }) } } diff --git a/ui/build/paths/config.go b/ui/build/paths/config.go index eba823ae2..65e2c8ebc 100644 --- a/ui/build/paths/config.go +++ b/ui/build/paths/config.go @@ -92,6 +92,7 @@ var Configuration = map[string]PathConfig{ "expr": Allowed, "fuser": Allowed, "gcert": Allowed, + "gcertstatus": Allowed, "getopt": Allowed, "git": Allowed, "hexdump": Allowed, |