From 374324b0427364a5038e4b6dbeafb02561ba3dd3 Mon Sep 17 00:00:00 2001 From: Kongqun Yang Date: Wed, 26 Feb 2014 20:26:16 -0800 Subject: [PATCH] Disable test_isolation_mode, glib, and x11 in GYP_DEFINES This removes unnecessary library dependencies. Change-Id: Id451766d1bedd7fbcd9cf9cf882de86ccb662486 --- gyp_packager.py | 21 ++++++++++++++------- media/event/media_event.gyp | 2 +- media/test/media_test.gyp | 13 +++++++++++-- mpd/mpd.gyp | 2 +- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/gyp_packager.py b/gyp_packager.py index 6559e2b078..89320eba6b 100755 --- a/gyp_packager.py +++ b/gyp_packager.py @@ -14,12 +14,12 @@ # 1. Setup gyp: ./gyp_packager.py # # clang is not enabled by default, which can be enabled by overriding -# GYP_DEFINE environment variable, i.e. "GYP_DEFINES='clang=1 -# use_openssl=1' ./gyp_packager.py". +# GYP_DEFINE environment variable, i.e. +# "GYP_DEFINES='clang=1' ./gyp_packager.py". # # Ninja is the default build system. User can also change to make by -# overriding GYP_GENERATORS to make, i.e. "GYP_GENERATORS='make' -# ./gyp_packager.py". +# overriding GYP_GENERATORS to make, i.e. +# "GYP_GENERATORS='make' ./gyp_packager.py". # # 2. The first step generates the make files but does not start the # build process. Ninja is the default build system. Refer to Ninja @@ -59,9 +59,16 @@ if __name__ == '__main__': # Gyp should run from current directory. args.append('--depth=.') - # Set GYP_DEFINES if it is not explicitly set yet. - if not os.environ.get('GYP_DEFINES'): - os.environ['GYP_DEFINES'] = 'use_openssl=1' + # Set these default GYP_DEFINES if user does not set the value explicitly. + _DEFAULT_DEFINES = {"test_isolation_mode" : "noop", "use_glib" : 0, + "use_openssl" : 1, "use_x11" : 0} + + gyp_defines = (os.environ['GYP_DEFINES'] if os.environ.get('GYP_DEFINES') + else "") + for key in _DEFAULT_DEFINES: + if key not in gyp_defines: + gyp_defines += " {}={}".format(key, _DEFAULT_DEFINES[key]) + os.environ['GYP_DEFINES'] = gyp_defines.strip() # There shouldn't be a circular dependency relationship between .gyp files, # but in Chromium's .gyp files, on non-Mac platforms, circular relationships diff --git a/media/event/media_event.gyp b/media/event/media_event.gyp index a620d3a89d..cbd033f1ec 100644 --- a/media/event/media_event.gyp +++ b/media/event/media_event.gyp @@ -38,9 +38,9 @@ ], 'dependencies': [ '../../base/base.gyp:base', - '../../base/base.gyp:run_all_unittests', '../../mpd/mpd.gyp:media_info_proto', '../../testing/gtest.gyp:gtest', + '../../testing/gtest.gyp:gtest_main', # Depends on full protobuf to read/write with TextFormat. '../../third_party/protobuf/protobuf.gyp:protobuf_full_do_not_use', '../file/file.gyp:file', diff --git a/media/test/media_test.gyp b/media/test/media_test.gyp index 20e1ed6e79..f1ad4254a2 100644 --- a/media/test/media_test.gyp +++ b/media/test/media_test.gyp @@ -12,16 +12,25 @@ }, 'targets': [ { - 'target_name': 'media_test_support', + 'target_name': 'run_all_unittests', 'type': '<(component)', 'sources': [ 'run_tests_with_atexit_manager.cc', + ], + 'dependencies': [ + '../../testing/gtest.gyp:gtest', + ], + }, + { + 'target_name': 'media_test_support', + 'type': '<(component)', + 'sources': [ 'test_data_util.cc', 'test_data_util.h', ], 'dependencies': [ '../../base/base.gyp:base', - '../../testing/gtest.gyp:gtest', + 'run_all_unittests', ], }, ], diff --git a/mpd/mpd.gyp b/mpd/mpd.gyp index b9a35bd7b1..06fb119356 100644 --- a/mpd/mpd.gyp +++ b/mpd/mpd.gyp @@ -68,8 +68,8 @@ ], 'dependencies': [ '../base/base.gyp:base', - '../base/base.gyp:run_all_unittests', '../media/file/file.gyp:file', + '../media/test/media_test.gyp:run_all_unittests', '../testing/gtest.gyp:gtest', 'mpd_builder', 'mpd_util',