Skip to content

Commit

Permalink
[chromecast] Introduce cast_source_set
Browse files Browse the repository at this point in the history
The main changes are in chromecast/chromecast.gni

The rest of the files were modified with these commands:

- Change source_set -> cast_source_set
git ls-files "chromecast/*.gn" | xargs sed -i 's/source_set(/cast_source_set(/g'

- Include chromecast.gni for any GN files missing it
git ls-files "chromecast/*.gn" | xargs grep -L '//chromecast/chromecast.gni' | xargs grep -l 'source_set' | xargs -L1 ~/src/scratch/add_line_after_first_comment.py 'import(' '"//chromecast/chromecast.gni")'

add_line_after_first_comment.py can be found under
chromecast/internal/tools

BUG=b/68723969
TEST=Build and run

Change-Id: I38a06ac4d8a45ebc7963b58e5a2db81fde84e635
Reviewed-on: https://chromium-review.googlesource.com/747894
Reviewed-by: Stephen Lanham <slan@chromium.org>
Commit-Queue: Bailey Forrest <bcf@chromium.org>
Cr-Commit-Position: refs/heads/master@{#513035}
  • Loading branch information
Bailey Forrest authored and Commit Bot committed Nov 1, 2017
1 parent 5b922d8 commit 635cecc
Show file tree
Hide file tree
Showing 35 changed files with 106 additions and 63 deletions.
5 changes: 5 additions & 0 deletions chromecast/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ group("all") {
testonly = true
}

# This is a config which is applied on all cast_* targets (which should be all
# code under chromecast/).
config("cast_config") {
}

# A list of all public test() binaries. This is an organizational target that
# cannot be depended upon or built directly. Build cast_test_lists instead.
cast_test_group("cast_tests") {
Expand Down
8 changes: 4 additions & 4 deletions chromecast/app/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import("//chromecast/chromecast.gni")
import("//testing/test.gni")
import("//tools/grit/grit_rule.gni")

source_set("app") {
cast_source_set("app") {
sources = [
"cast_main_delegate.cc",
"cast_main_delegate.h",
Expand All @@ -32,7 +32,7 @@ source_set("app") {
}
}

source_set("cast_crash_client") {
cast_source_set("cast_crash_client") {
sources = [
"android/cast_crash_reporter_client_android.cc",
"android/cast_crash_reporter_client_android.h",
Expand Down Expand Up @@ -67,7 +67,7 @@ source_set("cast_crash_client") {
}
}

source_set("test_support") {
cast_source_set("test_support") {
testonly = true
sources = [
"cast_test_launcher.cc",
Expand All @@ -84,7 +84,7 @@ source_set("test_support") {
]
}

source_set("unittests") {
cast_source_set("unittests") {
testonly = true
sources = [
"linux/cast_crash_reporter_client_unittest.cc",
Expand Down
14 changes: 7 additions & 7 deletions chromecast/base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if (is_android_arc) {
cast_product_type != 7)
}

source_set("base") {
cast_source_set("base") {
sources = [
"alarm_manager.cc",
"alarm_manager.h",
Expand Down Expand Up @@ -95,7 +95,7 @@ source_set("base") {
# 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.
source_set("chromecast_switches") {
cast_source_set("chromecast_switches") {
sources = [
"chromecast_switches.cc",
"chromecast_switches.h",
Expand All @@ -109,7 +109,7 @@ source_set("chromecast_switches") {
# command line initialization code for shared libs
# b/30398176 shared libs that depend on InitCommandLineShlib() only should
# use this target instead of //chromecast/base
source_set("init_shlib") {
cast_source_set("init_shlib") {
sources = [
"init_command_line_shlib.cc",
"init_command_line_shlib.h",
Expand All @@ -120,7 +120,7 @@ source_set("init_shlib") {
]
}

source_set("test_support") {
cast_source_set("test_support") {
sources = [
"scoped_temp_file.cc",
"scoped_temp_file.h",
Expand Down Expand Up @@ -157,7 +157,7 @@ test("cast_base_unittests") {
]
}

source_set("cast_sys_info") {
cast_source_set("cast_sys_info") {
sources = [
"cast_sys_info_android.cc",
"cast_sys_info_android.h",
Expand Down Expand Up @@ -196,7 +196,7 @@ cast_shared_library("libcast_sys_info_1.0") {
}

# Note: Android links //chromecast/base:cast_sys_info statically.
source_set("cast_sys_info_shlib") {
cast_source_set("cast_sys_info_shlib") {
if (!is_android) {
sources = [
"cast_sys_info_util_shlib.cc",
Expand All @@ -211,7 +211,7 @@ source_set("cast_sys_info_shlib") {
}
}

source_set("thread_health_checker") {
cast_source_set("thread_health_checker") {
sources = [
"thread_health_checker.cc",
"thread_health_checker.h",
Expand Down
2 changes: 1 addition & 1 deletion chromecast/base/component/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import("//chromecast/chromecast.gni")
import("//testing/test.gni")

source_set("component") {
cast_source_set("component") {
sources = [
"component.cc",
"component.h",
Expand Down
6 changes: 4 additions & 2 deletions chromecast/base/metrics/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

source_set("metrics") {
import("//chromecast/chromecast.gni")

cast_source_set("metrics") {
sources = [
"cast_histograms.h",
"cast_metrics_helper.cc",
Expand All @@ -16,7 +18,7 @@ source_set("metrics") {
]
}

source_set("test_support") {
cast_source_set("test_support") {
testonly = true

sources = [
Expand Down
8 changes: 4 additions & 4 deletions chromecast/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if (is_android) {
import("//build/config/android/rules.gni")
}

source_set("browser") {
cast_source_set("browser") {
sources = [
"cast_browser_context.cc",
"cast_browser_context.h",
Expand Down Expand Up @@ -253,7 +253,7 @@ grit("resources") {
]
}

source_set("test_support") {
cast_source_set("test_support") {
testonly = true
sources = [
"test/cast_browser_test.cc",
Expand All @@ -274,7 +274,7 @@ source_set("test_support") {
]
}

source_set("browsertests") {
cast_source_set("browsertests") {
testonly = true
sources = [
"cast_media_blocker_browsertest.cc",
Expand All @@ -296,7 +296,7 @@ source_set("browsertests") {
]
}

source_set("unittests") {
cast_source_set("unittests") {
testonly = true

sources = [
Expand Down
4 changes: 3 additions & 1 deletion chromecast/browser/metrics/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

source_set("metrics") {
import("//chromecast/chromecast.gni")

cast_source_set("metrics") {
sources = [
"cast_metrics_prefs.cc",
"cast_metrics_prefs.h",
Expand Down
13 changes: 12 additions & 1 deletion chromecast/chromecast.gni
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,21 @@ foreach(target_type,
"executable",
"shared_library",
"loadable_module",
"source_set",
]) {
template("cast_${target_type}") {
target(target_type, target_name) {
forward_variables_from(invoker, "*")

configs += [ "//chromecast:cast_config" ]

if (!defined(deps)) {
deps = []
}
deps += [ "//build/config:exe_and_shlib_deps" ]

if (target_type != "source_set") {
deps += [ "//build/config:exe_and_shlib_deps" ]
}
}
}
}
Expand All @@ -116,3 +123,7 @@ set_defaults("cast_loadable_module") {
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
}
}

set_defaults("cast_source_set") {
configs = default_compiler_configs
}
3 changes: 2 additions & 1 deletion chromecast/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//chromecast/chromecast.gni")
import("//mojo/public/tools/bindings/mojom.gni")

source_set("common") {
cast_source_set("common") {
sources = [
"cast_content_client.cc",
"cast_content_client.h",
Expand Down
2 changes: 1 addition & 1 deletion chromecast/common/media/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import("//chromecast/chromecast.gni")
import("//mojo/public/tools/bindings/mojom.gni")

source_set("media") {
cast_source_set("media") {
if (is_android) {
sources = [
"cast_media_drm_bridge_client.cc",
Expand Down
4 changes: 2 additions & 2 deletions chromecast/crash/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import("//testing/test.gni")
# TODO(crbug.com/753619): Enable crash reporting on Fuchsia.
assert(!is_fuchsia)

source_set("crash") {
cast_source_set("crash") {
sources = [
"app_state_tracker.cc",
"app_state_tracker.h",
Expand Down Expand Up @@ -71,7 +71,7 @@ cast_executable("crash_uploader") {
}
}

source_set("test_support") {
cast_source_set("test_support") {
sources = [
"linux/crash_testing_utils.cc",
"linux/crash_testing_utils.h",
Expand Down
3 changes: 2 additions & 1 deletion chromecast/crypto/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//chromecast/chromecast.gni")
import("//testing/test.gni")

source_set("crypto") {
cast_source_set("crypto") {
sources = [
"signature_cache.cc",
"signature_cache.h",
Expand Down
2 changes: 1 addition & 1 deletion chromecast/graphics/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import("//chromecast/chromecast.gni")
import("//build/config/ui.gni")
import("//testing/test.gni")

source_set("graphics") {
cast_source_set("graphics") {
sources = [
"cast_window_manager.h",
]
Expand Down
3 changes: 2 additions & 1 deletion chromecast/media/audio/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//chromecast/chromecast.gni")
import("//media/media_options.gni")

source_set("audio") {
cast_source_set("audio") {
sources = [
"cast_audio_manager.cc",
"cast_audio_manager.h",
Expand Down
10 changes: 5 additions & 5 deletions chromecast/media/base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import("//chromecast/chromecast.gni")

source_set("key_systems") {
cast_source_set("key_systems") {
sources = [
"key_systems_common.cc",
"key_systems_common.h",
Expand All @@ -22,7 +22,7 @@ source_set("key_systems") {
]
}

source_set("base") {
cast_source_set("base") {
sources = [
"audio_device_ids.cc",
"audio_device_ids.h",
Expand Down Expand Up @@ -64,7 +64,7 @@ source_set("base") {
]
}

source_set("media_resource_tracker") {
cast_source_set("media_resource_tracker") {
sources = [
"media_resource_tracker.cc",
"media_resource_tracker.h",
Expand All @@ -77,7 +77,7 @@ source_set("media_resource_tracker") {
]
}

source_set("media_codec_support") {
cast_source_set("media_codec_support") {
sources = [
"media_codec_support.cc",
"media_codec_support.h",
Expand All @@ -93,7 +93,7 @@ source_set("media_codec_support") {
]
}

source_set("video_plane_controller") {
cast_source_set("video_plane_controller") {
sources = [
"video_plane_controller.cc",
"video_plane_controller.h",
Expand Down
2 changes: 1 addition & 1 deletion chromecast/media/cdm/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import("//chromecast/chromecast.gni")
import("//media/media_options.gni")

source_set("cdm") {
cast_source_set("cdm") {
sources = [
"chromecast_init_data.cc",
"chromecast_init_data.h",
Expand Down
4 changes: 2 additions & 2 deletions chromecast/media/cma/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ group("cma") {
]
}

source_set("test_support") {
cast_source_set("test_support") {
testonly = true
sources = [
"test/frame_generator_for_test.cc",
Expand Down Expand Up @@ -42,7 +42,7 @@ source_set("test_support") {
]
}

source_set("unittests") {
cast_source_set("unittests") {
testonly = true
sources = [
"backend/audio_video_pipeline_device_unittest.cc",
Expand Down
Loading

0 comments on commit 635cecc

Please sign in to comment.