Merge pull request #441 from electron/fix-360/2

Light refactoring of the build script
This commit is contained in:
John Kleinschmidt 2018-02-06 10:40:47 -05:00 коммит произвёл GitHub
Родитель ad338ca1e8 2dfef9a118
Коммит bc53f258b0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 32 добавлений и 26 удалений

Просмотреть файл

@ -11,7 +11,6 @@ from lib.config import get_output_dir
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
VENDOR_DIR = os.path.join(SOURCE_ROOT, 'vendor')
TARGETS = ['chromiumcontent_all']
COMPONENTS = ['static_library', 'shared_library', 'ffmpeg']
MIPS64EL_GCC = 'gcc-4.8.3-d197-n64-loongson'
@ -52,34 +51,41 @@ def main():
os.chdir(SOURCE_ROOT)
for component in COMPONENTS:
if args.component == 'all' or args.component == component \
or (args.include_ffmpeg and component == 'ffmpeg'):
if component == 'shared_library' and args.no_shared_library:
continue
elif component == 'static_library' and args.no_static_library:
continue
out_dir = get_output_dir(SOURCE_ROOT, target_arch, component)
target = 'chromiumcontent:chromiumcontent'
subprocess.check_call([NINJA, '-C', os.path.relpath(out_dir), target], env=env)
if component == 'static_library':
subenv = env.copy()
subenv['CHROMIUMCONTENT_2ND_PASS'] = '1'
target = 'chromiumcontent:libs'
subprocess.check_call([NINJA, '-C', os.path.relpath(out_dir), target], env=subenv)
# Build everything by default.
components_to_build = COMPONENTS
if args.debug:
components_to_build = ['shared_library', 'ffmpeg']
elif args.release:
components_to_build = ['static_library', 'ffmpeg']
elif args.component is not None:
components_to_build = args.component
for component in components_to_build:
out_dir = get_output_dir(SOURCE_ROOT, target_arch, component)
target = 'chromiumcontent:chromiumcontent'
subprocess.check_call([NINJA, '-C', os.path.relpath(out_dir), target], env=env)
if component == 'static_library':
subenv = env.copy()
subenv['CHROMIUMCONTENT_2ND_PASS'] = '1'
target = 'chromiumcontent:libs'
subprocess.check_call([NINJA, '-C', os.path.relpath(out_dir), target], env=subenv)
def parse_args():
parser = argparse.ArgumentParser(description='Build libchromiumcontent')
parser.add_argument('-t', '--target_arch', default='x64', help='x64 or ia32')
parser.add_argument('-c', '--component', default='all',
help='static_library or shared_library or all')
parser.add_argument('-D', '--no_static_library', action='store_true',
help='Do not build static library version')
parser.add_argument('-R', '--no_shared_library', action='store_true',
help='Do not build shared library version')
parser.add_argument('-F', '--include_ffmpeg', action='store_true',
help='Include ffmpeg in component build')
parser.add_argument('-t', '--target_arch', default='x64',
choices=['arm', 'arm64', 'ia32', 'mips64el', 'x64'])
what_to_build_group = parser.add_mutually_exclusive_group()
what_to_build_group.add_argument('-c', '--component', nargs='+', default=None,
choices=COMPONENTS)
what_to_build_group.add_argument('-D', '--debug', action='store_true',
help='Build debug configuration')
what_to_build_group.add_argument('-R', '--release', action='store_true',
help='Build release configuration')
return parser.parse_args()

Просмотреть файл

@ -77,7 +77,7 @@ def run_ci(args, skip_upload, component=None):
component_args = []
if component is not None:
component_args = ['-c', component]
build_args += component_args + ['-F']
build_args += component_args + ['ffmpeg']
if sys.platform in ['win32', 'cygwin']:
target_arch = args[1]
# Set build env for VS.