naiveproxy/chromecast/base/BUILD.gn

353 lines
9.6 KiB
Plaintext
Raw Normal View History

2018-08-11 08:35:24 +03:00
# 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/util/process_version.gni")
import("//chromecast/chromecast.gni")
import("//testing/test.gni")
if (is_android) {
import("//build/config/android/rules.gni")
}
declare_args() {
# Denotes the type of Cast product. This is #defined as CAST_PRODUCT_TYPE in
# version.h. See //third_party/metrics_proto/cast_logs.proto for valid values.
if (is_android_arc) {
cast_product_type = 7 # CAST_PRODUCT_TYPE_CHROME_OS
} else if (is_android) {
if (is_android_things) {
cast_product_type = 6 # CAST_PRODUCT_TYPE_ANDROID_THINGS
} else {
cast_product_type = 4 # CAST_PRODUCT_TYPE_ANDROID_TV
}
} else {
cast_product_type = 0 # CAST_PRODUCT_TYPE_UNKNOWN
}
}
if (is_android_arc) {
assert(cast_product_type == 7)
} else if (is_android) {
assert(cast_product_type == 4 || cast_product_type == 6)
} else {
assert(cast_product_type >= 0 && cast_product_type <= 7 &&
cast_product_type != 4 && cast_product_type != 6 &&
cast_product_type != 7)
}
cast_source_set("base") {
sources = [
"alarm_manager.cc",
"alarm_manager.h",
"android/dumpstate_writer.cc",
"android/dumpstate_writer.h",
"android/system_time_change_notifier_android.cc",
"android/system_time_change_notifier_android.h",
"bind_to_task_runner.h",
"bitstream_audio_codecs.cc",
"bitstream_audio_codecs.h",
"cast_constants.cc",
"cast_constants.h",
"cast_features.cc",
"cast_features.h",
"cast_paths.cc",
"cast_paths.h",
"cast_resource.cc",
"cast_resource.h",
"chromecast_config_android.cc",
"chromecast_config_android.h",
"device_capabilities.h",
"device_capabilities_impl.cc",
"device_capabilities_impl.h",
"error_codes.cc",
"error_codes.h",
"observer.h",
"path_utils.cc",
"path_utils.h",
"pref_names.cc",
"pref_names.h",
"process_utils.cc",
"process_utils.h",
"serializers.cc",
"serializers.h",
"statistics/weighted_mean.cc",
"statistics/weighted_mean.h",
"statistics/weighted_moving_average.cc",
"statistics/weighted_moving_average.h",
"statistics/weighted_moving_linear_regression.cc",
"statistics/weighted_moving_linear_regression.h",
"system_time_change_notifier.cc",
"system_time_change_notifier.h",
"task_runner_impl.cc",
"task_runner_impl.h",
]
public_deps = [
":chromecast_switches",
":init_shlib",
"//chromecast/base/metrics",
"//chromecast/public",
]
deps = [
"//base",
"//chromecast:chromecast_buildflags",
]
if (is_android) {
deps += [ ":jni_headers" ]
}
if (chromecast_branding == "public") {
sources += [ "cast_features_internal.cc" ]
} else {
deps += [ "//chromecast/internal/base:cast_internal_features" ]
}
}
# chromecast related switch values
# b/30398176 components that depend on switch values should depend on
# this target directly instead of depend on //chromecast/base to avoid
# unnecessary size increase.
cast_source_set("chromecast_switches") {
sources = [
"chromecast_switches.cc",
"chromecast_switches.h",
]
deps = [
"//base",
]
}
# command line initialization code for shared libs
# b/30398176 shared libs that depend on InitCommandLineShlib() only should
# use this target instead of //chromecast/base
cast_source_set("init_shlib") {
sources = [
"init_command_line_shlib.cc",
"init_command_line_shlib.h",
]
deps = [
"//base",
"//chromecast:chromecast_buildflags",
]
}
cast_source_set("test_support") {
sources = [
"scoped_temp_file.cc",
"scoped_temp_file.h",
]
public_deps = [
":base",
"//base",
]
}
test("cast_base_unittests") {
sources = [
"alarm_manager_unittest.cc",
"bind_to_task_runner_unittest.cc",
"cast_features_unittest.cc",
"device_capabilities_impl_unittest.cc",
"error_codes_unittest.cc",
"metrics/cast_metrics_helper_unittest.cc",
"observer_unittest.cc",
"path_utils_unittest.cc",
"process_utils_unittest.cc",
"serializers_unittest.cc",
"statistics/weighted_moving_average_unittest.cc",
"statistics/weighted_moving_linear_regression_unittest.cc",
"system_time_change_notifier_unittest.cc",
"thread_health_checker_unittest.cc",
]
deps = [
":test_support",
":thread_health_checker",
"//base/test:run_all_unittests",
"//base/test:test_support",
"//testing/gmock",
"//testing/gtest",
]
}
cast_source_set("cast_sys_info") {
sources = [
"cast_sys_info_android.cc",
"cast_sys_info_android.h",
"cast_sys_info_dummy.cc",
"cast_sys_info_dummy.h",
"cast_sys_info_util.h",
]
deps = [
"//base",
"//chromecast/public",
]
if (is_android) {
deps += [
":cast_version",
"//chromecast:chromecast_buildflags",
"//chromecast/browser:jni_headers",
]
} else if (chromecast_branding == "public") {
sources += [ "cast_sys_info_util_simple.cc" ]
}
}
# Target for OEM partners to override sys_info shared library, i.e.
# libcast_sys_info_1.0.so.
cast_shared_library("libcast_sys_info_1.0") {
sources = [
"cast_sys_info_dummy.cc",
"cast_sys_info_dummy.h",
"cast_sys_info_shlib.cc",
]
deps = [
"//chromecast/public",
]
}
# Note: Android links //chromecast/base:cast_sys_info statically.
cast_source_set("cast_sys_info_shlib") {
if (!is_android) {
sources = [
"cast_sys_info_util_shlib.cc",
]
deps = [
":cast_sys_info",
":libcast_sys_info_1.0",
"//base",
"//chromecast/public",
]
}
}
cast_source_set("thread_health_checker") {
sources = [
"thread_health_checker.cc",
"thread_health_checker.h",
]
deps = [
":base",
"//base",
]
}
process_version("cast_version") {
template_file = "version.h.in"
output = "$target_gen_dir/version.h"
sources = [
"//chrome/VERSION",
]
extra_args = [
"-e",
"VERSION_FULL=\"%s.%s.%s.%s\"%(MAJOR,MINOR,BUILD,PATCH)",
"-e",
"CAST_BUILD_RELEASE=\"$cast_build_release\"",
"-e",
"CAST_BUILD_INCREMENTAL=\"$cast_build_incremental\"",
"-e",
"CAST_PRODUCT_TYPE=$cast_product_type",
]
if (cast_is_debug) {
extra_args += [
"-e",
"CAST_IS_DEBUG_BUILD=1",
]
} else {
extra_args += [
"-e",
"CAST_IS_DEBUG_BUILD=0",
]
}
}
if (is_android) {
generate_jni("jni_headers") {
sources = [
"java/src/org/chromium/chromecast/base/ChromecastConfigAndroid.java",
"java/src/org/chromium/chromecast/base/DumpstateWriter.java",
"java/src/org/chromium/chromecast/base/SystemTimeChangeNotifierAndroid.java",
]
jni_package = "chromecast"
}
android_library("base_java") {
java_src_dir = "//chromecast/base/java/src"
java_files = [
"$java_src_dir/org/chromium/chromecast/base/BiConsumer.java",
"$java_src_dir/org/chromium/chromecast/base/BiFunction.java",
"$java_src_dir/org/chromium/chromecast/base/BiPredicate.java",
"$java_src_dir/org/chromium/chromecast/base/Both.java",
"$java_src_dir/org/chromium/chromecast/base/CircularBuffer.java",
"$java_src_dir/org/chromium/chromecast/base/Controller.java",
"$java_src_dir/org/chromium/chromecast/base/Consumer.java",
"$java_src_dir/org/chromium/chromecast/base/Function.java",
"$java_src_dir/org/chromium/chromecast/base/Itertools.java",
"$java_src_dir/org/chromium/chromecast/base/Observable.java",
"$java_src_dir/org/chromium/chromecast/base/Scope.java",
"$java_src_dir/org/chromium/chromecast/base/Predicate.java",
"$java_src_dir/org/chromium/chromecast/base/ScopeFactories.java",
"$java_src_dir/org/chromium/chromecast/base/ScopeFactory.java",
"$java_src_dir/org/chromium/chromecast/base/Supplier.java",
"$java_src_dir/org/chromium/chromecast/base/Unit.java",
"$java_src_dir/org/chromium/chromecast/base/VoidScopeFactory.java",
# TODO(sanfin): Move these files to another target.
"$java_src_dir/org/chromium/chromecast/base/CastSettingsManager.java",
"$java_src_dir/org/chromium/chromecast/base/CastSwitches.java",
"$java_src_dir/org/chromium/chromecast/base/ChromecastConfigAndroid.java",
"$java_src_dir/org/chromium/chromecast/base/DumpstateWriter.java",
"$java_src_dir/org/chromium/chromecast/base/SystemTimeChangeNotifierAndroid.java",
]
deps = [
"//base:base_java",
]
}
android_library("cast_base_test_utils_java") {
java_test_dir = "//chromecast/base/java/test"
testonly = true
java_files = [
"$java_test_dir/org/chromium/chromecast/base/Inheritance.java",
"$java_test_dir/org/chromium/chromecast/base/ReactiveRecorder.java",
]
deps = [
":base_java",
"//third_party/hamcrest:hamcrest_java",
"//third_party/junit",
]
}
junit_binary("cast_base_junit_tests") {
java_test_dir = "//chromecast/base/java/test"
java_files = [
"$java_test_dir/org/chromium/chromecast/base/BothTest.java",
"$java_test_dir/org/chromium/chromecast/base/CircularBufferTest.java",
"$java_test_dir/org/chromium/chromecast/base/ItertoolsTest.java",
"$java_test_dir/org/chromium/chromecast/base/ObservableAndControllerTest.java",
"$java_test_dir/org/chromium/chromecast/base/ReactiveRecorderTest.java",
"$java_test_dir/org/chromium/chromecast/base/ScopeFactoriesTest.java",
"$java_test_dir/org/chromium/chromecast/base/UnitTest.java",
]
deps = [
":base_java",
":cast_base_test_utils_java",
"//third_party/hamcrest:hamcrest_java",
]
}
}