Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
|
jbudorick
2015/04/02 14:21:43
So this is in addition to build/host_jar.gypi? Do
mikecase (-- gone --)
2015/04/02 17:11:39
You're right. It looks like most of the things usi
| |
| 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 # an executable from java code. The executable will be in the output folder's |
| 7 # /bin/ directory. | |
| 7 # | 8 # |
| 8 # To use this, create a gyp target with the following form: | 9 # To use this, create a gyp target with the following form: |
| 9 # { | 10 # { |
| 10 # 'target_name': 'my_jar', | 11 # 'target_name': 'my_executable_jar', |
| 11 # 'type': 'none', | 12 # 'type': 'none', |
| 12 # 'variables': { | 13 # 'variables': { |
| 13 # 'src_paths': [ | 14 # 'src_paths': [ |
| 14 # 'path/to/directory', | 15 # 'path/to/directory', |
| 15 # 'path/to/other/directory', | 16 # 'path/to/other/directory', |
| 16 # 'path/to/individual_file.java', | 17 # 'path/to/individual_file.java', |
| 17 # ... | 18 # ... |
| 18 # ], | 19 # ], |
| 20 # 'main_class': 'org.foo.FooMain', | |
| 19 # }, | 21 # }, |
| 20 # 'includes': [ 'path/to/this/gypi/file' ], | 22 # 'includes': [ 'path/to/this/gypi/file' ], |
| 21 # } | 23 # } |
| 22 # | 24 # |
| 23 # Required variables: | 25 # Required variables: |
| 24 # src_paths - A list of all paths containing java files that should be | 26 # src_paths - A list of all paths containing java files that should be |
| 25 # included in the jar. Paths can be either directories or files. | 27 # included in the jar. Paths can be either directories or files. |
| 28 # main_class - The class containing the main() function that should be called | |
| 29 # when running the jar file. | |
| 26 # Optional/automatic variables: | 30 # Optional/automatic variables: |
| 27 # excluded_src_paths - A list of all paths that should be excluded from | 31 # excluded_src_paths - A list of all paths that should be excluded from |
| 28 # the jar. | 32 # the jar. |
| 29 # generated_src_dirs - Directories containing additional .java files | 33 # generated_src_dirs - Directories containing additional .java files |
| 30 # generated at build time. | 34 # generated at build time. |
| 31 # input_jars_paths - A list of paths to the jars that should be included | 35 # input_jars_paths - A list of paths to the jars that should be included |
| 32 # in the classpath. | 36 # in the classpath. |
| 33 # main_class - The class containing the main() function that should be called | |
| 34 # when running the jar file. | |
| 35 # jar_excluded_classes - A list of .class files that should be excluded | 37 # jar_excluded_classes - A list of .class files that should be excluded |
| 36 # from the jar. | 38 # from the jar. |
| 37 | 39 |
| 38 { | 40 { |
| 39 'dependencies': [ | 41 'dependencies': [ |
| 40 '<(DEPTH)/build/android/setup.gyp:build_output_dirs', | 42 '<(DEPTH)/build/android/setup.gyp:build_output_dirs', |
| 41 ], | 43 ], |
| 42 'variables': { | 44 'variables': { |
| 43 'classes_dir': '<(intermediate_dir)/classes', | 45 'classes_dir': '<(intermediate_dir)/classes', |
| 44 'excluded_src_paths': [], | 46 'excluded_src_paths': [], |
| 45 'generated_src_dirs': [], | 47 'generated_src_dirs': [], |
| 46 'input_jars_paths': [], | 48 'input_jars_paths': [], |
| 47 'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)', | 49 'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)', |
| 48 'jar_dir': '<(PRODUCT_DIR)/lib.java', | 50 'jar_dir': '<(PRODUCT_DIR)/lib.java', |
| 49 'jar_excluded_classes': [], | 51 'jar_excluded_classes': [], |
| 50 'jar_name': '<(_target_name).jar', | 52 'jar_name': '<(_target_name).jar', |
| 51 'jar_path': '<(jar_dir)/<(jar_name)', | 53 'jar_path': '<(jar_dir)/<(jar_name)', |
| 52 'main_class%': '', | |
| 53 'stamp': '<(intermediate_dir)/jar.stamp', | 54 'stamp': '<(intermediate_dir)/jar.stamp', |
| 54 }, | 55 }, |
| 55 'all_dependent_settings': { | 56 'all_dependent_settings': { |
| 56 'variables': { | 57 'variables': { |
| 57 'input_jars_paths': ['<(jar_path)'] | 58 'input_jars_paths': ['<(jar_path)'] |
| 58 }, | 59 }, |
| 59 }, | 60 }, |
| 60 'actions': [ | 61 'actions': [ |
| 61 { | 62 { |
| 62 'action_name': 'javac_<(_target_name)', | 63 'action_name': 'javac_<(_target_name)', |
| 63 'message': 'Compiling <(_target_name) java sources', | 64 'message': 'Compiling <(_target_name) java sources', |
| 64 'variables': { | 65 'variables': { |
| 65 'extra_options': [], | 66 'extra_options': [], |
| 66 'java_sources': [ '<!@(find <@(src_paths) -name "*.java")' ], | 67 'java_sources': [ '<!@(find <@(src_paths) -name "*.java")' ], |
| 67 'conditions': [ | 68 'conditions': [ |
| 68 ['"<(excluded_src_paths)" != ""', { | 69 ['"<(excluded_src_paths)" != ""', { |
| 69 'java_sources!': ['<!@(find <@(excluded_src_paths) -name "*.java")'] | 70 'java_sources!': ['<!@(find <@(excluded_src_paths) -name "*.java")'] |
| 70 }], | 71 }], |
| 71 ['"<(jar_excluded_classes)" != ""', { | 72 ['"<(jar_excluded_classes)" != ""', { |
| 72 'extra_options': ['--excluded-classes=<(jar_excluded_classes)'] | 73 'extra_options': ['--excluded-classes=<(jar_excluded_classes)'] |
| 73 }], | 74 }], |
| 74 ['">(main_class)" != ""', { | |
| 75 'extra_options': ['--main-class=>(main_class)'] | |
| 76 }] | |
| 77 ], | 75 ], |
| 78 }, | 76 }, |
| 79 'inputs': [ | 77 'inputs': [ |
| 80 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 78 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 81 '<(DEPTH)/build/android/gyp/javac.py', | 79 '<(DEPTH)/build/android/gyp/javac.py', |
| 82 '^@(java_sources)', | 80 '^@(java_sources)', |
| 83 '>@(input_jars_paths)', | 81 '>@(input_jars_paths)', |
| 84 ], | 82 ], |
| 85 'outputs': [ | 83 'outputs': [ |
| 86 '<(jar_path)', | 84 '<(jar_path)', |
| 87 '<(stamp)', | 85 '<(stamp)', |
| 88 ], | 86 ], |
| 89 'action': [ | 87 'action': [ |
| 90 'python', '<(DEPTH)/build/android/gyp/javac.py', | 88 'python', '<(DEPTH)/build/android/gyp/javac.py', |
| 91 '--classpath=>(input_jars_paths)', | 89 '--classpath=>(input_jars_paths)', |
| 92 '--src-gendirs=>(generated_src_dirs)', | 90 '--src-gendirs=>(generated_src_dirs)', |
| 93 '--chromium-code=<(chromium_code)', | 91 '--chromium-code=<(chromium_code)', |
| 94 '--stamp=<(stamp)', | 92 '--stamp=<(stamp)', |
| 95 '--jar-path=<(jar_path)', | 93 '--jar-path=<(jar_path)', |
| 96 '<@(extra_options)', | 94 '<@(extra_options)', |
| 97 '^@(java_sources)', | 95 '^@(java_sources)', |
| 98 ], | 96 ], |
| 99 }, | 97 }, |
| 98 { | |
| 99 'action_name': 'create_java_binary_script_<(_target_name)', | |
| 100 'message': 'Creating java binary script <(_target_name)', | |
| 101 'variables': { | |
| 102 'output': '<(PRODUCT_DIR)/bin/<(_target_name)', | |
| 103 }, | |
| 104 'inputs': [ | |
| 105 '<(DEPTH)/build/android/gyp/create_java_binary_script.py', | |
| 106 '<(jar_path)', | |
| 107 ], | |
| 108 'outputs': [ | |
| 109 '<(output)', | |
| 110 ], | |
| 111 'action': [ | |
| 112 'python', '<(DEPTH)/build/android/gyp/create_java_binary_script.py', | |
| 113 '--classpath=>(input_jars_paths)', | |
| 114 '--jar-path=<(jar_path)', | |
| 115 '--output=<(output)', | |
| 116 '--main-class=>(main_class)', | |
| 117 ], | |
| 118 } | |
| 100 ] | 119 ] |
| 101 } | 120 } |
| 102 | |
| OLD | NEW |