diff options
author | 2025-03-24 09:35:14 -0700 | |
---|---|---|
committer | 2025-03-24 09:35:14 -0700 | |
commit | 156f3dc769b1114428c3c6a8df0def6cea04e55a (patch) | |
tree | 878e585c925242d7d304235c98163059d9a7d2fd | |
parent | c9b8251657a4279bdf4d38befde4a3024fed0019 (diff) | |
parent | 5be47f763f9c555967349ba4f7c7be317026329f (diff) |
Merge "Add prepend_artifact_with_product attribute for dist" into main
-rw-r--r-- | android/androidmk.go | 15 | ||||
-rw-r--r-- | android/module.go | 6 | ||||
-rw-r--r-- | ci_tests/ci_test_package_zip.go | 8 |
3 files changed, 17 insertions, 12 deletions
diff --git a/android/androidmk.go b/android/androidmk.go index 7cc6aef00..e32835946 100644 --- a/android/androidmk.go +++ b/android/androidmk.go @@ -435,13 +435,18 @@ func getDistContributions(ctx ConfigAndOtherModuleProviderContext, mod Module) * suffix = *dist.Suffix } - productString := "" - if dist.Append_artifact_with_product != nil && *dist.Append_artifact_with_product { - productString = fmt.Sprintf("_%s", ctx.Config().DeviceProduct()) + prependProductString := "" + if proptools.Bool(dist.Prepend_artifact_with_product) { + prependProductString = fmt.Sprintf("%s-", ctx.Config().DeviceProduct()) } - if suffix != "" || productString != "" { - dest = strings.TrimSuffix(dest, ext) + suffix + productString + ext + appendProductString := "" + if proptools.Bool(dist.Append_artifact_with_product) { + appendProductString = fmt.Sprintf("_%s", ctx.Config().DeviceProduct()) + } + + if suffix != "" || appendProductString != "" || prependProductString != "" { + dest = prependProductString + strings.TrimSuffix(dest, ext) + suffix + appendProductString + ext } if dist.Dir != nil { diff --git a/android/module.go b/android/module.go index c0abfd0a3..1538861d3 100644 --- a/android/module.go +++ b/android/module.go @@ -208,6 +208,12 @@ type Dist struct { // no change to the artifact file name. Append_artifact_with_product *bool `android:"arch_variant"` + // If true, then the artifact file will be prepended with <product name>-. For + // example, if the product is coral and the module is an android_app module + // of name foo, then the artifact would be coral-foo.apk. If false, there is + // no change to the artifact file name. + Prepend_artifact_with_product *bool `android:"arch_variant"` + // A string tag to select the OutputFiles associated with the tag. // // If no tag is specified then it will select the default dist paths provided diff --git a/ci_tests/ci_test_package_zip.go b/ci_tests/ci_test_package_zip.go index d7aaa6686..4cadffddc 100644 --- a/ci_tests/ci_test_package_zip.go +++ b/ci_tests/ci_test_package_zip.go @@ -68,7 +68,7 @@ var ( pctx = android.NewPackageContext("android/soong/ci_tests") // test_package module type should only be used for the following modules. // TODO: remove "_soong" from the module names inside when eliminating the corresponding make modules - moduleNamesAllowed = []string{"continuous_native_tests_soong", "continuous_instrumentation_tests_soong", "platform_tests"} + moduleNamesAllowed = []string{"continuous_instrumentation_tests_soong", "continuous_instrumentation_metric_tests_soong", "continuous_native_tests_soong", "continuous_native_metric_tests_soong", "platform_tests"} ) func (p *testPackageZip) DepsMutator(ctx android.BottomUpMutatorContext) { @@ -150,12 +150,6 @@ func (p *testPackageZip) GenerateAndroidBuildActions(ctx android.ModuleContext) p.output = createOutput(ctx, pctx) ctx.SetOutputFiles(android.Paths{p.output}, "") - - // dist the test output - if ctx.ModuleName() == "platform_tests" { - distedName := ctx.Config().Getenv("TARGET_PRODUCT") + "-tests-FILE_NAME_TAG_PLACEHOLDER.zip" - ctx.DistForGoalWithFilename("platform_tests", p.output, distedName) - } } func createOutput(ctx android.ModuleContext, pctx android.PackageContext) android.ModuleOutPath { |