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 <algorithm> | 5 #include <algorithm> |
6 #include <limits> | 6 #include <limits> |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "tools/gn/err.h" | 9 #include "tools/gn/err.h" |
10 #include "tools/gn/functions.h" | 10 #include "tools/gn/functions.h" |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 // Note that we don't want to use MakeLabelForScope since that will include | 317 // Note that we don't want to use MakeLabelForScope since that will include |
318 // the toolchain name in the label, and toolchain labels don't themselves | 318 // the toolchain name in the label, and toolchain labels don't themselves |
319 // have toolchain names. | 319 // have toolchain names. |
320 const SourceDir& input_dir = scope->GetSourceDir(); | 320 const SourceDir& input_dir = scope->GetSourceDir(); |
321 Label label(input_dir, args[0].string_value()); | 321 Label label(input_dir, args[0].string_value()); |
322 if (g_scheduler->verbose_logging()) | 322 if (g_scheduler->verbose_logging()) |
323 g_scheduler->Log("Defining toolchain", label.GetUserVisibleName(false)); | 323 g_scheduler->Log("Defining toolchain", label.GetUserVisibleName(false)); |
324 | 324 |
325 // This object will actually be copied into the one owned by the toolchain | 325 // This object will actually be copied into the one owned by the toolchain |
326 // manager, but that has to be done in the lock. | 326 // manager, but that has to be done in the lock. |
327 scoped_ptr<Toolchain> toolchain(new Toolchain(scope->settings(), label)); | 327 std::unique_ptr<Toolchain> toolchain(new Toolchain(scope->settings(), label)); |
328 toolchain->set_defined_from(function); | 328 toolchain->set_defined_from(function); |
329 toolchain->visibility().SetPublic(); | 329 toolchain->visibility().SetPublic(); |
330 | 330 |
331 Scope block_scope(scope); | 331 Scope block_scope(scope); |
332 block_scope.SetProperty(&kToolchainPropertyKey, toolchain.get()); | 332 block_scope.SetProperty(&kToolchainPropertyKey, toolchain.get()); |
333 block->Execute(&block_scope, err); | 333 block->Execute(&block_scope, err); |
334 block_scope.SetProperty(&kToolchainPropertyKey, nullptr); | 334 block_scope.SetProperty(&kToolchainPropertyKey, nullptr); |
335 if (err->has_error()) | 335 if (err->has_error()) |
336 return Value(); | 336 return Value(); |
337 | 337 |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 subst_validator = &IsValidCopySubstitution; | 833 subst_validator = &IsValidCopySubstitution; |
834 subst_output_validator = &IsValidCopySubstitution; | 834 subst_output_validator = &IsValidCopySubstitution; |
835 } else if (tool_type == Toolchain::TYPE_COMPILE_XCASSETS) { | 835 } else if (tool_type == Toolchain::TYPE_COMPILE_XCASSETS) { |
836 subst_validator = &IsValidCompileXCassetsSubstitution; | 836 subst_validator = &IsValidCompileXCassetsSubstitution; |
837 subst_output_validator = &IsValidCompileXCassetsSubstitution; | 837 subst_output_validator = &IsValidCompileXCassetsSubstitution; |
838 } else { | 838 } else { |
839 subst_validator = &IsValidToolSubstitution; | 839 subst_validator = &IsValidToolSubstitution; |
840 subst_output_validator = &IsValidToolSubstitution; | 840 subst_output_validator = &IsValidToolSubstitution; |
841 } | 841 } |
842 | 842 |
843 scoped_ptr<Tool> tool(new Tool); | 843 std::unique_ptr<Tool> tool(new Tool); |
844 | 844 |
845 if (!ReadPattern(&block_scope, "command", subst_validator, tool.get(), | 845 if (!ReadPattern(&block_scope, "command", subst_validator, tool.get(), |
846 &Tool::set_command, err) || | 846 &Tool::set_command, err) || |
847 !ReadOutputExtension(&block_scope, tool.get(), err) || | 847 !ReadOutputExtension(&block_scope, tool.get(), err) || |
848 !ReadPattern(&block_scope, "depfile", subst_validator, tool.get(), | 848 !ReadPattern(&block_scope, "depfile", subst_validator, tool.get(), |
849 &Tool::set_depfile, err) || | 849 &Tool::set_depfile, err) || |
850 !ReadDepsFormat(&block_scope, tool.get(), err) || | 850 !ReadDepsFormat(&block_scope, tool.get(), err) || |
851 !ReadPattern(&block_scope, "description", subst_validator, tool.get(), | 851 !ReadPattern(&block_scope, "description", subst_validator, tool.get(), |
852 &Tool::set_description, err) || | 852 &Tool::set_description, err) || |
853 !ReadString(&block_scope, "lib_switch", tool.get(), &Tool::set_lib_switch, | 853 !ReadString(&block_scope, "lib_switch", tool.get(), &Tool::set_lib_switch, |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 return Value(); | 1009 return Value(); |
1010 | 1010 |
1011 Scope::KeyValueMap values; | 1011 Scope::KeyValueMap values; |
1012 block_scope.GetCurrentScopeValues(&values); | 1012 block_scope.GetCurrentScopeValues(&values); |
1013 toolchain->args() = values; | 1013 toolchain->args() = values; |
1014 | 1014 |
1015 return Value(); | 1015 return Value(); |
1016 } | 1016 } |
1017 | 1017 |
1018 } // namespace functions | 1018 } // namespace functions |
OLD | NEW |