Enable Soong's tradefed_binary to support multi-arch
The original `tradefed_binary_host` in Soong always used the host OS architecture when writing the `arch` in `test-suite-info.properties`. This change introduces the `Suite_arch` attribute in `tradefed_binary_host`, allowing users to specify the architecture for `test-suite-info.properties`. Bug: 313535357 Test: 1. Add property of `suite_arch` in the Android.bp 2. m cts-tradefed 3. check `test-suite-info.properties` in cts-tradefed.jar Change-Id: Ib95db4e0e8d238c9bb8a2a3fffea606fa6a764ce
This commit is contained in:
@@ -35,6 +35,7 @@ type TradefedBinaryProperties struct {
|
|||||||
Short_name string
|
Short_name string
|
||||||
Full_name string
|
Full_name string
|
||||||
Version string
|
Version string
|
||||||
|
Suite_arch string
|
||||||
Prepend_platform_version_name bool
|
Prepend_platform_version_name bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,6 +68,7 @@ func tradefedBinaryLoadHook(tfb *TradefedBinaryProperties) func(ctx android.Load
|
|||||||
Name: &genName,
|
Name: &genName,
|
||||||
Short_name: tfb.Short_name,
|
Short_name: tfb.Short_name,
|
||||||
Full_name: tfb.Full_name,
|
Full_name: tfb.Full_name,
|
||||||
|
Suite_arch: tfb.Suite_arch,
|
||||||
Version: version,
|
Version: version,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -95,6 +97,7 @@ type TradefedBinaryGenProperties struct {
|
|||||||
Short_name string
|
Short_name string
|
||||||
Full_name string
|
Full_name string
|
||||||
Version string
|
Version string
|
||||||
|
Suite_arch string
|
||||||
}
|
}
|
||||||
|
|
||||||
type tradefedBinaryGen struct {
|
type tradefedBinaryGen struct {
|
||||||
@@ -127,13 +130,19 @@ var tradefedBinaryGenRule = pctx.StaticRule("tradefedBinaryGenRule", blueprint.R
|
|||||||
func (tfg *tradefedBinaryGen) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (tfg *tradefedBinaryGen) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
buildNumberFile := ctx.Config().BuildNumberFile(ctx)
|
buildNumberFile := ctx.Config().BuildNumberFile(ctx)
|
||||||
outputFile := android.PathForModuleOut(ctx, "test-suite-info.properties")
|
outputFile := android.PathForModuleOut(ctx, "test-suite-info.properties")
|
||||||
|
|
||||||
|
arch := strings.ReplaceAll(tfg.properties.Suite_arch, " ", "")
|
||||||
|
if arch == "" {
|
||||||
|
arch = ctx.Config().DevicePrimaryArchType().String()
|
||||||
|
}
|
||||||
|
|
||||||
ctx.Build(pctx, android.BuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: tradefedBinaryGenRule,
|
Rule: tradefedBinaryGenRule,
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
OrderOnly: android.Paths{buildNumberFile},
|
OrderOnly: android.Paths{buildNumberFile},
|
||||||
Args: map[string]string{
|
Args: map[string]string{
|
||||||
"buildNumberFile": buildNumberFile.String(),
|
"buildNumberFile": buildNumberFile.String(),
|
||||||
"arch": ctx.Config().DevicePrimaryArchType().String(),
|
"arch": arch,
|
||||||
"name": tfg.properties.Short_name,
|
"name": tfg.properties.Short_name,
|
||||||
"fullname": tfg.properties.Full_name,
|
"fullname": tfg.properties.Full_name,
|
||||||
"version": tfg.properties.Version,
|
"version": tfg.properties.Version,
|
||||||
|
Reference in New Issue
Block a user