blob: 02e76bb73de6ae08d4c9c097221638094a71b8e4 [file] [log] [blame]
# Copyright 2015 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/config.gni")
import("//build/config/android/rules.gni")
import("//remoting/android/client_java_tmpl.gni")
import("//remoting/android/remoting_apk_tmpl.gni")
import("//remoting/remoting_options.gni")
import("//remoting/tools/build/remoting_localize.gni")
generate_jni("jni_headers") {
sources = [
"host/src/org/chromium/chromoting/host/jni/Host.java",
"java/src/org/chromium/chromoting/jni/Client.java",
"java/src/org/chromium/chromoting/jni/Display.java",
"java/src/org/chromium/chromoting/jni/JniInterface.java",
"java/src/org/chromium/chromoting/jni/TouchEventData.java",
]
jni_package = "remoting"
}
shared_library("remoting_client_jni") {
deps = [
"//remoting/android:jni_headers",
"//remoting/base",
"//remoting/client",
"//remoting/protocol",
"//ui/events:dom_keycode_converter",
"//ui/gfx",
]
sources = [
"//remoting/client/audio_player_android.cc",
"//remoting/client/audio_player_android.h",
"//remoting/client/jni/android_keymap.cc",
"//remoting/client/jni/android_keymap.h",
"//remoting/client/jni/chromoting_jni_instance.cc",
"//remoting/client/jni/chromoting_jni_instance.h",
"//remoting/client/jni/chromoting_jni_runtime.cc",
"//remoting/client/jni/chromoting_jni_runtime.h",
"//remoting/client/jni/display_updater_factory.h",
"//remoting/client/jni/egl_thread_context.cc",
"//remoting/client/jni/egl_thread_context.h",
"//remoting/client/jni/jni_client.cc",
"//remoting/client/jni/jni_client.h",
"//remoting/client/jni/jni_display_handler.cc",
"//remoting/client/jni/jni_display_handler.h",
"//remoting/client/jni/jni_frame_consumer.cc",
"//remoting/client/jni/jni_frame_consumer.h",
"//remoting/client/jni/jni_gl_display_handler.cc",
"//remoting/client/jni/jni_gl_display_handler.h",
"//remoting/client/jni/jni_pairing_secret_fetcher.cc",
"//remoting/client/jni/jni_pairing_secret_fetcher.h",
"//remoting/client/jni/jni_touch_event_data.cc",
"//remoting/client/jni/jni_touch_event_data.h",
"//remoting/client/jni/jni_video_renderer.h",
"//remoting/client/jni/remoting_jni_onload.cc",
"//remoting/client/jni/remoting_jni_registrar.cc",
"//remoting/client/jni/remoting_jni_registrar.h",
]
libs = [
"OpenSLES",
"EGL",
]
configs += [ "//remoting:enable_webrtc_remoting_client" ]
}
_raw_resources_base_dir = "$target_gen_dir/remoting_android_raw_resources/res"
copy("remoting_android_raw_resources") {
_credits_html = get_label_info("//remoting/webapp:credits",
"target_gen_dir") + "/credits.html"
sources = [
"//remoting/webapp/base/html/credits_css.css",
"//remoting/webapp/base/html/main.css",
"//remoting/webapp/base/js/credits_js.js",
_credits_html,
]
outputs = [
"$_raw_resources_base_dir/raw/{{source_file_part}}",
]
deps = [
"//remoting/webapp:credits",
]
}
remoting_localize("remoting_apk_manifest") {
sources = [
"java/AndroidManifest.xml.jinja2",
]
locales = [ "en" ]
if (remoting_enable_cardboard) {
defines = [ "ENABLE_CARDBOARD=1" ]
} else {
defines = [ "ENABLE_CARDBOARD=0" ]
}
variables = [ rebase_path(branding_path) ]
output = "$root_gen_dir/remoting/android/{{source_name_part}}"
}
android_resources("remoting_android_client_java_resources") {
custom_package = "org.chromium.chromoting"
resource_dirs = [ "java/res" ]
generated_resource_dirs = [ _raw_resources_base_dir ]
generated_resource_files =
get_target_outputs(":remoting_android_raw_resources")
deps = [
":remoting_android_raw_resources",
"//remoting/resources:strings_java",
"//third_party/android_tools:android_support_v7_appcompat_resources",
]
}
remoting_android_client_java_tmpl("remoting_android_client_java") {
remoting_google_play_services_library = google_play_services_library
}
if (current_cpu == "arm") {
action("remoting_cardboard_extract_native_lib") {
script = "//remoting/tools/extract_android_native_lib.py"
sources = [
"//third_party/cardboard-java/src/CardboardSample/libs/cardboard.jar",
]
outputs = [
"$root_out_dir/libvrtoolkit.so",
]
args = [ android_app_abi ]
args += rebase_path(sources, root_build_dir)
args += rebase_path(outputs, root_build_dir)
}
}
remoting_apk_tmpl("remoting_apk") {
apk_name = "Chromoting"
java_files = [ "//remoting/android/apk/src/org/chromium/chromoting/RemotingApplication.java" ]
deps = [
":remoting_android_client_java",
"//base:base_java",
"//net/android:net_java",
]
}
remoting_localize("remoting_test_apk_manifest") {
sources = [
"javatests/AndroidManifest.xml.jinja2",
]
locales = [ "en" ]
variables = [ rebase_path(branding_path) ]
output = "$root_gen_dir/remoting/android_test/{{source_name_part}}"
}
instrumentation_test_apk("remoting_test_apk") {
android_manifest = "$root_gen_dir/remoting/android_test/AndroidManifest.xml"
android_manifest_dep = ":remoting_test_apk_manifest"
apk_name = "ChromotingTest"
apk_under_test = ":remoting_apk"
java_files = [
"javatests/src/org/chromium/chromoting/EventTest.java",
"javatests/src/org/chromium/chromoting/MockInputStub.java",
"javatests/src/org/chromium/chromoting/SwipePinchDetectorTest.java",
"javatests/src/org/chromium/chromoting/TapGestureDetectorTest.java",
"javatests/src/org/chromium/chromoting/TouchEventBuilder.java",
"javatests/src/org/chromium/chromoting/TouchEventGenerator.java",
"javatests/src/org/chromium/chromoting/TouchInputStrategyTest.java",
"javatests/src/org/chromium/chromoting/test/util/MutableReference.java",
]
deps = [
":remoting_android_client_java",
"//base:base_java",
"//base:base_java_test_support",
]
}
shared_library("remoting_host_jni") {
deps = [
":jni_headers",
"//google_apis",
"//remoting/base",
"//remoting/host",
"//remoting/host/it2me:common",
"//remoting/protocol",
]
sources = [
"//remoting/host/android/jni_host.cc",
"//remoting/host/android/jni_host.h",
"//remoting/host/android/remoting_host_jni_onload.cc",
"//remoting/host/android/remoting_host_jni_registrar.cc",
"//remoting/host/android/remoting_host_jni_registrar.h",
]
}
android_resources("remoting_host_apk_resources") {
custom_package = "org.chromium.chromoting.host"
resource_dirs = [ "host/res" ]
deps = [
"//third_party/android_tools:android_support_v7_appcompat_resources",
]
}
android_apk("remoting_host_apk") {
apk_name = "ChromotingHost"
android_manifest = "host/AndroidManifest.xml"
shared_libraries = [ ":remoting_host_jni" ]
_java_file_prefix = "host/src/org/chromium/chromoting/host"
_java_files = [
"MainActivity.java",
"RemotingApplication.java",
"jni/Host.java",
"jni/It2MeHostObserver.java",
]
java_files = rebase_path(_java_files, ".", _java_file_prefix)
java_files +=
[ "java/src/org/chromium/chromoting/base/OAuthTokenFetcher.java" ]
deps = [
":remoting_host_apk_resources",
"//base:base_java",
"//net/android:net_java",
"//third_party/android_tools:android_support_v13_java",
"//third_party/android_tools:android_support_v7_appcompat_java",
google_play_services_library,
]
}