diff --git a/android/gradle/generate_gradle.py b/android/gradle/generate_gradle.py index ba2311ae5..e7bf827f9 100755 --- a/android/gradle/generate_gradle.py +++ b/android/gradle/generate_gradle.py @@ -211,7 +211,7 @@ class _ProjectEntry(object): def JavaFiles(self): if self._java_files is None: - java_sources_file = self.DepsInfo().get('java_sources_file') + java_sources_file = self.Gradle().get('java_sources_file') java_files = [] if java_sources_file: java_sources_file = _RebasePath(java_sources_file) diff --git a/android/gyp/write_build_config.py b/android/gyp/write_build_config.py index 6eab4b27b..c0851768b 100755 --- a/android/gyp/write_build_config.py +++ b/android/gyp/write_build_config.py @@ -413,7 +413,7 @@ def main(argv): gradle['android_manifest'] = options.android_manifest if options.type in ('java_binary', 'java_library', 'android_apk'): if options.java_sources_file: - deps_info['java_sources_file'] = options.java_sources_file + gradle['java_sources_file'] = options.java_sources_file if options.bundled_srcjars: gradle['bundled_srcjars'] = ( build_utils.ParseGnList(options.bundled_srcjars)) @@ -436,14 +436,6 @@ def main(argv): gradle['dependent_java_projects'].append(c['path']) - if options.type == 'android_apk': - config['jni'] = {} - all_java_sources = [c['java_sources_file'] for c in all_library_deps - if 'java_sources_file' in c] - if options.java_sources_file: - all_java_sources.append(options.java_sources_file) - config['jni']['all_source'] = all_java_sources - if (options.type in ('java_binary', 'java_library')): deps_info['requires_android'] = options.requires_android deps_info['supports_android'] = options.supports_android diff --git a/config/android/rules.gni b/config/android/rules.gni index ceffd063a..38032b768 100644 --- a/config/android/rules.gni +++ b/config/android/rules.gni @@ -192,6 +192,7 @@ if (enable_java_templates) { "--depfile", rebase_path(depfile, root_build_dir), "--input_file={{source}}", + "--optimize_generation=1", "--ptr_type=long", "--output_dir", rebase_path(jni_output_dir, root_build_dir), @@ -301,6 +302,7 @@ if (enable_java_templates) { rebase_path(jar_file, root_build_dir), "--input_file", class, + "--optimize_generation=1", "--ptr_type=long", "--output_dir", rebase_path(jni_output_dir, root_build_dir), @@ -332,61 +334,6 @@ if (enable_java_templates) { } } - # Declare a jni registration target. - # - # This target generates a header file calling JNI registration functions - # created by generate_jni and generate_jar_jni. - # - # See base/android/jni_generator/jni_registration_generator.py for more info - # about the format of the header file. - # - # Variables - # target: The Apk target to generate registrations for. - # output: Path to the generated .h file. - # exception_files: List of .java files that should be ignored when searching - # for native methods. (optional) - # - # Example - # generate_jni_registration("chrome_jni_registration") { - # target = ":chrome_public_apk" - # output = "$root_gen_dir/chrome/browser/android/${target_name}.h" - # exception_files = [ - # "//base/android/java/src/org/chromium/base/library_loader/LegacyLinker.java", - # "//base/android/java/src/org/chromium/base/library_loader/Linker.java", - # "//base/android/java/src/org/chromium/base/library_loader/ModernLinker.java", - # ] - # } - template("generate_jni_registration") { - action(target_name) { - forward_variables_from(invoker, [ "testonly" ]) - _build_config = get_label_info(invoker.target, "target_gen_dir") + "/" + - get_label_info(invoker.target, "name") + ".build_config" - _rebased_build_config = rebase_path(_build_config, root_build_dir) - - _rebase_exception_java_files = - rebase_path(invoker.exception_files, root_build_dir) - - script = "//base/android/jni_generator/jni_registration_generator.py" - deps = [ - "${invoker.target}__build_config", - ] - inputs = [ - _build_config, - ] - outputs = [ - invoker.output, - ] - - args = [ - # This is a list of .sources files. - "--sources_files=@FileArg($_rebased_build_config:jni:all_source)", - "--output", - rebase_path(invoker.output, root_build_dir), - "--no_register_java=$_rebase_exception_java_files", - ] - } - } - # Declare a target for c-preprocessor-generated java files # # NOTE: For generating Java conterparts to enums prefer using the java_cpp_enum