Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 # This file is meant to be included into a target to provide a rule to build | |
| 6 # an executable .jar for use on a host in a consistent manner. | |
| 7 # | |
| 8 # To use this, create a gyp target with the following form: | |
| 9 # { | |
| 10 # 'target_name': 'my_jar', | |
| 11 # 'type': 'none', | |
| 12 # 'variables': { | |
| 13 # 'main_class': 'my.package.MyMainClass', | |
| 14 # 'src_paths': [ | |
| 15 # 'path/to/directory', | |
| 16 # 'path/to/other/directory', | |
| 17 # 'path/to/individual_file.java', | |
| 18 # ... | |
| 19 # ], | |
| 20 # }, | |
| 21 # 'includes': [ 'path/to/this/gypi/file' ], | |
| 22 # } | |
| 23 # | |
| 24 # Required variables: | |
| 25 # main_class - The class containing the main() function that should be | |
| 26 # called when running the .jar file. | |
| 27 # src_paths - A list of all paths containing java files that should be | |
| 28 # included in the jar. Paths can be either directories or files. | |
| 29 # Optional/automatic variables: | |
| 30 # excluded_src_paths - A list of all paths that should be excluded from | |
| 31 # the jar. | |
| 32 # generated_src_dirs - Directories containing additional .java files | |
| 33 # generated at build time. | |
| 34 # input_jars_paths - A list of paths to the jars that should be included | |
| 35 # in the classpath. | |
| 36 # jar_excluded_classes - A list of .class files that should be excluded | |
| 37 # from the jar. | |
| 38 | |
| 39 { | |
| 40 'dependencies': [ | |
| 41 '<(DEPTH)/build/android/setup.gyp:build_output_dirs', | |
| 42 ], | |
| 43 'variables': { | |
| 44 'classes_dir': '<(intermediate_dir)/classes', | |
| 45 'compile_stamp': '<(intermediate_dir)/compile.stamp', | |
| 46 'excluded_src_paths%': [], | |
| 47 'generated_src_dirs%': [], | |
| 48 'input_jars_paths%': [], | |
| 49 'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)', | |
| 50 'jar_dir': '<(PRODUCT_DIR)/lib.java', | |
| 51 'jar_excluded_classes%': [], | |
| 52 'jar_name': '<(_target_name).jar', | |
| 53 'jar_path': '<(jar_dir)/<(jar_name)', | |
| 54 'jar_stamp': '<(intermediate_dir)/jar.stamp', | |
| 55 'manifest_path': '<(intermediate_dir)/<(_target_name).manifest', | |
| 56 }, | |
| 57 'all_dependent_settings': { | |
| 58 'variables': { | |
| 59 'input_jars_paths': ['<(jar_path)'] | |
| 60 }, | |
| 61 }, | |
| 62 'actions': [ | |
| 63 { | |
| 64 'action_name': 'javac_<(_target_name)', | |
| 65 'message': 'Compiling <(_target_name) java sources', | |
| 66 'variables': { | |
| 67 'java_sources': ['<!@(find <@(src_paths) -name "*.java")'], | |
| 68 'conditions': [ | |
| 69 ['"<(excluded_src_paths)" != ""', { | |
| 70 'java_sources!': ['<!@(find <@(excluded_src_paths) -name "*.java")'] | |
|
cjhopman
2014/09/15 22:27:36
This won't allow you to exclude sources in generat
jbudorick
2014/09/16 02:50:41
Hm, I hadn't thought of people trying to exclude t
| |
| 71 }], | |
| 72 ], | |
| 73 }, | |
| 74 'inputs': [ | |
| 75 '<(DEPTH)/build/android/gyp/util/build_utils.py', | |
| 76 '<(DEPTH)/build/android/gyp/javac.py', | |
| 77 '^@(java_sources)', | |
|
cjhopman
2014/09/15 22:27:37
Does this have to be '^' because of the 'java_sour
jbudorick
2014/09/16 02:50:41
Yep. Exclusion happens between PHASE_LATE (>) and
| |
| 78 '>@(input_jars_paths)', | |
| 79 ], | |
| 80 'outputs': [ | |
| 81 '<(classes_dir)', | |
| 82 '<(compile_stamp)', | |
| 83 ], | |
| 84 'action': [ | |
| 85 'python', '<(DEPTH)/build/android/gyp/javac.py', | |
| 86 '--classes-dir=<(classes_dir)', | |
| 87 '--classpath=>(input_jars_paths)', | |
| 88 '--src-gendirs=>(generated_src_dirs)', | |
| 89 '--chromium-code=<(chromium_code)', | |
| 90 '--stamp=<(compile_stamp)', | |
| 91 '^@(java_sources)', | |
| 92 ] | |
| 93 }, | |
| 94 { | |
| 95 'action_name': 'manifest_for_<(_target_name)', | |
| 96 'message': 'Creating manifest for <(_target_name) jar', | |
| 97 'variables': { | |
| 98 'extra_options': [ | |
| 99 '--classpath=>@(input_jars_paths)', | |
| 100 ], | |
| 101 'conditions': [ | |
| 102 ['">(main_class)" != ""', { | |
| 103 'extra_options': ['--main-class=>(main_class)'] | |
| 104 }], | |
| 105 ], | |
| 106 }, | |
| 107 'inputs':[ | |
| 108 '<(compile_stamp)', | |
| 109 '>@(input_jars_paths)', | |
| 110 '<(DEPTH)/build/android/gyp/manifest.py', | |
| 111 ], | |
| 112 'outputs': [ | |
| 113 '<(manifest_path)', | |
| 114 ], | |
| 115 'action': [ | |
| 116 'python', '<(DEPTH)/build/android/gyp/manifest.py', | |
| 117 '<@(extra_options)', | |
| 118 '--output-file=<(manifest_path)', | |
| 119 ], | |
| 120 }, | |
| 121 { | |
| 122 'action_name': 'jar_<(_target_name)', | |
| 123 'message': 'Creating <(_target_name) jar', | |
| 124 'variables': { | |
| 125 'extra_options': [], | |
| 126 'conditions': [ | |
| 127 ['"<(jar_excluded_classes)" != ""', { | |
| 128 'extra_options': ['--excluded-classes=<(jar_excluded_classes)'] | |
| 129 }], | |
| 130 ], | |
| 131 }, | |
| 132 'inputs': [ | |
| 133 '<(DEPTH)/build/android/gyp/util/build_utils.py', | |
| 134 '<(DEPTH)/build/android/gyp/util/md5_check.py', | |
| 135 '<(DEPTH)/build/android/gyp/jar.py', | |
| 136 '<(compile_stamp)', | |
| 137 '<(manifest_path)', | |
| 138 '<(classes_dir)', | |
| 139 ], | |
| 140 'outputs': [ | |
| 141 '<(jar_path)', | |
| 142 '<(jar_stamp)' | |
| 143 ], | |
| 144 'action': [ | |
| 145 'python', '<(DEPTH)/build/android/gyp/jar.py', | |
| 146 '--classes-dir=<(classes_dir)', | |
| 147 '--jar-path=<(jar_path)', | |
| 148 '--manifest-file=<(manifest_path)', | |
| 149 '--stamp=<(jar_stamp)', | |
| 150 '<@(extra_options)' | |
| 151 ], | |
| 152 }, | |
| 153 ] | |
| 154 } | |
| 155 | |
| OLD | NEW |