Skip to content

Commit 4711be3

Browse files
authored
cleanup: Remove testonly tag from build targets included in prod build. (#7833)
This change removes the `testonly = true` declaration from `//cobalt/browser` and related targets. To do it, it extracts `shell_switches` into a separate non-testonly target `//cobalt/shell:cobalt_shell_switches` to prevent prod build targets from depending on test-only build target(e.g. cobalt_shell_lib) Bug: 457265539
1 parent af87d28 commit 4711be3

File tree

10 files changed

+15
-27
lines changed

10 files changed

+15
-27
lines changed

cobalt/browser/BUILD.gn

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ source_set("browser") {
9191
}
9292

9393
source_set("features") {
94-
testonly = true
9594
sources = [
9695
"features.cc",
9796
"features.h",
@@ -100,16 +99,14 @@ source_set("features") {
10099
}
101100

102101
source_set("switches") {
103-
testonly = true
104-
105102
sources = [
106103
"switches.cc",
107104
"switches.h",
108105
]
109106

110107
deps = [
111108
"//base",
112-
"//cobalt/shell:cobalt_shell_lib",
109+
"//cobalt/shell:cobalt_shell_switches",
113110
]
114111
}
115112

@@ -131,10 +128,6 @@ action("embed_polyfilled_javascript") {
131128
}
132129

133130
source_set("global_features") {
134-
# TODO(cobalt, b/375655377): remove testonly declaration, needed because of
135-
# being depended-on by :browser above.
136-
testonly = true
137-
138131
sources = [
139132
"experiments/experiment_config_manager.cc",
140133
"experiments/experiment_config_manager.h",
@@ -154,10 +147,6 @@ source_set("global_features") {
154147
}
155148

156149
source_set("metrics") {
157-
# TODO(cobalt, b/375655377): remove testonly declaration, needed because of
158-
# being depended-on by :browser above.
159-
testonly = true
160-
161150
sources = [
162151
"metrics/cobalt_enabled_state_provider.cc",
163152
"metrics/cobalt_enabled_state_provider.h",
@@ -170,7 +159,6 @@ source_set("metrics") {
170159
]
171160
deps = [
172161
"//cobalt/browser/h5vcc_metrics/public/mojom",
173-
"//cobalt/shell:cobalt_shell_lib",
174162
"//components/metrics",
175163
"//components/metrics_services_manager",
176164
"//components/prefs",

cobalt/browser/h5vcc_experiments/BUILD.gn

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414

1515
source_set("h5vcc_experiments") {
16-
testonly = true
1716
sources = [
1817
"h5vcc_experiments_impl.cc",
1918
"h5vcc_experiments_impl.h",

cobalt/browser/h5vcc_metrics/BUILD.gn

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
# limitations under the License.
1414

1515
source_set("h5vcc_metrics") {
16-
# TODO(cobalt, b/375655377): remove testonly declaration, needed because of
17-
# being depended-on by :browser above.
18-
testonly = true
19-
2016
sources = [
2117
"h5vcc_metrics_impl.cc",
2218
"h5vcc_metrics_impl.h",

cobalt/browser/metrics/cobalt_metrics_services_manager_client.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "base/path_service.h"
2121
#include "cobalt/browser/metrics/cobalt_enabled_state_provider.h"
2222
#include "cobalt/browser/metrics/cobalt_metrics_service_client.h"
23-
#include "cobalt/shell/common/shell_paths.h"
2423
#include "components/metrics/client_info.h"
2524
#include "components/metrics/metrics_service.h"
2625
#include "components/metrics/metrics_service_client.h"

cobalt/browser/migrate_storage_record/migration_manager.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "base/time/time.h"
2929
#include "base/timer/elapsed_timer.h"
3030
#include "cobalt/browser/switches.h"
31+
#include "cobalt/shell/common/shell_switches.h"
3132
#include "components/url_matcher/url_util.h"
3233
#include "content/public/browser/render_frame_host.h"
3334
#include "content/public/browser/storage_partition.h"

cobalt/browser/switches.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
#include "cobalt/browser/switches.h"
1616

17+
#include "cobalt/shell/common/shell_switches.h"
18+
1719
namespace cobalt {
1820
namespace switches {
1921

cobalt/browser/switches.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <string>
1616

1717
#include "base/command_line.h"
18-
#include "cobalt/shell/common/shell_switches.h"
1918

2019
#ifndef COBALT_BROWSER_SWITCHES_H_
2120
#define COBALT_BROWSER_SWITCHES_H_

cobalt/shell/BUILD.gn

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,19 @@ source_set("browsertests_sources") {
206206
}
207207
}
208208

209+
static_library("cobalt_shell_switches") {
210+
sources = [
211+
"common/shell_switches.cc",
212+
"common/shell_switches.h",
213+
]
214+
}
215+
209216
static_library("cobalt_shell_lib") {
210217
testonly = true
211-
public_deps = [ ":cobalt_shell_lib_deps" ]
218+
public_deps = [
219+
":cobalt_shell_lib_deps",
220+
":cobalt_shell_switches",
221+
]
212222
sources = [
213223
"browser/shell.cc",
214224
"browser/shell.h",
@@ -241,8 +251,6 @@ static_library("cobalt_shell_lib") {
241251
"common/shell_content_client.h",
242252
"common/shell_paths.cc",
243253
"common/shell_paths.h",
244-
"common/shell_switches.cc",
245-
"common/shell_switches.h",
246254
"gpu/shell_content_gpu_client.cc",
247255
"gpu/shell_content_gpu_client.h",
248256
"renderer/shell_content_renderer_client.cc",

cobalt/shell/common/shell_switches.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
#include "cobalt/shell/common/shell_switches.h"
1616

17-
#include "base/command_line.h"
18-
1917
namespace switches {
2018

2119
// Makes Content Shell use the given path for its data directory.

cobalt/shell/common/shell_switches.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#ifndef COBALT_SHELL_COMMON_SHELL_SWITCHES_H_
1818
#define COBALT_SHELL_COMMON_SHELL_SWITCHES_H_
1919

20-
#include "build/build_config.h"
21-
2220
namespace switches {
2321

2422
constexpr char kDefaultURL[] = "https://www.youtube.com/tv/splash";

0 commit comments

Comments
 (0)