#️⃣ Use cache version instead of Tuist version in target hash calculation (#3554)

* feat: use cache version instead of Tuist version in target hash calculation

* chore: update PR template
This commit is contained in:
Daniele Formichelli 2021-10-22 11:10:10 +02:00 committed by GitHub
parent 53cbae4794
commit 15ab668514
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 7 deletions

View File

@ -11,3 +11,4 @@ Request for comments document (if applies):
- [ ] The changes have been tested following the [documented guidelines](https://docs.tuist.io/contributors/testing-strategy/).
- [ ] The `CHANGELOG.md` has been updated to reflect the changes. In case of a breaking change, it's been flagged as such.
- [ ] In case the PR introduces changes that affect users, the documentation has been updated.
- [ ] In case the PR introduces changes that affect how the cache artifact is generated starting from the `TuistGraph.Target`, the `Constants.cacheVersion` has been updated.

View File

@ -4,6 +4,11 @@ Please, check out guidelines: https://keepachangelog.com/en/1.0.0/
## Next
### Changed
- Use cache version instead of Tuist version in target hash calculation [#3554](https://github.com/tuist/tuist/pull/3554) by [@danyf90](https://github.com/danyf90)
- Perform remote cache download and upload concurrently [#3549](https://github.com/tuist/tuist/pull/3549) by [@danyf90](https://github.com/danyf90)
### Added
- Add `analytics` option to `Config.Cloud` to enable sending analytics event to cloud backend [#3547](https://github.com/tuist/tuist/pull/3547) by [@danyf90](https://github.com/danyf90)
@ -13,10 +18,6 @@ Please, check out guidelines: https://keepachangelog.com/en/1.0.0/
- Add arbitrarily high `LastUpgradeCheck` to SwiftPackageManager generated projects to disable warnings [#3569](https://github.com/tuist/tuist/pull/3569) by [@danyf90](https://github.com/danyf90)
- Add `isCI` parameter to analytics events [#3568](https://github.com/tuist/tuist/pull/3568) by [@mollyIV](https://github.com/mollyIV).
### Changed
- Perform remote cache download and upload concurrently [#3549](https://github.com/tuist/tuist/pull/3549) by [@danyf90](https://github.com/danyf90)
### Fixed
- Fix target caching resources linking for extensions. They are now considered `runnable` targrts (which they are) [#3570](https://github.com/tuist/tuist/pull/3570) by [@fila95](https://github.com/fila95)

View File

@ -59,7 +59,7 @@ public final class CacheGraphContentHasher: CacheGraphContentHashing {
cacheProfileContentHasher.hash(cacheProfile: cacheProfile),
cacheOutputType.description,
System.shared.swiftVersion(),
Constants.version,
Constants.cacheVersion,
]
)
}

View File

@ -27,6 +27,11 @@ public enum Constants {
public static let joinSlackURL: String = "https://slack.tuist.io/"
public static let tuistGeneratedFileName = ".tuist-generated"
/// The cache version.
/// This should change only when it changes the logic to map a `TuistGraph.Target` to a cached build artifact.
/// Changing this results in changing the target hash and hence forcing a rebuild of its artifact.
public static let cacheVersion = "1.0.0"
public enum Vendor {
public static let swiftLint = "swiftlint"
public static let swiftDoc = "swift-doc"

View File

@ -148,8 +148,8 @@ final class ContentHashingIntegrationTests: TuistUnitTestCase {
let contentHash = try subject.contentHashes(for: graph, cacheProfile: cacheProfile, cacheOutputType: .framework, excludedTargets: [])
// Then
XCTAssertEqual(contentHash[framework1], "3563ba794088ce02e5d7c85e153033f3")
XCTAssertEqual(contentHash[framework2], "05f37d88d6e9009040f00b0c5118e30e")
XCTAssertEqual(contentHash[framework1], "d31f7192381862aa6b74c7bbf2f097ce")
XCTAssertEqual(contentHash[framework2], "d0229bc4f00ff0b52bccb45668b9baa9")
}
func test_contentHashes_hashChangesWithCacheOutputType() throws {