Skip to content

Add ability to concatenate Swift source files produced with apple_core_data_model #2726

@daltonclaybrook

Description

@daltonclaybrook

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions