diff options
| author | mosimchah <mosimchah@gmail.com> | 2025-12-02 09:27:38 -0500 |
|---|---|---|
| committer | mosimchah <mosimchah@gmail.com> | 2025-12-02 09:27:38 -0500 |
| commit | c7bade461dc55726f62997d13a48582f7c4b4655 (patch) | |
| tree | ea0588da76060a2038f54f67efd046ca77634b10 /java/ravenwood.go | |
| parent | 0f5414d19317805e8bbbe7c4db5f0fd78769bad5 (diff) | |
| parent | 89d78cff8b00d3b20a90074635c3fe5a2ee49474 (diff) | |
Merge branch 'lineage-23.1' of https://github.com/LineageOS/android_build_soong into HEADw16.1
* 'lineage-23.1' of https://github.com/LineageOS/android_build_soong: (528 commits)
Revert "install_symlink: Make symlink target configurable"
Reapply "Clear as much of cc.Module as possible after GenerateBuildActions"
Revert "rust: config: Fix missing CPU variant LD flags in Rust"
Rename build-flag in outdir
Revert^4 "cipd: Default CIPD proxy server to on, add opt-out"
Convert check-vintf-all to phony with actions
Create a partial implementation of check-vintf-all for soong-only
Configure RBE rust pool based on build variant
Revert^3 "Add sdk version check to arr"
Add jdk.internal.invoke to the allowlist
Make droid always depend on symbols zip
Import Device and Odm skus
Don't install gob_gen in Soong
Remove bazel reference from run_integration_tests.sh
Fix bootstrap_test.sh
Don't panic in aconfig libraries when AllowMissingDependencies is set
Avoid returning nil paths from PathForModuleSrc
Revert "Flag controled clang version"
Rework module target dependencies on required deps
Revert^2 "Add sdk version check to arr"
...
Change-Id: I6e9a63fa14fda917a42e426e5dcebbad7f67e1de
Diffstat (limited to 'java/ravenwood.go')
| -rw-r--r-- | java/ravenwood.go | 109 |
1 files changed, 90 insertions, 19 deletions
diff --git a/java/ravenwood.go b/java/ravenwood.go index a942dc653..b096a2592 100644 --- a/java/ravenwood.go +++ b/java/ravenwood.go @@ -16,6 +16,7 @@ package java import ( "strconv" + "android/soong/aconfig" "android/soong/android" "android/soong/tradefed" @@ -37,14 +38,16 @@ var ravenwoodUtilsTag = dependencyTag{name: "ravenwoodutils"} var ravenwoodRuntimeTag = dependencyTag{name: "ravenwoodruntime"} var ravenwoodTestResourceApkTag = dependencyTag{name: "ravenwoodtestresapk"} var ravenwoodTestInstResourceApkTag = dependencyTag{name: "ravenwoodtest-inst-res-apk"} +var allAconfigModuleTag = dependencyTag{name: "all_aconfig"} 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") + "echo instPackageName=$instPackageName >> $out && " + + "echo instrumentationClass=$instrumentationClass >> $out", + }, "targetSdkVersionInt", "targetSdkVersionRaw", "packageName", "instPackageName", "instrumentationClass") const ravenwoodUtilsName = "ravenwood-utils" const ravenwoodRuntimeName = "ravenwood-runtime" @@ -87,8 +90,12 @@ type ravenwoodTestProperties struct { // Specify the package name of this test module. // This will be set to the test Context's package name. - //(i.e. Instrumentation.getContext().getPackageName()) + // (i.e. Instrumentation.getContext().getPackageName()) Inst_package_name *string + + // Specify the name of the Instrumentation subclass to use. + // (e.g. "androidx.test.runner.AndroidJUnitRunner") + Instrumentation_class *string } type ravenwoodTest struct { @@ -97,7 +104,9 @@ type ravenwoodTest struct { ravenwoodTestProperties ravenwoodTestProperties testProperties testProperties - testConfig android.Path + + testConfig android.Path + data android.Paths forceOSType android.OsType forceArchType android.ArchType @@ -168,13 +177,31 @@ func (r *ravenwoodTest) GenerateAndroidBuildActions(ctx android.ModuleContext) { r.forceArchType = ctx.Config().BuildArch r.testConfig = tradefed.AutoGenTestConfig(ctx, tradefed.AutoGenTestConfigOptions{ - TestConfigProp: r.testProperties.Test_config, - TestConfigTemplateProp: r.testProperties.Test_config_template, - TestSuites: r.testProperties.Test_suites, - AutoGenConfig: r.testProperties.Auto_gen_config, - DeviceTemplate: "${RavenwoodTestConfigTemplate}", - HostTemplate: "${RavenwoodTestConfigTemplate}", + TestConfigProp: r.testProperties.Test_config, + TestConfigTemplateProp: r.testProperties.Test_config_template, + OptionsForAutogenerated: r.testProperties.Test_options.Tradefed_options, + TestRunnerOptions: r.testProperties.Test_options.Test_runner_options, + TestSuites: r.testProperties.Test_suites, + AutoGenConfig: r.testProperties.Auto_gen_config, + DeviceTemplate: "${RavenwoodTestConfigTemplate}", + HostTemplate: "${RavenwoodTestConfigTemplate}", }) + r.data = android.PathsForModuleSrc(ctx, r.testProperties.Data) + r.data = append(r.data, android.PathsForModuleSrc(ctx, r.testProperties.Device_common_data)...) + r.data = append(r.data, android.PathsForModuleSrc(ctx, r.testProperties.Device_first_data)...) + r.data = append(r.data, android.PathsForModuleSrc(ctx, r.testProperties.Device_first_prefer32_data)...) + r.data = append(r.data, android.PathsForModuleSrc(ctx, r.testProperties.Host_common_data)...) + + r.data = android.SortedUniquePaths(r.data) + + var testData []android.DataPath + for _, data := range r.data { + dataPath := android.DataPath{SrcPath: data} + testData = append(testData, dataPath) + } + for _, d := range r.extraOutputFiles { + testData = append(testData, android.DataPath{SrcPath: d}) + } // Always enable Ravenizer for ravenwood tests. r.Library.ravenizer.enabled = true @@ -244,20 +271,28 @@ func (r *ravenwoodTest) GenerateAndroidBuildActions(ctx android.ModuleContext) { targetSdkVersionInt := r.TargetSdkVersion(ctx).FinalOrFutureInt() // FinalOrFutureInt may be 10000. packageName := proptools.StringDefault(r.ravenwoodTestProperties.Package_name, "") instPackageName := proptools.StringDefault(r.ravenwoodTestProperties.Inst_package_name, "") + instClassName := proptools.StringDefault(r.ravenwoodTestProperties.Instrumentation_class, "") 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, + "targetSdkVersionInt": strconv.Itoa(targetSdkVersionInt), + "targetSdkVersionRaw": targetSdkVersion, + "packageName": packageName, + "instPackageName": instPackageName, + "instrumentationClass": instClassName, }, }) installProps := ctx.InstallFile(installPath, "ravenwood.properties", propertiesOutputPath) installDeps = append(installDeps, installProps) + // Copy data files + for _, data := range r.data { + installedData := ctx.InstallFile(installPath, data.Rel(), data) + installDeps = append(installDeps, installedData) + } + // Install our JAR with all dependencies ctx.InstallFile(installPath, ctx.ModuleName()+".jar", r.outputFile, installDeps...) @@ -338,6 +373,10 @@ func (r *ravenwoodLibgroup) DepsMutator(ctx android.BottomUpMutatorContext) { for _, lib := range r.ravenwoodLibgroupProperties.Jni_libs.GetOrDefault(ctx, nil) { ctx.AddVariationDependencies(ctx.Config().BuildOSTarget.Variations(), jniLibTag, lib) } + + if r.Name() == ravenwoodRuntimeName { + ctx.AddVariationDependencies(nil, allAconfigModuleTag, aconfig.AllAconfigModule) + } } func (r *ravenwoodLibgroup) GenerateAndroidBuildActions(ctx android.ModuleContext) { @@ -355,11 +394,17 @@ func (r *ravenwoodLibgroup) GenerateAndroidBuildActions(ctx android.ModuleContex names: jniDepNames, }) + install := func(to android.InstallPath, srcs ...android.Path) { + for _, s := range srcs { + ctx.InstallFile(to, s.Base(), s) + } + } + // Install our runtime into expected location for packaging installPath := android.PathForModuleInstall(ctx, r.BaseModuleName()) for _, lib := range r.ravenwoodLibgroupProperties.Libs { libModule := ctx.GetDirectDepProxyWithTag(lib, ravenwoodLibContentTag) - if libModule == nil { + if libModule.IsNil() { if ctx.Config().AllowMissingDependencies() { ctx.AddMissingDependencies([]string{lib}) } else { @@ -368,24 +413,50 @@ func (r *ravenwoodLibgroup) GenerateAndroidBuildActions(ctx android.ModuleContex continue } libJar := android.OutputFileForModule(ctx, libModule, "") - ctx.InstallFile(installPath, lib+".jar", libJar) + ctx.InstallFile(installPath, libJar.Base(), libJar) } soInstallPath := android.PathForModuleInstall(ctx, r.BaseModuleName()).Join(ctx, getLibPath(r.forceArchType)) for _, jniLib := range jniLibs { - ctx.InstallFile(soInstallPath, jniLib.path.Base(), jniLib.path) + install(soInstallPath, jniLib.path) } dataInstallPath := installPath.Join(ctx, "ravenwood-data") data := android.PathsForModuleSrc(ctx, r.ravenwoodLibgroupProperties.Data) for _, file := range data { - ctx.InstallFile(dataInstallPath, file.Base(), file) + install(dataInstallPath, file) } fontsInstallPath := installPath.Join(ctx, "fonts") fonts := android.PathsForModuleSrc(ctx, r.ravenwoodLibgroupProperties.Fonts) for _, file := range fonts { - ctx.InstallFile(fontsInstallPath, file.Base(), file) + install(fontsInstallPath, file) + } + + // Copy aconfig flag storage files. + if r.Name() == ravenwoodRuntimeName { + allAconfigFound := false + if allAconfig := ctx.GetDirectDepProxyWithTag(aconfig.AllAconfigModule, allAconfigModuleTag); !allAconfig.IsNil() { + aadi, ok := android.OtherModuleProvider(ctx, allAconfig, aconfig.AllAconfigDeclarationsInfoProvider) + if ok { + // Binary proto file and the text proto. + // We don't really use the text proto file, but having this would make debugging easier. + install(installPath.Join(ctx, "aconfig/metadata/aconfig/etc"), aadi.ParsedFlagsFile, aadi.TextProtoFlagsFile) + + // The "new" storage files. + install(installPath.Join(ctx, "aconfig/metadata/aconfig/maps"), aadi.StoragePackageMap, aadi.StorageFlagMap) + install(installPath.Join(ctx, "aconfig/metadata/aconfig/boot"), aadi.StorageFlagVal, aadi.StorageFlagInfo) + + allAconfigFound = true + } + } + if !allAconfigFound { + if ctx.Config().AllowMissingDependencies() { + ctx.AddMissingDependencies([]string{aconfig.AllAconfigModule}) + } else { + ctx.ModuleErrorf("missing dependency %q", aconfig.AllAconfigModule) + } + } } // Normal build should perform install steps |
