| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 # This file is meant to be included into a target to provide a rule | 5 # This file is meant to be included into a target to provide a rule |
| 6 # to generate Java source files from templates that are processed | 6 # to generate Java source files from templates that are processed |
| 7 # through the host C pre-processor. | 7 # through the host C pre-processor. |
| 8 # | 8 # |
| 9 # This assumes a GNU-compatible pre-processor installed as 'cpp'. | |
| 10 # Only tested on Linux. | |
| 11 # | |
| 12 # To use this, create a gyp target with the following form: | 9 # To use this, create a gyp target with the following form: |
| 13 # { | 10 # { |
| 14 # 'target_name': 'android_net_java_constants', | 11 # 'target_name': 'android_net_java_constants', |
| 15 # 'type': 'none', | 12 # 'type': 'none', |
| 16 # 'sources': [ | 13 # 'sources': [ |
| 17 # 'net/android/NetError.template', | 14 # 'net/android/NetError.template', |
| 18 # ], | 15 # ], |
| 19 # 'variables': { | 16 # 'variables': { |
| 20 # 'package_name': 'org/chromium/net', | 17 # 'package_name': 'org/chromium/net', |
| 21 # 'template_deps': ['net/base/certificate_mime_type_list.h'], | 18 # 'template_deps': ['net/base/certificate_mime_type_list.h'], |
| (...skipping 28 matching lines...) Expand all Loading... |
| 50 'rules': [ | 47 'rules': [ |
| 51 { | 48 { |
| 52 'rule_name': 'generate_java_constants', | 49 'rule_name': 'generate_java_constants', |
| 53 'extension': 'template', | 50 'extension': 'template', |
| 54 # Set template_deps as additional dependencies. | 51 # Set template_deps as additional dependencies. |
| 55 'inputs': ['<@(template_deps)'], | 52 'inputs': ['<@(template_deps)'], |
| 56 'outputs': [ | 53 'outputs': [ |
| 57 '<(output_dir)/<(RULE_INPUT_ROOT).java' | 54 '<(output_dir)/<(RULE_INPUT_ROOT).java' |
| 58 ], | 55 ], |
| 59 'action': [ | 56 'action': [ |
| 60 'cpp', # invoke host pre-processor. | 57 'gcc', # invoke host gcc. |
| 58 '-E', # stop after preprocessing. |
| 61 '-x', 'c-header', # treat sources as C header files | 59 '-x', 'c-header', # treat sources as C header files |
| 62 '-P', # disable line markers, i.e. '#line 309' | 60 '-P', # disable line markers, i.e. '#line 309' |
| 63 '-I', '<(DEPTH)', # Add project top-level to include path | 61 '-I', '<(DEPTH)', # Add project top-level to include path |
| 64 '-o', '<@(_outputs)', # Specify output file | 62 '-o', '<@(_outputs)', # Specify output file |
| 65 '<(RULE_INPUT_PATH)', # Specify input file | 63 '<(RULE_INPUT_PATH)', # Specify input file |
| 66 ], | 64 ], |
| 67 'message': 'Generating Java from cpp template <(RULE_INPUT_PATH)', | 65 'message': 'Generating Java from cpp template <(RULE_INPUT_PATH)', |
| 68 } | 66 } |
| 69 ], | 67 ], |
| 70 } | 68 } |
| OLD | NEW |