diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/app.go | 17 | ||||
-rw-r--r-- | java/app_import.go | 8 | ||||
-rw-r--r-- | java/bootclasspath_fragment.go | 16 | ||||
-rw-r--r-- | java/bootclasspath_fragment_test.go | 3 | ||||
-rw-r--r-- | java/classpath_fragment.go | 5 | ||||
-rw-r--r-- | java/dex.go | 21 | ||||
-rw-r--r-- | java/droiddoc.go | 4 | ||||
-rw-r--r-- | java/droidstubs.go | 15 | ||||
-rw-r--r-- | java/java.go | 22 | ||||
-rw-r--r-- | java/platform_bootclasspath.go | 2 | ||||
-rw-r--r-- | java/ravenwood.go | 42 | ||||
-rw-r--r-- | java/ravenwood_test.go | 10 | ||||
-rw-r--r-- | java/systemserver_classpath_fragment.go | 23 |
13 files changed, 129 insertions, 59 deletions
diff --git a/java/app.go b/java/app.go index 94c9e5b82..8bb73cb38 100644 --- a/java/app.go +++ b/java/app.go @@ -848,7 +848,7 @@ func (a *AndroidApp) createPrivappAllowlist(ctx android.ModuleContext) android.P packageName := packageNameProp.Get() fileName := "privapp_allowlist_" + packageName + ".xml" - outPath := android.PathForModuleOut(ctx, fileName).OutputPath + outPath := android.PathForModuleOut(ctx, fileName) ctx.Build(pctx, android.BuildParams{ Rule: modifyAllowlist, Input: android.PathForModuleSrc(ctx, *a.appProperties.Privapp_allowlist), @@ -857,7 +857,7 @@ func (a *AndroidApp) createPrivappAllowlist(ctx android.ModuleContext) android.P "packageName": packageName, }, }) - return &outPath + return outPath } func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) { @@ -1465,8 +1465,9 @@ func (a *AndroidTest) GenerateAndroidBuildActions(ctx android.ModuleContext) { a.data = append(a.data, android.PathsForModuleSrc(ctx, a.testProperties.Device_common_data)...) a.data = append(a.data, android.PathsForModuleSrc(ctx, a.testProperties.Device_first_data)...) a.data = append(a.data, android.PathsForModuleSrc(ctx, a.testProperties.Device_first_prefer32_data)...) + android.SetProvider(ctx, tradefed.BaseTestProviderKey, tradefed.BaseTestProviderData{ - InstalledFiles: a.data, + TestcaseRelDataFiles: testcaseRel(a.data), OutputFile: a.OutputFile(), TestConfig: a.testConfig, HostRequiredModuleNames: a.HostRequiredModuleNames(), @@ -1474,6 +1475,8 @@ func (a *AndroidTest) GenerateAndroidBuildActions(ctx android.ModuleContext) { IsHost: false, LocalCertificate: a.certificate.AndroidMkString(), IsUnitTest: Bool(a.testProperties.Test_options.Unit_test), + MkInclude: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk", + MkAppClass: "APPS", }) android.SetProvider(ctx, android.TestOnlyProviderKey, android.TestModuleInformation{ TestOnly: true, @@ -1482,6 +1485,14 @@ func (a *AndroidTest) GenerateAndroidBuildActions(ctx android.ModuleContext) { } +func testcaseRel(paths android.Paths) []string { + relPaths := []string{} + for _, p := range paths { + relPaths = append(relPaths, p.Rel()) + } + return relPaths +} + func (a *AndroidTest) FixTestConfig(ctx android.ModuleContext, testConfig android.Path) android.Path { if testConfig == nil { return nil diff --git a/java/app_import.go b/java/app_import.go index 6b88f1c43..f044c6848 100644 --- a/java/app_import.go +++ b/java/app_import.go @@ -88,7 +88,7 @@ type AndroidAppImport struct { hideApexVariantFromMake bool - provenanceMetaDataFile android.OutputPath + provenanceMetaDataFile android.Path } type AndroidAppImportProperties struct { @@ -259,7 +259,7 @@ func (a *AndroidAppImport) DepsMutator(ctx android.BottomUpMutatorContext) { } func (a *AndroidAppImport) uncompressEmbeddedJniLibs( - ctx android.ModuleContext, inputPath android.Path, outputPath android.OutputPath) { + ctx android.ModuleContext, inputPath android.Path, outputPath android.WritablePath) { // Test apps don't need their JNI libraries stored uncompressed. As a matter of fact, messing // with them may invalidate pre-existing signature data. if ctx.InstallInTestcases() && (Bool(a.properties.Presigned) || Bool(a.properties.Preprocessed)) { @@ -345,7 +345,7 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext // Uncompress JNI libraries in the apk jnisUncompressed := android.PathForModuleOut(ctx, "jnis-uncompressed", ctx.ModuleName()+".apk") - a.uncompressEmbeddedJniLibs(ctx, srcApk, jnisUncompressed.OutputPath) + a.uncompressEmbeddedJniLibs(ctx, srcApk, jnisUncompressed) var pathFragments []string relInstallPath := String(a.properties.Relative_install_path) @@ -493,7 +493,7 @@ func (a *AndroidAppImport) Certificate() Certificate { return a.certificate } -func (a *AndroidAppImport) ProvenanceMetaDataFile() android.OutputPath { +func (a *AndroidAppImport) ProvenanceMetaDataFile() android.Path { return a.provenanceMetaDataFile } diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go index 7c0f54431..c778f0404 100644 --- a/java/bootclasspath_fragment.go +++ b/java/bootclasspath_fragment.go @@ -111,7 +111,7 @@ type BootclasspathFragmentCoverageAffectedProperties struct { // property. // // The order of this list matters as it is the order that is used in the bootclasspath. - Contents []string + Contents proptools.Configurable[[]string] `android:"arch_variant"` // The properties for specifying the API stubs provided by this fragment. BootclasspathAPIProperties @@ -295,8 +295,8 @@ func testBootclasspathFragmentFactory() android.Module { return m } -func (m *BootclasspathFragmentModule) bootclasspathFragmentPropertyCheck(ctx android.EarlyModuleContext) { - contents := m.properties.Contents +func (m *BootclasspathFragmentModule) bootclasspathFragmentPropertyCheck(ctx android.ModuleContext) { + contents := m.properties.Contents.GetOrDefault(ctx, nil) if len(contents) == 0 { ctx.PropertyErrorf("contents", "required property is missing") return @@ -434,7 +434,7 @@ func (b *BootclasspathFragmentModule) ComponentDepsMutator(ctx android.BottomUpM module := ctx.Module() _, isSourceModule := module.(*BootclasspathFragmentModule) - for _, name := range b.properties.Contents { + for _, name := range b.properties.Contents.GetOrDefault(ctx, nil) { // A bootclasspath_fragment must depend only on other source modules, while the // prebuilt_bootclasspath_fragment must only depend on other prebuilt modules. // @@ -588,7 +588,7 @@ func (b *BootclasspathFragmentModule) configuredJars(ctx android.ModuleContext) return global.ArtApexJars } - possibleUpdatableModules := gatherPossibleApexModuleNamesAndStems(ctx, b.properties.Contents, bootclasspathFragmentContentDepTag) + possibleUpdatableModules := gatherPossibleApexModuleNamesAndStems(ctx, b.properties.Contents.GetOrDefault(ctx, nil), bootclasspathFragmentContentDepTag) jars, unknown := global.ApexBootJars.Filter(possibleUpdatableModules) // TODO(satayev): for apex_test we want to include all contents unconditionally to classpaths @@ -600,7 +600,7 @@ func (b *BootclasspathFragmentModule) configuredJars(ctx android.ModuleContext) } else if android.InList("test_framework-apexd", possibleUpdatableModules) { jars = jars.Append("com.android.apex.test_package", "test_framework-apexd") } else if global.ApexBootJars.Len() != 0 { - unknown = android.RemoveListFromList(unknown, b.properties.Coverage.Contents) + unknown = android.RemoveListFromList(unknown, b.properties.Coverage.Contents.GetOrDefault(ctx, nil)) _, unknown = android.RemoveFromList("core-icu4j", unknown) // This module only exists in car products. // So ignore it even if it is not in PRODUCT_APEX_BOOT_JARS. @@ -847,7 +847,7 @@ func (b *BootclasspathFragmentModule) getProfilePath() android.Path { // Collect information for opening IDE project files in java/jdeps.go. func (b *BootclasspathFragmentModule) IDEInfo(ctx android.BaseModuleContext, dpInfo *android.IdeInfo) { - dpInfo.Deps = append(dpInfo.Deps, b.properties.Contents...) + dpInfo.Deps = append(dpInfo.Deps, b.properties.Contents.GetOrDefault(ctx, nil)...) } type bootclasspathFragmentMemberType struct { @@ -923,7 +923,7 @@ func (b *bootclasspathFragmentSdkMemberProperties) PopulateFromVariant(ctx andro module := variant.(*BootclasspathFragmentModule) b.Image_name = module.properties.Image_name - b.Contents = module.properties.Contents + b.Contents = module.properties.Contents.GetOrDefault(ctx.SdkModuleContext(), nil) // Get the hidden API information from the module. mctx := ctx.SdkModuleContext() diff --git a/java/bootclasspath_fragment_test.go b/java/bootclasspath_fragment_test.go index 60f1a50e1..3aa1258a3 100644 --- a/java/bootclasspath_fragment_test.go +++ b/java/bootclasspath_fragment_test.go @@ -191,7 +191,8 @@ func TestBootclasspathFragment_Coverage(t *testing.T) { checkContents := func(t *testing.T, result *android.TestResult, expected ...string) { module := result.Module("myfragment", "android_common").(*BootclasspathFragmentModule) - android.AssertArrayString(t, "contents property", expected, module.properties.Contents) + eval := module.ConfigurableEvaluator(android.PanickingConfigAndErrorContext(result.TestContext)) + android.AssertArrayString(t, "contents property", expected, module.properties.Contents.GetOrDefault(eval, nil)) } preparer := android.GroupFixturePreparers( diff --git a/java/classpath_fragment.go b/java/classpath_fragment.go index 18a5dae6c..fdccd3a84 100644 --- a/java/classpath_fragment.go +++ b/java/classpath_fragment.go @@ -18,9 +18,10 @@ package java import ( "fmt" + "strings" + "github.com/google/blueprint" "github.com/google/blueprint/proptools" - "strings" "android/soong/android" ) @@ -103,7 +104,7 @@ type classpathJar struct { func gatherPossibleApexModuleNamesAndStems(ctx android.ModuleContext, contents []string, tag blueprint.DependencyTag) []string { set := map[string]struct{}{} for _, name := range contents { - dep, _ := ctx.GetDirectDepWithTag(name, tag).(android.Module) + dep := ctx.GetDirectDepWithTag(name, tag) set[ModuleStemForDeapexing(dep)] = struct{}{} if m, ok := dep.(ModuleWithStem); ok { set[m.Stem()] = struct{}{} diff --git a/java/dex.go b/java/dex.go index 516a91709..983377ead 100644 --- a/java/dex.go +++ b/java/dex.go @@ -430,17 +430,18 @@ type compileDexParams struct { // Adds --art-profile to r8/d8 command. // r8/d8 will output a generated profile file to match the optimized dex code. func (d *dexer) addArtProfile(ctx android.ModuleContext, dexParams *compileDexParams) (flags []string, deps android.Paths, artProfileOutputPath *android.OutputPath) { - if dexParams.artProfileInput != nil { - artProfileInputPath := android.PathForModuleSrc(ctx, *dexParams.artProfileInput) - artProfileOutputPathValue := android.PathForModuleOut(ctx, "profile.prof.txt").OutputPath - artProfileOutputPath = &artProfileOutputPathValue - flags = []string{ - "--art-profile", - artProfileInputPath.String(), - artProfileOutputPath.String(), - } - deps = append(deps, artProfileInputPath) + if dexParams.artProfileInput == nil { + return nil, nil, nil + } + artProfileInputPath := android.PathForModuleSrc(ctx, *dexParams.artProfileInput) + artProfileOutputPathValue := android.PathForModuleOut(ctx, "profile.prof.txt").OutputPath + artProfileOutputPath = &artProfileOutputPathValue + flags = []string{ + "--art-profile", + artProfileInputPath.String(), + artProfileOutputPath.String(), } + deps = append(deps, artProfileInputPath) return flags, deps, artProfileOutputPath } diff --git a/java/droiddoc.go b/java/droiddoc.go index 2980d91de..82713920d 100644 --- a/java/droiddoc.go +++ b/java/droiddoc.go @@ -427,9 +427,9 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps { // Find the corresponding aconfig_declarations module name for such case. for _, src := range j.properties.Srcs { if moduleName, tag := android.SrcIsModuleWithTag(src); moduleName != "" { - otherModule := android.GetModuleFromPathDep(ctx, moduleName, tag) + otherModule := android.GetModuleProxyFromPathDep(ctx, moduleName, tag) if otherModule != nil { - if dep, ok := android.OtherModuleProvider(ctx, otherModule, android.CodegenInfoProvider); ok { + if dep, ok := android.OtherModuleProvider(ctx, *otherModule, android.CodegenInfoProvider); ok { deps.aconfigProtoFiles = append(deps.aconfigProtoFiles, dep.IntermediateCacheOutputPaths...) } } diff --git a/java/droidstubs.go b/java/droidstubs.go index 6bcdf85a2..cf3e21925 100644 --- a/java/droidstubs.go +++ b/java/droidstubs.go @@ -997,12 +997,13 @@ func (d *Droidstubs) everythingOptionalCmd(ctx android.ModuleContext, cmd *andro msg := `$'` + // Enclose with $' ... ' `************************************************************\n` + `Your API changes are triggering API Lint warnings or errors.\n` + - `To make these errors go away, fix the code according to the\n` + - `error and/or warning messages above.\n` + `\n` + - `If it is not possible to do so, there are workarounds:\n` + + `To make the failures go away:\n` + `\n` + - `1. You can suppress the errors with @SuppressLint("<id>")\n` + + `1. REQUIRED: Read the messages carefully and address them by` + + ` fixing the API if appropriate.\n` + + `2. If the failure is a false positive, you can suppress it with:\n` + + ` @SuppressLint("<id>")\n` + ` where the <id> is given in brackets in the error message above.\n` if baselineFile.Valid() { @@ -1010,8 +1011,8 @@ func (d *Droidstubs) everythingOptionalCmd(ctx android.ModuleContext, cmd *andro cmd.FlagWithOutput("--update-baseline:api-lint ", updatedBaselineOutput) msg += fmt.Sprintf(``+ - `2. You can update the baseline by executing the following\n`+ - ` command:\n`+ + `3. FOR LSC ONLY: You can update the baseline by executing\n` + + ` the following command:\n`+ ` (cd $ANDROID_BUILD_TOP && cp \\\n`+ ` "%s" \\\n`+ ` "%s")\n`+ @@ -1019,7 +1020,7 @@ func (d *Droidstubs) everythingOptionalCmd(ctx android.ModuleContext, cmd *andro ` repository, you will need approval.\n`, updatedBaselineOutput, baselineFile.Path()) } else { msg += fmt.Sprintf(``+ - `2. You can add a baseline file of existing lint failures\n`+ + `3. FOR LSC ONLY: You can add a baseline file of existing lint failures\n`+ ` to the build rule of %s.\n`, d.Name()) } // Note the message ends with a ' (single quote), to close the $' ... ' . diff --git a/java/java.go b/java/java.go index 1d572faef..64ef782f5 100644 --- a/java/java.go +++ b/java/java.go @@ -226,9 +226,9 @@ var ( // Rule for generating device binary default wrapper deviceBinaryWrapper = pctx.StaticRule("deviceBinaryWrapper", blueprint.RuleParams{ - Command: `echo -e '#!/system/bin/sh\n` + + Command: `printf '#!/system/bin/sh\n` + `export CLASSPATH=/system/framework/$jar_name\n` + - `exec app_process /$partition/bin $main_class "$$@"'> ${out}`, + `exec app_process /$partition/bin $main_class "$$@"\n'> ${out}`, Description: "Generating device binary wrapper ${jar_name}", }, "jar_name", "partition", "main_class") ) @@ -1557,14 +1557,16 @@ func (j *TestHost) GenerateAndroidBuildActions(ctx android.ModuleContext) { j.Test.generateAndroidBuildActionsWithConfig(ctx, configs) android.SetProvider(ctx, tradefed.BaseTestProviderKey, tradefed.BaseTestProviderData{ - InstalledFiles: j.data, - OutputFile: j.outputFile, - TestConfig: j.testConfig, - RequiredModuleNames: j.RequiredModuleNames(ctx), - TestSuites: j.testProperties.Test_suites, - IsHost: true, - LocalSdkVersion: j.sdkVersion.String(), - IsUnitTest: Bool(j.testProperties.Test_options.Unit_test), + TestcaseRelDataFiles: testcaseRel(j.data), + OutputFile: j.outputFile, + TestConfig: j.testConfig, + RequiredModuleNames: j.RequiredModuleNames(ctx), + TestSuites: j.testProperties.Test_suites, + IsHost: true, + LocalSdkVersion: j.sdkVersion.String(), + IsUnitTest: Bool(j.testProperties.Test_options.Unit_test), + MkInclude: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", + MkAppClass: "JAVA_LIBRARIES", }) } diff --git a/java/platform_bootclasspath.go b/java/platform_bootclasspath.go index 8b0ca97a1..d09a02e50 100644 --- a/java/platform_bootclasspath.go +++ b/java/platform_bootclasspath.go @@ -184,7 +184,7 @@ func (b *platformBootclasspathModule) GenerateAndroidBuildActions(ctx android.Mo } jarArgs := resourcePathsToJarArgs(transitiveSrcFiles) jarArgs = append(jarArgs, "-srcjar") // Move srcfiles to the right package - srcjar := android.PathForModuleOut(ctx, ctx.ModuleName()+"-transitive.srcjar").OutputPath + srcjar := android.PathForModuleOut(ctx, ctx.ModuleName()+"-transitive.srcjar") TransformResourcesToJar(ctx, srcjar, jarArgs, transitiveSrcFiles) // Gather all the fragments dependencies. diff --git a/java/ravenwood.go b/java/ravenwood.go index 4c9fdc212..4c43a9ffb 100644 --- a/java/ravenwood.go +++ b/java/ravenwood.go @@ -14,6 +14,8 @@ package java import ( + "strconv" + "android/soong/android" "android/soong/tradefed" @@ -36,6 +38,14 @@ var ravenwoodRuntimeTag = dependencyTag{name: "ravenwoodruntime"} var ravenwoodTestResourceApkTag = dependencyTag{name: "ravenwoodtestresapk"} var ravenwoodTestInstResourceApkTag = dependencyTag{name: "ravenwoodtest-inst-res-apk"} +var genManifestProperties = pctx.AndroidStaticRule("genManifestProperties", + blueprint.RuleParams{ + Command: "echo targetSdkVersionInt=$targetSdkVersionInt > $out && " + + "echo targetSdkVersionRaw=$targetSdkVersionRaw >> $out && " + + "echo packageName=$packageName >> $out && " + + "echo instPackageName=$instPackageName >> $out", + }, "targetSdkVersionInt", "targetSdkVersionRaw", "packageName", "instPackageName") + const ravenwoodUtilsName = "ravenwood-utils" const ravenwoodRuntimeName = "ravenwood-runtime" @@ -68,6 +78,17 @@ type ravenwoodTestProperties struct { // the ravenwood test can access it. This APK will be loaded as resources of the test // instrumentation app itself. Inst_resource_apk *string + + // Specify the package name of the test target apk. + // This will be set to the target Context's package name. + // (i.e. Instrumentation.getTargetContext().getPackageName()) + // If this is omitted, Package_name will be used. + Package_name *string + + // Specify the package name of this test module. + // This will be set to the test Context's package name. + //(i.e. Instrumentation.getContext().getPackageName()) + Inst_package_name *string } type ravenwoodTest struct { @@ -216,6 +237,27 @@ func (r *ravenwoodTest) GenerateAndroidBuildActions(ctx android.ModuleContext) { copyResApk(ravenwoodTestResourceApkTag, "ravenwood-res.apk") copyResApk(ravenwoodTestInstResourceApkTag, "ravenwood-inst-res.apk") + // Generate manifest properties + propertiesOutputPath := android.PathForModuleGen(ctx, "ravenwood.properties") + + targetSdkVersion := proptools.StringDefault(r.deviceProperties.Target_sdk_version, "") + targetSdkVersionInt := r.TargetSdkVersion(ctx).FinalOrFutureInt() // FinalOrFutureInt may be 10000. + packageName := proptools.StringDefault(r.ravenwoodTestProperties.Package_name, "") + instPackageName := proptools.StringDefault(r.ravenwoodTestProperties.Inst_package_name, "") + ctx.Build(pctx, android.BuildParams{ + Rule: genManifestProperties, + Description: "genManifestProperties", + Output: propertiesOutputPath, + Args: map[string]string{ + "targetSdkVersionInt": strconv.Itoa(targetSdkVersionInt), + "targetSdkVersionRaw": targetSdkVersion, + "packageName": packageName, + "instPackageName": instPackageName, + }, + }) + installProps := ctx.InstallFile(installPath, "ravenwood.properties", propertiesOutputPath) + installDeps = append(installDeps, installProps) + // Install our JAR with all dependencies ctx.InstallFile(installPath, ctx.ModuleName()+".jar", r.outputFile, installDeps...) } diff --git a/java/ravenwood_test.go b/java/ravenwood_test.go index 5d62ede74..6394a9ac9 100644 --- a/java/ravenwood_test.go +++ b/java/ravenwood_test.go @@ -177,6 +177,12 @@ func TestRavenwoodTest(t *testing.T) { resource_apk: "app2", inst_resource_apk: "app3", sdk_version: "test_current", + target_sdk_version: "34", + package_name: "a.b.c", + inst_package_name: "x.y.z", + } + android_ravenwood_test { + name: "ravenwood-test-empty", } `) @@ -199,12 +205,16 @@ func TestRavenwoodTest(t *testing.T) { // Verify that we've emitted test artifacts in expected location outputJar := module.Output(installPathPrefix + "/ravenwood-test/ravenwood-test.jar") module.Output(installPathPrefix + "/ravenwood-test/ravenwood-test.config") + module.Output(installPathPrefix + "/ravenwood-test/ravenwood.properties") module.Output(installPathPrefix + "/ravenwood-test/lib64/jni-lib1.so") module.Output(installPathPrefix + "/ravenwood-test/lib64/libblue.so") module.Output(installPathPrefix + "/ravenwood-test/lib64/libpink.so") module.Output(installPathPrefix + "/ravenwood-test/ravenwood-res-apks/ravenwood-res.apk") module.Output(installPathPrefix + "/ravenwood-test/ravenwood-res-apks/ravenwood-inst-res.apk") + module = ctx.ModuleForTests("ravenwood-test-empty", "android_common") + module.Output(installPathPrefix + "/ravenwood-test-empty/ravenwood.properties") + // ravenwood-runtime*.so are included in the runtime, so it shouldn't be emitted. for _, o := range module.AllOutputs() { android.AssertStringDoesNotContain(t, "runtime libs shouldn't be included", o, "/ravenwood-test/lib64/ravenwood-runtime") diff --git a/java/systemserver_classpath_fragment.go b/java/systemserver_classpath_fragment.go index aad106007..608a61628 100644 --- a/java/systemserver_classpath_fragment.go +++ b/java/systemserver_classpath_fragment.go @@ -19,6 +19,7 @@ import ( "android/soong/dexpreopt" "github.com/google/blueprint" + "github.com/google/blueprint/proptools" ) func init() { @@ -98,12 +99,12 @@ type systemServerClasspathFragmentProperties struct { // List of system_server classpath jars, could be either java_library, or java_sdk_library. // // The order of this list matters as it is the order that is used in the SYSTEMSERVERCLASSPATH. - Contents []string + Contents proptools.Configurable[[]string] `android:"arch_variant"` // List of jars that system_server loads dynamically using separate classloaders. // // The order does not matter. - Standalone_contents []string + Standalone_contents proptools.Configurable[[]string] `android:"arch_variant"` } func systemServerClasspathFactory() android.Module { @@ -116,7 +117,7 @@ func systemServerClasspathFactory() android.Module { } func (s *SystemServerClasspathModule) GenerateAndroidBuildActions(ctx android.ModuleContext) { - if len(s.properties.Contents) == 0 && len(s.properties.Standalone_contents) == 0 { + if len(s.properties.Contents.GetOrDefault(ctx, nil)) == 0 && len(s.properties.Standalone_contents.GetOrDefault(ctx, nil)) == 0 { ctx.PropertyErrorf("contents", "Either contents or standalone_contents needs to be non-empty") } @@ -152,7 +153,7 @@ func (s *SystemServerClasspathModule) setPartitionInfoOfLibraries(ctx android.Mo func (s *SystemServerClasspathModule) configuredJars(ctx android.ModuleContext) android.ConfiguredJarList { global := dexpreopt.GetGlobalConfig(ctx) - possibleUpdatableModules := gatherPossibleApexModuleNamesAndStems(ctx, s.properties.Contents, systemServerClasspathFragmentContentDepTag) + possibleUpdatableModules := gatherPossibleApexModuleNamesAndStems(ctx, s.properties.Contents.GetOrDefault(ctx, nil), systemServerClasspathFragmentContentDepTag) jars, unknown := global.ApexSystemServerJars.Filter(possibleUpdatableModules) // TODO(satayev): remove geotz ssc_fragment, since geotz is not part of SSCP anymore. _, unknown = android.RemoveFromList("geotz", unknown) @@ -184,7 +185,7 @@ func (s *SystemServerClasspathModule) configuredJars(ctx android.ModuleContext) func (s *SystemServerClasspathModule) standaloneConfiguredJars(ctx android.ModuleContext) android.ConfiguredJarList { global := dexpreopt.GetGlobalConfig(ctx) - possibleUpdatableModules := gatherPossibleApexModuleNamesAndStems(ctx, s.properties.Standalone_contents, systemServerClasspathFragmentContentDepTag) + possibleUpdatableModules := gatherPossibleApexModuleNamesAndStems(ctx, s.properties.Standalone_contents.GetOrDefault(ctx, nil), systemServerClasspathFragmentContentDepTag) jars, _ := global.ApexStandaloneSystemServerJars.Filter(possibleUpdatableModules) // TODO(jiakaiz): add a check to ensure that the contents are declared in make. @@ -245,8 +246,8 @@ func (s *SystemServerClasspathModule) ComponentDepsMutator(ctx android.BottomUpM module := ctx.Module() _, isSourceModule := module.(*SystemServerClasspathModule) var deps []string - deps = append(deps, s.properties.Contents...) - deps = append(deps, s.properties.Standalone_contents...) + deps = append(deps, s.properties.Contents.GetOrDefault(ctx, nil)...) + deps = append(deps, s.properties.Standalone_contents.GetOrDefault(ctx, nil)...) for _, name := range deps { // A systemserverclasspath_fragment must depend only on other source modules, while the @@ -260,8 +261,8 @@ func (s *SystemServerClasspathModule) ComponentDepsMutator(ctx android.BottomUpM // Collect information for opening IDE project files in java/jdeps.go. func (s *SystemServerClasspathModule) IDEInfo(ctx android.BaseModuleContext, dpInfo *android.IdeInfo) { - dpInfo.Deps = append(dpInfo.Deps, s.properties.Contents...) - dpInfo.Deps = append(dpInfo.Deps, s.properties.Standalone_contents...) + dpInfo.Deps = append(dpInfo.Deps, s.properties.Contents.GetOrDefault(ctx, nil)...) + dpInfo.Deps = append(dpInfo.Deps, s.properties.Standalone_contents.GetOrDefault(ctx, nil)...) } type systemServerClasspathFragmentMemberType struct { @@ -302,8 +303,8 @@ type systemServerClasspathFragmentSdkMemberProperties struct { func (s *systemServerClasspathFragmentSdkMemberProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) { module := variant.(*SystemServerClasspathModule) - s.Contents = module.properties.Contents - s.Standalone_contents = module.properties.Standalone_contents + s.Contents = module.properties.Contents.GetOrDefault(ctx.SdkModuleContext(), nil) + s.Standalone_contents = module.properties.Standalone_contents.GetOrDefault(ctx.SdkModuleContext(), nil) } func (s *systemServerClasspathFragmentSdkMemberProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) { |