<Hermetic> Replace Soong Python bootstrap process with embedded
launcher. For Python2, we bundle embedded launcher as bootstrapper within every .par file. This feature is only enabled for linux_x86_64 for now. We provide a user flag: hermetic_enabled within bp file. By default, Pyhon2 still use classic bootstrapping way to construct .par file and relys on host interpreter. Once embedded_launcher is enabled, launcher will be used to bootstrap .par file and execute user program. For Python3, the launcher will be ready soon, and for now it still relys on classic bootstrapping. Test: Real example is used to test. Bug: b/63018041 Change-Id: I28deba413d8ad3af407595e46f77d663e79a3705
This commit is contained in:
@@ -16,7 +16,6 @@ package python
|
||||
|
||||
import (
|
||||
"android/soong/android"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// This file contains the module types for building Python test.
|
||||
@@ -25,30 +24,29 @@ func init() {
|
||||
android.RegisterModuleType("python_test_host", PythonTestHostFactory)
|
||||
}
|
||||
|
||||
type PythonTestHost struct {
|
||||
pythonBinaryBase
|
||||
type testDecorator struct {
|
||||
*binaryDecorator
|
||||
}
|
||||
|
||||
var _ PythonSubModule = (*PythonTestHost)(nil)
|
||||
|
||||
type pythonTestHostDecorator struct {
|
||||
pythonDecorator
|
||||
func (test *testDecorator) install(ctx android.ModuleContext, file android.Path) {
|
||||
test.binaryDecorator.baseInstaller.install(ctx, file)
|
||||
}
|
||||
|
||||
func (p *pythonTestHostDecorator) install(ctx android.ModuleContext, file android.Path) {
|
||||
p.pythonDecorator.baseInstaller.dir = filepath.Join("nativetest", ctx.ModuleName())
|
||||
p.pythonDecorator.baseInstaller.install(ctx, file)
|
||||
func NewTest(hod android.HostOrDeviceSupported) *Module {
|
||||
module, binary := NewBinary(hod)
|
||||
|
||||
binary.baseInstaller = NewPythonInstaller("nativetest")
|
||||
|
||||
test := &testDecorator{binaryDecorator: binary}
|
||||
|
||||
module.bootstrapper = test
|
||||
module.installer = test
|
||||
|
||||
return module
|
||||
}
|
||||
|
||||
func PythonTestHostFactory() android.Module {
|
||||
decorator := &pythonTestHostDecorator{
|
||||
pythonDecorator: pythonDecorator{baseInstaller: NewPythonInstaller("nativetest")}}
|
||||
module := NewTest(android.HostSupportedNoCross)
|
||||
|
||||
module := &PythonBinaryHost{}
|
||||
module.pythonBaseModule.installer = decorator
|
||||
|
||||
module.AddProperties(&module.binaryProperties)
|
||||
|
||||
return InitPythonBaseModule(&module.pythonBinaryBase.pythonBaseModule,
|
||||
&module.pythonBinaryBase, android.HostSupportedNoCross)
|
||||
return module.Init()
|
||||
}
|
||||
|
Reference in New Issue
Block a user