# 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("//chrome/version.gni") # TODO layering violation! 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. This is an integer in the range [0-4]. cast_product_type = 0 # If true, IS_CAST_DEBUG_BUILD() will evaluate to 1 in version.h. Otherwise, # it will evaluate to 0. Overriding this when is_debug=false is useful for # doing engineering builds. cast_is_debug = is_debug } assert(cast_product_type >= 0 && cast_product_type <= 4) # GYP target: chromecast.gyp:cast_base source_set("base") { sources = [ "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", "cast_constants.cc", "cast_constants.h", "cast_paths.cc", "cast_paths.h", "cast_resource.cc", "cast_resource.h", "chromecast_config_android.cc", "chromecast_config_android.h", "chromecast_switches.cc", "chromecast_switches.h", "device_capabilities.h", "device_capabilities_impl.cc", "device_capabilities_impl.h", "error_codes.cc", "error_codes.h", "path_utils.cc", "path_utils.h", "pref_names.cc", "pref_names.h", "process_utils.cc", "process_utils.h", "serializers.cc", "serializers.h", "system_time_change_notifier.cc", "system_time_change_notifier.h", "task_runner_impl.cc", "task_runner_impl.h", ] public_deps = [ "//chromecast/base/metrics", "//chromecast/public", ] deps = [ "//base", ] if (is_android) { deps += [ ":jni_headers" ] } } # GYP target: n/a source_set("test_support") { sources = [ "scoped_temp_file.cc", "scoped_temp_file.h", ] public_deps = [ ":base", "//base", ] } # GYP target: chromecast_tests.gypi:cast_base_unittests test("cast_base_unittests") { sources = [ "bind_to_task_runner_unittest.cc", "chromecast_switches_unittest.cc", "device_capabilities_impl_unittest.cc", "error_codes_unittest.cc", "path_utils_unittest.cc", "process_utils_unittest.cc", "serializers_unittest.cc", "system_time_change_notifier_unittest.cc", ] deps = [ ":test_support", "//base/test:run_all_unittests", "//base/test:test_support", "//testing/gmock", "//testing/gtest", ] } 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/browser:jni_headers", ] } else if (chromecast_branding == "public") { sources += [ "cast_sys_info_util_simple.cc" ] } } # This target runs a script which generates a file containing key-value pairs. # //build/util/version.py will parse this file, creating "version.h". This # target shall only be depended upon by ":cast_version". action("generate_cast_version_params") { visibility = [ ":cast_version_action" ] script = "//chromecast/tools/build/generate_cast_version_params.py" params_file = "$root_gen_dir/cast_version_params" outputs = [ params_file, ] args = [ "-o", rebase_path(params_file), "-p", "$cast_product_type", ] if (cast_is_debug) { args += [ "-d" ] } if (chromecast_branding != "public") { args += [ "-r", rebase_path("//chromecast/internal/build/cast_build_release"), ] } } process_version("cast_version") { template_file = "version.h.in" output = "$target_gen_dir/version.h" params_file = get_target_outputs(":generate_cast_version_params") deps = [ ":generate_cast_version_params", ] extra_args = [ "-e", "VERSION_FULL=\"%s.%s.%s.%s\"%(MAJOR,MINOR,BUILD,PATCH)", "-f", rebase_path(params_file[0]), ] } if (is_android) { # GYP target: chromecast.gyp:jni_headers 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" } # GYP target: chromecast.gyp:cast_base_java android_library("base_java") { java_src_dir = "//chromecast/base/java/src" java_files = [ "$java_src_dir/org/chromium/chromecast/base/CastSettingsManager.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", ] } }