Allow usage of swift tool outputs in other targets' inputs When building a framework for a library implemented in Swift, the framework needs to include the swift module (and associated files such as .abi.json, .swiftdoc, ...). Currently those files are listed in the outputs of the swift tool but not in the outputs of the individual targets generating them (as they are source_set(...) targets). Special case source_set(...) containing .swift files to list the outputs of the swift tool in order to allow using them as inputs to other targets (e.g. bundle_data(...) targets). Bug: b/493762975 Change-Id: Id1e2ffb725c80df05fc4b3192b04258257989f6c Reviewed-on: https://gn-review.googlesource.com/c/gn/+/29360 Reviewed-by: Andrew Grieve <agrieve@google.com> Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
diff --git a/src/gn/target.cc b/src/gn/target.cc index d03a092..4547987 100644 --- a/src/gn/target.cc +++ b/src/gn/target.cc
@@ -996,6 +996,10 @@ dependency_output_file_ = GetOutputFile(*this, BuildDirType::OBJ, label().name(), ".stamp"); } + if (output_type_ == SOURCE_SET && source_types_used().SwiftSourceUsed()) { + tool = toolchain_->GetTool(CTool::kCToolSwift); + check_tool_outputs = true; + } break; } case EXECUTABLE: