blob: f468ba8a0123b2ca783bcbdf358cf64aac424b7e [file] [log] [blame]
Sasha Smundakff36da02019-02-12 17:12:08 -08001// Copyright 2016 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
17import (
18 "fmt"
19 "io"
20)
21
22// Implements vts_config module
23
24func init() {
25 RegisterModuleType("vts_config", VtsConfigFactory)
26}
27
28type vtsConfigProperties struct {
29 // Test manifest file name if different from AndroidTest.xml.
30 Test_config *string
31}
32
33type VtsConfig struct {
34 ModuleBase
35 properties vtsConfigProperties
36 OutputFilePath OutputPath
37}
38
39func (me *VtsConfig) GenerateAndroidBuildActions(ctx ModuleContext) {
40 me.OutputFilePath = PathForModuleOut(ctx, me.BaseModuleName()).OutputPath
41}
42
43func (me *VtsConfig) AndroidMk() AndroidMkData {
44 androidMkData := AndroidMkData{
45 Class: "FAKE",
46 Include: "$(BUILD_SYSTEM)/android_vts_host_config.mk",
47 OutputFile: OptionalPathForPath(me.OutputFilePath),
48 }
49 if me.properties.Test_config != nil {
50 androidMkData.Extra = []AndroidMkExtraFunc{
51 func(w io.Writer, outputFile Path) {
52 fmt.Fprintf(w, "LOCAL_TEST_CONFIG := %s\n",
53 *me.properties.Test_config)
54 },
55 }
56 }
57 return androidMkData
58}
59
60func InitVtsConfigModule(me *VtsConfig) {
61 me.AddProperties(&me.properties)
62}
63
64// Defines VTS configuration.
65func VtsConfigFactory() Module {
66 module := &VtsConfig{}
67 InitVtsConfigModule(module)
68 InitAndroidArchModule(module /*TODO: or HostAndDeviceSupported? */, HostSupported, MultilibFirst)
69 return module
70}