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