summaryrefslogtreecommitdiffstats
path: root/extensions/shell/BUILD.gn
blob: fca3ec3e9277a789420b8912b52569427f21d761 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//extensions/shell/app_shell.gni")

# Technically, this directory should not depend on files from src/chrome, but
# that's where the VERSION file is. This  should probably all be moved to
# src/build.
import("//chrome/version.gni")
import("//testing/test.gni")
import("//tools/grit/grit_rule.gni")

assert(enable_extensions)

grit("resources") {
  source = "app_shell_resources.grd"
  outputs = [
    "grit/app_shell_resources.h",
    "app_shell_resources.pak",
  ]
}

source_set("app_shell_lib") {
  # TODO(jamescook): investigate and get rid of test dependencies. This library
  # is testonly because it depends on testonly libraries, namely
  # //content/shell:content_shell_lib. See http://crbug.com/438283
  testonly = true
  deps = [
    ":resources",
    ":version_header",
    "//base",
    "//components/devtools_discovery",
    "//components/devtools_http_handler",
    "//components/guest_view/browser",
    "//components/guest_view/common",
    "//components/guest_view/renderer",
    "//components/pref_registry",
    "//components/prefs",
    "//components/update_client",
    "//components/user_prefs",
    "//components/web_cache/renderer",
    "//content",
    "//content/shell:content_shell_lib",
    "//device/core",
    "//device/hid",
    "//extensions:extensions_resources",
    "//extensions:shell_and_test_pak",
    "//extensions/browser",
    "//extensions/common",
    "//extensions/common/api",
    "//extensions/common/api:api_registration",
    "//extensions/renderer",
    "//extensions/shell/common/api",
    "//extensions/shell/common/api:api_registration",
    "//extensions/utility",
    "//mojo/edk/system",
    "//skia",
    "//third_party/WebKit/public:blink",
    "//ui/base",
    "//ui/base/ime",
    "//v8",
  ]

  sources = rebase_path(app_shell_gypi_values.app_shell_lib_sources,
                        ".",
                        "//extensions/shell")

  if (use_aura) {
    deps += [ "//ui/wm" ]

    aura_sources = rebase_path(app_shell_gypi_values.app_shell_lib_sources_aura,
                               ".",
                               "//extensions/shell")
    sources += aura_sources
  }

  if (is_chromeos) {
    deps += [
      "//chromeos",
      "//ui/chromeos:ui_chromeos",
      "//ui/display",
    ]
    chromeos_sources =
        rebase_path(app_shell_gypi_values.app_shell_lib_sources_chromeos,
                    ".",
                    "//extensions/shell")
    sources += chromeos_sources
  }

  if (enable_nacl) {
    sources += [
      "browser/shell_nacl_browser_delegate.cc",
      "browser/shell_nacl_browser_delegate.h",
    ]

    deps += [
      "//components/nacl/browser",
      "//components/nacl/common",
      "//components/nacl/loader",
      "//components/nacl/renderer",
      "//components/nacl/renderer/plugin:nacl_trusted_plugin",
    ]

    if (is_linux) {
      deps += [
        "//components/nacl/loader:helper_nonsfi",
        "//components/nacl/loader:nacl_helper",
      ]
    }
  }

  if (cld_version == 2) {
    deps += [ "//third_party/cld_2:cld2_platform_impl" ]
  }
}

if (!(is_chromeos && !use_ozone)) {
  executable("app_shell") {
    # testonly because :app_shell_lib is testonly. See :app_shell_lib comment.
    testonly = true
    sources = rebase_path(app_shell_gypi_values.app_shell_sources,
                          ".",
                          "//extensions/shell")
    deps = [
      ":app_shell_lib",
      "//build/config/sanitizers:deps",
      "//extensions:shell_and_test_pak",
    ]

    if (is_win) {
      configs += [ "//build/config/win:windowed" ]
      configs -= [ "//build/config/win:console" ]
    }

    if (is_mac) {
      # TODO(GYP) bug 546894: Fix GN and toolchains to handle spaces here.
      #output_name = "App Shell"
      # TODO(GYP): Mac bundling. See also content_shell which this is basically
      # a copy-paste of.
      deps += [ ":app_shell_framework" ]
      # TODO(GYP): Mac app_shell_helper stuff.
    }
  }
}

test("app_shell_unittests") {
  sources = rebase_path(app_shell_gypi_values.app_shell_unittests_sources,
                        ".",
                        "//extensions/shell")

  data = [
    "//extensions/test/data/",
    "$root_out_dir/extensions_shell_and_test.pak",

    #"$root_out_dir/natives_blob.bin", # move to gin
    #"$root_out_dir/snapshot_blob.bin",
  ]

  deps = [
    ":app_shell_lib",
    "//base",
    "//base/test:test_support",
    "//content/test:test_support",
    "//extensions:shell_and_test_pak",
    "//extensions:test_support",
    "//testing/gtest",
  ]

  data_deps = [
    # "//gin", # TODO(dpranke): Either gin or v8 data is needed ...
    "//third_party/mesa:osmesa",
  ]

  if (use_aura) {
    deps += [ "//ui/aura:test_support" ]

    aura_sources =
        rebase_path(app_shell_gypi_values.app_shell_unittests_sources_aura,
                    ".",
                    "//extensions/shell")
    sources += aura_sources
  }

  if (is_chromeos) {
    deps += [ "//chromeos:test_support_without_gmock" ]

    chromeos_sources =
        rebase_path(app_shell_gypi_values.app_shell_unittests_sources_chromeos,
                    ".",
                    "//extensions/shell")
    sources += chromeos_sources
  }

  # TODO(GYP): Enable this when //components/nacl GN is done.
  if (false) {
    if (use_nacl) {
      nacl_sources =
          rebase_path(app_shell_gypi_values.app_shell_unittests_sources_nacl,
                      ".",
                      "//extensions/shell")
      sources += nacl_sources
    }
  }
}

process_version("version_header") {
  template_file = "common/version.h.in"
  output = "$target_gen_dir/common/version.h"
}

if (is_mac) {
  # TODO(GYP) this should be a bundle. Lots of other stuff in this target.
  # Should be able to copy content shell framework (this is basically a
  # copy-paste of that target).
  shared_library("app_shell_framework") {
    testonly = true
    sources = [
      "app/shell_main_mac.cc",
      "app/shell_main_mac.h",
    ]
    deps = [
      ":app_shell_lib",
    ]
  }
}