diff options
-rw-r--r-- | apex/apex.go | 72 | ||||
-rw-r--r-- | cc/compdb.go | 19 | ||||
-rw-r--r-- | cc/config/darwin_host.go | 1 | ||||
-rw-r--r-- | cc/config/x86_windows_host.go | 2 | ||||
-rw-r--r-- | java/dex.go | 19 | ||||
-rw-r--r-- | java/java.go | 8 |
6 files changed, 86 insertions, 35 deletions
diff --git a/apex/apex.go b/apex/apex.go index 77ebf2624..ec71c1858 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -213,6 +213,50 @@ type apexBundleProperties struct { 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 @@ type ApexNativeDependencies struct { 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 @@ type ApexNativeDependencies struct { 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 @@ type ApexNativeDependencies struct { } // 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 @@ var ( ) // 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 @@ func addDependenciesForNativeModules(ctx android.BottomUpMutatorContext, nativeM // 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 @@ func addDependenciesForNativeModules(ctx android.BottomUpMutatorContext, nativeM 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 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) { } } 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 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) { 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 @@ func (a *apexBundle) ApexInfoMutator(mctx android.TopDownMutatorContext) { 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 @@ func (a *apexBundle) AddSanitizerDependencies(ctx android.BottomUpMutatorContext 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 da2818324..b33f490f7 100644 --- a/cc/compdb.go +++ b/cc/compdb.go @@ -85,23 +85,24 @@ func (c *compdbGeneratorSingleton) GenerateBuildActions(ctx android.SingletonCon 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 2ea607a9d..1783f4967 100644 --- a/cc/config/darwin_host.go +++ b/cc/config/darwin_host.go @@ -29,6 +29,7 @@ var ( 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 ea7d3426a..a4d43b996 100644 --- a/cc/config/x86_windows_host.go +++ b/cc/config/x86_windows_host.go @@ -47,6 +47,8 @@ var ( // Windows flags to generate PDB "-g", "-gcodeview", + + "-fno-omit-frame-pointer", } windowsIncludeFlags = []string{ diff --git a/java/dex.go b/java/dex.go index d88e8f86f..6c739a27f 100644 --- a/java/dex.go +++ b/java/dex.go @@ -289,15 +289,18 @@ func (d *dexer) r8Flags(ctx android.ModuleContext, dexParams *compileDexParams) // - 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 258ebba0c..46344c842 100644 --- a/java/java.go +++ b/java/java.go @@ -1864,10 +1864,12 @@ func (j *Binary) DepsMutator(ctx android.BottomUpMutatorContext) { 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()) |