Home | History | Annotate | Download | only in mac
      1 #!/usr/bin/env python
      2 
      3 # Copyright (c) 2012 Google Inc. All rights reserved.
      4 # Use of this source code is governed by a BSD-style license that can be
      5 # found in the LICENSE file.
      6 
      7 """
      8 Verifies that app bundles are rebuilt correctly.
      9 """
     10 
     11 import TestGyp
     12 
     13 import sys
     14 
     15 if sys.platform == 'darwin':
     16   test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'])
     17 
     18   CHDIR = 'rebuild'
     19   test.run_gyp('test.gyp', chdir=CHDIR)
     20 
     21   test.build('test.gyp', 'test_app', chdir=CHDIR)
     22 
     23   # Touch a source file, rebuild, and check that the app target is up-to-date.
     24   test.touch('rebuild/main.c')
     25   test.build('test.gyp', 'test_app', chdir=CHDIR)
     26 
     27   test.up_to_date('test.gyp', 'test_app', chdir=CHDIR)
     28 
     29   # Xcode runs postbuilds on every build, so targets with postbuilds are
     30   # never marked as up_to_date.
     31   if test.format != 'xcode':
     32     # Same for a framework bundle.
     33     test.build('test.gyp', 'test_framework_postbuilds', chdir=CHDIR)
     34     test.up_to_date('test.gyp', 'test_framework_postbuilds', chdir=CHDIR)
     35 
     36     # Test that an app bundle with a postbuild that touches the app binary needs
     37     # to be built only once.
     38     test.build('test.gyp', 'test_app_postbuilds', chdir=CHDIR)
     39     test.up_to_date('test.gyp', 'test_app_postbuilds', chdir=CHDIR)
     40 
     41   test.pass_test()
     42