Chromium Code Reviews| Index: tools/gn/target.cc |
| diff --git a/tools/gn/target.cc b/tools/gn/target.cc |
| index 40c8a21e2adf743d0b0de24edcfee564f6559b3e..47780b153356b8ec597509414e0d2393ef252573 100644 |
| --- a/tools/gn/target.cc |
| +++ b/tools/gn/target.cc |
| @@ -47,19 +47,6 @@ Err MakeTestOnlyError(const Target* from, const Target* to) { |
| "Either mark it test-only or don't do this dependency."); |
| } |
| -Err MakeStaticLibDepsError(const Target* from, const Target* to) { |
| - return Err(from->defined_from(), |
| - "Complete static libraries can't depend on static libraries.", |
| - from->label().GetUserVisibleName(false) + |
| - "\n" |
| - "which is a complete static library can't depend on\n" + |
| - to->label().GetUserVisibleName(false) + |
| - "\n" |
| - "which is a static library.\n" |
| - "\n" |
| - "Use source sets for intermediate targets instead."); |
| -} |
| - |
| } // namespace |
| Target::Target(const Settings* settings, const Label& label) |
| @@ -136,8 +123,6 @@ bool Target::OnResolved(Err* err) { |
| return false; |
| if (!CheckTestonly(err)) |
| return false; |
| - if (!CheckNoNestedStaticLibs(err)) |
| - return false; |
| return true; |
| } |
| @@ -244,8 +229,23 @@ void Target::PullDependentTarget(const Target* dep, bool is_public) { |
| // The current target isn't linked, so propogate linked deps and |
| // libraries up the dependency tree. |
| inherited_libraries_.AppendInherited(dep->inherited_libraries(), is_public); |
| + } else if (dep->complete_static_lib()) { |
| + // Inherit only final targets through _complete_ static libraries. |
| + // |
| + // Inherited final libraries aren't linked into complete static libraries. |
| + // They are forwarded here so that targets that depend on complete |
| + // static libraries can link them in. Conversely, since complete static |
| + // libraries link in non-final targets they shouldn't be inherited. |
| + for (const auto& inherited : |
| + dep->inherited_libraries().GetOrderedAndPublicFlag()) { |
| + if (inherited.first->IsFinal()) |
| + inherited_libraries_.Append(inherited.first, |
| + is_public && inherited.second); |
|
kal
2015/04/27 21:10:34
Does the is_public handling here make sense?
|
| + } |
| + } |
| - // Inherited library settings. |
| + // Library settings are always inherited across static library boundaries. |
| + if (!dep->IsFinal() || dep->output_type() == STATIC_LIBRARY) { |
| all_lib_dirs_.append(dep->all_lib_dirs()); |
| all_libs_.append(dep->all_libs()); |
| } |
| @@ -385,27 +385,3 @@ bool Target::CheckTestonly(Err* err) const { |
| return true; |
| } |
| - |
| -bool Target::CheckNoNestedStaticLibs(Err* err) const { |
| - // If the current target is not a complete static library, it can depend on |
| - // static library targets with no problem. |
| - if (!(output_type() == Target::STATIC_LIBRARY && complete_static_lib())) |
| - return true; |
| - |
| - // Verify no deps are static libraries. |
| - for (const auto& pair : GetDeps(DEPS_ALL)) { |
| - if (pair.ptr->output_type() == Target::STATIC_LIBRARY) { |
| - *err = MakeStaticLibDepsError(this, pair.ptr); |
| - return false; |
| - } |
| - } |
| - |
| - // Verify no inherited libraries are static libraries. |
| - for (const auto& lib : inherited_libraries().GetOrdered()) { |
| - if (lib->output_type() == Target::STATIC_LIBRARY) { |
| - *err = MakeStaticLibDepsError(this, lib); |
| - return false; |
| - } |
| - } |
| - return true; |
| -} |