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

Place build.db under the scratch directory #7471

Merged

Conversation

kateinoigakukun
Copy link
Member

Motivation:

The build database should be shared between different triple builds to re-generate the build manifest correctly.

With the current implementation, the following build command sequence fails:

# 1st iteration: They both do not trigger "PackageStructure" build
$ swift build --experimental-swift-sdk wasm32-unknown-wasi
$ swift build

# 2nd iteration: They both trigger "PackageStructure" build because there is description.json and debug.yaml
$ swift build --experimental-swift-sdk wasm32-unknown-wasi
$ swift build

# 3rd iteration: Manifest cache entry in .build/wasm32-unknown-wasi/build.db created by 2nd iteration hits,
# so do not update debug.yaml. <--- Incorrect
$ swift build --experimental-swift-sdk wasm32-unknown-wasi

Modifications:

This changes the llbuild build database to be placed under .build/build.db instead of .build/<product triple>/build.db.
Also this change splits llbuild target names for each triple to avoid cache invalidation when switching triple.

Result:

build.db will be shared across product target triples, and SwiftPM will keep consistent cache state when switching triples.

@kateinoigakukun
Copy link
Member Author

@swift-ci test

@kateinoigakukun kateinoigakukun marked this pull request as ready for review April 22, 2024 15:45
@MaxDesiatov MaxDesiatov added enhancement build system Changes to interactions with build systems labels Apr 22, 2024
@kateinoigakukun kateinoigakukun force-pushed the yt/place-build-db-under-scratch-dir branch from 2ec6fb1 to 010745d Compare May 27, 2024 11:00
@kateinoigakukun
Copy link
Member Author

@swift-ci test

The build database should be shared between different triple builds to
re-generate the build manifest correctly.
Also this change splits llbuild target names for each triple to avoid cache
invalidation when switching triple.
@kateinoigakukun kateinoigakukun force-pushed the yt/place-build-db-under-scratch-dir branch from 010745d to 6be1d40 Compare May 27, 2024 11:21
@kateinoigakukun
Copy link
Member Author

@swift-ci test

@MaxDesiatov
Copy link
Member

@swift-ci test windows

@apple apple deleted a comment from domciiiiix May 28, 2024
This change is to make the target names of llbuild targets unique by
target triple so that switching triples will not invalidate target
artifact cache.
@kateinoigakukun
Copy link
Member Author

@swift-ci test

@kateinoigakukun
Copy link
Member Author

@swift-ci test Windows

Copy link
Member

@xedin xedin left a comment

Choose a reason for hiding this comment

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

LGTM, thank you! I started a source compatibility build with these changes @ apple/swift#73908

@kateinoigakukun
Copy link
Member Author

Ok, source compat tests passed. At least this change does not break initial clean build 😌

@kateinoigakukun kateinoigakukun merged commit e9399c2 into apple:main May 29, 2024
5 checks passed
xedin pushed a commit that referenced this pull request Jun 7, 2024
The build database should be shared between different triple builds to
re-generate the build manifest correctly.

With the current implementation, the following build command sequence
fails:
```
$ swift build --experimental-swift-sdk wasm32-unknown-wasi
$ swift build

$ swift build --experimental-swift-sdk wasm32-unknown-wasi
$ swift build

$ swift build --experimental-swift-sdk wasm32-unknown-wasi
```

This changes the llbuild build database to be placed under
`.build/build.db` instead of `.build/<product triple>/build.db`.
Also this change splits llbuild target names for each triple to avoid
cache invalidation when switching triple.

`build.db` will be shared across product target triples, and SwiftPM
will keep consistent cache state when switching triples.

(cherry picked from commit e9399c2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build system Changes to interactions with build systems enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants