1adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org#!/usr/bin/env python 2adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org 3adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# Copyright 2014 Google Inc. All rights reserved. 4adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# 5adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# Redistribution and use in source and binary forms, with or without 6adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# modification, are permitted provided that the following conditions are 7adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# met: 8adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# 9adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# * Redistributions of source code must retain the above copyright 10adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# notice, this list of conditions and the following disclaimer. 11adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# * Redistributions in binary form must reproduce the above 12adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# copyright notice, this list of conditions and the following disclaimer 13adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# in the documentation and/or other materials provided with the 14adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# distribution. 15adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# * Neither the name of Google Inc. nor the names of its 16adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# contributors may be used to endorse or promote products derived from 17adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# this software without specific prior written permission. 18adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# 19adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org 31adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.orgimport os 32adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.orgimport platform 33adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.orgimport sys 34adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org 35adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.orgscript_dir = os.path.dirname(os.path.realpath(__file__)) 36adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.orgbreakpad_root = os.path.abspath(os.path.join(script_dir, os.pardir)) 37adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org 38adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.orgsys.path.insert(0, os.path.join(breakpad_root, 'tools', 'gyp', 'pylib')) 39adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.orgimport gyp 40adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org 41adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.orgdef run_gyp(args): 42adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org rc = gyp.main(args) 43adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org if rc != 0: 44adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org print 'Error running GYP' 45adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org sys.exit(rc) 46adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org 47adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org 48adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.orgdef main(): 49adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org args = sys.argv[1:] 50adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org args.append(os.path.join(script_dir, 'all.gyp')) 51adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org 52adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org args.append('-I') 53adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org args.append(os.path.join(breakpad_root, 'build', 'common.gypi')) 54adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org 55adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org args.extend(['-D', 'gyp_output_dir=out']) 56adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org 57adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org # Set the GYP DEPTH variable to the root of the project. 58adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org args.append('--depth=' + os.path.relpath(breakpad_root)) 59adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org 60adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org print 'Updating projects from gyp files...' 61adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org sys.stdout.flush() 62adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org 63adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org run_gyp(args) 64adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org 65adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org 66adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.orgif __name__ == '__main__': 67adfd1257d0313a2da2773a6673eba846af512a4arsesek@chromium.org sys.exit(main()) 68