Skip to content

[Index] Generate versioning files for targets fully built for indexing - #1795

Merged
rintaro merged 1 commit into
swiftlang:mainfrom
rintaro:index-arena-versioning-file
Sep 29, 2026
Merged

rintaro merged 1 commit into
swiftlang:mainfrom
rintaro:index-arena-versioning-file

Conversation

@rintaro

@rintaro rintaro commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

The index build arena skips the Apple Generic Versioning file (<PRODUCT_NAME>_vers.c) and for every target, so that targets that are only being prepared don't have to build their Swift module.

However, targets in targetsRequiredToBuildForIndexing are fully compiled and linked in the arena, so skipping these files saves nothing for them. It also leaves their binaries without the <Product>VersionNumber and <Product>VersionString symbols a regular build exports. If the target also sets SUPPORTS_TEXT_BASED_API, GenerateTAPI fails verification on those symbols when its umbrella header declares them, for example: declaration has external linkage, but dynamic library doesn't have symbol 'LibVersionNumber'.

With this change, these files are skipped only for targets that aren't required to build for indexing.

rdar://188475806

The index build arena skipped the Apple Generic Versioning file and
the kernel extension module info file for every target, to avoid
forcing Swift module generation when a target is only being prepared.
Targets in targetsRequiredToBuildForIndexing are fully compiled and
linked in the arena, so skipping these files only produces a binary
missing the <Product>VersionNumber and <Product>VersionString symbols
a regular build exports. When the target also sets
SUPPORTS_TEXT_BASED_API, GenerateTAPI's verification then fails on the
version symbols declared in its umbrella header.

Only skip these files for targets that aren't required to build for
indexing.

rdar://188475806
@rintaro rintaro changed the title Generate versioning files for targets fully built for indexing [Index] Generate versioning files for targets fully built for indexing Sep 27, 2026
@rintaro

rintaro commented Sep 27, 2026

Copy link
Copy Markdown
Member Author

@swift-ci Please test

results.checkWarning(.contains("argument unused during compilation: '-index-unit-output-path"), failIfNotFound: false)
results.checkNoDiagnostics()
results.checkTaskExists(.matchTargetName("Lib"), .matchRuleType("CompileC"), .matchRuleItemBasename("Lib_vers.c"))
results.checkTaskExists(.matchTargetName("Lib"), .matchRuleType("GenerateTAPI"))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GenerateTAPI shouldn't be needed in prepare builds. rdar://188503355

@rintaro
rintaro merged commit 96738a4 into swiftlang:main Sep 29, 2026
91 of 124 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants