diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-12 21:56:41 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-12 21:56:41 +0000 |
commit | 120d8a7558b8d44348ece290437e2b235c72e054 (patch) | |
tree | 9405517f0d1d447535eb86eb65ccb71f6a27af65 /build/java_apk.gypi | |
parent | 3773fa4347e09b56c344a08d36f0bf9807a20249 (diff) | |
download | chromium_src-120d8a7558b8d44348ece290437e2b235c72e054.zip chromium_src-120d8a7558b8d44348ece290437e2b235c72e054.tar.gz chromium_src-120d8a7558b8d44348ece290437e2b235c72e054.tar.bz2 |
android: Pass (non-generated) .java files via a gyp filelist to javac.py
Before this CL, the javac action rules called `find javadir -name "*.java"` to
compute the action's inputs, and passed javadir to javac.py. The script then
again looked for all .java files in that directory. One issue with that approach
is that if a java file gets removed, the javac.py action didn't get executed again
since actions are only run if their commandline changes or an input file is newer
than an output file – a disappearing input doesn't mark an action dirty. (As
workaround, the md5 hash of all .java files is currently passed in an
--ignore parameter, so removal of a java file will lead to a changing
commandline, which _will_ cause a rebuild.)
After this CL, the result of `find javadir -name "*.java"` is written to a gyp
filelist (see https://codereview.chromium.org/27418008/), and the filelist
is passed to javac.py. gyp writes filelists exactly if their contents would
change, so removal of java file will change the mtime of the filelist, which will
cause a rebuild. Another advantage is that the list of java files is computed in
only one place.
This CL doesn't yet remove the md5 hack, but it makes it possible to do so
in a follow-up change.
(This approach doesn't work for generated java files, because these might
not yet exist at gyp time. Rename --src-dirs to --src-gendirs and keep it in
use for generated files. The dependency handling of generated java files is
done through stamp files, so the md5 hack isn't needed for them.)
No intended behavior change.
BUG=177552
R=cjhopman@chromium.org
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=256097
Review URL: https://codereview.chromium.org/193693002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256667 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/java_apk.gypi')
-rw-r--r-- | build/java_apk.gypi | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/build/java_apk.gypi b/build/java_apk.gypi index f9387cd2..0431f9d 100644 --- a/build/java_apk.gypi +++ b/build/java_apk.gypi @@ -513,19 +513,27 @@ 'action_name': 'javac_<(_target_name)', 'message': 'Compiling java for <(_target_name)', 'variables': { - 'all_src_dirs': [ - '<(java_in_dir)/src', + 'gen_src_dirs': [ '<(intermediate_dir)/gen', - '>@(additional_src_dirs)', '>@(generated_src_dirs)', ], + # If there is a separate find for additional_src_dirs, it will find the + # wrong .java files when additional_src_dirs is empty. + # TODO(thakis): Gyp caches >! evaluation by command. Both java.gypi and + # java_apk.gypi evaluate the same command, and at the moment two targets + # set java_in_dir to "java". Add a dummy comment here to make sure + # that the two targets (one uses java.gypi, the other java_apk.gypi) + # get distinct source lists. Medium-term, make targets list all their + # Java files instead of using find. (As is, this will be broken if two + # targets use the same java_in_dir and both use java_apk.gypi or + # both use java.gypi.) + 'java_source_list': '>|(javasources.<(_target_name).gypcmd >!@(find >(java_in_dir)/src >(additional_src_dirs) -name "*.java" # apk))', + }, 'inputs': [ '<(DEPTH)/build/android/gyp/util/build_utils.py', '<(DEPTH)/build/android/gyp/javac.py', - # If there is a separate find for additional_src_dirs, it will find the - # wrong .java files when additional_src_dirs is empty. - '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")', + '>(java_source_list)', '>@(input_jars_paths)', '<(codegen_stamp)', '>@(compile_input_paths)', @@ -537,7 +545,8 @@ 'python', '<(DEPTH)/build/android/gyp/javac.py', '--output-dir=<(classes_dir)', '--classpath=>(input_jars_paths) <(android_sdk_jar)', - '--src-dirs=>(all_src_dirs)', + '--src-filelist=>(java_source_list)', + '--src-gendirs=>(gen_src_dirs)', '--javac-includes=<(javac_includes)', '--chromium-code=<(chromium_code)', '--stamp=<(compile_stamp)', |