| # Copyright 2018 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/config/android/rules.gni") |
| import("//build/config/zip.gni") |
| import("//build/util/process_version.gni") |
| import("//chrome/android/channel.gni") |
| |
| # Depend on this on the Java side to get org.components.version_info.Channel and |
| # org.components.version_info.VersionConstants. |
| android_library("version_constants_java") { |
| java_files = [ |
| "java/src/org/chromium/components/version_info/VersionConstantsBridge.java", |
| ] |
| deps = [ |
| "//base:base_java", |
| ] |
| srcjar_deps = [ |
| ":channel_enum_srcjar", |
| ":version_constants_srcjar", |
| ] |
| } |
| |
| # Depend on this on the native side to get version_info::GetChannel. It requires |
| # version_constants_java for its JNI call. |
| static_library("channel_getter") { |
| sources = [ |
| "channel_getter.cc", |
| "channel_getter.h", |
| ] |
| deps = [ |
| ":version_constants_bridge_jni", |
| "..:channel", |
| ] |
| } |
| |
| java_cpp_enum("channel_enum_srcjar") { |
| sources = [ |
| "../channel.h", |
| ] |
| } |
| |
| version_constants_java_file = "$target_gen_dir/java/org/chromium/components/version_info/VersionConstants.java" |
| zip("version_constants_srcjar") { |
| inputs = [ |
| version_constants_java_file, |
| ] |
| output = "$target_gen_dir/$target_name.srcjar" |
| base_dir = "$target_gen_dir/java" |
| deps = [ |
| ":generate_version_constants_java", |
| ] |
| } |
| |
| process_version("generate_version_constants_java") { |
| template_file = "java/VersionConstants.java.version" |
| output = version_constants_java_file |
| sources = [ |
| "//chrome/VERSION", |
| ] |
| extra_args = [ |
| "-e", |
| "CHANNEL=str.upper('$android_channel')", |
| ] |
| } |
| |
| generate_jni("version_constants_bridge_jni") { |
| sources = [ |
| "java/src/org/chromium/components/version_info/VersionConstantsBridge.java", |
| ] |
| jni_package = "version_constants_bridge" |
| } |