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

Cache mixes up different Swift versions #61

Closed
fredpi opened this issue Jul 1, 2019 · 2 comments · Fixed by #62
Closed

Cache mixes up different Swift versions #61

fredpi opened this issue Jul 1, 2019 · 2 comments · Fixed by #62
Assignees
Labels
bug Something isn't working

Comments

@fredpi
Copy link
Contributor

fredpi commented Jul 1, 2019

When caching frameworks, Accio differentiates between different Swift versions, so that a user having set Xcode 10.2.1 as their command line tools won't get cached frameworks originating from a user that has Xcode 11 set as their command line tools. That's needed, as otherwise, Xcode would complain that the frameworks have been built with Swift 5.1, while the user is still running Xcode 10.2.1 with Swift 5.0.1.

So, it's perfectly valid to separate by Swift version. However, the implementation doesn't work properly, as the Swift version is retrieved on compile time of Accio:

static var swiftVersion: String {
    #if swift(>=6.0)
        return "Swift-6.0"
    #elseif swift(>=5.2)
        return "Swift-5.2"
    #elseif swift(>=5.1)
        return "Swift-5.1"
    #elseif swift(>=5.0)
        return "Swift-5.0"
    #else
        return "Swift-4.2"
    #endif
}

This works quite often, as the Accio-compile-time Swift version is likely to match the current Swift version, but in transition periods (like now, switching from Swift 5.0 to Swift 5.1), this is a real issue: The folder that should store Swift 5.0 builds may now also include Swift 5.1 builds and the other way round.

To get things to work, the swift version should instead be retrieved via the swift --version command during runtime.

@fredpi fredpi self-assigned this Jul 1, 2019
@fredpi fredpi added the bug Something isn't working label Jul 1, 2019
@Jeehut
Copy link
Contributor

Jeehut commented Jul 1, 2019

Absolutely correct. Would you mind fixing it? :)

@fredpi
Copy link
Contributor Author

fredpi commented Jul 1, 2019

Will fix it with pleasure ;)

@fredpi fredpi closed this as completed in #62 Jul 4, 2019
fredpi added a commit that referenced this issue Jul 4, 2019
Fix cache mixed up with different swift versions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants