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-12926] provide a way to get the SHA of the current package in code #4538

Open
weissi opened this issue Jun 2, 2020 · 2 comments
Open

Comments

@weissi
Copy link
Contributor

weissi commented Jun 2, 2020

Previous ID SR-12926
Radar rdar://problem/63888891
Original Reporter @weissi
Type New Feature
Additional Detail from JIRA
Votes 2
Component/s Package Manager
Labels New Feature
Assignee None
Priority Medium

md5: c119e8705c814a44ed478dbb1dec3864

relates to:

  • SR-473 Add version constants to each package
  • SR-4265 [SwiftPM] CURRENT_PROJECT_VERSION should be defined on generated-xcodeproj

Issue Description:

This needs design of course but in certain cases it's really helpful if the binary contains the version (ie. the current SHA (+ a "dirty" marker if modified)) of its package in the binary. Even better if accessible in code.

Potentially we could even embed something like Package.resolved into the binary too so that every module could get the information for all packages.

See also:

@weissi
Copy link
Contributor Author

weissi commented Jun 2, 2020

@swift-ci create

@ktoso
Copy link
Contributor

ktoso commented Jun 3, 2020

Just a thought, if we end up wanting to have a built-in rather than implement the same as a plugin that's fine as well:

If we had "extensible build tools" this could rather be solved as a plugin (again, if we had those), and this way it becomes "gather some resources and put them somewhere task".

I've built such thing many years ago for the java ecosystem for including git information https://github.com/git-commit-id/git-commit-id-maven-plugin what we found is that people may want to include various things, like marking things as "dev" if on some specific branch or for specific customer/build etc...

It might be nice to think about this as "how do we enable building this" rather than a built-in in SPM that would be less flexible. Such plugin would want to write a resource, and then the resource would use all the normal ways to get accessed (so https://github.com/apple/swift-evolution/blob/master/proposals/0271-package-manager-resources.md )

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from swiftlang/swift May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants