| 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/group_target_generator.h" | 5 #include "tools/gn/group_target_generator.h" |
| 6 | 6 |
| 7 #include "tools/gn/target.h" | 7 #include "tools/gn/target.h" |
| 8 #include "tools/gn/variables.h" | 8 #include "tools/gn/variables.h" |
| 9 | 9 |
| 10 GroupTargetGenerator::GroupTargetGenerator( | 10 GroupTargetGenerator::GroupTargetGenerator( |
| 11 Target* target, | 11 Target* target, |
| 12 Scope* scope, | 12 Scope* scope, |
| 13 const FunctionCallNode* function_call, | 13 const FunctionCallNode* function_call, |
| 14 Err* err) | 14 Err* err) |
| 15 : TargetGenerator(target, scope, function_call, err) { | 15 : TargetGenerator(target, scope, function_call, err) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 GroupTargetGenerator::~GroupTargetGenerator() { | 18 GroupTargetGenerator::~GroupTargetGenerator() { |
| 19 } | 19 } |
| 20 | 20 |
| 21 void GroupTargetGenerator::DoRun() { | 21 void GroupTargetGenerator::DoRun() { |
| 22 target_->set_output_type(Target::GROUP); | 22 target_->set_output_type(Target::GROUP); |
| 23 // Groups only have the default types filled in by the target generator | 23 // Groups only have the default types filled in by the target generator |
| 24 // base class. | 24 // base class. |
| 25 | |
| 26 // Before there was a deps/public_deps split, a group acted like all deps | |
| 27 // are public. During a transition period, if public_deps is not defined, | |
| 28 // treat all deps as public. This should be removed and existing groups | |
| 29 // updated to use "public_deps" when needed. | |
| 30 if (scope_->GetValue(variables::kDeps, false) && | |
| 31 !scope_->GetValue(variables::kPublicDeps, false)) { | |
| 32 std::swap(target_->private_deps(), target_->public_deps()); | |
| 33 } | |
| 34 } | 25 } |
| OLD | NEW |