Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 to build | 5 # This file is meant to be included into a target to provide a rule to build |
| 6 # a JAR file for use on a host in a consistent manner. | 6 # a JAR file for use on a host in a consistent manner. If a main class is |
| 7 # specified, this file will also generate an executable to run the jar in the | |
| 8 # output folder's /bin/ directory. | |
| 7 # | 9 # |
| 8 # To use this, create a gyp target with the following form: | 10 # To use this, create a gyp target with the following form: |
| 9 # { | 11 # { |
| 10 # 'target_name': 'my_jar', | 12 # 'target_name': 'my_jar', |
| 11 # 'type': 'none', | 13 # 'type': 'none', |
| 12 # 'variables': { | 14 # 'variables': { |
| 13 # 'src_paths': [ | 15 # 'src_paths': [ |
| 14 # 'path/to/directory', | 16 # 'path/to/directory', |
| 15 # 'path/to/other/directory', | 17 # 'path/to/other/directory', |
| 16 # 'path/to/individual_file.java', | 18 # 'path/to/individual_file.java', |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 'input_jars_paths': ['<(jar_path)'] | 59 'input_jars_paths': ['<(jar_path)'] |
| 58 }, | 60 }, |
| 59 }, | 61 }, |
| 60 'actions': [ | 62 'actions': [ |
| 61 { | 63 { |
| 62 'action_name': 'javac_<(_target_name)', | 64 'action_name': 'javac_<(_target_name)', |
| 63 'message': 'Compiling <(_target_name) java sources', | 65 'message': 'Compiling <(_target_name) java sources', |
| 64 'variables': { | 66 'variables': { |
| 65 'extra_options': [], | 67 'extra_options': [], |
| 66 'java_sources': [ '<!@(find <@(src_paths) -name "*.java")' ], | 68 'java_sources': [ '<!@(find <@(src_paths) -name "*.java")' ], |
| 69 'java_sources!': ['<!@(find <@(excluded_src_paths) -name "*.java")'], | |
|
cjhopman
2015/04/06 18:56:32
if excluded_src_paths is empty, this will do the w
mikecase (-- gone --)
2015/04/06 21:03:39
Done, but I kept 2 changes I made to the condition
| |
| 67 'conditions': [ | 70 'conditions': [ |
| 68 ['"<(excluded_src_paths)" != ""', { | 71 ['main_class != ""', { |
| 69 'java_sources!': ['<!@(find <@(excluded_src_paths) -name "*.java")'] | |
| 70 }], | |
| 71 ['"<(jar_excluded_classes)" != ""', { | |
| 72 'extra_options': ['--excluded-classes=<(jar_excluded_classes)'] | |
| 73 }], | |
| 74 ['">(main_class)" != ""', { | |
| 75 'extra_options': ['--main-class=>(main_class)'] | 72 'extra_options': ['--main-class=>(main_class)'] |
| 76 }] | 73 }] |
| 77 ], | 74 ], |
| 78 }, | 75 }, |
| 79 'inputs': [ | 76 'inputs': [ |
| 80 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 77 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 81 '<(DEPTH)/build/android/gyp/javac.py', | 78 '<(DEPTH)/build/android/gyp/javac.py', |
| 82 '^@(java_sources)', | 79 '^@(java_sources)', |
| 83 '>@(input_jars_paths)', | 80 '>@(input_jars_paths)', |
| 84 ], | 81 ], |
| 85 'outputs': [ | 82 'outputs': [ |
| 86 '<(jar_path)', | 83 '<(jar_path)', |
| 87 '<(stamp)', | 84 '<(stamp)', |
| 88 ], | 85 ], |
| 89 'action': [ | 86 'action': [ |
| 90 'python', '<(DEPTH)/build/android/gyp/javac.py', | 87 'python', '<(DEPTH)/build/android/gyp/javac.py', |
| 91 '--classpath=>(input_jars_paths)', | 88 '--classpath=>(input_jars_paths)', |
| 92 '--src-gendirs=>(generated_src_dirs)', | 89 '--src-gendirs=>(generated_src_dirs)', |
| 93 '--chromium-code=<(chromium_code)', | 90 '--chromium-code=<(chromium_code)', |
| 94 '--stamp=<(stamp)', | 91 '--stamp=<(stamp)', |
| 95 '--jar-path=<(jar_path)', | 92 '--jar-path=<(jar_path)', |
| 93 '--jar-excluded-classes=<(jar_excluded_classes)', | |
| 96 '<@(extra_options)', | 94 '<@(extra_options)', |
| 97 '^@(java_sources)', | 95 '^@(java_sources)', |
| 98 ], | 96 ], |
| 99 }, | 97 }, |
| 98 ], | |
| 99 'conditions': [ | |
| 100 ['main_class != ""', { | |
| 101 'actions': [ | |
| 102 { | |
| 103 'action_name': 'create_java_binary_script_<(_target_name)', | |
| 104 'message': 'Creating java binary script <(_target_name)', | |
| 105 'variables': { | |
| 106 'output': '<(PRODUCT_DIR)/bin/<(_target_name)', | |
| 107 }, | |
| 108 'inputs': [ | |
| 109 '<(DEPTH)/build/android/gyp/create_java_binary_script.py', | |
| 110 '<(jar_path)', | |
| 111 ], | |
| 112 'outputs': [ | |
| 113 '<(output)', | |
| 114 ], | |
| 115 'action': [ | |
| 116 'python', '<(DEPTH)/build/android/gyp/create_java_binary_script.py', | |
| 117 '--classpath=>(input_jars_paths)', | |
| 118 '--jar-path=<(jar_path)', | |
| 119 '--output=<(output)', | |
| 120 '--main-class=>(main_class)', | |
| 121 ], | |
| 122 } | |
| 123 ] | |
| 124 }] | |
| 100 ] | 125 ] |
| 101 } | 126 } |
| 102 | 127 |
| OLD | NEW |