Merge "Remove build target related fields from ModuleBase." into main
diff --git a/apex/apex.go b/apex/apex.go
index 77ebf26..ec71c18 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -213,6 +213,50 @@
type ApexNativeDependencies struct {
// List of native libraries that are embedded inside this APEX.
+ Native_shared_libs proptools.Configurable[[]string]
+
+ // List of JNI libraries that are embedded inside this APEX.
+ Jni_libs []string
+
+ // List of rust dyn libraries that are embedded inside this APEX.
+ Rust_dyn_libs []string
+
+ // List of native executables that are embedded inside this APEX.
+ Binaries proptools.Configurable[[]string]
+
+ // List of native tests that are embedded inside this APEX.
+ Tests []string
+
+ // List of filesystem images that are embedded inside this APEX bundle.
+ Filesystems []string
+
+ // List of prebuilt_etcs that are embedded inside this APEX bundle.
+ Prebuilts proptools.Configurable[[]string]
+
+ // List of native libraries to exclude from this APEX.
+ Exclude_native_shared_libs []string
+
+ // List of JNI libraries to exclude from this APEX.
+ Exclude_jni_libs []string
+
+ // List of rust dyn libraries to exclude from this APEX.
+ Exclude_rust_dyn_libs []string
+
+ // List of native executables to exclude from this APEX.
+ Exclude_binaries []string
+
+ // List of native tests to exclude from this APEX.
+ Exclude_tests []string
+
+ // List of filesystem images to exclude from this APEX bundle.
+ Exclude_filesystems []string
+
+ // List of prebuilt_etcs to exclude from this APEX bundle.
+ Exclude_prebuilts []string
+}
+
+type ResolvedApexNativeDependencies struct {
+ // List of native libraries that are embedded inside this APEX.
Native_shared_libs []string
// List of JNI libraries that are embedded inside this APEX.
@@ -222,8 +266,7 @@
Rust_dyn_libs []string
// List of native executables that are embedded inside this APEX.
- Binaries proptools.Configurable[[]string]
- ResolvedBinaries []string `blueprint:"mutated"`
+ Binaries []string
// List of native tests that are embedded inside this APEX.
Tests []string
@@ -232,8 +275,7 @@
Filesystems []string
// List of prebuilt_etcs that are embedded inside this APEX bundle.
- Prebuilts proptools.Configurable[[]string]
- ResolvedPrebuilts []string `blueprint:"mutated"`
+ Prebuilts []string
// List of native libraries to exclude from this APEX.
Exclude_native_shared_libs []string
@@ -258,14 +300,14 @@
}
// Merge combines another ApexNativeDependencies into this one
-func (a *ApexNativeDependencies) Merge(ctx android.BaseMutatorContext, b ApexNativeDependencies) {
- a.Native_shared_libs = append(a.Native_shared_libs, b.Native_shared_libs...)
+func (a *ResolvedApexNativeDependencies) Merge(ctx android.BaseMutatorContext, b ApexNativeDependencies) {
+ a.Native_shared_libs = append(a.Native_shared_libs, b.Native_shared_libs.GetOrDefault(ctx, nil)...)
a.Jni_libs = append(a.Jni_libs, b.Jni_libs...)
a.Rust_dyn_libs = append(a.Rust_dyn_libs, b.Rust_dyn_libs...)
- a.ResolvedBinaries = append(a.ResolvedBinaries, b.Binaries.GetOrDefault(ctx, nil)...)
+ a.Binaries = append(a.Binaries, b.Binaries.GetOrDefault(ctx, nil)...)
a.Tests = append(a.Tests, b.Tests...)
a.Filesystems = append(a.Filesystems, b.Filesystems...)
- a.ResolvedPrebuilts = append(a.ResolvedPrebuilts, b.Prebuilts.GetOrDefault(ctx, nil)...)
+ a.Prebuilts = append(a.Prebuilts, b.Prebuilts.GetOrDefault(ctx, nil)...)
a.Exclude_native_shared_libs = append(a.Exclude_native_shared_libs, b.Exclude_native_shared_libs...)
a.Exclude_jni_libs = append(a.Exclude_jni_libs, b.Exclude_jni_libs...)
@@ -700,7 +742,7 @@
)
// TODO(jiyong): shorten this function signature
-func addDependenciesForNativeModules(ctx android.BottomUpMutatorContext, nativeModules ApexNativeDependencies, target android.Target, imageVariation string) {
+func addDependenciesForNativeModules(ctx android.BottomUpMutatorContext, nativeModules ResolvedApexNativeDependencies, target android.Target, imageVariation string) {
binVariations := target.Variations()
libVariations := append(target.Variations(), blueprint.Variation{Mutator: "link", Variation: "shared"})
rustLibVariations := append(
@@ -718,7 +760,7 @@
// this module. This is required since arch variant of an APEX bundle is 'common' but it is
// 'arm' or 'arm64' for native shared libs.
ctx.AddFarVariationDependencies(binVariations, executableTag,
- android.RemoveListFromList(nativeModules.ResolvedBinaries, nativeModules.Exclude_binaries)...)
+ android.RemoveListFromList(nativeModules.Binaries, nativeModules.Exclude_binaries)...)
ctx.AddFarVariationDependencies(binVariations, testTag,
android.RemoveListFromList(nativeModules.Tests, nativeModules.Exclude_tests)...)
ctx.AddFarVariationDependencies(libVariations, jniLibTag,
@@ -730,7 +772,7 @@
ctx.AddFarVariationDependencies(target.Variations(), fsTag,
android.RemoveListFromList(nativeModules.Filesystems, nativeModules.Exclude_filesystems)...)
ctx.AddFarVariationDependencies(target.Variations(), prebuiltTag,
- android.RemoveListFromList(nativeModules.ResolvedPrebuilts, nativeModules.Exclude_prebuilts)...)
+ android.RemoveListFromList(nativeModules.Prebuilts, nativeModules.Exclude_prebuilts)...)
}
func (a *apexBundle) combineProperties(ctx android.BottomUpMutatorContext) {
@@ -781,7 +823,7 @@
}
}
for i, target := range targets {
- var deps ApexNativeDependencies
+ var deps ResolvedApexNativeDependencies
// Add native modules targeting both ABIs. When multilib.* is omitted for
// native_shared_libs/jni_libs/tests, it implies multilib.both
@@ -798,7 +840,7 @@
if isPrimaryAbi {
deps.Merge(ctx, a.properties.Multilib.First)
deps.Merge(ctx, ApexNativeDependencies{
- Native_shared_libs: nil,
+ Native_shared_libs: proptools.NewConfigurable[[]string](nil, nil),
Tests: nil,
Jni_libs: nil,
Binaries: a.properties.Binaries,
@@ -1035,7 +1077,7 @@
if a.dynamic_common_lib_apex() {
android.SetProvider(mctx, DCLAInfoProvider, DCLAInfo{
- ProvidedLibs: a.properties.Native_shared_libs,
+ ProvidedLibs: a.properties.Native_shared_libs.GetOrDefault(mctx, nil),
})
}
}
@@ -1492,7 +1534,7 @@
imageVariation := a.getImageVariation()
for _, target := range ctx.MultiTargets() {
if target.Arch.ArchType.Multilib == "lib64" {
- addDependenciesForNativeModules(ctx, ApexNativeDependencies{
+ addDependenciesForNativeModules(ctx, ResolvedApexNativeDependencies{
Native_shared_libs: []string{"libclang_rt.hwasan"},
Tests: nil,
Jni_libs: nil,
diff --git a/cc/compdb.go b/cc/compdb.go
index da28183..b33f490 100644
--- a/cc/compdb.go
+++ b/cc/compdb.go
@@ -85,23 +85,24 @@
if err != nil {
log.Fatalf("Could not create file %s: %s", compDBFile, err)
}
- defer f.Close()
+ defer func() {
+ if err := f.Close(); err != nil {
+ log.Fatalf("Could not close file %s: %s", compDBFile, err)
+ }
+ }()
v := make([]compDbEntry, 0, len(m))
-
for _, value := range m {
v = append(v, value)
}
- var dat []byte
+
+ w := json.NewEncoder(f)
if outputCompdbDebugInfo {
- dat, err = json.MarshalIndent(v, "", " ")
- } else {
- dat, err = json.Marshal(v)
+ w.SetIndent("", " ")
}
- if err != nil {
- log.Fatalf("Failed to marshal: %s", err)
+ if err := w.Encode(v); err != nil {
+ log.Fatalf("Failed to encode: %s", err)
}
- f.Write(dat)
if finalLinkDir := ctx.Config().Getenv(envVariableCompdbLink); finalLinkDir != "" {
finalLinkPath := filepath.Join(finalLinkDir, compdbFilename)
diff --git a/cc/config/darwin_host.go b/cc/config/darwin_host.go
index 2ea607a..1783f49 100644
--- a/cc/config/darwin_host.go
+++ b/cc/config/darwin_host.go
@@ -29,6 +29,7 @@
darwinCflags = []string{
"-fPIC",
"-funwind-tables",
+ "-fno-omit-frame-pointer",
"-isysroot ${macSdkRoot}",
"-mmacosx-version-min=${macMinVersion}",
diff --git a/cc/config/x86_windows_host.go b/cc/config/x86_windows_host.go
index ea7d342..a4d43b9 100644
--- a/cc/config/x86_windows_host.go
+++ b/cc/config/x86_windows_host.go
@@ -47,6 +47,8 @@
// Windows flags to generate PDB
"-g",
"-gcodeview",
+
+ "-fno-omit-frame-pointer",
}
windowsIncludeFlags = []string{
diff --git a/java/dex.go b/java/dex.go
index d88e8f8..6c739a2 100644
--- a/java/dex.go
+++ b/java/dex.go
@@ -289,15 +289,18 @@
// - suppress ProGuard warnings of referencing symbols unknown to the lower SDK version.
// - prevent ProGuard stripping subclass in the support library that extends class added in the higher SDK version.
// See b/20667396
- var proguardRaiseDeps classpath
- ctx.VisitDirectDepsWithTag(proguardRaiseTag, func(m android.Module) {
- if dep, ok := android.OtherModuleProvider(ctx, m, JavaInfoProvider); ok {
- proguardRaiseDeps = append(proguardRaiseDeps, dep.RepackagedHeaderJars...)
- }
- })
+ // TODO(b/360905238): Remove SdkSystemServer exception after resolving missing class references.
+ if !dexParams.sdkVersion.Stable() || dexParams.sdkVersion.Kind == android.SdkSystemServer {
+ var proguardRaiseDeps classpath
+ ctx.VisitDirectDepsWithTag(proguardRaiseTag, func(m android.Module) {
+ if dep, ok := android.OtherModuleProvider(ctx, m, JavaInfoProvider); ok {
+ proguardRaiseDeps = append(proguardRaiseDeps, dep.RepackagedHeaderJars...)
+ }
+ })
+ r8Flags = append(r8Flags, proguardRaiseDeps.FormJavaClassPath("-libraryjars"))
+ r8Deps = append(r8Deps, proguardRaiseDeps...)
+ }
- r8Flags = append(r8Flags, proguardRaiseDeps.FormJavaClassPath("-libraryjars"))
- r8Deps = append(r8Deps, proguardRaiseDeps...)
r8Flags = append(r8Flags, flags.bootClasspath.FormJavaClassPath("-libraryjars"))
r8Deps = append(r8Deps, flags.bootClasspath...)
r8Flags = append(r8Flags, flags.dexClasspath.FormJavaClassPath("-libraryjars"))
diff --git a/java/java.go b/java/java.go
index 258ebba..46344c8 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1864,10 +1864,12 @@
if ctx.Arch().ArchType == android.Common {
j.deps(ctx)
}
- if ctx.Arch().ArchType != android.Common {
- // These dependencies ensure the host installation rules will install the jar file and
- // the jni libraries when the wrapper is installed.
+ // These dependencies ensure the installation rules will install the jar file when the
+ // wrapper is installed, and the jni libraries on host when the wrapper is installed.
+ if ctx.Arch().ArchType != android.Common && ctx.Os().Class == android.Host {
ctx.AddVariationDependencies(nil, jniInstallTag, j.binaryProperties.Jni_libs...)
+ }
+ if ctx.Arch().ArchType != android.Common {
ctx.AddVariationDependencies(
[]blueprint.Variation{{Mutator: "arch", Variation: android.CommonArch.String()}},
binaryInstallTag, ctx.ModuleName())