github.com/westcoastroms/westcoastroms-build@v0.0.0-20190928114312-2350e5a73030/build/soong/python/test.go (about) 1 // 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 15 package python 16 17 import ( 18 "android/soong/android" 19 ) 20 21 // This file contains the module types for building Python test. 22 23 func init() { 24 android.RegisterModuleType("python_test_host", PythonTestHostFactory) 25 android.RegisterModuleType("python_test", PythonTestFactory) 26 } 27 28 type testDecorator struct { 29 *binaryDecorator 30 } 31 32 func (test *testDecorator) install(ctx android.ModuleContext, file android.Path) { 33 test.binaryDecorator.pythonInstaller.dir = "nativetest" 34 test.binaryDecorator.pythonInstaller.dir64 = "nativetest64" 35 36 test.binaryDecorator.pythonInstaller.relative = ctx.ModuleName() 37 38 test.binaryDecorator.pythonInstaller.install(ctx, file) 39 } 40 41 func NewTest(hod android.HostOrDeviceSupported) *Module { 42 module, binary := NewBinary(hod) 43 44 binary.pythonInstaller = NewPythonInstaller("nativetest", "nativetest64") 45 46 test := &testDecorator{binaryDecorator: binary} 47 48 module.bootstrapper = test 49 module.installer = test 50 51 return module 52 } 53 54 func PythonTestHostFactory() android.Module { 55 module := NewTest(android.HostSupportedNoCross) 56 57 return module.Init() 58 } 59 60 func PythonTestFactory() android.Module { 61 module := NewTest(android.HostAndDeviceSupported) 62 module.multilib = android.MultilibBoth 63 64 return module.Init() 65 }