blob: de2b13e1b4883537d418c86c0b79fafc431b521f [file] [log] [blame]
Nan Zhang5323f8e2017-05-10 13:37:54 -07001// Copyright 2017 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 python
16
17import (
18 "android/soong/android"
Nan Zhang5323f8e2017-05-10 13:37:54 -070019)
20
21// This file contains the module types for building Python test.
22
23func init() {
24 android.RegisterModuleType("python_test_host", PythonTestHostFactory)
25}
26
Nan Zhangd4e641b2017-07-12 12:55:28 -070027type testDecorator struct {
28 *binaryDecorator
Nan Zhang5323f8e2017-05-10 13:37:54 -070029}
30
Nan Zhangd4e641b2017-07-12 12:55:28 -070031func (test *testDecorator) install(ctx android.ModuleContext, file android.Path) {
Nan Zhang0a32e592017-12-01 06:19:27 +000032 test.binaryDecorator.baseInstaller.install(ctx, file)
Nan Zhang5323f8e2017-05-10 13:37:54 -070033}
34
Nan Zhangd4e641b2017-07-12 12:55:28 -070035func NewTest(hod android.HostOrDeviceSupported) *Module {
36 module, binary := NewBinary(hod)
37
Nan Zhang0a32e592017-12-01 06:19:27 +000038 binary.baseInstaller = NewPythonInstaller("nativetest")
Nan Zhangd4e641b2017-07-12 12:55:28 -070039
40 test := &testDecorator{binaryDecorator: binary}
41
42 module.bootstrapper = test
43 module.installer = test
44
45 return module
Nan Zhang5323f8e2017-05-10 13:37:54 -070046}
47
Colin Cross36242852017-06-23 15:06:31 -070048func PythonTestHostFactory() android.Module {
Nan Zhangd4e641b2017-07-12 12:55:28 -070049 module := NewTest(android.HostSupportedNoCross)
Nan Zhang5323f8e2017-05-10 13:37:54 -070050
Nan Zhangd4e641b2017-07-12 12:55:28 -070051 return module.Init()
Nan Zhang5323f8e2017-05-10 13:37:54 -070052}