Merge changes If313580b,I68d50d68 into main
* changes:
Use a provider for systems modules
Add PrepareForTestWithBuildFlag
diff --git a/Android.bp b/Android.bp
index 8d1280c..432c7fc 100644
--- a/Android.bp
+++ b/Android.bp
@@ -149,3 +149,21 @@
relative_install_path: "etc", // system_ext/etc/build.prop
visibility: ["//visibility:private"],
}
+
+build_prop {
+ name: "product-build.prop",
+ stem: "build.prop",
+ product_specific: true,
+ product_config: ":product_config",
+ relative_install_path: "etc", // product/etc/build.prop
+ visibility: ["//visibility:private"],
+}
+
+build_prop {
+ name: "odm-build.prop",
+ stem: "build.prop",
+ device_specific: true,
+ product_config: ":product_config",
+ relative_install_path: "etc", // odm/etc/build.prop
+ visibility: ["//visibility:private"],
+}
diff --git a/android/build_prop.go b/android/build_prop.go
index d48d94d..b127755 100644
--- a/android/build_prop.go
+++ b/android/build_prop.go
@@ -61,6 +61,8 @@
return ctx.Config().SystemPropFiles(ctx)
} else if partition == "system_ext" {
return ctx.Config().SystemExtPropFiles(ctx)
+ } else if partition == "product" {
+ return ctx.Config().ProductPropFiles(ctx)
}
return nil
}
@@ -80,6 +82,28 @@
return false
}
+// Can't use PartitionTag() because PartitionTag() returns the partition this module is actually
+// installed (e.g. odm module's partition tag can be either "odm" or "vendor")
+func (p *buildPropModule) partition(config DeviceConfig) string {
+ if p.SocSpecific() {
+ return "vendor"
+ } else if p.DeviceSpecific() {
+ return "odm"
+ } else if p.ProductSpecific() {
+ return "product"
+ } else if p.SystemExtSpecific() {
+ return "system_ext"
+ }
+ return "system"
+}
+
+var validPartitions = []string{
+ "system",
+ "system_ext",
+ "product",
+ "odm",
+}
+
func (p *buildPropModule) GenerateAndroidBuildActions(ctx ModuleContext) {
p.outputFilePath = PathForModuleOut(ctx, "build.prop").OutputPath
if !ctx.Config().KatiEnabled() {
@@ -88,9 +112,9 @@
return
}
- partition := p.PartitionTag(ctx.DeviceConfig())
- if partition != "system" && partition != "system_ext" {
- ctx.PropertyErrorf("partition", "unsupported partition %q: only \"system\" and \"system_ext\" are supported", partition)
+ partition := p.partition(ctx.DeviceConfig())
+ if !InList(partition, validPartitions) {
+ ctx.PropertyErrorf("partition", "unsupported partition %q: only %q are supported", partition, validPartitions)
return
}
@@ -118,7 +142,7 @@
cmd.FlagWithInput("--platform-preview-sdk-fingerprint-file=", ApiFingerprintPath(ctx))
cmd.FlagWithInput("--product-config=", PathForModuleSrc(ctx, proptools.String(p.properties.Product_config)))
cmd.FlagWithArg("--partition=", partition)
- cmd.FlagForEachInput("--prop-files=", ctx.Config().SystemPropFiles(ctx))
+ cmd.FlagForEachInput("--prop-files=", p.propFiles(ctx))
cmd.FlagWithOutput("--out=", p.outputFilePath)
postProcessCmd := rule.Command().BuiltTool("post_process_props")
diff --git a/android/config.go b/android/config.go
index 3b30af8..d13e5ab 100644
--- a/android/config.go
+++ b/android/config.go
@@ -2046,6 +2046,10 @@
return PathsForSource(ctx, c.productVariables.SystemExtPropFiles)
}
+func (c *config) ProductPropFiles(ctx PathContext) Paths {
+ return PathsForSource(ctx, c.productVariables.ProductPropFiles)
+}
+
func (c *config) EnableUffdGc() string {
return String(c.productVariables.EnableUffdGc)
}
diff --git a/android/variable.go b/android/variable.go
index c9b29f1..4025607 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -510,6 +510,7 @@
SystemPropFiles []string `json:",omitempty"`
SystemExtPropFiles []string `json:",omitempty"`
+ ProductPropFiles []string `json:",omitempty"`
EnableUffdGc *string `json:",omitempty"`
}
diff --git a/java/base.go b/java/base.go
index daa50ef..8a4c64d 100644
--- a/java/base.go
+++ b/java/base.go
@@ -2027,16 +2027,20 @@
// Collect information for opening IDE project files in java/jdeps.go.
func (j *Module) IDEInfo(dpInfo *android.IdeInfo) {
- dpInfo.Deps = append(dpInfo.Deps, j.CompilerDeps()...)
- dpInfo.Srcs = append(dpInfo.Srcs, j.expandIDEInfoCompiledSrcs...)
- dpInfo.SrcJars = append(dpInfo.SrcJars, j.compiledSrcJars.Strings()...)
- dpInfo.Aidl_include_dirs = append(dpInfo.Aidl_include_dirs, j.deviceProperties.Aidl.Include_dirs...)
+ // jarjar rules will repackage the sources. To prevent misleading results, IdeInfo should contain the
+ // repackaged jar instead of the input sources.
if j.expandJarjarRules != nil {
dpInfo.Jarjar_rules = append(dpInfo.Jarjar_rules, j.expandJarjarRules.String())
+ dpInfo.Jars = append(dpInfo.Jars, j.headerJarFile.String())
+ } else {
+ dpInfo.Srcs = append(dpInfo.Srcs, j.expandIDEInfoCompiledSrcs...)
+ dpInfo.SrcJars = append(dpInfo.SrcJars, j.compiledSrcJars.Strings()...)
+ dpInfo.SrcJars = append(dpInfo.SrcJars, j.annoSrcJars.Strings()...)
}
+ dpInfo.Deps = append(dpInfo.Deps, j.CompilerDeps()...)
+ dpInfo.Aidl_include_dirs = append(dpInfo.Aidl_include_dirs, j.deviceProperties.Aidl.Include_dirs...)
dpInfo.Static_libs = append(dpInfo.Static_libs, j.properties.Static_libs...)
dpInfo.Libs = append(dpInfo.Libs, j.properties.Libs...)
- dpInfo.SrcJars = append(dpInfo.SrcJars, j.annoSrcJars.Strings()...)
}
func (j *Module) CompilerDeps() []string {
diff --git a/java/jdeps_test.go b/java/jdeps_test.go
index 47bfac1..ff54da9 100644
--- a/java/jdeps_test.go
+++ b/java/jdeps_test.go
@@ -91,16 +91,23 @@
}
}
-func TestCollectJavaLibraryPropertiesAddJarjarRules(t *testing.T) {
- expected := "Jarjar_rules.txt"
- module := LibraryFactory().(*Library)
- module.expandJarjarRules = android.PathForTesting(expected)
+func TestCollectJavaLibraryWithJarJarRules(t *testing.T) {
+ ctx, _ := testJava(t,
+ `
+ java_library {
+ name: "javalib",
+ srcs: ["foo.java"],
+ jarjar_rules: "jarjar_rules.txt",
+ }
+ `)
+ module := ctx.ModuleForTests("javalib", "android_common").Module().(*Library)
dpInfo := &android.IdeInfo{}
module.IDEInfo(dpInfo)
-
- if dpInfo.Jarjar_rules[0] != expected {
- t.Errorf("Library.IDEInfo() Jarjar_rules = %v, want %v", dpInfo.Jarjar_rules[0], expected)
+ android.AssertBoolEquals(t, "IdeInfo.Srcs of repackaged library should be empty", true, len(dpInfo.Srcs) == 0)
+ android.AssertStringEquals(t, "IdeInfo.Jar_rules of repackaged library should not be empty", "jarjar_rules.txt", dpInfo.Jarjar_rules[0])
+ if !android.SubstringInList(dpInfo.Jars, "soong/.intermediates/javalib/android_common/jarjar/turbine/javalib.jar") {
+ t.Errorf("IdeInfo.Jars of repackaged library should contain the output of jarjar-ing. All outputs: %v\n", dpInfo.Jars)
}
}
diff --git a/java/sdk_library.go b/java/sdk_library.go
index a8cc1b8..4f95a99 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -3602,3 +3602,19 @@
propertySet.AddProperty("doctag_files", dests)
}
}
+
+// TODO(b/358613520): This can be removed when modules are no longer allowed to depend on the top-level library.
+func (s *SdkLibrary) IDEInfo(dpInfo *android.IdeInfo) {
+ s.Library.IDEInfo(dpInfo)
+ if s.implLibraryModule != nil {
+ dpInfo.Deps = append(dpInfo.Deps, s.implLibraryModule.Name())
+ } else {
+ // This java_sdk_library does not have an implementation (it sets `api_only` to true).
+ // Examples of this are `art.module.intra.core.api` (IntraCore api surface).
+ // Return the "public" stubs for these.
+ stubPaths := s.findClosestScopePath(apiScopePublic)
+ if len(stubPaths.stubsHeaderPath) > 0 {
+ dpInfo.Jars = append(dpInfo.Jars, stubPaths.stubsHeaderPath[0].String())
+ }
+ }
+}
diff --git a/scripts/gen_build_prop.py b/scripts/gen_build_prop.py
index 2bd246d..c08a3fd 100644
--- a/scripts/gen_build_prop.py
+++ b/scripts/gen_build_prop.py
@@ -472,6 +472,8 @@
# Add the 16K developer args if it is defined for the product.
props.append(f"ro.product.build.16k_page.enabled={'true' if config['Product16KDeveloperOption'] else 'false'}")
+ props.append(f"ro.product.page_size={16384 if config['TargetBoots16K'] else 4096}")
+
props.append(f"ro.build.characteristics={config['AAPTCharacteristics']}")
if "AbOtaUpdater" in config and config["AbOtaUpdater"]:
@@ -537,6 +539,7 @@
]
build_prop(args, gen_build_info=False, gen_common_build_props=True, variables=variables)
+'''
def build_product_prop(args):
config = args.config
@@ -547,8 +550,32 @@
"ADDITIONAL_PRODUCT_PROPERTIES",
"PRODUCT_PRODUCT_PROPERTIES",
]
+
+ gen_common_build_props = True
+
+ # Skip common /product properties generation if device released before R and
+ # has no product partition. This is the first part of the check.
+ if config["Shipping_api_level"] and int(config["Shipping_api_level"]) < 30:
+ gen_common_build_props = False
+
+ # The second part of the check - always generate common properties for the
+ # devices with product partition regardless of shipping level.
+ if config["UsesProductImage"]:
+ gen_common_build_props = True
+
build_prop(args, gen_build_info=False, gen_common_build_props=True, variables=variables)
-'''
+
+ if config["OemProperties"]:
+ print("####################################")
+ print("# PRODUCT_OEM_PROPERTIES")
+ print("####################################")
+
+ for prop in config["OemProperties"]:
+ print(f"import /oem/oem.prop {prop}")
+
+def build_odm_prop(args):
+ variables = ["ADDITIONAL_ODM_PROPERTIES", "PRODUCT_ODM_PROPERTIES"]
+ build_prop(args, gen_build_info=False, gen_common_build_props=True, variables=variables)
def build_prop(args, gen_build_info, gen_common_build_props, variables):
config = args.config
@@ -570,18 +597,19 @@
args = parse_args()
with contextlib.redirect_stdout(args.out):
- if args.partition == "system":
- build_system_prop(args)
- elif args.partition == "system_ext":
- build_system_ext_prop(args)
- '''
- elif args.partition == "vendor":
- build_vendor_prop(args)
- elif args.partition == "product":
- build_product_prop(args)
- '''
- else:
- sys.exit(f"not supported partition {args.partition}")
+ match args.partition:
+ case "system":
+ build_system_prop(args)
+ case "system_ext":
+ build_system_ext_prop(args)
+ case "odm":
+ build_odm_prop(args)
+ case "product":
+ build_product_prop(args)
+ # case "vendor": # NOT IMPLEMENTED
+ # build_vendor_prop(args)
+ case _:
+ sys.exit(f"not supported partition {args.partition}")
if __name__ == "__main__":
main()
diff --git a/snapshot/Android.bp b/snapshot/Android.bp
index c384f8a..ae1869a 100644
--- a/snapshot/Android.bp
+++ b/snapshot/Android.bp
@@ -14,12 +14,8 @@
// Source file name convention is to include _snapshot as a
// file suffix for files that are generating snapshots.
srcs: [
- "host_snapshot.go",
"snapshot_base.go",
"util.go",
],
- testSrcs: [
- "host_test.go",
- ],
pluginFor: ["soong_build"],
}
diff --git a/snapshot/host_snapshot.go b/snapshot/host_snapshot.go
deleted file mode 100644
index 1ecab7d..0000000
--- a/snapshot/host_snapshot.go
+++ /dev/null
@@ -1,238 +0,0 @@
-// Copyright 2021 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.
-
-package snapshot
-
-import (
- "encoding/json"
- "fmt"
- "path/filepath"
- "sort"
- "strings"
-
- "github.com/google/blueprint"
- "github.com/google/blueprint/proptools"
-
- "android/soong/android"
-)
-
-//
-// The host_snapshot module creates a snapshot of the modules defined in
-// the deps property. The modules within the deps property (host tools)
-// are ones that return a valid path via HostToolPath() of the
-// HostToolProvider. The created snapshot contains the binaries and any
-// transitive PackagingSpecs of the included host tools, along with a JSON
-// meta file.
-//
-// The snapshot is installed into a source tree via
-// development/vendor_snapshot/update.py, the included modules are
-// provided as preferred prebuilts.
-//
-// To determine which tools to include in the host snapshot see
-// host_fake_snapshot.go.
-
-func init() {
- registerHostBuildComponents(android.InitRegistrationContext)
-}
-
-func registerHostBuildComponents(ctx android.RegistrationContext) {
- ctx.RegisterModuleType("host_snapshot", hostSnapshotFactory)
-}
-
-// Relative installation path
-type RelativeInstallPath interface {
- RelativeInstallPath() string
-}
-
-type hostSnapshot struct {
- android.ModuleBase
- android.PackagingBase
-
- outputFile android.OutputPath
- installDir android.InstallPath
-}
-
-type ProcMacro interface {
- ProcMacro() bool
- CrateName() string
-}
-
-func hostSnapshotFactory() android.Module {
- module := &hostSnapshot{}
- initHostToolsModule(module)
- return module
-}
-func initHostToolsModule(module *hostSnapshot) {
- android.InitPackageModule(module)
- android.InitAndroidMultiTargetsArchModule(module, android.HostSupported, android.MultilibCommon)
-}
-
-var dependencyTag = struct {
- blueprint.BaseDependencyTag
- android.InstallAlwaysNeededDependencyTag
- android.PackagingItemAlwaysDepTag
-}{}
-
-func (f *hostSnapshot) DepsMutator(ctx android.BottomUpMutatorContext) {
- f.AddDeps(ctx, dependencyTag)
-}
-func (f *hostSnapshot) installFileName() string {
- return f.Name() + ".zip"
-}
-
-// Create zipfile with JSON description, notice files... for dependent modules
-func (f *hostSnapshot) CreateMetaData(ctx android.ModuleContext, fileName string) android.OutputPath {
- var jsonData []SnapshotJsonFlags
- var metaPaths android.Paths
-
- installedNotices := make(map[string]bool)
- metaZipFile := android.PathForModuleOut(ctx, fileName).OutputPath
-
- // Create JSON file based on the direct dependencies
- ctx.VisitDirectDeps(func(dep android.Module) {
- desc := hostJsonDesc(ctx, dep)
- if desc != nil {
- jsonData = append(jsonData, *desc)
- }
- for _, notice := range dep.EffectiveLicenseFiles() {
- if _, ok := installedNotices[notice.String()]; !ok {
- installedNotices[notice.String()] = true
- noticeOut := android.PathForModuleOut(ctx, "NOTICE_FILES", notice.String()).OutputPath
- CopyFileToOutputPathRule(pctx, ctx, notice, noticeOut)
- metaPaths = append(metaPaths, noticeOut)
- }
- }
- })
- // Sort notice paths and json data for repeatble build
- sort.Slice(jsonData, func(i, j int) bool {
- return (jsonData[i].ModuleName < jsonData[j].ModuleName)
- })
- sort.Slice(metaPaths, func(i, j int) bool {
- return (metaPaths[i].String() < metaPaths[j].String())
- })
-
- marsh, err := json.Marshal(jsonData)
- if err != nil {
- ctx.ModuleErrorf("host snapshot json marshal failure: %#v", err)
- return android.OutputPath{}
- }
-
- jsonZipFile := android.PathForModuleOut(ctx, "host_snapshot.json").OutputPath
- metaPaths = append(metaPaths, jsonZipFile)
- rspFile := android.PathForModuleOut(ctx, "host_snapshot.rsp").OutputPath
- android.WriteFileRule(ctx, jsonZipFile, string(marsh))
-
- builder := android.NewRuleBuilder(pctx, ctx)
-
- builder.Command().
- BuiltTool("soong_zip").
- FlagWithArg("-C ", android.PathForModuleOut(ctx).OutputPath.String()).
- FlagWithOutput("-o ", metaZipFile).
- FlagWithRspFileInputList("-r ", rspFile, metaPaths)
- builder.Build("zip_meta", fmt.Sprintf("zipping meta data for %s", ctx.ModuleName()))
-
- return metaZipFile
-}
-
-// Create the host tool zip file
-func (f *hostSnapshot) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- // Create a zip file for the binaries, and a zip of the meta data, then merge zips
- depsZipFile := android.PathForModuleOut(ctx, f.Name()+"_deps.zip").OutputPath
- modsZipFile := android.PathForModuleOut(ctx, f.Name()+"_mods.zip").OutputPath
- f.outputFile = android.PathForModuleOut(ctx, f.installFileName()).OutputPath
-
- f.installDir = android.PathForModuleInstall(ctx)
-
- f.CopyDepsToZip(ctx, f.GatherPackagingSpecs(ctx), depsZipFile)
-
- builder := android.NewRuleBuilder(pctx, ctx)
- builder.Command().
- BuiltTool("zip2zip").
- FlagWithInput("-i ", depsZipFile).
- FlagWithOutput("-o ", modsZipFile).
- Text("**/*:" + proptools.ShellEscape(f.installDir.String()))
-
- metaZipFile := f.CreateMetaData(ctx, f.Name()+"_meta.zip")
-
- builder.Command().
- BuiltTool("merge_zips").
- Output(f.outputFile).
- Input(metaZipFile).
- Input(modsZipFile)
-
- builder.Build("manifest", fmt.Sprintf("Adding manifest %s", f.installFileName()))
- ctx.InstallFile(f.installDir, f.installFileName(), f.outputFile)
-
-}
-
-// Implements android.AndroidMkEntriesProvider
-func (f *hostSnapshot) AndroidMkEntries() []android.AndroidMkEntries {
- return []android.AndroidMkEntries{android.AndroidMkEntries{
- Class: "ETC",
- OutputFile: android.OptionalPathForPath(f.outputFile),
- DistFiles: android.MakeDefaultDistFiles(f.outputFile),
- ExtraEntries: []android.AndroidMkExtraEntriesFunc{
- func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
- entries.SetString("LOCAL_MODULE_PATH", f.installDir.String())
- entries.SetString("LOCAL_INSTALLED_MODULE_STEM", f.installFileName())
- },
- },
- }}
-}
-
-// Get host tools path and relative install string helpers
-func hostToolPath(m android.Module) android.OptionalPath {
- if provider, ok := m.(android.HostToolProvider); ok {
- return provider.HostToolPath()
- }
- return android.OptionalPath{}
-
-}
-func hostRelativePathString(m android.Module) string {
- var outString string
- if rel, ok := m.(RelativeInstallPath); ok {
- outString = rel.RelativeInstallPath()
- }
- return outString
-}
-
-// Create JSON description for given module, only create descriptions for binary modules
-// and rust_proc_macro modules which provide a valid HostToolPath
-func hostJsonDesc(ctx android.ConfigAndErrorContext, m android.Module) *SnapshotJsonFlags {
- path := hostToolPath(m)
- relPath := hostRelativePathString(m)
- procMacro := false
- moduleStem := filepath.Base(path.String())
- crateName := ""
-
- if pm, ok := m.(ProcMacro); ok && pm.ProcMacro() {
- procMacro = pm.ProcMacro()
- moduleStem = strings.TrimSuffix(moduleStem, filepath.Ext(moduleStem))
- crateName = pm.CrateName()
- }
-
- if path.Valid() && path.String() != "" {
- props := &SnapshotJsonFlags{
- ModuleStemName: moduleStem,
- Filename: path.String(),
- Required: append(m.HostRequiredModuleNames(), m.RequiredModuleNames(ctx)...),
- RelativeInstallPath: relPath,
- RustProcMacro: procMacro,
- CrateName: crateName,
- }
- props.InitBaseSnapshotProps(m)
- return props
- }
- return nil
-}
diff --git a/snapshot/host_test.go b/snapshot/host_test.go
deleted file mode 100644
index c68fdaf..0000000
--- a/snapshot/host_test.go
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright 2021 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.
-
-package snapshot
-
-import (
- "path/filepath"
- "testing"
-
- "android/soong/android"
-)
-
-// host_snapshot and host-fake-snapshot test functions
-
-type hostTestModule struct {
- android.ModuleBase
- props struct {
- Deps []string
- }
-}
-
-func hostTestBinOut(bin string) string {
- return filepath.Join("out", "bin", bin)
-}
-
-func (c *hostTestModule) HostToolPath() android.OptionalPath {
- return (android.OptionalPathForPath(android.PathForTesting(hostTestBinOut(c.Name()))))
-}
-
-func hostTestModuleFactory() android.Module {
- m := &hostTestModule{}
- m.AddProperties(&m.props)
- android.InitAndroidArchModule(m, android.HostSupported, android.MultilibFirst)
- return m
-}
-func (m *hostTestModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- builtFile := android.PathForModuleOut(ctx, m.Name())
- dir := ctx.Target().Arch.ArchType.Multilib
- installDir := android.PathForModuleInstall(ctx, dir)
- ctx.InstallFile(installDir, m.Name(), builtFile)
-}
-
-// Common blueprint used for testing
-var hostTestBp = `
- license_kind {
- name: "test_notice",
- conditions: ["notice"],
- }
- license {
- name: "host_test_license",
- visibility: ["//visibility:public"],
- license_kinds: [
- "test_notice"
- ],
- license_text: [
- "NOTICE",
- ],
- }
- component {
- name: "foo",
- deps: ["bar"],
- }
- component {
- name: "bar",
- licenses: ["host_test_license"],
- }
- `
-
-var hostTestModBp = `
- host_snapshot {
- name: "test-host-snapshot",
- deps: [
- "foo",
- ],
- }
- `
-
-var prepareForHostTest = android.GroupFixturePreparers(
- android.PrepareForTestWithAndroidBuildComponents,
- android.PrepareForTestWithLicenses,
- android.FixtureRegisterWithContext(func(ctx android.RegistrationContext) {
- ctx.RegisterModuleType("component", hostTestModuleFactory)
- }),
-)
-
-// Prepare for host_snapshot test
-var prepareForHostModTest = android.GroupFixturePreparers(
- prepareForHostTest,
- android.FixtureWithRootAndroidBp(hostTestBp+hostTestModBp),
- android.FixtureRegisterWithContext(func(ctx android.RegistrationContext) {
- registerHostBuildComponents(ctx)
- }),
-)
-
-// Prepare for fake host snapshot test disabled
-var prepareForFakeHostTest = android.GroupFixturePreparers(
- prepareForHostTest,
- android.FixtureWithRootAndroidBp(hostTestBp),
-)
-
-// Validate that a hostSnapshot object is created containing zip files and JSON file
-// content of zip file is not validated as this is done by PackagingSpecs
-func TestHostSnapshot(t *testing.T) {
- result := prepareForHostModTest.RunTest(t)
- t.Helper()
- ctx := result.TestContext.ModuleForTests("test-host-snapshot", result.Config.BuildOS.String()+"_common")
- mod := ctx.Module().(*hostSnapshot)
- if ctx.MaybeOutput("host_snapshot.json").Rule == nil {
- t.Error("Manifest file not found")
- }
- zips := []string{"_deps.zip", "_mods.zip", ".zip"}
-
- for _, zip := range zips {
- zFile := mod.Name() + zip
- if ctx.MaybeOutput(zFile).Rule == nil {
- t.Error("Zip file ", zFile, "not found")
- }
-
- }
-}