Skip to content

[SR-11390] Incremental compilation isn't triggered when static frameworks change #53791

@keith

Description

@keith
Previous ID SR-11390
Radar None
Original Reporter @keith
Type Bug

Attachment: Download

Environment

Swift 5.0 in Xcode 10.3 and Swift 5.1 in Xcode 11.0 beta 7

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 077a54e973043a117a482957880a6580

Issue Description:

If you have a module that you're compiling incremental and that module depends on a framework using `-Fpath/to/framework -framework name`, if you change the framework's binary / swiftmodule but maintain the same path, in some cases this doesn't invalidate incremental compilation. This leads to you not rebuilding a module that depends on the changed framework, and can lead to linker failures caused by symbol changes between versions of the static frameworks.

Attached is a repro case project for this. The gist of the setup is:

  • There are 2 static frameworks named `framework`, they both have a type `Foo.swift`, one has an initializer that takes `a: String` and one has an initializer that takes `a: String, b: String?`

  • There is a consumer that depends on the first version of this framework, and therefore depends on this symbol `_$s9framework3FooV1aACSS_tcfC`

  • The consumer is compiled against the framework with this symbol passing a -F to a symlink directory that contains that framework

  • The symlink is replaced now pointing the the second framework that has a different symbol

  • The consumer is recompiled incrementally, and nothing happens

If you went to link the final consumer binary it would fail since it's depending on symbol the second static binary wouldn't provide.

To reproduce this run `./repro.sh`. This script will build the static frameworks, build consumer against both of them, and diff the symbols found in consumer. If it is working correctly the symbols should be different. This script also passes `-driver-show-incremental` which you will see prints the first time for the clean compile, but not the second time since nothing happens.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itself

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions