1#!/usr/bin/env python 2 3# Copyright (c) 2011 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""" 8Verify that a link time only dependency will get pulled into the set of built 9targets, even if no executable uses it. 10""" 11 12import TestGyp 13 14import sys 15 16test = TestGyp.TestGyp() 17 18test.run_gyp('lib_only.gyp') 19 20test.build('lib_only.gyp', test.ALL) 21 22test.built_file_must_exist('a', type=test.STATIC_LIB) 23 24# TODO(bradnelson/mark): 25# On linux and windows a library target will at least pull its link dependencies 26# into the generated project, since not doing so confuses users. 27# This is not currently implemented on mac, which has the opposite behavior. 28if sys.platform == 'darwin': 29 if test.format == 'xcode': 30 test.built_file_must_not_exist('b', type=test.STATIC_LIB) 31 else: 32 assert test.format in ('make', 'ninja') 33 test.built_file_must_exist('b', type=test.STATIC_LIB) 34else: 35 # Make puts the resulting library in a directory matching the input gyp file; 36 # for the 'b' library, that is in the 'b' subdirectory. 37 test.built_file_must_exist('b', type=test.STATIC_LIB, subdir='b') 38 39test.pass_test() 40