Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: build/config/win/manifest.gni

Issue 1943103002: Recompile .rc files when manifests change in GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # HOW MANIFESTS WORK IN THE GN BUILD 5 # HOW MANIFESTS WORK IN THE GN BUILD
6 # 6 #
7 # Use the windows_manifest template to declare a manifest generation step. 7 # Use the windows_manifest template to declare a manifest generation step.
8 # This will combine all listed .manifest files and generate a resource file 8 # This will combine all listed .manifest files and generate a resource file
9 # referencing the resulting manifest. To link this manifest, just depend on 9 # referencing the resulting manifest. To link this manifest, just depend on
10 # the manifest target from your executable or shared library. 10 # the manifest target from your executable or shared library.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 template("windows_manifest") { 86 template("windows_manifest") {
87 manifest_action_name = "${target_name}__gen_manifest" 87 manifest_action_name = "${target_name}__gen_manifest"
88 rc_action_name = "${target_name}__gen_rc" 88 rc_action_name = "${target_name}__gen_rc"
89 source_set_name = target_name 89 source_set_name = target_name
90 90
91 output_manifest = "$target_gen_dir/$source_set_name.manifest" 91 output_manifest = "$target_gen_dir/$source_set_name.manifest"
92 rcfile = "$output_manifest.rc" 92 rcfile = "$output_manifest.rc"
93 93
94 # Make the final .manifest file. 94 # Make the final .manifest file.
95 action(manifest_action_name) { 95 action(manifest_action_name) {
96 visibility = [ ":$source_set_name" ] 96 visibility = [
97 ":$source_set_name",
98 ":$rc_action_name",
99 ]
97 100
98 script = "$root_build_dir/gyp-win-tool" 101 script = "$root_build_dir/gyp-win-tool"
99 102
100 assert(defined(invoker.sources), 103 assert(defined(invoker.sources),
101 "\"sources\" must be defined for a windows_manifest target") 104 "\"sources\" must be defined for a windows_manifest target")
102 inputs = invoker.sources 105 inputs = invoker.sources
103 106
104 outputs = [ 107 outputs = [
105 output_manifest, 108 output_manifest,
106 ] 109 ]
107 110
108 args = [ 111 args = [
109 "manifest-wrapper", 112 "manifest-wrapper",
110 _environment_file, 113 _environment_file,
111 "mt.exe", 114 "mt.exe",
112 "-nologo", 115 "-nologo",
113 "-manifest", 116 "-manifest",
114 ] 117 ]
115 args += rebase_path(invoker.sources, root_build_dir) 118 args += rebase_path(invoker.sources, root_build_dir)
116 args += [ "-out:" + rebase_path(output_manifest, root_build_dir) ] 119 args += [ "-out:" + rebase_path(output_manifest, root_build_dir) ]
117 120
118 # Apply any dependencies from the invoker to this target, since those 121 # Apply any dependencies from the invoker to this target, since those
119 # dependencies may have created the input manifest files. 122 # dependencies may have created the input manifest files.
120 forward_variables_from(invoker, [ "deps" ]) 123 forward_variables_from(invoker, [ "deps" ])
121 } 124 }
122 125
123 # Make the .rc file that references the final manifest file. The manifest 126 # Make the .rc file that references the final manifest file.
124 # generation doesn't need to be a dependency because it's not actually
125 # needed until the .rc is compiled.
126 # 127 #
127 # This could easily be combined into one step, but this current separation 128 # This could easily be combined into one step, but this current separation
128 # of .manifest and .rc matches GYP and allows us to re-use gyp-win-tool. 129 # of .manifest and .rc matches GYP and allows us to re-use gyp-win-tool.
129 action(rc_action_name) { 130 action(rc_action_name) {
130 visibility = [ ":$source_set_name" ] 131 visibility = [ ":$source_set_name" ]
131 132
132 script = "$root_build_dir/gyp-win-tool" 133 script = "$root_build_dir/gyp-win-tool"
133 134
134 outputs = [ 135 outputs = [
135 rcfile, 136 rcfile,
(...skipping 10 matching lines...) Expand all
146 assert(false, "Bad value of \"type\", Must be \"exe\" or \"dll\"") 147 assert(false, "Bad value of \"type\", Must be \"exe\" or \"dll\"")
147 } 148 }
148 149
149 args = [ 150 args = [
150 "manifest-to-rc", 151 "manifest-to-rc",
151 "$_environment_file", 152 "$_environment_file",
152 rebase_path(output_manifest), 153 rebase_path(output_manifest),
153 rebase_path(rcfile, root_build_dir), 154 rebase_path(rcfile, root_build_dir),
154 manifest_resource_id, 155 manifest_resource_id,
155 ] 156 ]
157
158 # Although generating this file doesn't technically depend on the
159 # generated manifest, this dependency causes the .rc timestamp to be
160 # updated every time the manifest is updated. Otherwise, updating the
161 # manifest will not cause a recompilation of the .rc file.
162 deps = [
163 ":$manifest_action_name",
164 ]
156 } 165 }
157 166
158 # This source set only exists to compile and link the resource file. 167 # This source set only exists to compile and link the resource file.
159 source_set(source_set_name) { 168 source_set(source_set_name) {
160 forward_variables_from(invoker, [ "visibility" ]) 169 forward_variables_from(invoker, [ "visibility" ])
161 sources = [ 170 sources = [
162 rcfile, 171 rcfile,
163 ] 172 ]
164 deps = [ 173 deps = [
165 ":$manifest_action_name", 174 ":$manifest_action_name",
166 ":$rc_action_name", 175 ":$rc_action_name",
167 ] 176 ]
168 } 177 }
169 } 178 }
170 } else { 179 } else {
171 # Make a no-op group on non-Windows platforms so windows_manifest 180 # Make a no-op group on non-Windows platforms so windows_manifest
172 # instantiations don't need to be inside windows blocks. 181 # instantiations don't need to be inside windows blocks.
173 template("windows_manifest") { 182 template("windows_manifest") {
174 group(target_name) { 183 group(target_name) {
175 # Prevent unused variable warnings on non-Windows platforms. 184 # Prevent unused variable warnings on non-Windows platforms.
176 assert(invoker.type == "exe" || invoker.type == "dll") 185 assert(invoker.type == "exe" || invoker.type == "dll")
177 assert(invoker.sources != "") 186 assert(invoker.sources != "")
178 assert(!defined(invoker.deps) || invoker.deps != "") 187 assert(!defined(invoker.deps) || invoker.deps != "")
179 assert(!defined(invoker.visibility) || invoker.visibility != "") 188 assert(!defined(invoker.visibility) || invoker.visibility != "")
180 } 189 }
181 } 190 }
182 } 191 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698