blob: bf24d98c72a12ccbbdfc53e657b8c1967a979926 [file] [log] [blame]
karenluoc0318192019-10-10 21:26:26 -04001// Copyright 2019 Google Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package android
16
karenluoc0318192019-10-10 21:26:26 -040017func init() {
18 RegisterModuleType("csuite_config", CSuiteConfigFactory)
19}
20
21type csuiteConfigProperties struct {
22 // Override the default (AndroidTest.xml) test manifest file name.
23 Test_config *string
24}
25
26type CSuiteConfig struct {
27 ModuleBase
28 properties csuiteConfigProperties
29 OutputFilePath OutputPath
30}
31
32func (me *CSuiteConfig) GenerateAndroidBuildActions(ctx ModuleContext) {
33 me.OutputFilePath = PathForModuleOut(ctx, me.BaseModuleName()).OutputPath
34}
35
Liz Kammere2a17a52020-11-24 13:31:28 -080036func (me *CSuiteConfig) AndroidMkEntries() []AndroidMkEntries {
37 androidMkEntries := AndroidMkEntries{
karenluoc0318192019-10-10 21:26:26 -040038 Class: "FAKE",
39 Include: "$(BUILD_SYSTEM)/suite_host_config.mk",
40 OutputFile: OptionalPathForPath(me.OutputFilePath),
41 }
Liz Kammere2a17a52020-11-24 13:31:28 -080042 androidMkEntries.ExtraEntries = []AndroidMkExtraEntriesFunc{
43 func(entries *AndroidMkEntries) {
karenluoc0318192019-10-10 21:26:26 -040044 if me.properties.Test_config != nil {
Liz Kammere2a17a52020-11-24 13:31:28 -080045 entries.SetString("LOCAL_TEST_CONFIG", *me.properties.Test_config)
karenluoc0318192019-10-10 21:26:26 -040046 }
Liz Kammer57f5b332020-11-24 12:42:58 -080047 entries.AddCompatibilityTestSuites("csuite")
karenluoc0318192019-10-10 21:26:26 -040048 },
49 }
Liz Kammere2a17a52020-11-24 13:31:28 -080050 return []AndroidMkEntries{androidMkEntries}
karenluoc0318192019-10-10 21:26:26 -040051}
52
53func InitCSuiteConfigModule(me *CSuiteConfig) {
54 me.AddProperties(&me.properties)
55}
56
57// csuite_config generates an App Compatibility Test Suite (C-Suite) configuration file from the
58// <test_config> xml file and stores it in a subdirectory of $(HOST_OUT).
59func CSuiteConfigFactory() Module {
60 module := &CSuiteConfig{}
61 InitCSuiteConfigModule(module)
62 InitAndroidArchModule(module, HostSupported, MultilibFirst)
63 return module
64}