| OLD | NEW | 
|---|
| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 70 #     ] | 70 #     ] | 
| 71 #     type = "exe" | 71 #     type = "exe" | 
| 72 #   } | 72 #   } | 
| 73 # | 73 # | 
| 74 #   executable("doom_melon") { | 74 #   executable("doom_melon") { | 
| 75 #     deps = [ ":doom_melon_manifest" ] | 75 #     deps = [ ":doom_melon_manifest" ] | 
| 76 #     ... | 76 #     ... | 
| 77 #   } | 77 #   } | 
| 78 | 78 | 
| 79 if (is_win) { | 79 if (is_win) { | 
| 80   # This is the environment file that gyp-win-tool will use for the current | 80   # This is the environment file that tool_wrapper.py will use for the current | 
| 81   # toolchain. It is placed in root_build_dir by the toolchain setup. This | 81   # toolchain. It is placed in root_build_dir by the toolchain setup. This | 
| 82   # variable is the path relative to the root_build_dir which is what | 82   # variable is the path relative to the root_build_dir which is what | 
| 83   # gyp-win-tool expects as an argument. | 83   # tool_wrapper.py expects as an argument. | 
| 84   _environment_file = "environment.$current_cpu" | 84   _environment_file = "environment.$current_cpu" | 
| 85 | 85 | 
| 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 = [ | 96       visibility = [ | 
| 97         ":$source_set_name", | 97         ":$source_set_name", | 
| 98         ":$rc_action_name", | 98         ":$rc_action_name", | 
| 99       ] | 99       ] | 
| 100 | 100 | 
| 101       script = "$root_build_dir/gyp-win-tool" | 101       script = "//build/toolchain/win/tool_wrapper.py" | 
| 102 | 102 | 
| 103       assert(defined(invoker.sources), | 103       assert(defined(invoker.sources), | 
| 104              "\"sources\" must be defined for a windows_manifest target") | 104              "\"sources\" must be defined for a windows_manifest target") | 
| 105       inputs = invoker.sources | 105       inputs = invoker.sources | 
| 106 | 106 | 
| 107       outputs = [ | 107       outputs = [ | 
| 108         output_manifest, | 108         output_manifest, | 
| 109       ] | 109       ] | 
| 110 | 110 | 
| 111       args = [ | 111       args = [ | 
| 112         "manifest-wrapper", | 112         "manifest-wrapper", | 
| 113         _environment_file, | 113         _environment_file, | 
| 114         "mt.exe", | 114         "mt.exe", | 
| 115         "-nologo", | 115         "-nologo", | 
| 116         "-manifest", | 116         "-manifest", | 
| 117       ] | 117       ] | 
| 118       args += rebase_path(invoker.sources, root_build_dir) | 118       args += rebase_path(invoker.sources, root_build_dir) | 
| 119       args += [ "-out:" + rebase_path(output_manifest, root_build_dir) ] | 119       args += [ "-out:" + rebase_path(output_manifest, root_build_dir) ] | 
| 120 | 120 | 
| 121       # Apply any dependencies from the invoker to this target, since those | 121       # Apply any dependencies from the invoker to this target, since those | 
| 122       # dependencies may have created the input manifest files. | 122       # dependencies may have created the input manifest files. | 
| 123       forward_variables_from(invoker, [ "deps" ]) | 123       forward_variables_from(invoker, [ "deps" ]) | 
| 124     } | 124     } | 
| 125 | 125 | 
| 126     # Make the .rc file that references the final manifest file. | 126     # Make the .rc file that references the final manifest file. | 
| 127     # | 127     # | 
| 128     # 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 | 
| 129     # 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 tool_wrapper.py. | 
| 130     action(rc_action_name) { | 130     action(rc_action_name) { | 
| 131       visibility = [ ":$source_set_name" ] | 131       visibility = [ ":$source_set_name" ] | 
| 132 | 132 | 
| 133       script = "$root_build_dir/gyp-win-tool" | 133       script = "//build/toolchain/win/tool_wrapper.py" | 
| 134 | 134 | 
| 135       outputs = [ | 135       outputs = [ | 
| 136         rcfile, | 136         rcfile, | 
| 137       ] | 137       ] | 
| 138 | 138 | 
| 139       # EXEs have a resource ID of 1 for their manifest, DLLs use 2. | 139       # EXEs have a resource ID of 1 for their manifest, DLLs use 2. | 
| 140       assert(defined(invoker.type), | 140       assert(defined(invoker.type), | 
| 141              "\"type\" must be defined for a windows_manifest") | 141              "\"type\" must be defined for a windows_manifest") | 
| 142       if (invoker.type == "exe") { | 142       if (invoker.type == "exe") { | 
| 143         manifest_resource_id = "1" | 143         manifest_resource_id = "1" | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 182   template("windows_manifest") { | 182   template("windows_manifest") { | 
| 183     group(target_name) { | 183     group(target_name) { | 
| 184       # Prevent unused variable warnings on non-Windows platforms. | 184       # Prevent unused variable warnings on non-Windows platforms. | 
| 185       assert(invoker.type == "exe" || invoker.type == "dll") | 185       assert(invoker.type == "exe" || invoker.type == "dll") | 
| 186       assert(invoker.sources != "") | 186       assert(invoker.sources != "") | 
| 187       assert(!defined(invoker.deps) || invoker.deps != "") | 187       assert(!defined(invoker.deps) || invoker.deps != "") | 
| 188       assert(!defined(invoker.visibility) || invoker.visibility != "") | 188       assert(!defined(invoker.visibility) || invoker.visibility != "") | 
| 189     } | 189     } | 
| 190   } | 190   } | 
| 191 } | 191 } | 
| OLD | NEW | 
|---|