Merge "Disable dsymutil usage on Darwin host" into main
diff --git a/android/androidmk_test.go b/android/androidmk_test.go
index ae2187f..72b8654 100644
--- a/android/androidmk_test.go
+++ b/android/androidmk_test.go
@@ -36,10 +36,6 @@
data AndroidMkData
distFiles TaggedDistFiles
outputFile OptionalPath
-
- // The paths that will be used as the default dist paths if no tag is
- // specified.
- defaultDistPaths Paths
}
const (
@@ -51,6 +47,7 @@
func (m *customModule) GenerateAndroidBuildActions(ctx ModuleContext) {
m.base().licenseMetadataFile = PathForOutput(ctx, "meta_lic")
+ var defaultDistPaths Paths
// If the dist_output_file: true then create an output file that is stored in
// the OutputFile property of the AndroidMkEntry.
@@ -62,7 +59,7 @@
// property in AndroidMkEntry when determining the default dist paths.
// Setting this first allows it to be overridden based on the
// default_dist_files setting replicating that previous behavior.
- m.defaultDistPaths = Paths{path}
+ defaultDistPaths = Paths{path}
}
// Based on the setting of the default_dist_files property possibly create a
@@ -71,29 +68,40 @@
defaultDistFiles := proptools.StringDefault(m.properties.Default_dist_files, defaultDistFiles_Tagged)
switch defaultDistFiles {
case defaultDistFiles_None:
- // Do nothing
+ m.setOutputFiles(ctx, defaultDistPaths)
case defaultDistFiles_Default:
path := PathForTesting("default-dist.out")
- m.defaultDistPaths = Paths{path}
+ defaultDistPaths = Paths{path}
+ m.setOutputFiles(ctx, defaultDistPaths)
m.distFiles = MakeDefaultDistFiles(path)
case defaultDistFiles_Tagged:
// Module types that set AndroidMkEntry.DistFiles to the result of calling
// GenerateTaggedDistFiles(ctx) relied on no tag being treated as "" which
- // meant that the default dist paths would be whatever was returned by
- // OutputFiles(""). In order to preserve that behavior when treating no tag
- // as being equal to DefaultDistTag this ensures that
- // OutputFiles(DefaultDistTag) will return the same as OutputFiles("").
- m.defaultDistPaths = PathsForTesting("one.out")
+ // meant that the default dist paths would be the same as empty-string-tag
+ // output files. In order to preserve that behavior when treating no tag
+ // as being equal to DefaultDistTag this ensures that DefaultDistTag output
+ // will be the same as empty-string-tag output.
+ defaultDistPaths = PathsForTesting("one.out")
+ m.setOutputFiles(ctx, defaultDistPaths)
// This must be called after setting defaultDistPaths/outputFile as
- // GenerateTaggedDistFiles calls into OutputFiles(tag) which may use those
- // fields.
+ // GenerateTaggedDistFiles calls into outputFiles property which may use
+ // those fields.
m.distFiles = m.GenerateTaggedDistFiles(ctx)
}
}
+func (m *customModule) setOutputFiles(ctx ModuleContext, defaultDistPaths Paths) {
+ ctx.SetOutputFiles(PathsForTesting("one.out"), "")
+ ctx.SetOutputFiles(PathsForTesting("two.out", "three/four.out"), ".multiple")
+ ctx.SetOutputFiles(PathsForTesting("another.out"), ".another-tag")
+ if defaultDistPaths != nil {
+ ctx.SetOutputFiles(defaultDistPaths, DefaultDistTag)
+ }
+}
+
func (m *customModule) AndroidMk() AndroidMkData {
return AndroidMkData{
Custom: func(w io.Writer, name, prefix, moduleDir string, data AndroidMkData) {
@@ -102,25 +110,6 @@
}
}
-func (m *customModule) OutputFiles(tag string) (Paths, error) {
- switch tag {
- case DefaultDistTag:
- if m.defaultDistPaths != nil {
- return m.defaultDistPaths, nil
- } else {
- return nil, fmt.Errorf("default dist tag is not available")
- }
- case "":
- return PathsForTesting("one.out"), nil
- case ".multiple":
- return PathsForTesting("two.out", "three/four.out"), nil
- case ".another-tag":
- return PathsForTesting("another.out"), nil
- default:
- return nil, fmt.Errorf("unsupported module reference tag %q", tag)
- }
-}
-
func (m *customModule) AndroidMkEntries() []AndroidMkEntries {
return []AndroidMkEntries{
{
diff --git a/android/buildinfo_prop.go b/android/buildinfo_prop.go
index defbff0..bba4c0d 100644
--- a/android/buildinfo_prop.go
+++ b/android/buildinfo_prop.go
@@ -15,8 +15,6 @@
package android
import (
- "fmt"
-
"github.com/google/blueprint/proptools"
)
@@ -41,20 +39,10 @@
installPath InstallPath
}
-var _ OutputFileProducer = (*buildinfoPropModule)(nil)
-
func (p *buildinfoPropModule) installable() bool {
return proptools.BoolDefault(p.properties.Installable, true)
}
-// OutputFileProducer
-func (p *buildinfoPropModule) OutputFiles(tag string) (Paths, error) {
- if tag != "" {
- return nil, fmt.Errorf("unsupported tag %q", tag)
- }
- return Paths{p.outputFilePath}, nil
-}
-
func shouldAddBuildThumbprint(config Config) bool {
knownOemProperties := []string{
"ro.product.brand",
@@ -76,6 +64,8 @@
return
}
p.outputFilePath = PathForModuleOut(ctx, p.Name()).OutputPath
+ ctx.SetOutputFiles(Paths{p.outputFilePath}, "")
+
if !ctx.Config().KatiEnabled() {
WriteFileRule(ctx, p.outputFilePath, "# no buildinfo.prop if kati is disabled")
return
diff --git a/android/config.go b/android/config.go
index cda01f0..d16377d 100644
--- a/android/config.go
+++ b/android/config.go
@@ -1055,6 +1055,22 @@
return defaultDir.Join(ctx, "testkey.x509.pem"), defaultDir.Join(ctx, "testkey.pk8")
}
+func (c *config) ExtraOtaKeys(ctx PathContext, recovery bool) []SourcePath {
+ var otaKeys []string
+ if recovery {
+ otaKeys = c.productVariables.ExtraOtaRecoveryKeys
+ } else {
+ otaKeys = c.productVariables.ExtraOtaKeys
+ }
+
+ otaPaths := make([]SourcePath, len(otaKeys))
+ for i, key := range otaKeys {
+ otaPaths[i] = PathForSource(ctx, key+".x509.pem")
+ }
+
+ return otaPaths
+}
+
func (c *config) BuildKeys() string {
defaultCert := String(c.productVariables.DefaultAppCertificate)
if defaultCert == "" || defaultCert == filepath.Join(testKeyDir, "testkey") {
diff --git a/android/paths_test.go b/android/paths_test.go
index 93b9b9a..941f0ca 100644
--- a/android/paths_test.go
+++ b/android/paths_test.go
@@ -1183,9 +1183,6 @@
Outs []string
Tagged []string
}
-
- outs Paths
- tagged Paths
}
func pathForModuleSrcOutputFileProviderModuleFactory() Module {
@@ -1196,24 +1193,17 @@
}
func (p *pathForModuleSrcOutputFileProviderModule) GenerateAndroidBuildActions(ctx ModuleContext) {
+ var outs, taggedOuts Paths
for _, out := range p.props.Outs {
- p.outs = append(p.outs, PathForModuleOut(ctx, out))
+ outs = append(outs, PathForModuleOut(ctx, out))
}
for _, tagged := range p.props.Tagged {
- p.tagged = append(p.tagged, PathForModuleOut(ctx, tagged))
+ taggedOuts = append(taggedOuts, PathForModuleOut(ctx, tagged))
}
-}
-func (p *pathForModuleSrcOutputFileProviderModule) OutputFiles(tag string) (Paths, error) {
- switch tag {
- case "":
- return p.outs, nil
- case ".tagged":
- return p.tagged, nil
- default:
- return nil, fmt.Errorf("unsupported tag %q", tag)
- }
+ ctx.SetOutputFiles(outs, "")
+ ctx.SetOutputFiles(taggedOuts, ".tagged")
}
type pathForModuleSrcTestCase struct {
diff --git a/android/prebuilt_test.go b/android/prebuilt_test.go
index d775ac3..6e4fc0c 100644
--- a/android/prebuilt_test.go
+++ b/android/prebuilt_test.go
@@ -15,7 +15,6 @@
package android
import (
- "fmt"
"testing"
"github.com/google/blueprint"
@@ -494,7 +493,6 @@
properties struct {
Srcs []string `android:"path,arch_variant"`
}
- src Path
}
func newPrebuiltModule() Module {
@@ -510,24 +508,17 @@
}
func (p *prebuiltModule) GenerateAndroidBuildActions(ctx ModuleContext) {
+ var src Path
if len(p.properties.Srcs) >= 1 {
- p.src = p.prebuilt.SingleSourcePath(ctx)
+ src = p.prebuilt.SingleSourcePath(ctx)
}
+ ctx.SetOutputFiles(Paths{src}, "")
}
func (p *prebuiltModule) Prebuilt() *Prebuilt {
return &p.prebuilt
}
-func (p *prebuiltModule) OutputFiles(tag string) (Paths, error) {
- switch tag {
- case "":
- return Paths{p.src}, nil
- default:
- return nil, fmt.Errorf("unsupported module reference tag %q", tag)
- }
-}
-
type sourceModuleProperties struct {
Deps []string `android:"path,arch_variant"`
}
diff --git a/android/sdk.go b/android/sdk.go
index 121470d..4bcbe2e 100644
--- a/android/sdk.go
+++ b/android/sdk.go
@@ -513,6 +513,9 @@
// SupportedLinkages returns the names of the linkage variants supported by this module.
SupportedLinkages() []string
+ // DisablesStrip returns true if the stripping needs to be disabled for this module.
+ DisablesStrip() bool
+
// ArePrebuiltsRequired returns true if prebuilts are required in the sdk snapshot, false
// otherwise.
ArePrebuiltsRequired() bool
@@ -618,6 +621,9 @@
// The names of linkage variants supported by this module.
SupportedLinkageNames []string
+ // StripDisabled returns true if the stripping needs to be disabled for this module.
+ StripDisabled bool
+
// When set to true BpPropertyNotRequired indicates that the member type does not require the
// property to be specifiable in an Android.bp file.
BpPropertyNotRequired bool
@@ -689,6 +695,10 @@
return b.SupportedLinkageNames
}
+func (b *SdkMemberTypeBase) DisablesStrip() bool {
+ return b.StripDisabled
+}
+
// registeredModuleExportsMemberTypes is the set of registered SdkMemberTypes for module_exports
// modules.
var registeredModuleExportsMemberTypes = &sdkRegistry{}
diff --git a/android/variable.go b/android/variable.go
index a331439..d144f7d 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -274,8 +274,10 @@
AAPTPreferredConfig *string `json:",omitempty"`
AAPTPrebuiltDPI []string `json:",omitempty"`
- DefaultAppCertificate *string `json:",omitempty"`
- MainlineSepolicyDevCertificates *string `json:",omitempty"`
+ DefaultAppCertificate *string `json:",omitempty"`
+ ExtraOtaKeys []string `json:",omitempty"`
+ ExtraOtaRecoveryKeys []string `json:",omitempty"`
+ MainlineSepolicyDevCertificates *string `json:",omitempty"`
AppsDefaultVersionName *string `json:",omitempty"`
diff --git a/apex/apex.go b/apex/apex.go
index e6815bc..a2c1f2c 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -157,8 +157,7 @@
// Default: true.
Installable *bool
- // If set true, VNDK libs are considered as stable libs and are not included in this APEX.
- // Should be only used in non-system apexes (e.g. vendor: true). Default is false.
+ // Deprecated. Do not use. TODO(b/350644693) remove this after removing all usage
Use_vndk_as_stable *bool
// The type of filesystem to use. Either 'ext4', 'f2fs' or 'erofs'. Default 'ext4'.
@@ -950,24 +949,6 @@
return
}
- // Special casing for APEXes on non-system (e.g., vendor, odm, etc.) partitions. They are
- // provided with a property named use_vndk_as_stable, which when set to true doesn't collect
- // VNDK libraries as transitive dependencies. This option is useful for reducing the size of
- // the non-system APEXes because the VNDK libraries won't be included (and duped) in the
- // APEX, but shared across APEXes via the VNDK APEX.
- useVndk := a.SocSpecific() || a.DeviceSpecific() || (a.ProductSpecific() && mctx.Config().EnforceProductPartitionInterface())
- if proptools.Bool(a.properties.Use_vndk_as_stable) {
- if !useVndk {
- mctx.PropertyErrorf("use_vndk_as_stable", "not supported for system/system_ext APEXes")
- }
- if a.minSdkVersionValue(mctx) != "" {
- mctx.PropertyErrorf("use_vndk_as_stable", "not supported when min_sdk_version is set")
- }
- if mctx.Failed() {
- return
- }
- }
-
continueApexDepsWalk := func(child, parent android.Module) bool {
am, ok := child.(android.ApexModule)
if !ok || !am.CanHaveApexVariants() {
@@ -985,10 +966,6 @@
return false
}
- if useVndk && child.Name() == "libbinder" {
- mctx.ModuleErrorf("Module %s in the vendor APEX %s should not use libbinder. Use libbinder_ndk instead.", parent.Name(), a.Name())
- }
-
// By default, all the transitive dependencies are collected, unless filtered out
// above.
return true
@@ -2718,9 +2695,6 @@
if a.UsePlatformApis() {
ctx.PropertyErrorf("updatable", "updatable APEXes can't use platform APIs")
}
- if proptools.Bool(a.properties.Use_vndk_as_stable) {
- ctx.PropertyErrorf("use_vndk_as_stable", "updatable APEXes can't use external VNDK libs")
- }
if a.FutureUpdatable() {
ctx.PropertyErrorf("future_updatable", "Already updatable. Remove `future_updatable: true:`")
}
diff --git a/apex/apex_singleton.go b/apex/apex_singleton.go
index e6ebff2..a8d89b1 100644
--- a/apex/apex_singleton.go
+++ b/apex/apex_singleton.go
@@ -46,6 +46,9 @@
Command: "cat $out.rsp | xargs cat" +
// Only track non-external dependencies, i.e. those that end up in the binary
" | grep -v '(external)'" +
+ // Allowlist androidx deps
+ " | grep -v '^androidx\\.'" +
+ " | grep -v '^prebuilt_androidx\\.'" +
// Ignore comments in any of the files
" | grep -v '^#'" +
" | sort -u -f >$out",
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 3bb3966..df9db74 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -8278,60 +8278,6 @@
`)
}
-func Test_use_vndk_as_stable_shouldnt_be_used_for_updatable_vendor_apexes(t *testing.T) {
- testApexError(t, `"myapex" .*: use_vndk_as_stable: updatable APEXes can't use external VNDK libs`, `
- apex {
- name: "myapex",
- key: "myapex.key",
- updatable: true,
- use_vndk_as_stable: true,
- soc_specific: true,
- }
-
- apex_key {
- name: "myapex.key",
- public_key: "testkey.avbpubkey",
- private_key: "testkey.pem",
- }
- `)
-}
-
-func Test_use_vndk_as_stable_shouldnt_be_used_with_min_sdk_version(t *testing.T) {
- testApexError(t, `"myapex" .*: use_vndk_as_stable: not supported when min_sdk_version is set`, `
- apex {
- name: "myapex",
- key: "myapex.key",
- updatable: false,
- min_sdk_version: "29",
- use_vndk_as_stable: true,
- vendor: true,
- }
-
- apex_key {
- name: "myapex.key",
- public_key: "testkey.avbpubkey",
- private_key: "testkey.pem",
- }
- `)
-}
-
-func Test_use_vndk_as_stable_shouldnt_be_used_for_non_vendor_apexes(t *testing.T) {
- testApexError(t, `"myapex" .*: use_vndk_as_stable: not supported for system/system_ext APEXes`, `
- apex {
- name: "myapex",
- key: "myapex.key",
- updatable: false,
- use_vndk_as_stable: true,
- }
-
- apex_key {
- name: "myapex.key",
- public_key: "testkey.avbpubkey",
- private_key: "testkey.pem",
- }
- `)
-}
-
func TestUpdatable_should_not_set_generate_classpaths_proto(t *testing.T) {
testApexError(t, `"mysystemserverclasspathfragment" .* it must not set generate_classpaths_proto to false`, `
apex {
diff --git a/bin/afind b/bin/afind
new file mode 100755
index 0000000..080f06a
--- /dev/null
+++ b/bin/afind
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# Copyright (C) 2022 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+dir=${1:-.}
+
+shift
+
+args=( $@ )
+if [[ ${#args[@]} -eq 0 ]] ; then
+ args=( -print )
+fi
+
+find "$dir" -name .repo -prune -o -name .git -prune -o -name out -prune -o ${args[@]}
+
+exit $?
diff --git a/bin/aninja b/bin/aninja
index cceb794..5acb968 100755
--- a/bin/aninja
+++ b/bin/aninja
@@ -20,6 +20,19 @@
require_top
require_lunch
+case $(uname -s) in
+ Darwin)
+ host_arch=darwin-x86
+ ;;
+ Linux)
+ host_arch=linux-x86
+ ;;
+ *)
+ >&2 echo Unknown host $(uname -s)
+ exit 1
+ ;;
+esac
+
cd $(gettop)
-prebuilts/build-tools/linux-x86/bin/ninja -f out/combined-${TARGET_PRODUCT}.ninja "$@"
+prebuilts/build-tools/${host_arch}/bin/ninja -f out/combined-${TARGET_PRODUCT}.ninja "$@"
diff --git a/cc/afdo.go b/cc/afdo.go
index 00b2245..6921edf 100644
--- a/cc/afdo.go
+++ b/cc/afdo.go
@@ -176,6 +176,9 @@
func (a *afdoTransitionMutator) Mutate(ctx android.BottomUpMutatorContext, variation string) {
if m, ok := ctx.Module().(*Module); ok && m.afdo != nil {
+ if !m.Enabled(ctx) {
+ return
+ }
if variation == "" {
// The empty variation is either a module that has enabled AFDO for itself, or the non-AFDO
// variant of a dependency.
diff --git a/cc/check.go b/cc/check.go
index 32d1f06..e3af3b2 100644
--- a/cc/check.go
+++ b/cc/check.go
@@ -45,7 +45,8 @@
ctx.PropertyErrorf(prop, "-Weverything is not allowed in Android.bp files. "+
"Build with `m ANDROID_TEMPORARILY_ALLOW_WEVERYTHING=true` to experiment locally with -Weverything.")
}
- } else if strings.HasPrefix(flag, "-target") || strings.HasPrefix(flag, "--target") {
+ } else if strings.HasPrefix(flag, "-target ") || strings.HasPrefix(flag, "--target ") ||
+ strings.HasPrefix(flag, "-target=") || strings.HasPrefix(flag, "--target=") {
ctx.PropertyErrorf(prop, "Bad flag: `%s`, use the correct target soong rule.", flag)
} else if strings.Contains(flag, " ") {
args := strings.Split(flag, " ")
@@ -63,6 +64,10 @@
if len(args) > 2 {
ctx.PropertyErrorf(prop, "`-mllvm` only takes one argument: `%s`", flag)
}
+ } else if args[0] == "-Xclang" {
+ if len(args) > 2 {
+ ctx.PropertyErrorf(prop, "`-Xclang` only takes one argument: `%s`", flag)
+ }
} else if strings.HasPrefix(flag, "-D") && strings.Contains(flag, "=") {
// Do nothing in this case.
// For now, we allow space characters in -DNAME=def form to allow use cases
diff --git a/cc/cmake_ext_add_aidl_library.txt b/cc/cmake_ext_add_aidl_library.txt
index aa3235e3..d5c134e 100644
--- a/cc/cmake_ext_add_aidl_library.txt
+++ b/cc/cmake_ext_add_aidl_library.txt
@@ -1,3 +1,12 @@
+if ("${CMAKE_HOST_SYSTEM_PROCESSOR}" MATCHES "^(arm|aarch)")
+ set(PREBUILTS_BIN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/prebuilts/host/linux_musl-arm64/bin")
+else()
+ set(PREBUILTS_BIN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/prebuilts/host/linux-x86/bin")
+endif()
+if (NOT AIDL_BIN)
+ find_program(AIDL_BIN aidl REQUIRED HINTS "${PREBUILTS_BIN_DIR}")
+endif()
+
function(add_aidl_library NAME LANG AIDLROOT SOURCES AIDLFLAGS)
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.20")
cmake_policy(SET CMP0116 NEW)
diff --git a/cc/cmake_main.txt b/cc/cmake_main.txt
index f6e21a6..eeabf53 100644
--- a/cc/cmake_main.txt
+++ b/cc/cmake_main.txt
@@ -6,20 +6,12 @@
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(AddAidlLibrary)
include(AppendCxxFlagsIfSupported)
+include(FindThreads)
if (NOT ANDROID_BUILD_TOP)
set(ANDROID_BUILD_TOP "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
-if ("${CMAKE_HOST_SYSTEM_PROCESSOR}" MATCHES "^(arm|aarch)")
- set(PREBUILTS_BIN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/prebuilts/host/linux_musl-arm64/bin")
-else()
- set(PREBUILTS_BIN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/prebuilts/host/linux-x86/bin")
-endif()
-if (NOT AIDL_BIN)
- find_program(AIDL_BIN aidl REQUIRED HINTS "${PREBUILTS_BIN_DIR}")
-endif()
-
<<cflagsList .M.Name "_CFLAGS" .M.Properties.Cflags .M.Properties.Unportable_flags .M.Properties.Cflags_ignored>>
<<range .Pprop.SystemPackages ->>
@@ -29,6 +21,7 @@
add_subdirectory("${ANDROID_BUILD_TOP}/<<.>>" "<<.>>/build" EXCLUDE_FROM_ALL)
<<end>>
add_compile_options(${<<.M.Name>>_CFLAGS})
+link_libraries(${CMAKE_THREAD_LIBS_INIT})
<<range $moduleDir, $value := .ModuleDirs ->>
add_subdirectory(<<$moduleDir>>)
<<end>>
diff --git a/cc/cmake_snapshot.go b/cc/cmake_snapshot.go
index a5f8708..fb2924a 100644
--- a/cc/cmake_snapshot.go
+++ b/cc/cmake_snapshot.go
@@ -51,8 +51,10 @@
var cmakeExtAppendFlags string
var defaultUnportableFlags []string = []string{
+ "-Wno-c99-designator",
"-Wno-class-memaccess",
"-Wno-exit-time-destructors",
+ "-Winconsistent-missing-override",
"-Wno-inconsistent-missing-override",
"-Wreorder-init-list",
"-Wno-reorder-init-list",
@@ -67,6 +69,12 @@
"libc",
"libc++",
"libc++_static",
+ "libc++demangle",
+ "libc_musl",
+ "libc_musl_crtbegin_so",
+ "libc_musl_crtbegin_static",
+ "libc_musl_crtend",
+ "libc_musl_crtend_so",
"libdl",
"libm",
"prebuilt_libclang_rt.builtins",
@@ -89,8 +97,14 @@
}
type CmakeSnapshotProperties struct {
- // Modules to add to the snapshot package. Their dependencies are pulled in automatically.
- Modules []string
+ // Host modules to add to the snapshot package. Their dependencies are pulled in automatically.
+ Modules_host []string
+
+ // System modules to add to the snapshot package. Their dependencies are pulled in automatically.
+ Modules_system []string
+
+ // Vendor modules to add to the snapshot package. Their dependencies are pulled in automatically.
+ Modules_vendor []string
// Host prebuilts to bundle with the snapshot. These are tools needed to build outside Android.
Prebuilts []string
@@ -268,8 +282,14 @@
}
func (m *CmakeSnapshot) DepsMutator(ctx android.BottomUpMutatorContext) {
+ deviceVariations := ctx.Config().AndroidFirstDeviceTarget.Variations()
+ deviceSystemVariations := append(deviceVariations, blueprint.Variation{"image", ""})
+ deviceVendorVariations := append(deviceVariations, blueprint.Variation{"image", "vendor"})
hostVariations := ctx.Config().BuildOSTarget.Variations()
- ctx.AddVariationDependencies(hostVariations, cmakeSnapshotModuleTag, m.Properties.Modules...)
+
+ ctx.AddVariationDependencies(hostVariations, cmakeSnapshotModuleTag, m.Properties.Modules_host...)
+ ctx.AddVariationDependencies(deviceSystemVariations, cmakeSnapshotModuleTag, m.Properties.Modules_system...)
+ ctx.AddVariationDependencies(deviceVendorVariations, cmakeSnapshotModuleTag, m.Properties.Modules_vendor...)
if len(m.Properties.Prebuilts) > 0 {
prebuilts := append(m.Properties.Prebuilts, "libc++")
diff --git a/cc/cmake_snapshot_test.go b/cc/cmake_snapshot_test.go
index 8fca6c1..b6f4369 100644
--- a/cc/cmake_snapshot_test.go
+++ b/cc/cmake_snapshot_test.go
@@ -38,7 +38,9 @@
result := PrepareForIntegrationTestWithCc.RunTestWithBp(t, `
cc_cmake_snapshot {
name: "foo",
- modules: [],
+ modules_host: [],
+ modules_system: [],
+ modules_vendor: [],
prebuilts: ["libc++"],
include_sources: true,
}`)
@@ -65,7 +67,7 @@
result := android.GroupFixturePreparers(PrepareForIntegrationTestWithCc, xtra).RunTestWithBp(t, `
cc_cmake_snapshot {
name: "foo",
- modules: [
+ modules_system: [
"foo_binary",
],
include_sources: true,
@@ -99,7 +101,7 @@
cc_cmake_snapshot {
name: "foo",
- modules: [],
+ modules_system: [],
prebuilts: ["libc++"],
include_sources: true,
}`)
diff --git a/cc/config/riscv64_device.go b/cc/config/riscv64_device.go
index e5e95f3..6a5293f 100644
--- a/cc/config/riscv64_device.go
+++ b/cc/config/riscv64_device.go
@@ -29,8 +29,6 @@
// This is already the driver's Android default, but duplicated here (and
// below) for ease of experimentation with additional extensions.
"-march=rv64gcv_zba_zbb_zbs",
- // TODO: move to driver (https://github.com/google/android-riscv64/issues/111)
- "-mno-strict-align",
// TODO: remove when qemu V works (https://gitlab.com/qemu-project/qemu/-/issues/1976)
// (Note that we'll probably want to wait for berberis to be good enough
// that most people don't care about qemu's V performance either!)
diff --git a/cc/library_sdk_member.go b/cc/library_sdk_member.go
index a65b1ba..1f71c19 100644
--- a/cc/library_sdk_member.go
+++ b/cc/library_sdk_member.go
@@ -31,6 +31,7 @@
SupportsSdk: true,
HostOsDependent: true,
SupportedLinkageNames: []string{"shared"},
+ StripDisabled: true,
},
prebuiltModuleType: "cc_prebuilt_library_shared",
}
diff --git a/cmd/release_config/release_config_lib/flag_artifact.go b/cmd/release_config/release_config_lib/flag_artifact.go
index cfac7d7..93c50cd 100644
--- a/cmd/release_config/release_config_lib/flag_artifact.go
+++ b/cmd/release_config/release_config_lib/flag_artifact.go
@@ -116,20 +116,20 @@
if path != "" {
LoadMessage(path, ret)
} else {
- ret.FlagDeclarationArtifacts = []*rc_proto.FlagDeclarationArtifact{}
+ ret.FlagDeclarationArtifactList = []*rc_proto.FlagDeclarationArtifact{}
}
return ret
}
func (fas *FlagArtifacts) GenerateFlagDeclarationArtifacts(intermediates []*rc_proto.FlagDeclarationArtifacts) *rc_proto.FlagDeclarationArtifacts {
- ret := &rc_proto.FlagDeclarationArtifacts{FlagDeclarationArtifacts: []*rc_proto.FlagDeclarationArtifact{}}
+ ret := &rc_proto.FlagDeclarationArtifacts{FlagDeclarationArtifactList: []*rc_proto.FlagDeclarationArtifact{}}
for _, fa := range *fas {
- ret.FlagDeclarationArtifacts = append(ret.FlagDeclarationArtifacts, fa.GenerateFlagDeclarationArtifact())
+ ret.FlagDeclarationArtifactList = append(ret.FlagDeclarationArtifactList, fa.GenerateFlagDeclarationArtifact())
}
for _, fda := range intermediates {
- ret.FlagDeclarationArtifacts = append(ret.FlagDeclarationArtifacts, fda.FlagDeclarationArtifacts...)
+ ret.FlagDeclarationArtifactList = append(ret.FlagDeclarationArtifactList, fda.FlagDeclarationArtifactList...)
}
- slices.SortFunc(ret.FlagDeclarationArtifacts, func(a, b *rc_proto.FlagDeclarationArtifact) int {
+ slices.SortFunc(ret.FlagDeclarationArtifactList, func(a, b *rc_proto.FlagDeclarationArtifact) int {
return cmp.Compare(*a.Name, *b.Name)
})
return ret
diff --git a/cmd/release_config/release_config_proto/build_flags_declarations.pb.go b/cmd/release_config/release_config_proto/build_flags_declarations.pb.go
index 73a7e87..d2de89a 100644
--- a/cmd/release_config/release_config_proto/build_flags_declarations.pb.go
+++ b/cmd/release_config/release_config_proto/build_flags_declarations.pb.go
@@ -137,7 +137,7 @@
unknownFields protoimpl.UnknownFields
// The artifacts
- FlagDeclarationArtifacts []*FlagDeclarationArtifact `protobuf:"bytes,1,rep,name=flag_declaration_artifacts,json=flagDeclarationArtifacts" json:"flag_declaration_artifacts,omitempty"`
+ FlagDeclarationArtifactList []*FlagDeclarationArtifact `protobuf:"bytes,1,rep,name=flag_declaration_artifact_list,json=flagDeclarationArtifactList" json:"flag_declaration_artifact_list,omitempty"`
}
func (x *FlagDeclarationArtifacts) Reset() {
@@ -172,9 +172,9 @@
return file_build_flags_declarations_proto_rawDescGZIP(), []int{1}
}
-func (x *FlagDeclarationArtifacts) GetFlagDeclarationArtifacts() []*FlagDeclarationArtifact {
+func (x *FlagDeclarationArtifacts) GetFlagDeclarationArtifactList() []*FlagDeclarationArtifact {
if x != nil {
- return x.FlagDeclarationArtifacts
+ return x.FlagDeclarationArtifactList
}
return nil
}
@@ -204,20 +204,20 @@
0x52, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x1f, 0x0a, 0x0a, 0x63, 0x6f,
0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x18, 0xce, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52,
0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x4a, 0x04, 0x08, 0x04, 0x10,
- 0x05, 0x4a, 0x06, 0x08, 0xcf, 0x01, 0x10, 0xd0, 0x01, 0x22, 0x93, 0x01, 0x0a, 0x1a, 0x66, 0x6c,
+ 0x05, 0x4a, 0x06, 0x08, 0xcf, 0x01, 0x10, 0xd0, 0x01, 0x22, 0x9a, 0x01, 0x0a, 0x1a, 0x66, 0x6c,
0x61, 0x67, 0x5f, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61,
- 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x73, 0x12, 0x75, 0x0a, 0x1a, 0x66, 0x6c, 0x61, 0x67,
+ 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x73, 0x12, 0x7c, 0x0a, 0x1e, 0x66, 0x6c, 0x61, 0x67,
0x5f, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x72, 0x74,
- 0x69, 0x66, 0x61, 0x63, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x61,
- 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63,
- 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x66, 0x6c, 0x61, 0x67,
- 0x5f, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x72, 0x74,
- 0x69, 0x66, 0x61, 0x63, 0x74, 0x52, 0x18, 0x66, 0x6c, 0x61, 0x67, 0x44, 0x65, 0x63, 0x6c, 0x61,
- 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x73, 0x42,
- 0x33, 0x5a, 0x31, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2f, 0x73, 0x6f, 0x6f, 0x6e, 0x67,
- 0x2f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f,
- 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70,
- 0x72, 0x6f, 0x74, 0x6f,
+ 0x69, 0x66, 0x61, 0x63, 0x74, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
+ 0x32, 0x37, 0x2e, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61,
+ 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
+ 0x66, 0x6c, 0x61, 0x67, 0x5f, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
+ 0x5f, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x52, 0x1b, 0x66, 0x6c, 0x61, 0x67, 0x44,
+ 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61,
+ 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x33, 0x5a, 0x31, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69,
+ 0x64, 0x2f, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x2f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f,
+ 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63,
+ 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
}
var (
@@ -240,7 +240,7 @@
}
var file_build_flags_declarations_proto_depIdxs = []int32{
2, // 0: android.release_config_proto.flag_declaration_artifact.workflow:type_name -> android.release_config_proto.workflow
- 0, // 1: android.release_config_proto.flag_declaration_artifacts.flag_declaration_artifacts:type_name -> android.release_config_proto.flag_declaration_artifact
+ 0, // 1: android.release_config_proto.flag_declaration_artifacts.flag_declaration_artifact_list:type_name -> android.release_config_proto.flag_declaration_artifact
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
diff --git a/cmd/release_config/release_config_proto/build_flags_declarations.proto b/cmd/release_config/release_config_proto/build_flags_declarations.proto
index e0cf099..233158e 100644
--- a/cmd/release_config/release_config_proto/build_flags_declarations.proto
+++ b/cmd/release_config/release_config_proto/build_flags_declarations.proto
@@ -71,5 +71,5 @@
message flag_declaration_artifacts {
// The artifacts
- repeated flag_declaration_artifact flag_declaration_artifacts = 1;
+ repeated flag_declaration_artifact flag_declaration_artifact_list = 1;
}
diff --git a/dexpreopt/dexpreopt.go b/dexpreopt/dexpreopt.go
index d44cf7e..201515f 100644
--- a/dexpreopt/dexpreopt.go
+++ b/dexpreopt/dexpreopt.go
@@ -527,7 +527,7 @@
return false
}
- if contains(global.SpeedApps, name) || contains(global.SystemServerApps, name) {
+ if contains(global.SystemServerApps, name) {
return false
}
diff --git a/etc/Android.bp b/etc/Android.bp
index 97788e4..f02c12a 100644
--- a/etc/Android.bp
+++ b/etc/Android.bp
@@ -11,8 +11,9 @@
"soong-android",
],
srcs: [
- "prebuilt_etc.go",
"install_symlink.go",
+ "otacerts_zip.go",
+ "prebuilt_etc.go",
],
testSrcs: [
"prebuilt_etc_test.go",
diff --git a/etc/otacerts_zip.go b/etc/otacerts_zip.go
new file mode 100644
index 0000000..b6f175a
--- /dev/null
+++ b/etc/otacerts_zip.go
@@ -0,0 +1,146 @@
+// Copyright 2024 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package etc
+
+import (
+ "android/soong/android"
+
+ "github.com/google/blueprint/proptools"
+)
+
+func init() {
+ RegisterOtacertsZipBuildComponents(android.InitRegistrationContext)
+}
+
+func RegisterOtacertsZipBuildComponents(ctx android.RegistrationContext) {
+ ctx.RegisterModuleType("otacerts_zip", otacertsZipFactory)
+}
+
+type otacertsZipProperties struct {
+ // Make this module available when building for recovery.
+ // Only the recovery partition is available.
+ Recovery_available *bool
+
+ // Optional subdirectory under which the zip file is installed into.
+ Relative_install_path *string
+
+ // Optional name for the installed file. If unspecified, otacerts.zip is used.
+ Filename *string
+}
+
+type otacertsZipModule struct {
+ android.ModuleBase
+
+ properties otacertsZipProperties
+ outputPath android.OutputPath
+}
+
+// otacerts_zip collects key files defined in PRODUCT_DEFAULT_DEV_CERTIFICATE
+// and PRODUCT_EXTRA_OTA_KEYS for system or PRODUCT_EXTRA_RECOVERY_KEYS for
+// recovery image. The output file (otacerts.zip by default) is installed into
+// the relative_install_path directory under the etc directory of the target
+// partition.
+func otacertsZipFactory() android.Module {
+ module := &otacertsZipModule{}
+ module.AddProperties(&module.properties)
+ android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
+ return module
+}
+
+var _ android.ImageInterface = (*otacertsZipModule)(nil)
+
+func (m *otacertsZipModule) ImageMutatorBegin(ctx android.BaseModuleContext) {}
+
+func (m *otacertsZipModule) VendorVariantNeeded(ctx android.BaseModuleContext) bool {
+ return false
+}
+
+func (m *otacertsZipModule) ProductVariantNeeded(ctx android.BaseModuleContext) bool {
+ return false
+}
+
+func (m *otacertsZipModule) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
+ return !m.ModuleBase.InstallInRecovery()
+}
+
+func (m *otacertsZipModule) RamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
+ return false
+}
+
+func (m *otacertsZipModule) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
+ return false
+}
+
+func (m *otacertsZipModule) DebugRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
+ return false
+}
+
+func (m *otacertsZipModule) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
+ return proptools.Bool(m.properties.Recovery_available) || m.ModuleBase.InstallInRecovery()
+}
+
+func (m *otacertsZipModule) ExtraImageVariations(ctx android.BaseModuleContext) []string {
+ return nil
+}
+
+func (m *otacertsZipModule) SetImageVariation(ctx android.BaseModuleContext, variation string) {
+}
+
+func (m *otacertsZipModule) InRecovery() bool {
+ return m.ModuleBase.InRecovery() || m.ModuleBase.InstallInRecovery()
+}
+
+func (m *otacertsZipModule) InstallInRecovery() bool {
+ return m.InRecovery()
+}
+
+func (m *otacertsZipModule) outputFileName() string {
+ // Use otacerts.zip if not specified.
+ return proptools.StringDefault(m.properties.Filename, "otacerts.zip")
+}
+
+func (m *otacertsZipModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+ // Read .x509.pem file defined in PRODUCT_DEFAULT_DEV_CERTIFICATE or the default test key.
+ pem, _ := ctx.Config().DefaultAppCertificate(ctx)
+ // Read .x509.pem files listed in PRODUCT_EXTRA_OTA_KEYS or PRODUCT_EXTRA_RECOVERY_KEYS.
+ extras := ctx.Config().ExtraOtaKeys(ctx, m.InRecovery())
+ srcPaths := append([]android.SourcePath{pem}, extras...)
+ m.outputPath = android.PathForModuleOut(ctx, m.outputFileName()).OutputPath
+
+ rule := android.NewRuleBuilder(pctx, ctx)
+ cmd := rule.Command().BuiltTool("soong_zip").
+ FlagWithOutput("-o ", m.outputPath).
+ Flag("-j ").
+ Flag("-symlinks=false ")
+ for _, src := range srcPaths {
+ cmd.FlagWithInput("-f ", src)
+ }
+ rule.Build(ctx.ModuleName(), "Generating the otacerts zip file")
+
+ installPath := android.PathForModuleInstall(ctx, "etc", proptools.String(m.properties.Relative_install_path))
+ ctx.InstallFile(installPath, m.outputFileName(), m.outputPath)
+}
+
+func (m *otacertsZipModule) AndroidMkEntries() []android.AndroidMkEntries {
+ nameSuffix := ""
+ if m.InRecovery() {
+ nameSuffix = ".recovery"
+ }
+ return []android.AndroidMkEntries{android.AndroidMkEntries{
+ Class: "ETC",
+ SubName: nameSuffix,
+ OutputFile: android.OptionalPathForPath(m.outputPath),
+ }}
+}
diff --git a/filesystem/aconfig_files.go b/filesystem/aconfig_files.go
index 8daee85..5c047bc 100644
--- a/filesystem/aconfig_files.go
+++ b/filesystem/aconfig_files.go
@@ -16,7 +16,6 @@
import (
"android/soong/android"
- "path/filepath"
"strings"
"github.com/google/blueprint/proptools"
@@ -56,6 +55,7 @@
sb.WriteString(" \\\n")
sb.WriteString(sbCaches.String())
cmd.ImplicitOutput(installAconfigFlagsPath)
+ f.appendToEntry(ctx, installAconfigFlagsPath)
installAconfigStorageDir := dir.Join(ctx, "etc", "aconfig")
sb.WriteString("mkdir -p ")
@@ -63,16 +63,18 @@
sb.WriteRune('\n')
generatePartitionAconfigStorageFile := func(fileType, fileName string) {
+ outputPath := installAconfigStorageDir.Join(ctx, fileName)
sb.WriteString(aconfigToolPath.String())
sb.WriteString(" create-storage --container ")
sb.WriteString(f.PartitionType())
sb.WriteString(" --file ")
sb.WriteString(fileType)
sb.WriteString(" --out ")
- sb.WriteString(filepath.Join(installAconfigStorageDir.String(), fileName))
+ sb.WriteString(outputPath.String())
sb.WriteString(" \\\n")
sb.WriteString(sbCaches.String())
- cmd.ImplicitOutput(installAconfigStorageDir.Join(ctx, fileName))
+ cmd.ImplicitOutput(outputPath)
+ f.appendToEntry(ctx, outputPath)
}
generatePartitionAconfigStorageFile("package_map", "package.map")
generatePartitionAconfigStorageFile("flag_map", "flag.map")
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index c889dd6..ffa30a0 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -60,7 +60,9 @@
output android.OutputPath
installDir android.InstallPath
- // For testing. Keeps the result of CopySpecsToDir()
+ fileListFile android.OutputPath
+
+ // Keeps the entries installed from this filesystem
entries []string
}
@@ -221,8 +223,26 @@
f.installDir = android.PathForModuleInstall(ctx, "etc")
ctx.InstallFile(f.installDir, f.installFileName(), f.output)
-
ctx.SetOutputFiles([]android.Path{f.output}, "")
+
+ f.fileListFile = android.PathForModuleOut(ctx, "fileList").OutputPath
+ android.WriteFileRule(ctx, f.fileListFile, f.installedFilesList())
+}
+
+func (f *filesystem) appendToEntry(ctx android.ModuleContext, installedFile android.OutputPath) {
+ partitionBaseDir := android.PathForModuleOut(ctx, "root", f.partitionName()).String() + "/"
+
+ relPath, inTargetPartition := strings.CutPrefix(installedFile.String(), partitionBaseDir)
+ if inTargetPartition {
+ f.entries = append(f.entries, relPath)
+ }
+}
+
+func (f *filesystem) installedFilesList() string {
+ installedFilePaths := android.FirstUniqueStrings(f.entries)
+ slices.Sort(installedFilePaths)
+
+ return strings.Join(installedFilePaths, "\n")
}
func validatePartitionType(ctx android.ModuleContext, p partition) {
@@ -269,17 +289,19 @@
builder.Command().Textf("(! [ -e %s -o -L %s ] || (echo \"%s already exists from an earlier stage of the build\" && exit 1))", dst, dst, dst)
builder.Command().Text("mkdir -p").Text(filepath.Dir(dst.String()))
builder.Command().Text("ln -sf").Text(proptools.ShellEscape(target)).Text(dst.String())
+ f.appendToEntry(ctx, dst)
}
// create extra files if there's any
if f.buildExtraFiles != nil {
rootForExtraFiles := android.PathForModuleGen(ctx, "root-extra").OutputPath
extraFiles := f.buildExtraFiles(ctx, rootForExtraFiles)
- for _, f := range extraFiles {
- rel, err := filepath.Rel(rootForExtraFiles.String(), f.String())
+ for _, extraFile := range extraFiles {
+ rel, err := filepath.Rel(rootForExtraFiles.String(), extraFile.String())
if err != nil || strings.HasPrefix(rel, "..") {
- ctx.ModuleErrorf("can't make %q relative to %q", f, rootForExtraFiles)
+ ctx.ModuleErrorf("can't make %q relative to %q", extraFile, rootForExtraFiles)
}
+ f.appendToEntry(ctx, rootDir.Join(ctx, rel))
}
if len(extraFiles) > 0 {
builder.Command().BuiltTool("merge_directories").
@@ -535,6 +557,8 @@
for _, path := range android.SortedKeys(logtagsFilePaths) {
cmd.Text(path)
}
+
+ f.appendToEntry(ctx, eventLogtagsPath)
}
type partition interface {
@@ -558,6 +582,7 @@
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_MODULE_PATH", f.installDir.String())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", f.installFileName())
+ entries.SetString("LOCAL_FILESYSTEM_FILELIST", f.fileListFile.String())
},
},
}}
diff --git a/filesystem/fsverity_metadata.go b/filesystem/fsverity_metadata.go
index 3e50ff7..d7bb654 100644
--- a/filesystem/fsverity_metadata.go
+++ b/filesystem/fsverity_metadata.go
@@ -87,6 +87,7 @@
sb.WriteRune(' ')
sb.WriteString(srcPath.String())
sb.WriteRune('\n')
+ f.appendToEntry(ctx, destPath)
}
// STEP 2: generate signed BuildManifest.apk
@@ -108,6 +109,7 @@
sb.WriteString(" --output ")
sb.WriteString(manifestPbPath.String())
sb.WriteRune(' ')
+ f.appendToEntry(ctx, manifestPbPath)
manifestGeneratorListPath := android.PathForModuleOut(ctx, "fsverity_manifest.list")
f.writeManifestGeneratorListFile(ctx, manifestGeneratorListPath.OutputPath, matchedSpecs, rebasedDir)
@@ -115,15 +117,18 @@
sb.WriteString(manifestGeneratorListPath.String())
sb.WriteRune('\n')
cmd.Implicit(manifestGeneratorListPath)
+ f.appendToEntry(ctx, manifestGeneratorListPath.OutputPath)
// STEP 2-2: generate BuildManifest.apk (unsigned)
aapt2Path := ctx.Config().HostToolPath(ctx, "aapt2")
apkPath := rebasedDir.Join(ctx, "etc", "security", "fsverity", "BuildManifest.apk")
+ idsigPath := rebasedDir.Join(ctx, "etc", "security", "fsverity", "BuildManifest.apk.idsig")
manifestTemplatePath := android.PathForSource(ctx, "system/security/fsverity/AndroidManifest.xml")
libs := android.PathsForModuleSrc(ctx, f.properties.Fsverity.Libs)
cmd.Implicit(aapt2Path)
cmd.Implicit(manifestTemplatePath)
cmd.Implicits(libs)
+ cmd.ImplicitOutput(apkPath)
sb.WriteString(aapt2Path.String())
sb.WriteString(" link -o ")
@@ -150,12 +155,15 @@
sb.WriteString(f.partitionName())
sb.WriteRune('\n')
+ f.appendToEntry(ctx, apkPath)
+
// STEP 2-3: sign BuildManifest.apk
apksignerPath := ctx.Config().HostToolPath(ctx, "apksigner")
pemPath, keyPath := ctx.Config().DefaultAppCertificate(ctx)
cmd.Implicit(apksignerPath)
cmd.Implicit(pemPath)
cmd.Implicit(keyPath)
+ cmd.ImplicitOutput(idsigPath)
sb.WriteString(apksignerPath.String())
sb.WriteString(" sign --in ")
sb.WriteString(apkPath.String())
@@ -165,5 +173,7 @@
sb.WriteString(keyPath.String())
sb.WriteRune('\n')
+ f.appendToEntry(ctx, idsigPath)
+
android.WriteExecutableFileRuleVerbatim(ctx, fsverityBuilderPath, sb.String())
}
diff --git a/java/app.go b/java/app.go
index f35e4c3..e8c9bfe 100644
--- a/java/app.go
+++ b/java/app.go
@@ -583,7 +583,11 @@
a.aapt.splitNames = a.appProperties.Package_splits
a.aapt.LoggingParent = String(a.overridableAppProperties.Logging_parent)
if a.Updatable() {
- a.aapt.defaultManifestVersion = android.DefaultUpdatableModuleVersion
+ if override := ctx.Config().Getenv("OVERRIDE_APEX_MANIFEST_DEFAULT_VERSION"); override != "" {
+ a.aapt.defaultManifestVersion = override
+ } else {
+ a.aapt.defaultManifestVersion = android.DefaultUpdatableModuleVersion
+ }
}
// Use non final ids if we are doing optimized shrinking and are using R8.
diff --git a/java/app_test.go b/java/app_test.go
index 9e2d19e..5770ab4 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -519,6 +519,49 @@
testJavaError(t, `"libjni" .*: links "libbar" built against newer API version "current"`, bp)
}
+func TestUpdatableApps_ApplyDefaultUpdatableModuleVersion(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ PrepareForTestWithJavaDefaultModules,
+ ).RunTestWithBp(t, `
+ android_app {
+ name: "com.android.foo",
+ srcs: ["a.java"],
+ sdk_version: "current",
+ min_sdk_version: "31",
+ updatable: true,
+ }
+ `)
+ foo := result.ModuleForTests("com.android.foo", "android_common").Rule("manifestFixer")
+ android.AssertStringDoesContain(t,
+ "com.android.foo: expected manifest fixer to set override-placeholder-version to android.DefaultUpdatableModuleVersion",
+ foo.BuildParams.Args["args"],
+ fmt.Sprintf("--override-placeholder-version %s", android.DefaultUpdatableModuleVersion),
+ )
+}
+
+func TestUpdatableApps_ApplyOverrideApexManifestDefaultVersion(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ PrepareForTestWithJavaDefaultModules,
+ android.FixtureMergeEnv(map[string]string{
+ "OVERRIDE_APEX_MANIFEST_DEFAULT_VERSION": "1234",
+ }),
+ ).RunTestWithBp(t, `
+ android_app {
+ name: "com.android.foo",
+ srcs: ["a.java"],
+ sdk_version: "current",
+ min_sdk_version: "31",
+ updatable: true,
+ }
+ `)
+ foo := result.ModuleForTests("com.android.foo", "android_common").Rule("manifestFixer")
+ android.AssertStringDoesContain(t,
+ "com.android.foo: expected manifest fixer to set override-placeholder-version to 1234",
+ foo.BuildParams.Args["args"],
+ "--override-placeholder-version 1234",
+ )
+}
+
func TestResourceDirs(t *testing.T) {
testCases := []struct {
name string
@@ -4556,3 +4599,44 @@
)
}
+
+func TestNotApplyDefaultUpdatableModuleVersion(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ PrepareForTestWithJavaDefaultModules,
+ ).RunTestWithBp(t, `
+ android_app {
+ name: "com.android.foo",
+ srcs: ["a.java"],
+ sdk_version: "current",
+ min_sdk_version: "31",
+ }
+ `)
+ foo := result.ModuleForTests("com.android.foo", "android_common").Rule("manifestFixer")
+ android.AssertStringDoesNotContain(t,
+ "com.android.foo: expected manifest fixer to not set override-placeholder-version",
+ foo.BuildParams.Args["args"],
+ "--override-placeholder-version",
+ )
+}
+
+func TestNotApplyOverrideApexManifestDefaultVersion(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ PrepareForTestWithJavaDefaultModules,
+ android.FixtureMergeEnv(map[string]string{
+ "OVERRIDE_APEX_MANIFEST_DEFAULT_VERSION": "1234",
+ }),
+ ).RunTestWithBp(t, `
+ android_app {
+ name: "com.android.foo",
+ srcs: ["a.java"],
+ sdk_version: "current",
+ min_sdk_version: "31",
+ }
+ `)
+ foo := result.ModuleForTests("com.android.foo", "android_common").Rule("manifestFixer")
+ android.AssertStringDoesNotContain(t,
+ "com.android.foo: expected manifest fixer to not set override-placeholder-version",
+ foo.BuildParams.Args["args"],
+ "--override-placeholder-version",
+ )
+}
diff --git a/java/droidstubs.go b/java/droidstubs.go
index b32b754..0157185 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -1453,17 +1453,6 @@
stubsSrcJar android.Path
}
-func (p *PrebuiltStubsSources) OutputFiles(tag string) (android.Paths, error) {
- switch tag {
- // prebuilt droidstubs does not output "exportable" stubs.
- // Output the "everything" stubs srcjar file if the tag is ".exportable".
- case "", ".exportable":
- return android.Paths{p.stubsSrcJar}, nil
- default:
- return nil, fmt.Errorf("unsupported module reference tag %q", tag)
- }
-}
-
func (d *PrebuiltStubsSources) StubsSrcJar(_ StubsType) (android.Path, error) {
return d.stubsSrcJar, nil
}
@@ -1502,6 +1491,11 @@
rule.Build("zip src", "Create srcjar from prebuilt source")
p.stubsSrcJar = outPath
}
+
+ ctx.SetOutputFiles(android.Paths{p.stubsSrcJar}, "")
+ // prebuilt droidstubs does not output "exportable" stubs.
+ // Output the "everything" stubs srcjar file if the tag is ".exportable".
+ ctx.SetOutputFiles(android.Paths{p.stubsSrcJar}, ".exportable")
}
func (p *PrebuiltStubsSources) Prebuilt() *android.Prebuilt {
diff --git a/linkerconfig/linkerconfig.go b/linkerconfig/linkerconfig.go
index 3a8d3cf..87c0814 100644
--- a/linkerconfig/linkerconfig.go
+++ b/linkerconfig/linkerconfig.go
@@ -104,7 +104,7 @@
// Secondly, if there's provideLibs gathered from provideModules, append them
var provideLibs []string
for _, m := range provideModules {
- if c, ok := m.(*cc.Module); ok && cc.IsStubTarget(c) {
+ if c, ok := m.(*cc.Module); ok && (cc.IsStubTarget(c) || c.HasLlndkStubs()) {
for _, ps := range c.PackagingSpecs() {
provideLibs = append(provideLibs, ps.FileName())
}
diff --git a/scripts/gen_build_prop.py b/scripts/gen_build_prop.py
index 42e3207..799e00b 100644
--- a/scripts/gen_build_prop.py
+++ b/scripts/gen_build_prop.py
@@ -19,9 +19,12 @@
import argparse
import contextlib
import json
+import os
import subprocess
import sys
+TEST_KEY_DIR = "build/make/target/product/security"
+
def get_build_variant(product_config):
if product_config["Eng"]:
return "eng"
diff --git a/sdk/cc_sdk_test.go b/sdk/cc_sdk_test.go
index 9490d12..c9e20b3 100644
--- a/sdk/cc_sdk_test.go
+++ b/sdk/cc_sdk_test.go
@@ -148,6 +148,9 @@
srcs: ["linux_glibc/x86_64/lib/sdkmember.so"],
},
},
+ strip: {
+ none: true,
+ },
}
`),
checkAllCopyRules(`
@@ -368,6 +371,9 @@
srcs: ["arm/lib/mynativelib.so"],
},
},
+ strip: {
+ none: true,
+ },
}
`),
checkAllCopyRules(`
@@ -455,6 +461,9 @@
},
},
},
+ strip: {
+ none: true,
+ },
}
`),
checkAllCopyRules(`
@@ -697,6 +706,9 @@
srcs: ["x86_64/lib/mynativelib.so"],
},
},
+ strip: {
+ none: true,
+ },
}
`),
checkAllCopyRules(`
@@ -824,6 +836,9 @@
export_include_dirs: ["arm/include_gen/mynativelib/android_arm_armv7-a-neon_shared/gen/aidl"],
},
},
+ strip: {
+ none: true,
+ },
}
`),
checkAllCopyRules(`
@@ -932,6 +947,9 @@
srcs: ["arm/lib/mynativelib.so"],
},
},
+ strip: {
+ none: true,
+ },
}
cc_prebuilt_library_shared {
@@ -950,6 +968,9 @@
srcs: ["arm/lib/myothernativelib.so"],
},
},
+ strip: {
+ none: true,
+ },
}
cc_prebuilt_library_shared {
@@ -967,6 +988,9 @@
srcs: ["arm/lib/mysystemnativelib.so"],
},
},
+ strip: {
+ none: true,
+ },
}
`),
checkAllCopyRules(`
@@ -1041,6 +1065,9 @@
export_include_dirs: ["x86/include_gen/mynativelib/linux_glibc_x86_shared/gen/aidl"],
},
},
+ strip: {
+ none: true,
+ },
}
`),
checkAllCopyRules(`
@@ -1127,6 +1154,9 @@
srcs: ["windows/x86_64/lib/mynativelib.dll"],
},
},
+ strip: {
+ none: true,
+ },
}
`),
checkAllCopyRules(`
@@ -2021,6 +2051,9 @@
srcs: ["arm/lib/sslnil.so"],
},
},
+ strip: {
+ none: true,
+ },
}
cc_prebuilt_library_shared {
@@ -2038,6 +2071,9 @@
srcs: ["arm/lib/sslempty.so"],
},
},
+ strip: {
+ none: true,
+ },
}
cc_prebuilt_library_shared {
@@ -2055,6 +2091,9 @@
srcs: ["arm/lib/sslnonempty.so"],
},
},
+ strip: {
+ none: true,
+ },
}
`))
@@ -2114,6 +2153,9 @@
srcs: ["linux_glibc/x86/lib/sslvariants.so"],
},
},
+ strip: {
+ none: true,
+ },
}
`),
)
@@ -2171,6 +2213,9 @@
srcs: ["arm/lib/stubslib.so"],
},
},
+ strip: {
+ none: true,
+ },
}
`))
}
@@ -2242,6 +2287,9 @@
srcs: ["linux_glibc/x86/lib/stubslib.so"],
},
},
+ strip: {
+ none: true,
+ },
}
`),
)
@@ -2298,6 +2346,9 @@
srcs: ["linux_glibc/x86/lib/mylib-host.so"],
},
},
+ strip: {
+ none: true,
+ },
}
`),
checkAllCopyRules(`
@@ -2355,6 +2406,9 @@
srcs: ["arm/lib/mynativelib.so"],
},
},
+ strip: {
+ none: true,
+ },
}
`),
checkAllCopyRules(`
diff --git a/sdk/update.go b/sdk/update.go
index 0a97fd9..198c8d4 100644
--- a/sdk/update.go
+++ b/sdk/update.go
@@ -434,6 +434,14 @@
prebuiltModule := memberType.AddPrebuiltModule(memberCtx, member)
s.createMemberSnapshot(memberCtx, member, prebuiltModule.(*bpModule))
+ // Set stripper to none to skip stripping for generated snapshots.
+ // Mainline prebuilts (cc_prebuilt_library_shared) are not strippable in older platforms.
+ // Thus, stripping should be skipped when being used as prebuilts.
+ if memberType.DisablesStrip() {
+ stripPropertySet := prebuiltModule.(*bpModule).AddPropertySet("strip")
+ stripPropertySet.AddProperty("none", true)
+ }
+
if member.memberType != android.LicenseModuleSdkMemberType && !builder.isInternalMember(member.name) {
// More exceptions
// 1. Skip BCP and SCCP fragments
diff --git a/ui/build/config.go b/ui/build/config.go
index c4a6797..52c5e23 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -99,9 +99,10 @@
// Autodetected
totalRAM uint64
- brokenDupRules bool
- brokenUsesNetwork bool
- brokenNinjaEnvVars []string
+ brokenDupRules bool
+ brokenUsesNetwork bool
+ brokenNinjaEnvVars []string
+ brokenMissingOutputs bool
pathReplaced bool
@@ -312,6 +313,7 @@
"DISPLAY",
"GREP_OPTIONS",
"JAVAC",
+ "LEX",
"NDK_ROOT",
"POSIXLY_CORRECT",
@@ -1608,6 +1610,14 @@
return c.brokenNinjaEnvVars
}
+func (c *configImpl) SetBuildBrokenMissingOutputs(val bool) {
+ c.brokenMissingOutputs = val
+}
+
+func (c *configImpl) BuildBrokenMissingOutputs() bool {
+ return c.brokenMissingOutputs
+}
+
func (c *configImpl) SetTargetDeviceDir(dir string) {
c.targetDeviceDir = dir
}
diff --git a/ui/build/dumpvars.go b/ui/build/dumpvars.go
index eba86a0..e77df44 100644
--- a/ui/build/dumpvars.go
+++ b/ui/build/dumpvars.go
@@ -235,6 +235,11 @@
"BUILD_BROKEN_SRC_DIR_IS_WRITABLE",
"BUILD_BROKEN_SRC_DIR_RW_ALLOWLIST",
+ // Whether missing outputs should be treated as warnings
+ // instead of errors.
+ // `true` will relegate missing outputs to warnings.
+ "BUILD_BROKEN_MISSING_OUTPUTS",
+
// Not used, but useful to be in the soong.log
"TARGET_BUILD_TYPE",
"HOST_ARCH",
@@ -301,4 +306,5 @@
config.SetBuildBrokenUsesNetwork(makeVars["BUILD_BROKEN_USES_NETWORK"] == "true")
config.SetBuildBrokenNinjaUsesEnvVars(strings.Fields(makeVars["BUILD_BROKEN_NINJA_USES_ENV_VARS"]))
config.SetSourceRootDirs(strings.Fields(makeVars["PRODUCT_SOURCE_ROOT_DIRS"]))
+ config.SetBuildBrokenMissingOutputs(makeVars["BUILD_BROKEN_MISSING_OUTPUTS"] == "true")
}
diff --git a/ui/build/ninja.go b/ui/build/ninja.go
index 551b8ab..ae27330 100644
--- a/ui/build/ninja.go
+++ b/ui/build/ninja.go
@@ -77,6 +77,14 @@
"-w", "dupbuild=err",
"-w", "missingdepfile=err")
+ if !config.BuildBrokenMissingOutputs() {
+ // Missing outputs will be treated as errors.
+ // BUILD_BROKEN_MISSING_OUTPUTS can be used to bypass this check.
+ args = append(args,
+ "-w", "missingoutfile=err",
+ )
+ }
+
cmd := Command(ctx, config, "ninja", executable, args...)
// Set up the nsjail sandbox Ninja runs in.