Home | History | Annotate | Download | only in gn
      1 # Copyright (c) 2013 The Chromium Authors. 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 gyp_file = "gn.gyp"
      6 external = true
      7 
      8 # Not defined when doing a GYP build, this lets the code key off of GN-specific
      9 # features (the last change target). This can be removed when the last change
     10 # target is supported by the GN->GYP converter (see is_gyp conditional for that
     11 # below).
     12 if (!is_gyp) {
     13   defines = [ "GN_BUILD" ]
     14 }
     15 
     16 static_library("gn_lib") {
     17   sources = [
     18     "args.cc",
     19     "args.h",
     20     "binary_target_generator.cc",
     21     "binary_target_generator.h",
     22     "build_settings.cc",
     23     "build_settings.h",
     24     "builder.cc",
     25     "builder.h",
     26     "builder_record.cc",
     27     "builder_record.h",
     28     "command_args.cc",
     29     "command_desc.cc",
     30     "command_gen.cc",
     31     "command_gyp.cc",
     32     "command_help.cc",
     33     "command_refs.cc",
     34     "commands.cc",
     35     "commands.h",
     36     "config.cc",
     37     "config.h",
     38     "config_values.cc",
     39     "config_values.h",
     40     "config_values_extractors.cc",
     41     "config_values_extractors.h",
     42     "config_values_generator.cc",
     43     "config_values_generator.h",
     44     "copy_target_generator.cc",
     45     "copy_target_generator.h",
     46     "err.cc",
     47     "err.h",
     48     "escape.cc",
     49     "escape.h",
     50     "file_template.cc",
     51     "file_template.h",
     52     "filesystem_utils.cc",
     53     "filesystem_utils.h",
     54     "functions.cc",
     55     "functions.h",
     56     "functions_target.cc",
     57     "function_exec_script.cc",
     58     "function_process_file_template.cc",
     59     "function_read_file.cc",
     60     "function_rebase_path.cc",
     61     "function_set_default_toolchain.cc",
     62     "function_set_defaults.cc",
     63     "function_template.cc",
     64     "function_toolchain.cc",
     65     "function_write_file.cc",
     66     "group_target_generator.cc",
     67     "group_target_generator.h",
     68     "gyp_binary_target_writer.cc",
     69     "gyp_binary_target_writer.h",
     70     "gyp_helper.cc",
     71     "gyp_helper.h",
     72     "gyp_script_target_writer.cc",
     73     "gyp_script_target_writer.h",
     74     "gyp_target_writer.cc",
     75     "gyp_target_writer.h",
     76     "import_manager.cc",
     77     "import_manager.h",
     78     "input_conversion.cc",
     79     "input_conversion.h",
     80     "input_file.cc",
     81     "input_file.h",
     82     "input_file_manager.cc",
     83     "input_file_manager.h",
     84     "item.cc",
     85     "item.h",
     86     "label.cc",
     87     "label.h",
     88     "label_ptr.h",
     89     "loader.cc",
     90     "loader.h",
     91     "location.cc",
     92     "location.h",
     93     "ninja_binary_target_writer.cc",
     94     "ninja_binary_target_writer.h",
     95     "ninja_build_writer.cc",
     96     "ninja_build_writer.h",
     97     "ninja_copy_target_writer.cc",
     98     "ninja_copy_target_writer.h",
     99     "ninja_group_target_writer.cc",
    100     "ninja_group_target_writer.h",
    101     "ninja_helper.cc",
    102     "ninja_helper.h",
    103     "ninja_script_target_writer.cc",
    104     "ninja_script_target_writer.h",
    105     "ninja_target_writer.cc",
    106     "ninja_target_writer.h",
    107     "ninja_toolchain_writer.cc",
    108     "ninja_toolchain_writer.h",
    109     "ninja_writer.cc",
    110     "ninja_writer.h",
    111     "operators.cc",
    112     "operators.h",
    113     "output_file.h",
    114     "parse_tree.cc",
    115     "parse_tree.h",
    116     "parser.cc",
    117     "parser.h",
    118     "path_output.cc",
    119     "path_output.h",
    120     "pattern.cc",
    121     "pattern.h",
    122     "scheduler.cc",
    123     "scheduler.h",
    124     "scope.cc",
    125     "scope.h",
    126     "scope_per_file_provider.cc",
    127     "scope_per_file_provider.h",
    128     "script_target_generator.cc",
    129     "script_target_generator.h",
    130     "script_values.cc",
    131     "script_values.h",
    132     "settings.cc",
    133     "settings.h",
    134     "setup.cc",
    135     "setup.h",
    136     "source_dir.cc",
    137     "source_dir.h",
    138     "source_file.cc",
    139     "source_file.h",
    140     "standard_out.cc",
    141     "standard_out.h",
    142     "string_utils.cc",
    143     "string_utils.h",
    144     "target.cc",
    145     "target.h",
    146     "target_generator.cc",
    147     "target_generator.h",
    148     "token.cc",
    149     "token.h",
    150     "tokenizer.cc",
    151     "tokenizer.h",
    152     "toolchain.cc",
    153     "toolchain.h",
    154     "trace.cc",
    155     "trace.h",
    156     "value.cc",
    157     "value.h",
    158     "value_extractors.cc",
    159     "value_extractors.h",
    160     "variables.cc",
    161     "variables.h",
    162   ]
    163 
    164   deps = [
    165     "//base",
    166     "//base/third_party/dynamic_annotations",
    167   ]
    168 }
    169 
    170 executable("gn") {
    171   sources = [
    172     "gn_main.cc",
    173   ]
    174 
    175   deps = [
    176     ":gn_lib",
    177   ]
    178   if (!is_gyp) {
    179     # Currently this only works in GYP (see GN_BUILD above).
    180     deps += "//build/util:last_change"
    181   }
    182 }
    183 
    184 test("gn_unittests") {
    185   sources = [
    186     "builder_unittest.cc",
    187     "escape_unittest.cc",
    188     "file_template_unittest.cc",
    189     "filesystem_utils_unittest.cc",
    190     "function_rebase_path_unittest.cc",
    191     "gyp_script_target_writer_unittest.cc",
    192     "input_conversion_unittest.cc",
    193     "label_unittest.cc",
    194     "loader_unittest.cc",
    195     "ninja_binary_target_writer_unittest.cc",
    196     "ninja_copy_target_writer_unittest.cc",
    197     "ninja_helper_unittest.cc",
    198     "ninja_script_target_writer_unittest.cc",
    199     "parser_unittest.cc",
    200     "path_output_unittest.cc",
    201     "pattern_unittest.cc",
    202     "scope_per_file_provider_unittest.cc",
    203     "scope_unittest.cc",
    204     "source_dir_unittest.cc",
    205     "string_utils_unittest.cc",
    206     "target_generator_unittest.cc",
    207     "target_unittest.cc",
    208     "test_with_scope.cc",
    209     "test_with_scope.h",
    210     "tokenizer_unittest.cc",
    211   ]
    212   deps = [
    213     ":gn_lib",
    214     "//base:run_all_unittests",
    215     "//base:test_support_base",
    216     "//testing:gtest",
    217   ]
    218 }
    219 
    220 executable("generate_test_gn_data") {
    221   sources = [ "generate_test_gn_data.cc" ]
    222   deps = [ "//base" ]
    223 }
    224