| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 #!/usr/bin/env python | 
|  | 2 | 
|  | 3 # Copyright (c) 2013 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 msvs_external_builder being set will invoke the provided | 
|  | 9 msvs_external_builder_build_cmd and msvs_external_builder_clean_cmd, and will | 
|  | 10 not invoke MSBuild actions and rules. | 
|  | 11 """ | 
|  | 12 | 
|  | 13 import os | 
|  | 14 import TestGyp | 
|  | 15 | 
|  | 16 test = TestGyp.TestGyp(formats=['msvs'], workdir='workarea_all') | 
|  | 17 | 
|  | 18 # without the flag set | 
|  | 19 test.run_gyp('external.gyp') | 
|  | 20 test.build('external.gyp', target='external') | 
|  | 21 test.must_not_exist('external_builder.out') | 
|  | 22 test.must_exist('msbuild_rule.out') | 
|  | 23 test.must_exist('msbuild_action.out') | 
|  | 24 test.must_match('msbuild_rule.out', 'msbuild_rule.py hello.z a b c') | 
|  | 25 test.must_match('msbuild_action.out', 'msbuild_action.py x y z') | 
|  | 26 os.remove('msbuild_rule.out') | 
|  | 27 os.remove('msbuild_action.out') | 
|  | 28 | 
|  | 29 # with the flag set, using Build | 
|  | 30 try: | 
|  | 31   os.environ['GYP_DEFINES'] = 'use_external_builder=1' | 
|  | 32   test.run_gyp('external.gyp') | 
|  | 33   test.build('external.gyp', target='external') | 
|  | 34 finally: | 
|  | 35   del os.environ['GYP_DEFINES'] | 
|  | 36 test.must_not_exist('msbuild_rule.out') | 
|  | 37 test.must_not_exist('msbuild_action.out') | 
|  | 38 test.must_exist('external_builder.out') | 
|  | 39 test.must_match('external_builder.out', 'external_builder.py build 1 2 3') | 
|  | 40 os.remove('external_builder.out') | 
|  | 41 | 
|  | 42 # with the flag set, using Clean | 
|  | 43 try: | 
|  | 44   os.environ['GYP_DEFINES'] = 'use_external_builder=1' | 
|  | 45   test.run_gyp('external.gyp') | 
|  | 46   test.build('external.gyp', target='external', clean=True) | 
|  | 47 finally: | 
|  | 48   del os.environ['GYP_DEFINES'] | 
|  | 49 test.must_not_exist('msbuild_rule.out') | 
|  | 50 test.must_not_exist('msbuild_action.out') | 
|  | 51 test.must_exist('external_builder.out') | 
|  | 52 test.must_match('external_builder.out', 'external_builder.py clean 4 5') | 
|  | 53 os.remove('external_builder.out') | 
|  | 54 | 
|  | 55 test.pass_test() | 
|  | 56 | 
| OLD | NEW | 
|---|