Skip to content

swift code being compiled 3 times #33

@omarzl

Description

@omarzl

Hello @thii!

We migrated all our project and its dependencies to bazel but we can't reduce the build time in incremental builds for swift targets.

I added the profiling flag to bazel build command and here are the results loaded in chrome, as you can see there are three "Compiling Swift module Apollo" steps in different threads.

image

And if I use the official Bazel rule there is only one "Compiling Swift module Apollo" step

image

So I think that the swift module is being compile 3 times, I tried to modify the swift_static_framework.bzl without success, as far as I understand I guess that it is compiling 3 times because of the 3 header maps (public, private, private angled), each one compiles a swift module?

Do you have the same behavior with Line's dependencies?

Here is the target definition:

load("@rules_apple_line//apple:apple_library.bzl", "swift_library")

swift_library(
    name = "Apollo",
    srcs = glob(["Apollo/Sources/Apollo/*.swift"]),
    module_name = "Apollo",
    visibility = ["//visibility:public"],
)

And the trace files:

traces.zip

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