-
Notifications
You must be signed in to change notification settings - Fork 227
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
Comments: It's time to use Swift Package Manager #517
Comments
@orta imo it's long time for the community to modify the SPM to the iOS package management. I'm willing to participate in such a project. |
I don't see it happening for iOS package management in a reasonable time-frame (because a lot of that work needs to happen in xcbuild/Xcode (closed source) and Swift PM (which you could improve 👍) My last post on Swift PM had comments that mentioned a few hacks that people are using to try work around this which is a good start, maybe you could contribute to those? |
Check SE-0236: Package Manager Platform Deployment Settings thread. This proposal is already accepted (with some changes) but it seems like the right direction for full iOS support. Of course, there are a lot of things that should be done but the future seems reasonable for iOS. |
Nice! Maybe Xcode 11 could be the one 👍 |
Did you experience any issues while running Git pre-commit hook with Komondor? |
Great article Orta. I have a few questions:
|
The target section is to make sure that libDanger is built, so that it can be dynamically linked at runtime during the evaluation of Danger Swift (otherwise there's no easy way to connect the two) - plus you have to have a target or all commands fail.
Yep, it will download/build/run. in that one command. I prefer to have the commands as separate scripts mainly for readability, you could make it a one-liner with
There kinda isn't really, you'd have to do
That's the Unbox dependency, it's in the error message 😸 - I have a PR for this but it's been hard to get a release out. I brought it back up. |
Thanks for this! I prefer to do any autocorrection as a pre commit hook to avoid killing xcode's undo stack and this shows me an easy way to integrate it. For full control I prefer to review changes rather than just staging them and committing them. I modified the example you provided so it will abort the commit if there are any modifications to source files due to formatting. Here it is in case it is useful to anyone. #if canImport(PackageConfig)
import PackageConfig
let config = PackageConfig([
"komondor": [
// When someone has run `git commit`, first run
// run SwiftFormat and the auto-correcter for SwiftLint
// If there are any modifications then cancel the commit
// so changes can be reviewed
"pre-commit": [
"find Injectable -type f -name '*.swift' -exec md5 {} ';' | md5 > .pre_format_hash",
"swift run swiftformat .",
"swift run swiftlint autocorrect --path Injectable/",
"find Injectable -type f -name '*.swift' -exec md5 {} ';' | md5 > .post_format_hash",
"diff .pre_format_hash .post_format_hash > /dev/null || { echo \"File formatting modified\" ; rm .pre_format_hash ; rm .post_format_hash ; exit 1; }",
"rm .pre_format_hash ; rm .post_format_hash",
],
],
])
#endif It could be prohibitive on large codebases but I am not sure if there is a more straightforward way. IIRC either |
@nicholascross - Nice work - while I want Komondor to be pretty generic, I'd be open to baking something like this into the tool itself considering it's a good pattern that ideally everyone would want |
I thought about it some more and I think we can make it more generic and relevant by relying on git for the diff. I have updated my package file so that it only cares if staged files have been modified during the commit. git diff --cached --name-only | xargs git diff | md5 "Your staged files were modified during commit" kind of behaviour could be handy to support in Komondor directly! |
Hi @orta, I found this issue in Catalina OS with Swift 5.0. Any idea how to solve this? Thanks
|
Xcode 11 support SPM finally. However, it's still a pain to use the resource in SPM. (Also Post-Script) |
It seems that isn't possible to run post-scripts to SPM packages on Xcode 11. |
Did you get this working with React Native? If so can you open source your solution? |
http://artsy.github.io/blog/2019/01/05/its-time-to-use-spm/
The text was updated successfully, but these errors were encountered: