gyp_packager should repsect output_dir

- Check if 'output_dir=' is already defined in GYP_GENERATOR_FLAGS
  before appending the one generated in the script.
- Reusing out/ with different GYP_DEFINES causes everything to rebuild.
- This change allows the user to use different directories for different
  GYP_DEFINES; it can make sanity checking faster for different
  GYP_DEFINES.

Change-Id: Iffa6880381dabdd80a3aa7777a1d20cc3900f3e3
This commit is contained in:
Rintaro Kuroiwa 2016-01-14 15:40:46 -08:00
parent 5ad076d92c
commit 175606c88d
2 changed files with 9 additions and 7 deletions

2
.gitignore vendored
View File

@ -5,7 +5,7 @@
.pydevproject
.repo
.settings
/out/
/out*
/packager/base/
/packager/build/
/packager/buildtools/

View File

@ -91,12 +91,14 @@ if __name__ == '__main__':
if ['--depth' in arg for arg in args].count(True) == 0:
args.append('--depth=packager')
output_dir = os.path.join(checkout_dir, 'out')
gyp_generator_flags = 'output_dir="' + output_dir + '"'
if os.environ.get('GYP_GENERATOR_FLAGS'):
os.environ['GYP_GENERATOR_FLAGS'] += ' ' + gyp_generator_flags
else:
os.environ['GYP_GENERATOR_FLAGS'] = gyp_generator_flags
if (not os.environ.get('GYP_GENERATOR_FLAGS') or
('output_dir=' not in os.environ.get('GYP_GENERATOR_FLAGS'))):
output_dir = os.path.join(checkout_dir, 'out')
gyp_generator_flags = 'output_dir="' + output_dir + '"'
if os.environ.get('GYP_GENERATOR_FLAGS'):
os.environ['GYP_GENERATOR_FLAGS'] += ' ' + gyp_generator_flags
else:
os.environ['GYP_GENERATOR_FLAGS'] = gyp_generator_flags
print 'Updating projects from gyp files...'
sys.stdout.flush()