Today, apple_core_data_model produces a directory as its output file rather than individual Swift file outputs. This is because, under the hood, this rule invokes xcrun momc --action generate, which produces multiple Swift files from a single input file, and there's no way to know during the analysis phase what Swift files will be created.
Using a directory as an output rather than individual Swift files is problematic. For example, swift_library does not support using a directory in its srcs without a hacky workaround.
I'd like to propose a fix for this specific issue where, instead of only producing a directory of source files, apple_core_data_model provides an optional attribute merge_outputs = True. When set, the rule merges all Swift output files into a single Swift source file. This file can be known statically during analysis and can be included in the srcs list of a swift_library without the need for a hacky workaround.