Skip to content

Commit

Permalink
switch to new version of gyp
Browse files Browse the repository at this point in the history
  • Loading branch information
fceller committed Aug 6, 2014
1 parent 9d51963 commit dd67968
Show file tree
Hide file tree
Showing 927 changed files with 31,330 additions and 4,069 deletions.
5 changes: 5 additions & 0 deletions 3rdParty/V8/build/gyp/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@
# Name or Organization <email address>

Google Inc.
Bloomberg Finance L.P.
Yandex LLC

Steven Knight <knight@baldmt.com>
Ryan Norton <rnorton10@gmail.com>
David J. Sankel <david@sankelsoftware.com>
Eric N. Vander Weele <ericvw@gmail.com>
2 changes: 0 additions & 2 deletions 3rdParty/V8/build/gyp/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ vars = {
}

deps = {
"scons":
Var("chrome_trunk") + "/src/third_party/scons@44099",
}

deps_os = {
Expand Down
21 changes: 0 additions & 21 deletions 3rdParty/V8/build/gyp/MANIFEST

This file was deleted.

23 changes: 16 additions & 7 deletions 3rdParty/V8/build/gyp/PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
'test/lib/TestCmd.py',
'test/lib/TestCommon.py',
'test/lib/TestGyp.py',
# Needs style fix.
'pylib/gyp/generator/scons.py',
'pylib/gyp/generator/xcode.py',
]


Expand Down Expand Up @@ -75,13 +72,20 @@ def CheckChangeOnUpload(input_api, output_api):

def CheckChangeOnCommit(input_api, output_api):
report = []

# Accept any year number from 2009 to the current year.
current_year = int(input_api.time.strftime('%Y'))
allowed_years = (str(s) for s in reversed(xrange(2009, current_year + 1)))
years_re = '(' + '|'.join(allowed_years) + ')'

# The (c) is deprecated, but tolerate it until it's removed from all files.
license = (
r'.*? Copyright \(c\) %(year)s Google Inc\. All rights reserved\.\n'
r'.*? Copyright (\(c\) )?%(year)s Google Inc\. All rights reserved\.\n'
r'.*? Use of this source code is governed by a BSD-style license that '
r'can be\n'
r'.*? found in the LICENSE file\.\n'
) % {
'year': input_api.time.strftime('%Y'),
'year': years_re,
}

report.extend(input_api.canned_checks.PanProjectChecks(
Expand All @@ -91,19 +95,24 @@ def CheckChangeOnCommit(input_api, output_api):
'http://gyp-status.appspot.com/status',
'http://gyp-status.appspot.com/current'))

import os
import sys
old_sys_path = sys.path
try:
sys.path = ['pylib', 'test/lib'] + sys.path
blacklist = PYLINT_BLACKLIST
if sys.platform == 'win32':
blacklist = [os.path.normpath(x).replace('\\', '\\\\')
for x in PYLINT_BLACKLIST]
report.extend(input_api.canned_checks.RunPylint(
input_api,
output_api,
black_list=PYLINT_BLACKLIST,
black_list=blacklist,
disabled_warnings=PYLINT_DISABLED_WARNINGS))
finally:
sys.path = old_sys_path
return report


def GetPreferredTrySlaves():
return ['gyp-win32', 'gyp-win64', 'gyp-linux', 'gyp-mac']
return ['gyp-win32', 'gyp-win64', 'gyp-linux', 'gyp-mac', 'gyp-android']
149 changes: 137 additions & 12 deletions 3rdParty/V8/build/gyp/buildbot/buildbot_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,116 @@
BUILDBOT_DIR = os.path.dirname(os.path.abspath(__file__))
TRUNK_DIR = os.path.dirname(BUILDBOT_DIR)
ROOT_DIR = os.path.dirname(TRUNK_DIR)
ANDROID_DIR = os.path.join(ROOT_DIR, 'android')
CMAKE_DIR = os.path.join(ROOT_DIR, 'cmake')
CMAKE_BIN_DIR = os.path.join(CMAKE_DIR, 'bin')
OUT_DIR = os.path.join(TRUNK_DIR, 'out')


def GypTestFormat(title, format=None, msvs_version=None):
def CallSubProcess(*args, **kwargs):
"""Wrapper around subprocess.call which treats errors as build exceptions."""
retcode = subprocess.call(*args, **kwargs)
if retcode != 0:
print '@@@STEP_EXCEPTION@@@'
sys.exit(1)


def PrepareCmake():
"""Build CMake 2.8.8 since the version in Precise is 2.8.7."""
if os.environ['BUILDBOT_CLOBBER'] == '1':
print '@@@BUILD_STEP Clobber CMake checkout@@@'
shutil.rmtree(CMAKE_DIR)

# We always build CMake 2.8.8, so no need to do anything
# if the directory already exists.
if os.path.isdir(CMAKE_DIR):
return

print '@@@BUILD_STEP Initialize CMake checkout@@@'
os.mkdir(CMAKE_DIR)
CallSubProcess(['git', 'config', '--global', 'user.name', 'trybot'])
CallSubProcess(['git', 'config', '--global',
'user.email', 'chrome-bot@google.com'])
CallSubProcess(['git', 'config', '--global', 'color.ui', 'false'])

print '@@@BUILD_STEP Sync CMake@@@'
CallSubProcess(
['git', 'clone',
'--depth', '1',
'--single-branch',
'--branch', 'v2.8.8',
'--',
'git://cmake.org/cmake.git',
CMAKE_DIR],
cwd=CMAKE_DIR)

print '@@@BUILD_STEP Build CMake@@@'
CallSubProcess(
['/bin/bash', 'bootstrap', '--prefix=%s' % CMAKE_DIR],
cwd=CMAKE_DIR)

CallSubProcess( ['make', 'cmake'], cwd=CMAKE_DIR)


_ANDROID_SETUP = 'source build/envsetup.sh && lunch full-eng'


def PrepareAndroidTree():
"""Prepare an Android tree to run 'android' format tests."""
if os.environ['BUILDBOT_CLOBBER'] == '1':
print '@@@BUILD_STEP Clobber Android checkout@@@'
shutil.rmtree(ANDROID_DIR)

# The release of Android we use is static, so there's no need to do anything
# if the directory already exists.
if os.path.isdir(ANDROID_DIR):
return

print '@@@BUILD_STEP Initialize Android checkout@@@'
os.mkdir(ANDROID_DIR)
CallSubProcess(['git', 'config', '--global', 'user.name', 'trybot'])
CallSubProcess(['git', 'config', '--global',
'user.email', 'chrome-bot@google.com'])
CallSubProcess(['git', 'config', '--global', 'color.ui', 'false'])
CallSubProcess(
['repo', 'init',
'-u', 'https://android.googlesource.com/platform/manifest',
'-b', 'android-4.2.1_r1',
'-g', 'all,-notdefault,-device,-darwin,-mips,-x86'],
cwd=ANDROID_DIR)

print '@@@BUILD_STEP Sync Android@@@'
CallSubProcess(['repo', 'sync', '-j4'], cwd=ANDROID_DIR)

print '@@@BUILD_STEP Build Android@@@'
CallSubProcess(
['/bin/bash',
'-c', '%s && make -j4' % _ANDROID_SETUP],
cwd=ANDROID_DIR)


def StartAndroidEmulator():
"""Start an android emulator from the built android tree."""
print '@@@BUILD_STEP Start Android emulator@@@'
android_host_bin = '$ANDROID_HOST_OUT/bin'
subprocess.Popen(
['/bin/bash', '-c',
'%s && %s/emulator -no-window' % (_ANDROID_SETUP, android_host_bin)],
cwd=ANDROID_DIR)
CallSubProcess(
['/bin/bash', '-c',
'%s && %s/adb wait-for-device' % (_ANDROID_SETUP, android_host_bin)],
cwd=ANDROID_DIR)


def StopAndroidEmulator():
"""Stop all android emulators."""
print '@@@BUILD_STEP Stop Android emulator@@@'
# If this fails, it's because there is no emulator running.
subprocess.call(['pkill', 'emulator.*'])


def GypTestFormat(title, format=None, msvs_version=None, tests=[]):
"""Run the gyp tests for a given format, emitting annotator tags.
See annotator docs at:
Expand All @@ -41,20 +147,24 @@ def GypTestFormat(title, format=None, msvs_version=None):
print '@@@BUILD_STEP ' + title + '@@@'
sys.stdout.flush()
env = os.environ.copy()
# TODO(bradnelson): remove this when this issue is resolved:
# http://code.google.com/p/chromium/issues/detail?id=108251
if format == 'ninja':
env['NOGOLD'] = '1'
if msvs_version:
env['GYP_MSVS_VERSION'] = msvs_version
retcode = subprocess.call(' '.join(
command = ' '.join(
[sys.executable, 'trunk/gyptest.py',
'--all',
'--passed',
'--format', format,
'--chdir', 'trunk',
'--path', '../scons']),
cwd=ROOT_DIR, env=env, shell=True)
'--path', CMAKE_BIN_DIR,
'--chdir', 'trunk'] + tests)
if format == 'android':
# gyptest needs the environment setup from envsetup/lunch in order to build
# using the 'android' backend, so this is done in a single shell.
retcode = subprocess.call(
['/bin/bash',
'-c', '%s && cd %s && %s' % (_ANDROID_SETUP, ROOT_DIR, command)],
cwd=ANDROID_DIR, env=env)
else:
retcode = subprocess.call(command, cwd=ROOT_DIR, env=env, shell=True)
if retcode:
# Emit failure tag, and keep going.
print '@@@STEP_FAILURE@@@'
Expand All @@ -70,19 +180,34 @@ def GypBuild():
print 'Done.'

retcode = 0
if sys.platform.startswith('linux'):
# The Android gyp bot runs on linux so this must be tested first.
if os.environ['BUILDBOT_BUILDERNAME'] == 'gyp-android':
PrepareAndroidTree()
StartAndroidEmulator()
try:
retcode += GypTestFormat('android')
finally:
StopAndroidEmulator()
elif sys.platform.startswith('linux'):
retcode += GypTestFormat('ninja')
retcode += GypTestFormat('scons')
retcode += GypTestFormat('make')
PrepareCmake()
retcode += GypTestFormat('cmake')
elif sys.platform == 'darwin':
retcode += GypTestFormat('ninja')
retcode += GypTestFormat('xcode')
retcode += GypTestFormat('make')
elif sys.platform == 'win32':
retcode += GypTestFormat('ninja')
retcode += GypTestFormat('msvs-2008', format='msvs', msvs_version='2008')
if os.environ['BUILDBOT_BUILDERNAME'] == 'gyp-win64':
retcode += GypTestFormat('msvs-ninja-2012', format='msvs-ninja',
msvs_version='2012',
tests=[
'test\generator-output\gyptest-actions.py',
'test\generator-output\gyptest-relocate.py',
'test\generator-output\gyptest-rules.py'])
retcode += GypTestFormat('msvs-2010', format='msvs', msvs_version='2010')
retcode += GypTestFormat('msvs-2012', format='msvs', msvs_version='2012')
else:
raise Exception('Unknown platform')
if retcode:
Expand Down
20 changes: 5 additions & 15 deletions 3rdParty/V8/build/gyp/gyp
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
#!/usr/bin/env python

# Copyright (c) 2009 Google Inc. All rights reserved.
#!/bin/bash
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import sys

# TODO(mark): sys.path manipulation is some temporary testing stuff.
try:
import gyp
except ImportError, e:
import os.path
sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), 'pylib'))
import gyp

if __name__ == '__main__':
sys.exit(gyp.main(sys.argv[1:]))
set -e
base=$(dirname "$0")
exec python "${base}/gyp_main.py" "$@"
2 changes: 1 addition & 1 deletion 3rdParty/V8/build/gyp/gyp.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
@rem Use of this source code is governed by a BSD-style license that can be
@rem found in the LICENSE file.

@python "%~dp0/gyp" %*
@python "%~dp0gyp_main.py" %*
26 changes: 17 additions & 9 deletions 3rdParty/V8/build/gyp/gyptest.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,18 @@ def __getattr__(self, attr):
sys.stderr = Unbuffered(sys.stderr)


def is_test_name(f):
return f.startswith('gyptest') and f.endswith('.py')


def find_all_gyptest_files(directory):
result = []
for root, dirs, files in os.walk(directory):
if '.svn' in dirs:
dirs.remove('.svn')
result.extend([ os.path.join(root, f) for f in files
if f.startswith('gyptest') and f.endswith('.py') ])
result.sort()
return result
result = []
for root, dirs, files in os.walk(directory):
if '.svn' in dirs:
dirs.remove('.svn')
result.extend([ os.path.join(root, f) for f in files if is_test_name(f) ])
result.sort()
return result


def main(argv=None):
Expand Down Expand Up @@ -173,7 +176,7 @@ def main(argv=None):
if opts.path:
extra_path = [os.path.abspath(p) for p in opts.path]
extra_path = os.pathsep.join(extra_path)
os.environ['PATH'] += os.pathsep + extra_path
os.environ['PATH'] = extra_path + os.pathsep + os.environ['PATH']

if not args:
if not opts.all:
Expand All @@ -186,6 +189,9 @@ def main(argv=None):
if os.path.isdir(arg):
tests.extend(find_all_gyptest_files(os.path.normpath(arg)))
else:
if not is_test_name(os.path.basename(arg)):
print >>sys.stderr, arg, 'is not a valid gyp test name.'
sys.exit(1)
tests.append(arg)

if opts.list:
Expand All @@ -210,8 +216,10 @@ def main(argv=None):
else:
# TODO: not duplicate this mapping from pylib/gyp/__init__.py
format_list = {
'aix5': ['make'],
'freebsd7': ['make'],
'freebsd8': ['make'],
'openbsd5': ['make'],
'cygwin': ['msvs'],
'win32': ['msvs', 'ninja'],
'linux2': ['make', 'ninja'],
Expand Down
Loading

0 comments on commit dd67968

Please sign in to comment.