diff options
Diffstat (limited to 'apex/apex.go')
-rw-r--r-- | apex/apex.go | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/apex/apex.go b/apex/apex.go index f6fecb5aa..ff38773b8 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -94,10 +94,6 @@ type apexBundleProperties struct { // a default one is automatically generated. AndroidManifest *string `android:"path"` - // Canonical name of this APEX bundle. Used to determine the path to the activated APEX on - // device (/apex/<apex_name>). If unspecified, follows the name property. - Apex_name *string - // Determines the file contexts file for setting the security contexts to files in this APEX // bundle. For platform APEXes, this should points to a file under /system/sepolicy Default: // /system/sepolicy/apex/<module_name>_file_contexts. @@ -149,16 +145,6 @@ type apexBundleProperties struct { // Should be only used in non-system apexes (e.g. vendor: true). Default is false. Use_vndk_as_stable *bool - // Whether this is multi-installed APEX should skip installing symbol files. - // Multi-installed APEXes share the same apex_name and are installed at the same time. - // Default is false. - // - // Should be set to true for all multi-installed APEXes except the singular - // default version within the multi-installed group. - // Only the default version can install symbol files in $(PRODUCT_OUT}/apex, - // or else conflicting build rules may be created. - Multi_install_skip_symbol_files *bool - // The type of APEX to build. Controls what the APEX payload is. Either 'image', 'zip' or // 'both'. When set to image, contents are stored in a filesystem image inside a zip // container. When set to zip, contents are stored in a zip container directly. This type is @@ -1047,7 +1033,7 @@ func (a *apexBundle) ApexInfoMutator(mctx android.TopDownMutatorContext) { // This is the main part of this mutator. Mark the collected dependencies that they need to // be built for this apexBundle. - apexVariationName := proptools.StringDefault(a.properties.Apex_name, mctx.ModuleName()) // could be com.android.foo + apexVariationName := mctx.ModuleName() // could be com.android.foo a.properties.ApexVariationName = apexVariationName apexInfo := android.ApexInfo{ ApexVariationName: apexVariationName, @@ -1781,6 +1767,18 @@ func apexFileForJavaModuleWithFile(ctx android.BaseModuleContext, module javaMod return af } +func apexFileForJavaModuleProfile(ctx android.BaseModuleContext, module javaModule) *apexFile { + if dexpreopter, ok := module.(java.DexpreopterInterface); ok { + if profilePathOnHost := dexpreopter.ProfilePathOnHost(); profilePathOnHost != nil { + dirInApex := "javalib" + af := newApexFile(ctx, profilePathOnHost, module.BaseModuleName()+"-profile", dirInApex, etc, nil) + af.customStem = module.Stem() + ".jar.prof" + return &af + } + } + return nil +} + // androidApp is an interface to handle all app modules (android_app, android_app_import, etc.) in // the same way. type androidApp interface { @@ -1996,21 +1994,17 @@ func (a *apexBundle) ProcessBazelQueryResponse(ctx android.ModuleContext) { a.installedFile = ctx.InstallFile(a.installDir, a.Name()+installSuffix, a.outputFile, a.compatSymlinks.Paths()...) default: - panic(fmt.Errorf("unexpected apex_type for the ProcessBazelQuery: %v", a.properties.ApexType)) + panic(fmt.Errorf("internal error: unexpected apex_type for the ProcessBazelQueryResponse: %v", a.properties.ApexType)) } - /* - TODO(asmundak): compared to building an APEX with Soong, building it with Bazel does not - return filesInfo and requiredDeps fields (in the Soong build the latter is updated). - Fix this, as these fields are subsequently used in apex/androidmk.go and in apex/builder/go - To find out what Soong build puts there, run: - vctx := visitorContext{handleSpecialLibs: !android.Bool(a.properties.Ignore_system_library_special_case)} - ctx.WalkDepsBlueprint(func(child, parent blueprint.Module) bool { - return a.depVisitor(&vctx, ctx, child, parent) - }) - vctx.normalizeFileInfo() - */ - + // filesInfo is not set in mixed mode, because all information about the + // apex's contents should completely come from the Starlark providers. + // + // Prevent accidental writes to filesInfo in the earlier parts Soong by + // asserting it to be nil. + if a.filesInfo != nil { + panic(fmt.Errorf("internal error: filesInfo must be nil for an apex handled by Bazel.")) + } } func (a *apexBundle) setCompression(ctx android.ModuleContext) { @@ -2480,6 +2474,9 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext, case *java.Library, *java.SdkLibrary: af := apexFileForJavaModule(ctx, child.(javaModule)) vctx.filesInfo = append(vctx.filesInfo, af) + if profileAf := apexFileForJavaModuleProfile(ctx, child.(javaModule)); profileAf != nil { + vctx.filesInfo = append(vctx.filesInfo, *profileAf) + } return true // track transitive dependencies default: ctx.PropertyErrorf("systemserverclasspath_fragments", |