summaryrefslogtreecommitdiff
path: root/chromium/ui/file_manager/BUILD.gn
blob: fb6ec9b678522fa84e9d6315d25474811d1ea8f2 (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
# 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("//chrome/common/features.gni")
import("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/grit/preprocess_grit.gni")
import("//ui/webui/resources/tools/generate_grd.gni")

grit("resources") {
  source = "file_manager_resources.grd"
  outputs = [
    "grit/file_manager_resources.h",
    "grit/file_manager_resources_map.cc",
    "grit/file_manager_resources_map.h",
    "file_manager_resources.pak",
    "file_manager_resources.rc",
  ]
}

component("file_manager") {
  sources = [ "file_manager_export.h" ]
  public_deps = [
    ":file_manager_gen_resources",
    ":resources",
    "//base",
  ]
  defines = [ "FILE_MANAGER_IMPLEMENTATION" ]
}

group("closure_compile") {
  # Subfolders' closure_compile groups bundle the non-test "module" type-check
  # groups as well as unittests and test_support.
  testonly = true

  deps = [
    "audio_player/elements:closure_compile",
    "audio_player/js:closure_compile",
    "base/js:closure_compile",
    "file_manager/background/js:closure_compile",
    "file_manager/common/js:closure_compile",
    "file_manager/foreground/elements:closure_compile",
    "file_manager/foreground/js:closure_compile",
    "file_manager/foreground/js/metadata:closure_compile",
    "file_manager/foreground/js/ui:closure_compile",
    "file_manager/test:closure_compile",
    "gallery/js:closure_compile",
    "gallery/js/image_editor:closure_compile",
    "image_loader:closure_compile",
    "integration_tests:closure_compile",
    "integration_tests/file_manager:closure_compile",
    "video_player/js:closure_compile",
  ]
}

group("unit_test_data") {
  testonly = true
  deps = [
    "base/js:js_test_gen_html",
    "file_manager/background/js:js_test_gen_html",
    "file_manager/common/js:js_test_gen_html",
    "file_manager/common/js:js_test_gen_html_modules",
    "file_manager/foreground/elements:js_test_gen_html",
    "file_manager/foreground/js:js_test_gen_html",
    "file_manager/foreground/js/metadata:js_test_gen_html",
    "file_manager/foreground/js/metadata:js_test_gen_html_modules",
    "file_manager/foreground/js/ui:js_test_gen_html",
    "gallery/js:js_test_gen_html",
    "gallery/js/image_editor:js_test_gen_html",
    "image_loader:js_test_gen_html",
    "image_loader:js_test_gen_html_modules",
    "video_player/js:js_test_gen_html",
  ]
}

preprocess_folder = "$target_gen_dir/preprocessed"

# Inline images and move files to the preprocessed folder to combine all
# resources in the same folder to be able to generate the JS bundle.
# This is for files direct from the src/:  input_folder="./".
preprocess_grit("preprocess_static") {
  in_folder = "./"
  out_folder = preprocess_folder

  in_files = [ "audio_player/js/main.m.js" ]

  deps = [ "//ui/file_manager/audio_player/js:main.m" ]
}

# This is for files that are generated in "gen/": input_folder=target_gen_dir.
preprocess_grit("preprocess_generated") {
  in_folder = target_gen_dir
  out_folder = preprocess_folder

  in_files = [
    "base/js/app_util.m.js",
    "base/js/volume_manager_types.m.js",
    "base/js/mediasession_types.m.js",
  ]

  deps = [ "//ui/file_manager/base/js:modulize" ]
}

grd_prefix = "file_manager_gen"
generated_grd = "$target_gen_dir/${grd_prefix}_resources.grd"

generate_grd("build_grd") {
  out_grd = generated_grd

  input_files_base_dir =
      rebase_path("$target_gen_dir/preprocessed", root_gen_dir)
  input_files = [ "../audio_player/js/main.m.rollup.js" ]

  resource_path_rewrites =
      [ "../audio_player/js/main.m.rollup.js|audio_player/js/main.m.js" ]

  deps = [ "//ui/file_manager/audio_player/js:build" ]
}

# Resources for the JS modules.
grit("file_manager_gen_resources") {
  grit_flags = [
    "-E",
    "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
    "-E",
    "root_src_dir=" + rebase_path(root_gen_dir, root_build_dir),
  ]

  defines = chrome_grit_defines

  # These arguments are needed since the grd is generated at build time.
  enable_input_discovery_for_gn_analyze = false
  defines +=
      [ "SHARED_INTERMEDIATE_DIR=" + rebase_path(root_gen_dir, root_build_dir) ]

  source = generated_grd
  deps = [ ":build_grd" ]

  outputs = [
    "grit/file_manager_gen_resources.h",
    "grit/file_manager_gen_resources_map.cc",
    "grit/file_manager_gen_resources_map.h",
    "file_manager_gen_resources.pak",
  ]
  output_dir = "$root_gen_dir/ui/file_manager"
}