| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 } | 550 } |
| 551 case EXECUTABLE: | 551 case EXECUTABLE: |
| 552 case LOADABLE_MODULE: | 552 case LOADABLE_MODULE: |
| 553 // Executables and loadable modules don't get linked to, but the first | 553 // Executables and loadable modules don't get linked to, but the first |
| 554 // output is used for dependency management. | 554 // output is used for dependency management. |
| 555 CHECK_GE(tool->outputs().list().size(), 1u); | 555 CHECK_GE(tool->outputs().list().size(), 1u); |
| 556 check_tool_outputs = true; | 556 check_tool_outputs = true; |
| 557 dependency_output_file_ = | 557 dependency_output_file_ = |
| 558 SubstitutionWriter::ApplyPatternToLinkerAsOutputFile( | 558 SubstitutionWriter::ApplyPatternToLinkerAsOutputFile( |
| 559 this, tool, tool->outputs().list()[0]); | 559 this, tool, tool->outputs().list()[0]); |
| 560 |
| 561 if (tool->runtime_outputs().list().empty()) { |
| 562 // Default to the first output for the runtime output. |
| 563 runtime_outputs_.push_back(dependency_output_file_); |
| 564 } else { |
| 565 SubstitutionWriter::ApplyListToLinkerAsOutputFile( |
| 566 this, tool, tool->runtime_outputs(), &runtime_outputs_); |
| 567 } |
| 560 break; | 568 break; |
| 561 case STATIC_LIBRARY: | 569 case STATIC_LIBRARY: |
| 562 // Static libraries both have dependencies and linking going off of the | 570 // Static libraries both have dependencies and linking going off of the |
| 563 // first output. | 571 // first output. |
| 564 CHECK(tool->outputs().list().size() >= 1); | 572 CHECK(tool->outputs().list().size() >= 1); |
| 565 check_tool_outputs = true; | 573 check_tool_outputs = true; |
| 566 link_output_file_ = dependency_output_file_ = | 574 link_output_file_ = dependency_output_file_ = |
| 567 SubstitutionWriter::ApplyPatternToLinkerAsOutputFile( | 575 SubstitutionWriter::ApplyPatternToLinkerAsOutputFile( |
| 568 this, tool, tool->outputs().list()[0]); | 576 this, tool, tool->outputs().list()[0]); |
| 569 break; | 577 break; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 581 link_output_file_ = | 589 link_output_file_ = |
| 582 SubstitutionWriter::ApplyPatternToLinkerAsOutputFile( | 590 SubstitutionWriter::ApplyPatternToLinkerAsOutputFile( |
| 583 this, tool, tool->link_output()); | 591 this, tool, tool->link_output()); |
| 584 } | 592 } |
| 585 if (!tool->depend_output().empty()) { | 593 if (!tool->depend_output().empty()) { |
| 586 dependency_output_file_ = | 594 dependency_output_file_ = |
| 587 SubstitutionWriter::ApplyPatternToLinkerAsOutputFile( | 595 SubstitutionWriter::ApplyPatternToLinkerAsOutputFile( |
| 588 this, tool, tool->depend_output()); | 596 this, tool, tool->depend_output()); |
| 589 } | 597 } |
| 590 } | 598 } |
| 591 if (tool->runtime_link_output().empty()) { | 599 if (tool->runtime_outputs().list().empty()) { |
| 592 runtime_link_output_file_ = link_output_file_; | 600 // Default to the link output for the runtime output. |
| 601 runtime_outputs_.push_back(link_output_file_); |
| 593 } else { | 602 } else { |
| 594 runtime_link_output_file_ = | 603 SubstitutionWriter::ApplyListToLinkerAsOutputFile( |
| 595 SubstitutionWriter::ApplyPatternToLinkerAsOutputFile( | 604 this, tool, tool->runtime_outputs(), &runtime_outputs_); |
| 596 this, tool, tool->runtime_link_output()); | |
| 597 } | 605 } |
| 598 break; | 606 break; |
| 599 case UNKNOWN: | 607 case UNKNOWN: |
| 600 default: | 608 default: |
| 601 NOTREACHED(); | 609 NOTREACHED(); |
| 602 } | 610 } |
| 603 | 611 |
| 604 // Count anything generated from bundle_data dependencies. | 612 // Count anything generated from bundle_data dependencies. |
| 605 if (output_type_ == CREATE_BUNDLE) | 613 if (output_type_ == CREATE_BUNDLE) |
| 606 bundle_data_.GetOutputFiles(settings(), &computed_outputs_); | 614 bundle_data_.GetOutputFiles(settings(), &computed_outputs_); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 check_data_deps = g_scheduler->IsFileGeneratedByWriteRuntimeDeps(out_file); | 769 check_data_deps = g_scheduler->IsFileGeneratedByWriteRuntimeDeps(out_file); |
| 762 // Check object files (much slower and very rare) only if the "normal" | 770 // Check object files (much slower and very rare) only if the "normal" |
| 763 // output check failed. | 771 // output check failed. |
| 764 consider_object_files = !check_data_deps; | 772 consider_object_files = !check_data_deps; |
| 765 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, | 773 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, |
| 766 consider_object_files, | 774 consider_object_files, |
| 767 check_data_deps, &seen_targets)) | 775 check_data_deps, &seen_targets)) |
| 768 g_scheduler->AddUnknownGeneratedInput(this, source); | 776 g_scheduler->AddUnknownGeneratedInput(this, source); |
| 769 } | 777 } |
| 770 } | 778 } |
| OLD | NEW |