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.
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. 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.
10 # To use this, create a gyp target with the following form:
12 # 'target_name': 'my_jar',
16 # 'path/to/directory',
17 # 'path/to/other/directory',
18 # 'path/to/individual_file.java',
22 # 'includes': [ 'path/to/this/gypi/file' ],
26 # src_paths - A list of all paths containing java files that should be
27 # included in the jar. Paths can be either directories or files.
28 # Optional/automatic variables:
29 # excluded_src_paths - A list of all paths that should be excluded from
31 # generated_src_dirs - Directories containing additional .java files
32 # generated at build time.
33 # input_jars_paths - A list of paths to the jars that should be included
35 # main_class - The class containing the main() function that should be called
36 # when running the jar file.
37 # jar_excluded_classes - A list of .class files that should be excluded
42 '<(DEPTH)/build/android/setup.gyp:build_output_dirs',
45 'classes_dir': '<(intermediate_dir)/classes',
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)',
55 'stamp': '<(intermediate_dir)/jar.stamp',
57 'all_dependent_settings': {
59 'input_jars_paths': ['<(jar_path)']
64 'action_name': 'javac_<(_target_name)',
65 'message': 'Compiling <(_target_name) java sources',
68 'java_sources': [ '<!@(find <@(src_paths) -name "*.java")' ],
70 ['"<(excluded_src_paths)" != ""', {
71 'java_sources!': ['<!@(find <@(excluded_src_paths) -name "*.java")']
73 ['"<(jar_excluded_classes)" != ""', {
74 'extra_options': ['--jar-excluded-classes=<(jar_excluded_classes)']
76 ['main_class != ""', {
77 'extra_options': ['--main-class=>(main_class)']
82 '<(DEPTH)/build/android/gyp/util/build_utils.py',
83 '<(DEPTH)/build/android/gyp/javac.py',
85 '>@(input_jars_paths)',
92 'python', '<(DEPTH)/build/android/gyp/javac.py',
93 '--classpath=>(input_jars_paths)',
94 '--src-gendirs=>(generated_src_dirs)',
95 '--chromium-code=<(chromium_code)',
97 '--jar-path=<(jar_path)',
104 ['main_class != ""', {
107 'action_name': 'create_java_binary_script_<(_target_name)',
108 'message': 'Creating java binary script <(_target_name)',
110 'output': '<(PRODUCT_DIR)/bin/<(_target_name)',
113 '<(DEPTH)/build/android/gyp/create_java_binary_script.py',
120 'python', '<(DEPTH)/build/android/gyp/create_java_binary_script.py',
121 '--classpath=>(input_jars_paths)',
122 '--jar-path=<(jar_path)',
123 '--output=<(output)',
124 '--main-class=>(main_class)',