OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "tools/gn/target.h" | 5 #include "tools/gn/target.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "tools/gn/config_values_extractors.h" | 10 #include "tools/gn/config_values_extractors.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 // static | 119 // static |
120 const char* Target::GetStringForOutputType(OutputType type) { | 120 const char* Target::GetStringForOutputType(OutputType type) { |
121 switch (type) { | 121 switch (type) { |
122 case UNKNOWN: | 122 case UNKNOWN: |
123 return "Unknown"; | 123 return "Unknown"; |
124 case GROUP: | 124 case GROUP: |
125 return "Group"; | 125 return "Group"; |
126 case EXECUTABLE: | 126 case EXECUTABLE: |
127 return "Executable"; | 127 return "Executable"; |
| 128 case LOADABLE_MODULE: |
| 129 return "Loadable module"; |
128 case SHARED_LIBRARY: | 130 case SHARED_LIBRARY: |
129 return "Shared library"; | 131 return "Shared library"; |
130 case STATIC_LIBRARY: | 132 case STATIC_LIBRARY: |
131 return "Static library"; | 133 return "Static library"; |
132 case SOURCE_SET: | 134 case SOURCE_SET: |
133 return "Source set"; | 135 return "Source set"; |
134 case COPY_FILES: | 136 case COPY_FILES: |
135 return "Copy"; | 137 return "Copy"; |
136 case ACTION: | 138 case ACTION: |
137 return "Action"; | 139 return "Action"; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 } | 188 } |
187 | 189 |
188 return true; | 190 return true; |
189 } | 191 } |
190 | 192 |
191 bool Target::IsLinkable() const { | 193 bool Target::IsLinkable() const { |
192 return output_type_ == STATIC_LIBRARY || output_type_ == SHARED_LIBRARY; | 194 return output_type_ == STATIC_LIBRARY || output_type_ == SHARED_LIBRARY; |
193 } | 195 } |
194 | 196 |
195 bool Target::IsFinal() const { | 197 bool Target::IsFinal() const { |
196 return output_type_ == EXECUTABLE || output_type_ == SHARED_LIBRARY || | 198 return output_type_ == EXECUTABLE || |
| 199 output_type_ == SHARED_LIBRARY || |
| 200 output_type_ == LOADABLE_MODULE || |
197 (output_type_ == STATIC_LIBRARY && complete_static_lib_); | 201 (output_type_ == STATIC_LIBRARY && complete_static_lib_); |
198 } | 202 } |
199 | 203 |
200 DepsIteratorRange Target::GetDeps(DepsIterationType type) const { | 204 DepsIteratorRange Target::GetDeps(DepsIterationType type) const { |
201 if (type == DEPS_LINKED) { | 205 if (type == DEPS_LINKED) { |
202 return DepsIteratorRange(DepsIterator( | 206 return DepsIteratorRange(DepsIterator( |
203 &public_deps_, &private_deps_, nullptr)); | 207 &public_deps_, &private_deps_, nullptr)); |
204 } | 208 } |
205 // All deps. | 209 // All deps. |
206 return DepsIteratorRange(DepsIterator( | 210 return DepsIteratorRange(DepsIterator( |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 case ACTION_FOREACH: { | 347 case ACTION_FOREACH: { |
344 // These don't get linked to and use stamps which should be the first | 348 // These don't get linked to and use stamps which should be the first |
345 // entry in the outputs. These stamps are named | 349 // entry in the outputs. These stamps are named |
346 // "<target_out_dir>/<targetname>.stamp". | 350 // "<target_out_dir>/<targetname>.stamp". |
347 dependency_output_file_ = GetTargetOutputDirAsOutputFile(this); | 351 dependency_output_file_ = GetTargetOutputDirAsOutputFile(this); |
348 dependency_output_file_.value().append(GetComputedOutputName(true)); | 352 dependency_output_file_.value().append(GetComputedOutputName(true)); |
349 dependency_output_file_.value().append(".stamp"); | 353 dependency_output_file_.value().append(".stamp"); |
350 break; | 354 break; |
351 } | 355 } |
352 case EXECUTABLE: | 356 case EXECUTABLE: |
353 // Executables don't get linked to, but the first output is used for | 357 case LOADABLE_MODULE: |
354 // dependency management. | 358 // Executables and loadable modules don't get linked to, but the first |
| 359 // output is used for dependency management. |
355 CHECK_GE(tool->outputs().list().size(), 1u); | 360 CHECK_GE(tool->outputs().list().size(), 1u); |
356 check_tool_outputs = true; | 361 check_tool_outputs = true; |
357 dependency_output_file_ = | 362 dependency_output_file_ = |
358 SubstitutionWriter::ApplyPatternToLinkerAsOutputFile( | 363 SubstitutionWriter::ApplyPatternToLinkerAsOutputFile( |
359 this, tool, tool->outputs().list()[0]); | 364 this, tool, tool->outputs().list()[0]); |
360 break; | 365 break; |
361 case STATIC_LIBRARY: | 366 case STATIC_LIBRARY: |
362 // Static libraries both have dependencies and linking going off of the | 367 // Static libraries both have dependencies and linking going off of the |
363 // first output. | 368 // first output. |
364 CHECK(tool->outputs().list().size() >= 1); | 369 CHECK(tool->outputs().list().size() >= 1); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 return; // Not in output dir, this is OK. | 542 return; // Not in output dir, this is OK. |
538 | 543 |
539 // Tell the scheduler about unknown files. This will be noted for later so | 544 // Tell the scheduler about unknown files. This will be noted for later so |
540 // the list of files written by the GN build itself (often response files) | 545 // the list of files written by the GN build itself (often response files) |
541 // can be filtered out of this list. | 546 // can be filtered out of this list. |
542 OutputFile out_file(settings()->build_settings(), source); | 547 OutputFile out_file(settings()->build_settings(), source); |
543 std::set<const Target*> seen_targets; | 548 std::set<const Target*> seen_targets; |
544 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, &seen_targets)) | 549 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, &seen_targets)) |
545 g_scheduler->AddUnknownGeneratedInput(this, source); | 550 g_scheduler->AddUnknownGeneratedInput(this, source); |
546 } | 551 } |
OLD | NEW |