Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-4127] swiftc shouldn't rebuild downstream dependencies when private API changes #46710

Open
ddunbar opened this issue Mar 1, 2017 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself incremental compilation

Comments

@ddunbar
Copy link
Member

ddunbar commented Mar 1, 2017

Previous ID SR-4127
Radar None
Original Reporter @ddunbar
Type Bug

Attachment: Download

Environment

macOS

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, IncrementalBuild
Assignee None
Priority Medium

md5: 1f0e2aac39013f6dc1f73cf999e85e6f

Issue Description:

In the following test case, the second build should not recompile or relink bazTests, because the additional function added to the source does not change the public API of baz.

This requires a couple things to be fixed:

  1. The baz.swiftmodule currently does change in the test case.
  2. The baz.o file is rewritten, even though its contents are unchanged.

Test case is attached, steps to reproduce:

$ rm -rf .build
$ swift build -c release --build-tests
Compile Swift Module 'baz' (1 sources)
Compile Swift Module 'bazTests' (1 sources)
Linking ./.build/release/bazPackageTests.xctest/Contents/MacOS/bazPackageTests
$ (for f in .build/release/baz.{swiftmodule,build/baz.swift.o}; do printf "%s -- stat hash: %s -- content hash: %s\n" ${f} $(stat ${f} | md5) $(md5 < ${f}); done)
.build/release/baz.swiftmodule -- stat hash: 51b581c0e5b03d1ac6d76d6536b6c657 -- content hash: 2a13cb88f1d5100364fe882eae166d6c
.build/release/baz.build/baz.swift.o -- stat hash: 034c99c73f4ca317f8c2177f9bbe6321 -- content hash: ae38b556a84069586ff9c359d4749915
$ printf 'private func f%d() {}\n' $(wc -c < Sources/baz.swift) >> Sources/baz.swift 
$ swift build -c release --build-tests
Compile Swift Module 'baz' (1 sources)
Compile Swift Module 'bazTests' (1 sources)
$ (for f in .build/release/baz.{swiftmodule,build/baz.swift.o}; do printf "%s -- stat hash: %s -- content hash: %s\n" ${f} $(stat ${f} | md5) $(md5 < ${f}); done)
.build/release/baz.swiftmodule -- stat hash: 8654cc82d490935f8b0781ecff4e2078 -- content hash: 6f24a013ba83f16864ad410211b4caf5
.build/release/baz.build/baz.swift.o -- stat hash: 156d28f073b62c27f66d0eb2add5b60a -- content hash: ae38b556a84069586ff9c359d4749915
@belkadan
Copy link
Contributor

belkadan commented Mar 1, 2017

In order to do this we need to stop putting non-public things into the swiftmodule.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself incremental compilation
Projects
None yet
Development

No branches or pull requests

2 participants