Home | History | Annotate | Download | only in xcode-env-order
      1 # Copyright (c) 2012 Google Inc. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 {
      5   'targets': [
      6     {
      7       'target_name': 'test_app',
      8       'product_name': 'Test',
      9       'type': 'executable',
     10       'mac_bundle': 1,
     11       'sources': [
     12         'main.c',
     13         'file.ext1',
     14         'file.ext2',
     15         'file.ext3',
     16       ],
     17       # Env vars in copies.
     18       'copies': [
     19         {
     20           'destination': '<(PRODUCT_DIR)/${PRODUCT_NAME}-copy-brace',
     21           'files': [ 'main.c', ],  # ${SOURCE_ROOT} doesn't work with xcode
     22         },
     23         {
     24           'destination': '<(PRODUCT_DIR)/$(PRODUCT_NAME)-copy-paren',
     25           'files': [ '$(SOURCE_ROOT)/main.c', ],
     26         },
     27         {
     28           'destination': '<(PRODUCT_DIR)/$PRODUCT_NAME-copy-bare',
     29           'files': [ 'main.c', ],  # $SOURCE_ROOT doesn't work with xcode
     30         },
     31       ],
     32       # Env vars in actions. The $FOO's are here to test that env vars that
     33       # aren't defined are handled in some way that doesn't break the build.
     34       'actions': [
     35         {
     36           'action_name': 'Action copy braces ${PRODUCT_NAME} ${FOO}',
     37           'description': 'Action copy braces ${PRODUCT_NAME} ${FOO}',
     38           'inputs': [ '${SOURCE_ROOT}/main.c' ],
     39           # Referencing ${PRODUCT_NAME} in action outputs doesn't work with
     40           # the Xcode generator (PRODUCT_NAME expands to "Test Support").
     41           'outputs': [ '<(PRODUCT_DIR)/action-copy-brace.txt' ],
     42           'action': [ 'cp', '${SOURCE_ROOT}/main.c',
     43                       '<(PRODUCT_DIR)/action-copy-brace.txt' ],
     44         },
     45         {
     46           'action_name': 'Action copy parens $(PRODUCT_NAME) $(FOO)',
     47           'description': 'Action copy parens $(PRODUCT_NAME) $(FOO)',
     48           'inputs': [ '$(SOURCE_ROOT)/main.c' ],
     49           # Referencing $(PRODUCT_NAME) in action outputs doesn't work with
     50           # the Xcode generator (PRODUCT_NAME expands to "Test Support").
     51           'outputs': [ '<(PRODUCT_DIR)/action-copy-paren.txt' ],
     52           'action': [ 'cp', '$(SOURCE_ROOT)/main.c',
     53                       '<(PRODUCT_DIR)/action-copy-paren.txt' ],
     54         },
     55         {
     56           'action_name': 'Action copy bare $PRODUCT_NAME $FOO',
     57           'description': 'Action copy bare $PRODUCT_NAME $FOO',
     58           'inputs': [ '$SOURCE_ROOT/main.c' ],
     59           # Referencing $PRODUCT_NAME in action outputs doesn't work with
     60           # the Xcode generator (PRODUCT_NAME expands to "Test Support").
     61           'outputs': [ '<(PRODUCT_DIR)/action-copy-bare.txt' ],
     62           'action': [ 'cp', '$SOURCE_ROOT/main.c',
     63                       '<(PRODUCT_DIR)/action-copy-bare.txt' ],
     64         },
     65       ],
     66       # Env vars in xcode_settings.
     67       'xcode_settings': {
     68         'INFOPLIST_FILE': 'Info.plist',
     69         'STRING_KEY': '/Source/Project',
     70 
     71         'BRACE_DEPENDENT_KEY2': '${STRING_KEY}/${PRODUCT_NAME}',
     72         'BRACE_DEPENDENT_KEY1': 'D:${BRACE_DEPENDENT_KEY2}',
     73         'BRACE_DEPENDENT_KEY3': '${PRODUCT_TYPE}:${BRACE_DEPENDENT_KEY1}',
     74 
     75         'PAREN_DEPENDENT_KEY2': '$(STRING_KEY)/$(PRODUCT_NAME)',
     76         'PAREN_DEPENDENT_KEY1': 'D:$(PAREN_DEPENDENT_KEY2)',
     77         'PAREN_DEPENDENT_KEY3': '$(PRODUCT_TYPE):$(PAREN_DEPENDENT_KEY1)',
     78 
     79         'BARE_DEPENDENT_KEY2': '$STRING_KEY/$PRODUCT_NAME',
     80         'BARE_DEPENDENT_KEY1': 'D:$BARE_DEPENDENT_KEY2',
     81         'BARE_DEPENDENT_KEY3': '$PRODUCT_TYPE:$BARE_DEPENDENT_KEY1',
     82 
     83         'MIXED_DEPENDENT_KEY': '${STRING_KEY}:$(PRODUCT_NAME):$MACH_O_TYPE',
     84       },
     85       # Env vars in rules. The $FOO's are here to test that env vars that
     86       # aren't defined are handled in some way that doesn't break the build.
     87       'rules': [
     88         {
     89           'rule_name': 'brace_rule',
     90           'message': 'Rule braces ${PRODUCT_NAME} ${FOO} <(RULE_INPUT_NAME)',
     91           'extension': 'ext1',
     92           'inputs': [ '${SOURCE_ROOT}/main.c' ],
     93           'outputs': [ '<(PRODUCT_DIR)/rule-copy-brace.txt' ],
     94           'action': [ 'cp', '${SOURCE_ROOT}/main.c',
     95                       '<(PRODUCT_DIR)/rule-copy-brace.txt' ],
     96         },
     97         {
     98           'rule_name': 'paren_rule',
     99           'message': 'Rule parens $(PRODUCT_NAME) $(FOO) <(RULE_INPUT_NAME)',
    100           'extension': 'ext2',
    101           'inputs': [ '$(SOURCE_ROOT)/main.c' ],
    102           'outputs': [ '<(PRODUCT_DIR)/rule-copy-paren.txt' ],
    103           'action': [ 'cp', '$(SOURCE_ROOT)/main.c',
    104                       '<(PRODUCT_DIR)/rule-copy-paren.txt' ],
    105         },
    106         # TODO: Fails in xcode. Looks like a bug in the xcode generator though
    107         #       (which uses makefiles for rules, and thinks $PRODUCT_NAME is
    108         #       $(P)RODUCT_NAME).
    109         #{
    110         #  'rule_name': 'bare_rule',
    111         #  'message': 'Rule copy bare $PRODUCT_NAME $FOO',
    112         #  'extension': 'ext3',
    113         #  'inputs': [ '$SOURCE_ROOT/main.c' ],
    114         #  'outputs': [ '<(PRODUCT_DIR)/rule-copy-bare.txt' ],
    115         #  'action': [ 'cp', '$SOURCE_ROOT/main.c',
    116         #              '<(PRODUCT_DIR)/rule-copy-bare.txt' ],
    117         #},
    118       ],
    119     },
    120   ],
    121 }
    122