| 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_generator.h" | 5 #include "tools/gn/target_generator.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "tools/gn/action_target_generator.h" | 9 #include "tools/gn/action_target_generator.h" |
| 10 #include "tools/gn/binary_target_generator.h" | 10 #include "tools/gn/binary_target_generator.h" |
| 11 #include "tools/gn/build_settings.h" | 11 #include "tools/gn/build_settings.h" |
| 12 #include "tools/gn/bundle_data_target_generator.h" |
| 12 #include "tools/gn/config.h" | 13 #include "tools/gn/config.h" |
| 13 #include "tools/gn/copy_target_generator.h" | 14 #include "tools/gn/copy_target_generator.h" |
| 14 #include "tools/gn/err.h" | 15 #include "tools/gn/err.h" |
| 15 #include "tools/gn/filesystem_utils.h" | 16 #include "tools/gn/filesystem_utils.h" |
| 16 #include "tools/gn/functions.h" | 17 #include "tools/gn/functions.h" |
| 17 #include "tools/gn/group_target_generator.h" | 18 #include "tools/gn/group_target_generator.h" |
| 18 #include "tools/gn/parse_tree.h" | 19 #include "tools/gn/parse_tree.h" |
| 19 #include "tools/gn/scheduler.h" | 20 #include "tools/gn/scheduler.h" |
| 20 #include "tools/gn/scope.h" | 21 #include "tools/gn/scope.h" |
| 21 #include "tools/gn/token.h" | 22 #include "tools/gn/token.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 Label label(scope->GetSourceDir(), args[0].string_value(), | 81 Label label(scope->GetSourceDir(), args[0].string_value(), |
| 81 toolchain_label.dir(), toolchain_label.name()); | 82 toolchain_label.dir(), toolchain_label.name()); |
| 82 | 83 |
| 83 if (g_scheduler->verbose_logging()) | 84 if (g_scheduler->verbose_logging()) |
| 84 g_scheduler->Log("Defining target", label.GetUserVisibleName(true)); | 85 g_scheduler->Log("Defining target", label.GetUserVisibleName(true)); |
| 85 | 86 |
| 86 scoped_ptr<Target> target(new Target(scope->settings(), label)); | 87 scoped_ptr<Target> target(new Target(scope->settings(), label)); |
| 87 target->set_defined_from(function_call); | 88 target->set_defined_from(function_call); |
| 88 | 89 |
| 89 // Create and call out to the proper generator. | 90 // Create and call out to the proper generator. |
| 90 if (output_type == functions::kCopy) { | 91 if (output_type == functions::kBundleData) { |
| 92 BundleDataTargetGenerator generator( |
| 93 target.get(), scope, function_call, err); |
| 94 generator.Run(); |
| 95 } else if (output_type == functions::kCopy) { |
| 91 CopyTargetGenerator generator(target.get(), scope, function_call, err); | 96 CopyTargetGenerator generator(target.get(), scope, function_call, err); |
| 92 generator.Run(); | 97 generator.Run(); |
| 93 } else if (output_type == functions::kAction) { | 98 } else if (output_type == functions::kAction) { |
| 94 ActionTargetGenerator generator(target.get(), scope, function_call, | 99 ActionTargetGenerator generator(target.get(), scope, function_call, |
| 95 Target::ACTION, err); | 100 Target::ACTION, err); |
| 96 generator.Run(); | 101 generator.Run(); |
| 97 } else if (output_type == functions::kActionForEach) { | 102 } else if (output_type == functions::kActionForEach) { |
| 98 ActionTargetGenerator generator(target.get(), scope, function_call, | 103 ActionTargetGenerator generator(target.get(), scope, function_call, |
| 99 Target::ACTION_FOREACH, err); | 104 Target::ACTION_FOREACH, err); |
| 100 generator.Run(); | 105 generator.Run(); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 | 371 |
| 367 bool TargetGenerator::FillGenericDeps(const char* var_name, | 372 bool TargetGenerator::FillGenericDeps(const char* var_name, |
| 368 LabelTargetVector* dest) { | 373 LabelTargetVector* dest) { |
| 369 const Value* value = scope_->GetValue(var_name, true); | 374 const Value* value = scope_->GetValue(var_name, true); |
| 370 if (value) { | 375 if (value) { |
| 371 ExtractListOfLabels(*value, scope_->GetSourceDir(), | 376 ExtractListOfLabels(*value, scope_->GetSourceDir(), |
| 372 ToolchainLabelForScope(scope_), dest, err_); | 377 ToolchainLabelForScope(scope_), dest, err_); |
| 373 } | 378 } |
| 374 return !err_->has_error(); | 379 return !err_->has_error(); |
| 375 } | 380 } |
| OLD | NEW |