BUILD.gn 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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. # Note that this build file assumes rlz_use_chrome_net which is a condition in
  5. # the GYP file, but is always true for Chrome builds.
  6. import("//build/config/chromeos/ui_mode.gni")
  7. import("//rlz/buildflags/buildflags.gni")
  8. import("//testing/test.gni")
  9. config("rlz_lib_config") {
  10. defines = [ "RLZ_NETWORK_IMPLEMENTATION_CHROME_NET" ]
  11. }
  12. source_set("rlz_utils") {
  13. sources = [
  14. "lib/assert.cc",
  15. "lib/assert.h",
  16. "lib/crc32.h",
  17. "lib/crc32_wrapper.cc",
  18. "lib/lib_values.cc",
  19. "lib/lib_values.h",
  20. "lib/net_response_check.cc",
  21. "lib/net_response_check.h",
  22. "lib/rlz_api.h",
  23. "lib/rlz_enums.h",
  24. "lib/string_utils.cc",
  25. "lib/string_utils.h",
  26. ]
  27. public_deps = [ "//base" ]
  28. deps = [
  29. "//build:chromeos_buildflags",
  30. "//third_party/zlib",
  31. ]
  32. }
  33. if (enable_rlz_support) {
  34. source_set("rlz_lib_no_network") {
  35. sources = [
  36. "lib/crc8.cc",
  37. "lib/crc8.h",
  38. "lib/machine_deal_win.h",
  39. "lib/machine_id.cc",
  40. "lib/machine_id.h",
  41. "lib/rlz_lib_clear.cc",
  42. "lib/rlz_lib_clear.h",
  43. "lib/rlz_value_store.h",
  44. "lib/supplementary_branding.cc",
  45. "lib/supplementary_branding.h",
  46. "lib/time_util.h",
  47. ]
  48. if (is_win) {
  49. sources += [
  50. "lib/time_util_win.cc",
  51. "win/lib/lib_mutex.cc",
  52. "win/lib/lib_mutex.h",
  53. "win/lib/machine_deal.cc",
  54. "win/lib/machine_deal.h",
  55. "win/lib/machine_id_win.cc",
  56. "win/lib/process_info.cc",
  57. "win/lib/process_info.h",
  58. "win/lib/registry_util.cc",
  59. "win/lib/registry_util.h",
  60. "win/lib/rlz_lib_win.cc",
  61. "win/lib/rlz_value_store_registry.cc",
  62. "win/lib/rlz_value_store_registry.h",
  63. ]
  64. } else {
  65. sources += [ "lib/time_util_base.cc" ]
  66. }
  67. deps = [
  68. ":rlz_utils",
  69. "//base",
  70. "//build:chromeos_buildflags",
  71. ]
  72. if (is_chromeos_ash) {
  73. sources += [
  74. "chromeos/lib/rlz_value_store_chromeos.cc",
  75. "chromeos/lib/rlz_value_store_chromeos.h",
  76. ]
  77. deps += [
  78. "//chromeos/dbus",
  79. "//chromeos/system",
  80. ]
  81. }
  82. if (is_apple) {
  83. sources += [
  84. "mac/lib/rlz_value_store_mac.h",
  85. "mac/lib/rlz_value_store_mac.mm",
  86. ]
  87. frameworks = [ "Foundation.framework" ]
  88. if (is_mac) {
  89. sources += [ "mac/lib/machine_id_mac.cc" ]
  90. frameworks += [ "IOKit.framework" ]
  91. }
  92. if (is_ios) {
  93. sources += [ "ios/lib/machine_id_ios.cc" ]
  94. }
  95. }
  96. if (is_posix) {
  97. sources += [
  98. "lib/recursive_cross_process_lock_posix.cc",
  99. "lib/recursive_cross_process_lock_posix.h",
  100. ]
  101. }
  102. }
  103. source_set("rlz_lib") {
  104. sources = [
  105. "lib/financial_ping.cc",
  106. "lib/financial_ping.h",
  107. "lib/rlz_lib.cc",
  108. "lib/rlz_lib.h",
  109. ]
  110. public_deps = [
  111. ":rlz_lib_no_network",
  112. "//base",
  113. ]
  114. deps = [
  115. ":rlz_utils",
  116. "//base/third_party/dynamic_annotations",
  117. "//build:chromeos_buildflags",
  118. "//net",
  119. "//services/network/public/cpp:cpp",
  120. "//services/network/public/mojom",
  121. "//url",
  122. ]
  123. if (is_chromeos_ash) {
  124. deps += [
  125. "//chromeos/dbus",
  126. "//chromeos/system",
  127. ]
  128. }
  129. public_configs = [ ":rlz_lib_config" ]
  130. }
  131. source_set("test_support") {
  132. testonly = true
  133. sources = [
  134. "test/rlz_test_helpers.cc",
  135. "test/rlz_test_helpers.h",
  136. ]
  137. public_deps = [
  138. "//base",
  139. "//base/test:test_support",
  140. "//testing/gtest",
  141. ]
  142. deps = [
  143. ":rlz_lib",
  144. "//build:chromeos_buildflags",
  145. ]
  146. if (is_chromeos_ash) {
  147. public_deps += [ "//chromeos/system" ]
  148. }
  149. }
  150. test("rlz_unittests") {
  151. sources = [
  152. "lib/crc32_unittest.cc",
  153. "lib/crc8_unittest.cc",
  154. "lib/financial_ping_test.cc",
  155. "lib/lib_values_unittest.cc",
  156. "lib/machine_id_unittest.cc",
  157. "lib/rlz_lib_test.cc",
  158. "lib/string_utils_unittest.cc",
  159. "test/rlz_unittest_main.cc",
  160. ]
  161. if (is_win) {
  162. sources += [ "win/lib/machine_deal_test.cc" ]
  163. }
  164. deps = [
  165. ":rlz_lib",
  166. ":rlz_utils",
  167. ":test_support",
  168. "//base",
  169. "//build:chromeos_buildflags",
  170. "//mojo/core/embedder",
  171. "//net:test_support",
  172. "//services/network:test_support",
  173. "//testing/gmock",
  174. "//testing/gtest",
  175. "//third_party/zlib",
  176. ]
  177. if (is_chromeos_ash) {
  178. deps += [
  179. "//chromeos/dbus:test_support",
  180. "//chromeos/system",
  181. ]
  182. }
  183. }
  184. }
  185. if (!is_ios && !is_android) {
  186. executable("rlz_id") {
  187. sources = [ "examples/rlz_id.cc" ]
  188. deps = [
  189. ":rlz_lib",
  190. "//build/win:default_exe_manifest",
  191. ]
  192. }
  193. }
  194. if (is_win) {
  195. shared_library("rlz") {
  196. sources = [
  197. "win/dll/dll_main.cc",
  198. "win/dll/exports.cc",
  199. ]
  200. deps = [
  201. ":rlz_lib",
  202. ":rlz_utils",
  203. "//third_party/zlib",
  204. ]
  205. }
  206. }