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

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

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