BUILD.gn 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785
  1. # Copyright 2015 The Chromium Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file.
  4. import("//build/buildflag_header.gni")
  5. import("//build/config/features.gni")
  6. import("//build/config/sanitizers/sanitizers.gni")
  7. import("//build/config/ui.gni")
  8. import("//chromecast/build/tests/cast_test.gni")
  9. import("//chromecast/chromecast.gni")
  10. import("//chromecast/resource_sizes/chromecast_resource_sizes.gni")
  11. import("//media/media_options.gni")
  12. import("//tools/grit/repack.gni")
  13. import("//v8/gni/v8.gni")
  14. if (chromecast_branding != "public") {
  15. import("//chromecast/internal/chromecast_internal.gni")
  16. }
  17. if (is_android) {
  18. import("//build/config/android/rules.gni")
  19. import("//components/module_installer/android/module_desc_java.gni")
  20. }
  21. declare_args() {
  22. cast_test_extra_flags = ""
  23. vendor_cast_media_gtest_excludes = []
  24. }
  25. # Depends on all non-test targets that should be built by the Chromecast
  26. # internal build infrastructure.
  27. group("all") {
  28. data_deps = []
  29. deps = [ "//chromecast/build:archive" ]
  30. if (is_android) {
  31. if (chromecast_branding == "public") {
  32. deps += [ ":cast_shell_apk" ]
  33. } else {
  34. deps += [ ":cast_browser_bundle_module" ]
  35. }
  36. } else if (!is_fuchsia) {
  37. data_deps += [
  38. ":cast_browser",
  39. ":cast_shell",
  40. ]
  41. }
  42. if (is_linux) {
  43. deps += [ "//chromecast/tracing" ]
  44. }
  45. if (chromecast_branding != "public") {
  46. deps += [ "//chromecast/internal:all" ]
  47. }
  48. if (enable_external_mojo_services) {
  49. deps += [ "//chromecast/external_mojo/external_service_support:standalone_mojo_broker" ]
  50. }
  51. # No other targets should depend on this target, since it's just a convenience
  52. # target for the Chromecast internal build infrastructure.
  53. visibility = []
  54. testonly = true
  55. }
  56. # This is a config which is applied on all cast_* targets (which should be all
  57. # code under chromecast/).
  58. config("cast_config") {
  59. cflags = [ "-Wshadow" ]
  60. }
  61. config("iot_service") {
  62. if (iot_service_rpath != "") {
  63. ldflags = [ "-Wl,-rpath=${iot_service_rpath}" ]
  64. }
  65. }
  66. if (!is_fuchsia) {
  67. chromecast_resource_sizes_test("resource_sizes_chromecast") {
  68. data_deps = [
  69. ":cast_shell",
  70. ":cast_shell_pak",
  71. ":chromecast_locales_pak",
  72. ]
  73. }
  74. }
  75. # A list of all public test() binaries. This is an organizational target that
  76. # cannot be depended upon or built directly. Build cast_test_lists instead.
  77. cast_test_group("cast_tests") {
  78. filters = []
  79. tests = [
  80. "//base:base_unittests",
  81. "//cc:cc_unittests",
  82. "//chromecast/base:cast_base_unittests",
  83. "//chromecast/base/component:cast_component_unittests",
  84. "//chromecast/common:cast_common_unittests",
  85. "//chromecast/crypto:cast_crypto_unittests",
  86. "//chromecast/device/bluetooth:cast_bluetooth_unittests",
  87. "//chromecast/metrics:cast_metrics_unittest",
  88. "//chromecast/net:cast_net_unittests",
  89. "//chromecast/shared:cast_shared_unittests",
  90. "//chromecast/system/reboot:cast_reboot_unittests",
  91. "//components/viz:viz_unittests",
  92. "//crypto:crypto_unittests",
  93. "//media:media_unittests",
  94. "//media/midi:midi_unittests",
  95. "//net:net_unittests",
  96. "//sql:sql_unittests",
  97. "//storage:storage_unittests",
  98. "//ui/base:ui_base_unittests",
  99. ]
  100. if (!is_fuchsia) {
  101. tests += [
  102. "//chromecast/ui/display_settings:cast_display_settings_unittests",
  103. "//content/test:content_unittests",
  104. ]
  105. }
  106. if (!is_cast_audio_only) {
  107. tests += [ "//gpu:gpu_unittests" ]
  108. if (use_aura && !is_fuchsia) {
  109. tests += [ "//chromecast/graphics:cast_graphics_unittests" ]
  110. }
  111. }
  112. if (use_v4l2_codec) {
  113. tests += [ "//media/gpu:video_decode_accelerator_tests" ]
  114. }
  115. if (is_linux) {
  116. tests += [
  117. "//chromecast/crash:cast_crash_unittests",
  118. "//sandbox/linux:sandbox_linux_unittests",
  119. ]
  120. sandbox_linux_unittests_filter = {
  121. test_name = "sandbox_linux_unittests"
  122. # TODO(b/148974697): re-enable this.
  123. gtest_excludes = [ "BaselinePolicy.SystemEperm" ]
  124. }
  125. filters += [ sandbox_linux_unittests_filter ]
  126. }
  127. # TODO(crbug/1319009): `media_use_ffmpeg` should not largely affect top-level
  128. # test list. Better create another flag to do this or handle the ffmpeg flag
  129. # in //chromecast/media/cma/decoder.
  130. if (media_use_ffmpeg && !is_fuchsia) {
  131. tests += [
  132. "//chromecast/cast_core:cast_cast_core_unittests",
  133. "//chromecast/media:cast_media_unittests",
  134. ]
  135. cast_media_unittests_filter = {
  136. test_name = "cast_media_unittests"
  137. gtest_excludes = vendor_cast_media_gtest_excludes
  138. # --test-launcher-jobs=1 => so internal code can bind to port
  139. args = [ "--test-launcher-jobs=1" ]
  140. }
  141. filters += [ cast_media_unittests_filter ]
  142. }
  143. if (is_linux) {
  144. tests += [ "//chromecast/media/cma/backend:cast_audio_backend_unittests" ]
  145. cast_audio_backend_unittests_filter = {
  146. test_name = "cast_audio_backend_unittests"
  147. # --test-launcher-jobs=1 => so mixer service receiver can bind.
  148. args = [
  149. "--test-launcher-jobs=1",
  150. "--mixer-service-endpoint=/tmp/cast_audio_backend_unittest-mixer",
  151. "--mixer-service-port=12855",
  152. ]
  153. }
  154. filters += [ cast_audio_backend_unittests_filter ]
  155. }
  156. if (is_android) {
  157. tests += [ "//chromecast/media/cma/backend/android:cast_android_cma_backend_unittests" ]
  158. }
  159. if (!is_android && !is_fuchsia) {
  160. tests += [
  161. "//ipc:ipc_tests",
  162. "//url:url_unittests",
  163. ]
  164. if (media_use_ffmpeg) {
  165. tests += [
  166. ":cast_shell_browsertests",
  167. ":cast_shell_unittests",
  168. ]
  169. cast_shell_browsertests_filter = {
  170. test_name = "cast_shell_browsertests"
  171. # --enable-local-file-accesses => to load sample media files
  172. # --test-launcher-jobs=1 => so internal code can bind to port
  173. args = [
  174. "--no-sandbox",
  175. "--enable-local-file-accesses",
  176. "--test-launcher-jobs=1",
  177. "--enable-hardware-overlays=",
  178. ]
  179. gtest_excludes = []
  180. # TODO(b/112440248): This test was failing:
  181. # * On v1 and Cast Audio devices since 2017-03-15.
  182. # * On desktop builds since 2018-08-22
  183. # Also see: b/36238710, b/36239051, hotlist/461351
  184. gtest_excludes += [ "RendererPrelauncherTest.ReusedRenderer" ]
  185. if (!is_cast_desktop_build) {
  186. args += [ "--use-gpu-in-tests" ]
  187. # TODO(derekjchow): Make these tests pass on Chromecast devices.
  188. # Once all of the CastMediaBlockerTest.* have been un-DISABLEd and
  189. # are running successfully, revisit these tests and see if they pass
  190. # on devices. (crbug/665118, internal b/32023194)
  191. gtest_excludes += [
  192. "CastMediaBlockerBrowserTest.Video_BlockUnblock",
  193. "CastMediaBlockerBrowserTest.Audio_BlockUnblock",
  194. # This browser test can only be run inside of a source checkout.
  195. "CastWebContentsBrowserTest.*",
  196. ]
  197. }
  198. if (!is_cast_desktop_build && !is_cast_audio_only &&
  199. !enable_assistant) {
  200. # TODO(mbjorge): The VideoPlaybackMp4 test is failing on v1 devices.
  201. # Temporarily disable it as part of an effort to re-green the unittests.
  202. # Re-enable once the tests have been fixed. Limitations in the filter
  203. # system mean this is getting temporarily disabled on all video devices,
  204. # though it is only failing on v1.
  205. # b/36723698, hotlist/461351
  206. gtest_excludes += [ "CastNavigationBrowserTest.VideoPlaybackMp4" ]
  207. }
  208. # TODO(mbjorge): Temporarily disable AudioPlaybackWavPcm because it is
  209. # failing on device. As part of an effort to re-green the unittests,
  210. # current (2017-03-15) failures are being disabled to get back to a
  211. # green state. Re-enable once the tests have been fixed.
  212. # b/36239152, hotlist/461351
  213. if (enable_assistant && !is_cast_desktop_build) {
  214. gtest_excludes += [ "CastNavigationBrowserTest.AudioPlaybackWavPcm" ]
  215. }
  216. }
  217. filters += [ cast_shell_browsertests_filter ]
  218. }
  219. ipc_tests_filter = {
  220. test_name = "ipc_tests"
  221. # --test-launcher-jobs=1 => so internal code can bind to port
  222. args = [ "--test-launcher-jobs=1" ]
  223. }
  224. filters += [ ipc_tests_filter ]
  225. url_unittests_filter = {
  226. test_name = "url_unittests"
  227. if (target_os == "linux" && !is_cast_desktop_build) {
  228. # DoAppendUTF8Invalid fails because of dcheck_always_on flag in Eng builds
  229. gtest_excludes = [ "URLCanonTest.DoAppendUTF8Invalid" ]
  230. }
  231. }
  232. filters += [ url_unittests_filter ]
  233. }
  234. base_unittests_filter = {
  235. test_name = "base_unittests"
  236. gtest_excludes = []
  237. if (target_os == "linux") {
  238. if (is_cast_desktop_build) {
  239. # Disable PartitionAllocDeathTest.* (b/67975693)
  240. gtest_excludes += [ "PartitionAllocDeathTest.*" ]
  241. } else {
  242. # Disable ProcessMetricsTest.GetNumberOfThreads (b/15610509)
  243. # Disable ProcessUtilTest.* (need to define OS_ANDROID)
  244. # Disable StackContainer.BufferAlignment (don't support 16-byte alignment)
  245. # Disable SystemMetrics2Test.GetSystemMemoryInfo (buffers>0 can't be guaranteed)
  246. # Disable PostTasksViaTaskRunner/* to green up devices (b/62246873)
  247. # Disable WorkerDetaches to green up devices (b/62246873)
  248. gtest_excludes += [
  249. "ProcessMetricsTest.GetNumberOfThreads",
  250. "ProcessUtilTest.*",
  251. "StackContainer.BufferAlignment",
  252. "SystemMetrics2Test.GetSystemMemoryInfo",
  253. "OneTraitsExecutionModePair/ThreadPoolImplTest.PostTasksViaTaskRunner/*",
  254. "TaskSchedulerWorkerTest.WorkerDetaches",
  255. ]
  256. }
  257. if (is_cast_audio_only) {
  258. # Also disable TimeFormattingTest on audio-only builds, since we don't
  259. # include the necessary info in icudtl.dat.
  260. gtest_excludes += [ "TimeFormattingTest.*" ]
  261. }
  262. }
  263. }
  264. filters += [ base_unittests_filter ]
  265. cc_unittests_filter = {
  266. test_name = "cc_unittests"
  267. # Temporarily disable all test cases (b/113324890)
  268. gtest_excludes = [ "*" ]
  269. if (!is_cast_desktop_build) {
  270. #Disable ToColorSpace/ColorTransformPixelTest* (b/64346790)
  271. #Disable ImageBackgroundFilter* (b/64346875)
  272. #Disable LayerTreeHostTilesTestPartialInvalidation* (b/65844132)
  273. gtest_excludes += [
  274. "ToColorSpace/ColorTransformPixelTest.*",
  275. "ImageBackgroundFilter.*",
  276. "LayerTreeHostTilesTestPartialInvalidation.*",
  277. ]
  278. }
  279. }
  280. filters += [ cc_unittests_filter ]
  281. viz_unittests_filter = {
  282. test_name = "viz_unittests"
  283. # TODO(crbug.com/1338342): Make these tests pass.
  284. gtest_excludes = [
  285. "PromotedTrueFalse/MultiUnderlayPromotedTest.UnderlaysBlendPrimaryPlane/0",
  286. "UnderlayCastTest.BlackOutsideOverlayContentBounds",
  287. "UnderlayCastTest.FullScreenOverlayContentBounds",
  288. "UnderlayCastTest.OverlayOccludedContentBounds",
  289. "UnderlayCastTest.OverlayOccludedUnionContentBounds",
  290. "UnderlayCastTest.OverlayPromotionWithMaskFilter",
  291. "UnderlayCastTest.ReplacementQuad",
  292. "UnderlayCastTest.RoundContentBounds",
  293. "UnderlayCastTest.RoundOverlayContentBounds",
  294. ]
  295. }
  296. filters += [ viz_unittests_filter ]
  297. # content_unittests are not run on Fuchsia.
  298. if (!is_fuchsia) {
  299. content_unittests_filter = {
  300. test_name = "content_unittests"
  301. # IsSupportedVideoConfig_VP9TransferFunctions fails on all cast builds since
  302. # the cast IsSupportedVideoConfigs ignore the transfer function parameter.
  303. # (b/36984215).
  304. gtest_excludes = [ "*.IsSupportedVideoConfig_VP9TransferFunctions" ]
  305. if (target_os == "linux" && !is_cast_desktop_build) {
  306. # DesktopCaptureDeviceTest.*: No capture device on Eureka
  307. # Disable PepperGamepadHostTest.WaitForReply (pepper not supported on Eureka)
  308. # Disable RenderWidgetHostTest.Background because we disable the
  309. # blacklist to enable WebGL (b/16142554)
  310. gtest_excludes += [
  311. "LegacyDomStorageDatabaseTest.TestCanOpenAndReadWebCoreDatabase",
  312. "DesktopCaptureDeviceTest.Capture",
  313. "GamepadProviderTest.PollingAccess",
  314. "PepperGamepadHostTest.WaitForReply",
  315. "RenderWidgetHostTest.Background",
  316. ]
  317. }
  318. if (is_cast_audio_only) {
  319. # No way to display URL's on audio only cast devices.
  320. gtest_excludes += [ "NavigationEntryTest.NavigationEntryURLs" ]
  321. }
  322. if (enable_assistant && !is_cast_desktop_build) {
  323. # Temporarily disable DefaultConstructor on assistant device builds. Cause
  324. # of failure is unclear, but it's highly likely it's related to them being
  325. # DEATH tests. These were passing until the is_official_build flag was
  326. # enabled. These tests are considered non-critical in this context.
  327. # (b/62469368)
  328. gtest_excludes += [ "WebBluetoothDeviceIdTest.DefaultConstructor" ]
  329. }
  330. }
  331. filters += [ content_unittests_filter ]
  332. }
  333. media_unittests_filter = {
  334. test_name = "media_unittests"
  335. if (target_os == "linux" && !is_cast_desktop_build) {
  336. # Disable VP9 related tests (b/18593324)
  337. # PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM
  338. # PipelineIntegrationTest.BasicPlayback_VideoOnly_VP9_WebM
  339. # PipelineIntegrationTest.BasicPlayback_VP9*
  340. # PipelineIntegrationTest.P444_VP9_WebM
  341. # Disable VP8A tests (b/18593324)
  342. # PipelineIntegrationTest.BasicPlayback_VP8A*
  343. # Disable OpusAudioDecoderTest/AudioDecoderTest.ProduceAudioSamples/0 (unit
  344. # test fails when Opus decoder uses fixed-point)
  345. # Due to b/16456550, disable the following four test cases:
  346. # AudioOutputControllerTest.PlayDivertSwitchDeviceRevertClose
  347. # AudioOutputControllerTest.PlaySwitchDeviceClose
  348. # AudioStreamHandlerTest.Play
  349. # SoundsManagerTest.Play
  350. # Disable AudioStreamHandlerTest.ConsecutivePlayRequests (b/16539293)
  351. gtest_excludes = [
  352. "AudioOutputControllerTest.PlayDivertSwitchDeviceRevertClose",
  353. "AudioOutputControllerTest.PlaySwitchDeviceClose",
  354. "AudioStreamHandlerTest.Play",
  355. "AudioStreamHandlerTest.ConsecutivePlayRequests",
  356. "PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM",
  357. "PipelineIntegrationTest.BasicPlayback_VideoOnly_VP9_WebM",
  358. "PipelineIntegrationTest.BasicPlayback_VP9*",
  359. "PipelineIntegrationTest.P444_VP9_WebM",
  360. "PipelineIntegrationTest.BasicPlayback_VP8A*",
  361. "OpusAudioDecoderTest/AudioDecoderTest.ProduceAudioSamples/0",
  362. "SoundsManagerTest.Play",
  363. ]
  364. } else if (target_os == "android" || is_cast_desktop_build) {
  365. # Disable PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM (not supported)
  366. gtest_excludes =
  367. [ "PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM" ]
  368. }
  369. }
  370. filters += [ media_unittests_filter ]
  371. net_unittests_filter = {
  372. test_name = "net_unittests"
  373. if (using_sanitizer) {
  374. # TODO(mbjorge): net_unittests do not complete when run with sanitizers,
  375. # (in particular, TSAN and UBSAN), resulting in build machines getting stuck
  376. # for many hours. Disable them for now, since these are getting run on
  377. # Chromium bots anyway. (internal b/31279943)
  378. gtest_excludes = [ "*" ]
  379. } else if (target_os == "linux" && !is_cast_desktop_build) {
  380. # Run net_unittests first to avoid random failures due to slow python startup
  381. # PacFileFetcherImplTest.HttpMimeType is flaking (b/19848784)
  382. # Running a batch of net_unittests has high overhead. Run tests in batches of 50 to reduce number of batches (b/23156294).
  383. gtest_excludes = [ "PacFileFetcherImplTest.HttpMimeType" ]
  384. args = [ "--test-launcher-batch-limit=50" ]
  385. } else if (is_cast_desktop_build || target_os == "android") {
  386. # CTLogVerifierTest.VerifiesValidConsistencyProofsFromReferenceGenerator
  387. # times out occasionally, paricularly on the CQ bots; disable to reduce
  388. # CQ flakiness (crbug/598406) (b/29415636).
  389. # Running a batch of net_unittests has high overhead, so
  390. # run tests in batches of 25 to reduce number of batches (b/23156294).
  391. gtest_excludes = [ "CTLogVerifierTest.VerifiesValidConsistencyProofsFromReferenceGenerator" ]
  392. args = [ "--test-launcher-batch-limit=25" ]
  393. }
  394. }
  395. filters += [ net_unittests_filter ]
  396. }
  397. # Creates the build and run lists for all test targets.
  398. cast_test_group_list("cast_test_lists") {
  399. build_list_path = "$root_out_dir/tests/build_test_list.txt"
  400. runtime_deps_path = "$root_out_dir/tests/runtime_deps.json"
  401. run_list_path = "$root_out_dir/tests/run_test_list.txt"
  402. additional_options = [
  403. "--ozone-platform=headless --test-launcher-bot-mode $cast_test_extra_flags",
  404. ]
  405. test_groups = [ ":cast_tests" ]
  406. if (chromecast_branding != "public") {
  407. test_groups += internal_cast_test_groups
  408. }
  409. }
  410. if (is_android) {
  411. cast_test_group("cast_junit_tests") {
  412. test_type = "junit"
  413. tests = [
  414. "//base:base_junit_tests",
  415. "//chromecast/base:cast_base_junit_tests",
  416. "//chromecast/browser/android:cast_shell_junit_tests",
  417. "//content/public/android:content_junit_tests",
  418. "//net/android:net_junit_tests",
  419. "//testing/android/junit:junit_unit_tests",
  420. "//ui/android:ui_junit_tests",
  421. ]
  422. }
  423. cast_test_group_list("cast_junit_test_lists") {
  424. test_type = "junit"
  425. build_list_path = "$root_out_dir/junit/build_junit_test_list.txt"
  426. runtime_deps_path = "$root_out_dir/junit/runtime_deps.json"
  427. run_list_path = "$root_out_dir/junit/run_junit_test_list.txt"
  428. test_groups = [ ":cast_junit_tests" ]
  429. if (chromecast_branding != "public") {
  430. test_groups += [ "//chromecast/internal:internal_cast_junit_tests" ]
  431. }
  432. }
  433. }
  434. if (!is_fuchsia) {
  435. test("cast_shell_unittests") {
  436. deps = [
  437. ":cast_shell_lib",
  438. "//chromecast/app:test_support",
  439. "//chromecast/app:unittests",
  440. "//chromecast/browser:unittests",
  441. "//ui/gl:test_support",
  442. ]
  443. }
  444. test("cast_shell_browsertests") {
  445. deps = [
  446. # These browser tests always use the simple implementation, since we only
  447. # need to test web content primitives and not all of Cast receiver.
  448. ":cast_shell_lib_simple",
  449. "//chromecast/app:test_support",
  450. "//chromecast/bindings:browsertests",
  451. "//chromecast/browser:browsertests",
  452. ]
  453. data_deps = [ ":chromecast_locales_pak" ]
  454. }
  455. group("cast_shell_lib") {
  456. if (chromecast_branding != "public") {
  457. deps = [
  458. ":cast_shell_lib_base",
  459. "//chromecast/internal/shell",
  460. ]
  461. } else {
  462. deps = [ ":cast_shell_lib_simple" ]
  463. }
  464. }
  465. group("cast_shell_lib_base") {
  466. data_deps = [ ":cast_shell_pak" ]
  467. deps = [
  468. "//chromecast/app",
  469. "//chromecast/base:default_create_sys_info",
  470. "//chromecast/browser",
  471. "//chromecast/common",
  472. "//chromecast/renderer",
  473. "//chromecast/utility",
  474. ]
  475. }
  476. group("cast_shell_lib_simple") {
  477. deps = [
  478. "//chromecast/browser:prefs_simple",
  479. "//chromecast/browser:simple_main_parts",
  480. "//chromecast/utility:simple_client",
  481. ]
  482. if (enable_cast_media_runtime) {
  483. deps += [ "//chromecast/cast_core:core_runtime_lib_simple" ]
  484. } else {
  485. deps += [
  486. ":cast_shell_lib_base",
  487. "//chromecast/browser:simple_client",
  488. "//chromecast/renderer:simple_client",
  489. ]
  490. }
  491. }
  492. cast_executable("cast_shell") {
  493. sources = [ "app/cast_main.cc" ]
  494. deps = [
  495. ":cast_shell_lib",
  496. ":chromecast_locales_pak",
  497. "//chromecast/app",
  498. "//content/public/app",
  499. "//third_party/widevine/cdm",
  500. ]
  501. }
  502. cast_executable("cast_browser") {
  503. sources = [ "app/cast_main.cc" ]
  504. deps = [
  505. ":cast_shell_lib_simple",
  506. ":chromecast_locales_pak",
  507. "//chromecast/app",
  508. "//content/public/app",
  509. "//third_party/widevine/cdm",
  510. ]
  511. }
  512. repack("cast_shell_pak") {
  513. sources = [
  514. "$root_gen_dir/chromecast/app/shell_resources.pak",
  515. "$root_gen_dir/components/cast/named_message_port_connector/named_message_port_connector_resources.pak",
  516. "$root_gen_dir/content/content_resources.pak",
  517. "$root_gen_dir/content/dev_ui_content_resources.pak",
  518. "$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
  519. "$root_gen_dir/net/net_resources.pak",
  520. "$root_gen_dir/third_party/blink/public/resources/blink_resources.pak",
  521. "$root_gen_dir/third_party/blink/public/resources/blink_scaled_resources_100_percent.pak",
  522. "$root_gen_dir/third_party/blink/public/strings/blink_strings_en-US.pak",
  523. "$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
  524. "$root_gen_dir/ui/resources/webui_generated_resources.pak",
  525. "$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
  526. "$root_gen_dir/ui/strings/ax_strings_en-US.pak",
  527. "$root_gen_dir/ui/strings/ui_strings_en-US.pak",
  528. ]
  529. output = "$root_out_dir/assets/cast_shell.pak"
  530. deps = [
  531. "//chromecast/app:resources",
  532. "//components/cast/named_message_port_connector:resources",
  533. "//content:content_resources",
  534. "//content:dev_ui_content_resources",
  535. "//mojo/public/js:resources",
  536. "//net:net_resources",
  537. "//third_party/blink/public:resources",
  538. "//third_party/blink/public:scaled_resources_100_percent",
  539. "//third_party/blink/public/strings",
  540. "//ui/resources",
  541. "//ui/strings",
  542. ]
  543. }
  544. # Intermediate targets that repack grit resources by locale. For each locale
  545. # in |cast_locales| (see //chromecast/chromecast.gni), all resources
  546. # are packed into a single .pak file in an output directory. These targets
  547. # should not be depended on directly; depend on ":chromecast_locales_pak"
  548. # instead.
  549. foreach(locale, cast_locales) {
  550. repack("_cast_repack_${locale}") {
  551. visibility = [ ":chromecast_locales_pak" ]
  552. output = "$root_out_dir/chromecast_locales/${locale}.pak"
  553. sources =
  554. [ "$root_gen_dir/chromecast/app/chromecast_settings_${locale}.pak" ]
  555. deps = [ "//chromecast/app:chromecast_settings" ]
  556. if (chromecast_branding != "public") {
  557. sources += [
  558. "$root_gen_dir/chromecast/internal/castui/app_strings_${locale}.pak",
  559. ]
  560. deps += [ "//chromecast/internal/castui:cast_ui_app_strings" ]
  561. if (enable_chromecast_webui) {
  562. sources += [ "$root_gen_dir/chromecast/internal/castui/ui_localized_${locale}.pak" ]
  563. deps += [ "//chromecast/internal/castui:cast_ui_localized" ]
  564. }
  565. }
  566. }
  567. }
  568. # A meta-target which repacks resources by locale.
  569. group("chromecast_locales_pak") {
  570. data_deps = []
  571. foreach(locale, cast_locales) {
  572. data_deps += [ ":_cast_repack_${locale}" ]
  573. }
  574. }
  575. } # !is_fuchsia
  576. buildflag_header("chromecast_buildflags") {
  577. header = "chromecast_buildflags.h"
  578. _command_line_flags = string_join(",", default_command_line_flags)
  579. flags = [
  580. "DEFAULT_COMMAND_LINE_FLAGS=\"$_command_line_flags\"",
  581. "DISABLE_SECURE_FLAC_OPUS_DECODING=$disable_secure_flac_and_opus_decoding",
  582. "ENABLE_ASSISTANT=$enable_assistant",
  583. "ENABLE_CHROMECAST_WEBUI=$enable_chromecast_webui",
  584. "ENABLE_EXTERNAL_MOJO_SERVICES=$enable_external_mojo_services",
  585. "ENABLE_PLAYREADY=$enable_playready",
  586. "ENABLE_VIDEO_CAPTURE_SERVICE=$enable_video_capture_service",
  587. "IS_CAST_AUDIO_ONLY=$is_cast_audio_only",
  588. "IS_CAST_DESKTOP_BUILD=$is_cast_desktop_build",
  589. "USE_ANDROID_USER_AGENT=$use_android_user_agent",
  590. "USE_CHROMECAST_CDMS=$use_chromecast_cdms",
  591. "ENABLE_CHROMIUM_RUNTIME_CAST_RENDERER=$enable_chromium_runtime_cast_renderer",
  592. "ENABLE_CAST_MEDIA_RUNTIME=$enable_cast_media_runtime",
  593. ]
  594. }
  595. if (is_android) {
  596. generate_jni_registration("cast_shell_jni_registration") {
  597. targets = [ ":cast_shell_apk" ]
  598. if (chromecast_branding != "public") {
  599. targets += [ ":cast_browser_bundle_module" ]
  600. }
  601. header_output = "$root_gen_dir/chromecast/android/${target_name}.h"
  602. }
  603. android_assets("cast_shell_apk_assets") {
  604. sources = [ "$root_out_dir/assets/cast_shell.pak" ]
  605. deps = [
  606. ":cast_shell_apk_locale_assets",
  607. ":cast_shell_pak",
  608. "//third_party/icu:icu_assets",
  609. "//v8:v8_external_startup_data_assets",
  610. ]
  611. disable_compression = true
  612. }
  613. android_assets("cast_shell_apk_locale_assets") {
  614. renaming_sources = []
  615. renaming_destinations = []
  616. foreach(locale, cast_locales) {
  617. renaming_sources += [ "$root_out_dir/chromecast_locales/${locale}.pak" ]
  618. renaming_destinations += [ "stored-locales/${locale}.pak" ]
  619. }
  620. deps = [ ":chromecast_locales_pak" ]
  621. treat_as_locale_paks = true
  622. disable_compression = true
  623. }
  624. android_apk("cast_shell_apk") {
  625. enable_lint = true
  626. lint_baseline_file = "android/lint-baseline.xml"
  627. lint_suppressions_file = "android/lint-suppressions.xml"
  628. apk_name = "CastShell"
  629. android_manifest = "$root_gen_dir/cast_shell_manifest/AndroidManifest.xml"
  630. android_manifest_dep = "//chromecast/browser/android:cast_shell_manifest"
  631. min_sdk_version = 23
  632. target_sdk_version = 33
  633. shared_libraries = [ "//chromecast/android:libcast_shell_android" ]
  634. deps = [
  635. ":cast_shell_apk_assets",
  636. "//base:base_java",
  637. "//base:jni_java",
  638. "//build/android:build_java",
  639. "//chromecast/android:libcast_shell_android",
  640. "//chromecast/browser/android:cast_shell_java",
  641. "//components/crash/core/app:chrome_crashpad_handler_named_as_so",
  642. ]
  643. loadable_modules = [ "$root_out_dir/libchrome_crashpad_handler.so" ]
  644. command_line_flags_file = "castshell-command-line"
  645. enable_multidex = true
  646. }
  647. if (chromecast_branding != "public") {
  648. android_app_bundle_module("cast_browser_bundle_module") {
  649. is_base_module = false
  650. base_module_target = "//chromecast/internal/service/main/android:cast_service_bundle_module"
  651. android_manifest =
  652. "$root_gen_dir/cast_browser_manifest/AndroidManifest.xml"
  653. android_manifest_dep =
  654. "//chromecast/browser/android:cast_browser_manifest"
  655. min_sdk_version = 23
  656. target_sdk_version = 33
  657. package_name = "cast_browser"
  658. # |package_id| is required because the default one conflicts with the base
  659. # modules' ID (0x7f).
  660. package_id = 125
  661. shared_libraries = [ "//chromecast/android:libcast_browser_android" ]
  662. deps = [
  663. "//base:base_java",
  664. "//base:jni_java",
  665. "//build/android:build_java",
  666. "//chromecast/browser/android:cast_browser_java",
  667. "//components/crash/core/app:chrome_crashpad_handler_named_as_so",
  668. "//components/viz/service:service_java",
  669. "//third_party/crashpad/crashpad/handler:crashpad_handler_trampoline",
  670. ]
  671. loadable_modules = [
  672. "$root_out_dir/libchrome_crashpad_handler.so",
  673. "$root_out_dir/libcrashpad_handler_trampoline.so",
  674. ]
  675. # TODO(b/228506503): remove the exclusion rule after cast_service and
  676. # cast_browser depend on different resource targets.
  677. resource_exclusion_regex = "cast_web_contents_activity.xml"
  678. enable_multidex = true
  679. # TODO(b/222780347): Enable when compile errors are resolved on release
  680. # builds.
  681. proguard_enabled = false
  682. generate_native_libraries_java = true
  683. }
  684. }
  685. }