2016-02-16 19:07:48 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# Copyright 2016 the V8 project authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
2019-02-19 08:28:26 +00:00
|
|
|
# for py2/py3 compatibility
|
|
|
|
from __future__ import print_function
|
|
|
|
|
2016-02-16 19:07:48 +00:00
|
|
|
import os
|
2018-04-16 09:24:22 +00:00
|
|
|
import os.path
|
2017-04-04 08:23:24 +00:00
|
|
|
import signal
|
2016-02-16 19:07:48 +00:00
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
|
|
|
|
GCMOLE_PATH = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
CLANG_BIN = os.path.join(GCMOLE_PATH, 'gcmole-tools', 'bin')
|
|
|
|
CLANG_PLUGINS = os.path.join(GCMOLE_PATH, 'gcmole-tools')
|
2020-11-18 10:36:23 +00:00
|
|
|
DRIVER = os.path.join(GCMOLE_PATH, 'gcmole.py')
|
2016-02-17 08:39:44 +00:00
|
|
|
BASE_PATH = os.path.dirname(os.path.dirname(GCMOLE_PATH))
|
2016-02-16 19:07:48 +00:00
|
|
|
|
2020-11-18 10:36:23 +00:00
|
|
|
assert len(sys.argv) >= 2
|
2016-02-16 19:07:48 +00:00
|
|
|
|
2020-10-04 14:42:15 +00:00
|
|
|
if not os.path.isfile("out/build/gen/torque-generated/builtin-definitions.h"):
|
|
|
|
print("Expected generated headers in out/build/gen.")
|
2020-11-18 10:36:23 +00:00
|
|
|
print("Either build v8 in out/build or change the 'out/build/gen' location in gcmole.py")
|
2018-04-16 09:24:22 +00:00
|
|
|
sys.exit(-1)
|
|
|
|
|
2017-04-04 08:23:24 +00:00
|
|
|
proc = subprocess.Popen(
|
2020-11-26 08:26:39 +00:00
|
|
|
[sys.executable, DRIVER] + sys.argv[1:],
|
2016-02-16 19:07:48 +00:00
|
|
|
env={'CLANG_BIN': CLANG_BIN, 'CLANG_PLUGINS': CLANG_PLUGINS},
|
2016-02-17 08:39:44 +00:00
|
|
|
cwd=BASE_PATH,
|
2017-04-04 08:23:24 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
def handle_sigterm(*args):
|
|
|
|
try:
|
|
|
|
proc.kill()
|
|
|
|
except OSError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
signal.signal(signal.SIGTERM, handle_sigterm)
|
|
|
|
|
|
|
|
proc.communicate()
|
|
|
|
sys.exit(proc.returncode)
|