blob: d832b0a0738d1d67e1004a3dbadf4a81ca91b29b [file] [log] [blame]
brians343bc112013-02-10 01:53:46 +00001# Include this file in any target that is going to build java files.
2#
3# To use, create a target of the following form:
4# {
5# 'target_name': 'whatever',
6# 'variables': {
7# 'srcdirs': ['.', 'java'],
8# },
9# 'includes': ['path/to/java.gypi'],
10# }
11# See below for more variables.
12# To make any output jars include some loadable modules, set the 'jni_libs'
13# variable in 'direct_dependent_settings'. Making this easier causes lots of
14# recursion issues in gyp.
15# The dependency on these targets also has to be added manually.
16{
17 'type': 'none',
18 'variables': {
19# The manifest file for creating the jar.
20 'manifest%': '/dev/null',
21# Additional jars/directories to add to the classpath when compiling.
22# This target will automatically add itself to this list for any dependents.
23 'classpath': [],
24# Classes to generate JNI headers for.
25# They will be able to be #included as "jni/package_ClassName.h" by targets
26# that depend on this one.
27 'gen_headers': [],
28# Like 'srcdirs', except not required to exist at gyp time. However, nothing
29# here will depend on any files in these directories.
30 'gen_srcdirs': ['/dev/null'],
31# Like 'gen_srcdirs', except all folders that are children of this folder will
32# be used instead.
33 'gen_srcdir_parents%': [],
34 'srcdirs': ['/dev/null'],
35 'jar_dir': '<(PRODUCT_DIR)/jars',
36 'java_files': '<!(find <(srcdirs) -name *.java)',
37 'create_jar': '<(AOS)/build/create_jar',
38 'out_jar': '<(jar_dir)/<(_target_name).jar',
39 'header_dir': '<(SHARED_INTERMEDIATE_DIR)/jni_headers_<!(pwd | sed s:/:_:g)_<(_target_name)',
40 'no_rsync': 1,
41 },
42 'direct_dependent_settings': {
43 'variables': {
44 'classpath': ['<(out_jar)'],
45 },
46 'include_dirs': [
47 '<(header_dir)',
48 ],
49 },
50 'actions': [
51 {
52 'action_name': 'run javac',
53 'message': 'Compiling java code',
54 'inputs': [
55 '<(create_jar)',
56 '<@(java_files)',
57 '>@(classpath)',
58 '>@(gen_srcdirs)',
59 '>(manifest)',
60 ],
61 'outputs': [
62 '<(out_jar)',
63 ],
64 'action': [
65 '<(create_jar)',
66 '<(srcdirs) <(gen_srcdirs)',
67 '<(INTERMEDIATE_DIR)', '>(classpath)',
68 '>(gen_srcdir_parents)',
69 '>(manifest)', '<(out_jar)',
70 '<(header_dir)/jni', '>(gen_headers)',
71 ],
72 },
73 ],
74}