diff options
author | 2025-01-29 15:14:17 -0800 | |
---|---|---|
committer | 2025-01-29 15:29:06 -0800 | |
commit | 58eef4f7de976345ce33c94cfc45440634158448 (patch) | |
tree | f67c7370762e3871e739acda33d81c4e04b2c606 /rust/test.go | |
parent | d2c82e1253469a518acf2cf6431ee966551da693 (diff) |
Convert rust module-info.json to soong
This leads to idendical results as before, with the exception of
the "required" field in module-info.json. Make has more complicated
logic to fill out the required field than soong, and it leads to
make-specific names such as ones suffixed with :32 and don't make sense
in soong. I'm don't think there are critical users of that field though,
so I'll try removing it.
Everything else should be identical to the make-generated information
though.
Bug: 389720048
Test: diff'd module-info.json before and after this cl in soong+make mode
Change-Id: I74aefe578287f07474c15e5f92a0c2780a679047
Diffstat (limited to 'rust/test.go')
-rw-r--r-- | rust/test.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/rust/test.go b/rust/test.go index 5e42c3f60..9a59117cc 100644 --- a/rust/test.go +++ b/rust/test.go @@ -259,6 +259,32 @@ func (test *testDecorator) testBinary() bool { return true } +func (test *testDecorator) moduleInfoJSON(ctx ModuleContext, moduleInfoJSON *android.ModuleInfoJSON) { + test.binaryDecorator.moduleInfoJSON(ctx, moduleInfoJSON) + moduleInfoJSON.Class = []string{"NATIVE_TESTS"} + if Bool(test.Properties.Test_options.Unit_test) { + moduleInfoJSON.IsUnitTest = "true" + if ctx.Host() { + moduleInfoJSON.CompatibilitySuites = append(moduleInfoJSON.CompatibilitySuites, "host-unit-tests") + } + } + moduleInfoJSON.TestOptionsTags = append(moduleInfoJSON.TestOptionsTags, test.Properties.Test_options.Tags...) + if test.testConfig != nil { + if _, ok := test.testConfig.(android.WritablePath); ok { + moduleInfoJSON.AutoTestConfig = []string{"true"} + } + moduleInfoJSON.TestConfig = append(moduleInfoJSON.TestConfig, test.testConfig.String()) + } + + moduleInfoJSON.DataDependencies = append(moduleInfoJSON.DataDependencies, test.Properties.Data_bins...) + + if len(test.Properties.Test_suites) > 0 { + moduleInfoJSON.CompatibilitySuites = append(moduleInfoJSON.CompatibilitySuites, test.Properties.Test_suites...) + } else { + moduleInfoJSON.CompatibilitySuites = append(moduleInfoJSON.CompatibilitySuites, "null-suite") + } +} + func rustTestHostMultilib(ctx android.LoadHookContext) { type props struct { Target struct { |