BUILD.gn 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. # Copyright 2014 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/chromeos/ui_mode.gni")
  6. import("//components/gcm_driver/config.gni")
  7. buildflag_header("gcm_buildflags") {
  8. header = "gcm_buildflags.h"
  9. flags = [ "USE_GCM_FROM_PLATFORM=$use_gcm_from_platform" ]
  10. }
  11. static_library("gcm_driver") {
  12. sources = [
  13. "features.cc",
  14. "features.h",
  15. "gcm_activity.cc",
  16. "gcm_activity.h",
  17. "gcm_app_handler.cc",
  18. "gcm_app_handler.h",
  19. "gcm_backoff_policy.cc",
  20. "gcm_backoff_policy.h",
  21. "gcm_client.cc",
  22. "gcm_client.h",
  23. "gcm_connection_observer.cc",
  24. "gcm_connection_observer.h",
  25. "gcm_delayed_task_controller.cc",
  26. "gcm_delayed_task_controller.h",
  27. "gcm_driver.cc",
  28. "gcm_driver.h",
  29. "gcm_driver_constants.cc",
  30. "gcm_driver_constants.h",
  31. "gcm_internals_constants.cc",
  32. "gcm_internals_constants.h",
  33. "gcm_internals_helper.cc",
  34. "gcm_internals_helper.h",
  35. "gcm_profile_service.cc",
  36. "gcm_profile_service.h",
  37. "registration_info.cc",
  38. "registration_info.h",
  39. "system_encryptor.cc",
  40. "system_encryptor.h",
  41. ]
  42. public_deps = [
  43. "//base",
  44. "//components/gcm_driver/common",
  45. "//components/gcm_driver/crypto",
  46. "//components/gcm_driver/instance_id",
  47. "//crypto",
  48. ]
  49. deps = [
  50. ":gcm_buildflags",
  51. "//base:i18n",
  52. "//components/crx_file",
  53. "//components/keyed_service/core",
  54. "//components/os_crypt",
  55. "//components/pref_registry",
  56. "//components/prefs",
  57. "//components/signin/public/identity_manager",
  58. "//components/version_info",
  59. "//google_apis",
  60. "//google_apis/gcm",
  61. "//net",
  62. "//services/network/public/cpp",
  63. "//services/network/public/mojom",
  64. "//url:url",
  65. ]
  66. # This target goes with these other deps and they can include headers from
  67. # each other.
  68. allow_circular_includes_from = [
  69. "//components/gcm_driver/crypto",
  70. "//components/gcm_driver/instance_id",
  71. ]
  72. if (use_gcm_from_platform) {
  73. assert(is_android)
  74. sources += [
  75. "gcm_driver_android.cc",
  76. "gcm_driver_android.h",
  77. "gcm_stats_recorder_android.cc",
  78. "gcm_stats_recorder_android.h",
  79. ]
  80. } else {
  81. sources += [
  82. "account_tracker.cc",
  83. "account_tracker.h",
  84. "gcm_account_mapper.cc",
  85. "gcm_account_mapper.h",
  86. "gcm_account_tracker.cc",
  87. "gcm_account_tracker.h",
  88. "gcm_client_factory.cc",
  89. "gcm_client_factory.h",
  90. "gcm_client_impl.cc",
  91. "gcm_client_impl.h",
  92. "gcm_desktop_utils.cc",
  93. "gcm_desktop_utils.h",
  94. "gcm_driver_desktop.cc",
  95. "gcm_driver_desktop.h",
  96. "gcm_stats_recorder_impl.cc",
  97. "gcm_stats_recorder_impl.h",
  98. ]
  99. deps += [
  100. "//build:chromeos_buildflags",
  101. "//components/crx_file",
  102. "//google_apis/gcm",
  103. ]
  104. }
  105. if (is_android) {
  106. deps += [ "android:jni_headers" ]
  107. }
  108. }
  109. static_library("test_support") {
  110. testonly = true
  111. sources = [
  112. "fake_gcm_app_handler.cc",
  113. "fake_gcm_app_handler.h",
  114. "fake_gcm_driver.cc",
  115. "fake_gcm_driver.h",
  116. "fake_gcm_profile_service.cc",
  117. "fake_gcm_profile_service.h",
  118. ]
  119. public_deps = [ ":gcm_driver" ]
  120. deps = [
  121. "//base",
  122. "//components/gcm_driver/instance_id:test_support",
  123. "//google_apis/gcm:test_support",
  124. "//net",
  125. "//services/network:test_support",
  126. "//services/network/public/cpp",
  127. "//services/network/public/mojom",
  128. "//testing/gtest",
  129. ]
  130. # This target goes with Instance ID and they can include headers from each
  131. # other.
  132. allow_circular_includes_from =
  133. [ "//components/gcm_driver/instance_id:test_support" ]
  134. if (is_ios) {
  135. sources -= [
  136. "fake_gcm_profile_service.cc",
  137. "fake_gcm_profile_service.h",
  138. ]
  139. }
  140. if (!use_gcm_from_platform) {
  141. sources += [
  142. "fake_gcm_client.cc",
  143. "fake_gcm_client.h",
  144. "fake_gcm_client_factory.cc",
  145. "fake_gcm_client_factory.h",
  146. ]
  147. deps += [ "//google_apis/gcm:test_support" ]
  148. }
  149. }
  150. # This is part of the components_unittests BUILD target.
  151. source_set("unit_tests") {
  152. testonly = true
  153. sources = [ "gcm_delayed_task_controller_unittest.cc" ]
  154. deps = [
  155. ":gcm_driver",
  156. ":test_support",
  157. "//base",
  158. "//base/test:test_support",
  159. "//components/gcm_driver/crypto",
  160. "//components/prefs:test_support",
  161. "//google_apis:test_support",
  162. "//google_apis/gcm:test_support",
  163. "//net:test_support",
  164. "//testing/gtest",
  165. "//third_party/leveldatabase",
  166. "//third_party/protobuf:protobuf_lite",
  167. ]
  168. if (is_android) {
  169. sources += [ "gcm_stats_recorder_android_unittest.cc" ]
  170. }
  171. if (!use_gcm_from_platform) {
  172. sources += [
  173. "account_tracker_unittest.cc",
  174. "gcm_account_mapper_unittest.cc",
  175. "gcm_account_tracker_unittest.cc",
  176. "gcm_client_impl_unittest.cc",
  177. "gcm_driver_desktop_unittest.cc",
  178. "gcm_driver_unittest.cc",
  179. "gcm_stats_recorder_impl_unittest.cc",
  180. ]
  181. deps += [
  182. "//build:chromeos_buildflags",
  183. "//components/signin/public/identity_manager:test_support",
  184. ]
  185. }
  186. }