-
Notifications
You must be signed in to change notification settings - Fork 822
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
Adds ability to include related frameworks when using Carthage #506
Adds ability to include related frameworks when using Carthage #506
Conversation
13d8795
to
112453c
Compare
Awesome work @rpassis! This will be so useful. |
Is there no way to use (I was going to try and do this myself and that's where I was planning to start). |
Yeah that's a good point @ellneal. There looks to be |
Just so I understand, are you suggesting that we add Carthage/CarthageKit as a dependency? I'm not sure that I could justify that just for reading the version file from disk. There's a lot of baggage that we will need to inherit if we go down that path, plus after a quick glance it looks like the What do you think? |
Yeah it would mean adding Carthage as a dependency. Advantage is having access to the proper formal and tested version of the file spec. Also means if Carthage updates the file format we can just easily update the dependency. |
So I played around a bit with trying to get CarthageKit included as a dependency and it seems like it could be worth a try if there is interest in using it for more than just this particular feature. I can see potential in, for example, having a project spec that only specifies that it wants to add dependencies from a Cartfile, and FWIW introducing CarthageKit also means introducing a few other dependencies include ReactiveSwift which in itself is a big deal as it will definitely have a significant impact on how the code base for this project will evolve. Let me know what you think! |
Does |
Good points made. I have to admit that my 15 minute foray into doing this did hit a few roadblocks with CarthageKit not building correctly. Maybe something to discuss another time, and not in the interest of implementing this new feature. |
@yonaskolb you're right about the Cartfile. From what I've seen so far, the goal of the I'll do a bit more digging and if it's a dead end I'll just move along with what's already here, and start working on adding unit tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @rpassis, I've added some small comments above
case watchOS | ||
} | ||
|
||
let _data: [Key: [Reference]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: can we drop the underscore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 12a46f20df8da47f928d234d9f673a1f0a19cab3
097B0B6C198B9A52D4312F11000496FD /* App_watchOS.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = A680BE9F68A255B0FB291AE6F0A2B045 /* App_watchOS.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; | ||
0A5E7A45C7461184B613A920B3C875D2 /* RelatedDependencyE.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = AD4E8DA1D9D161F174789188D3B650DA /* RelatedDependencyE.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, as these aren't actually part of the Cartfile this will fail. They can go into a different fixture if you want an integration test on them. You could find a real carthage dependency with multiple frameworks to add to the Cartfile in this project, but I don't want to slow down CI too much
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool I went with your suggestion, created a dependency fixture and added to the TestProject's Cartfile. At the moment it is pointing to rpassis/CarthageTestFixture
but feel free to clone that repo to your own and we can update the Cartfile accordingly.
You can see the changes in ac8224ebfb8e83aa1c49a6564f7aaa7763780f9f
bf7cd4f
to
7fe19fb
Compare
Hey @yonaskolb CI is failing on the project diff here and I just wanted to make sure this is not a pipeline issue. This is what the configuration file looks like at the moment
Thanks! |
Hi @rpassis XcodeGen previously didn't require that Carthage dependencies had been built before generation, to be a bit more flexible. What has been added here now does in fact require that carthage has built it's dependencies so that the version file is in place. That should be added to the documentation here. |
@ellneal any comments on this PR as you were thinking of implementing this yourself? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good to me. I've added some comments, but my opinion is also that it wouldn't hurt to refactor the dependencies(for:)
function a bit. Took me a while to get my head around what it was doing.
This is an interesting one. We could check in the dependencies but now you have an issue of built frameworks being tied in to a specific Swift toolchain, and the project will break - for example - when we all move to Swift 5. I thought about just updating the build pipeline so we bootstrap first, then run the generation and diffing. This will work fine in CI but anyone working locally will need to run I think option #2 is still a better experience, we will just have to make sure it is well documented. Thoughts? |
That's why I suggested perhaps having a different fixture that uses related dependencies, not the main one that gets built. Otherwise another solution would be to check in the version files and nothing else, but that might mean Carthage thinks they are already built? |
@yonaskolb I'm not sure we should add a different fixture just for testing this feature, seems like too much overhead for something that should technically work off the main project what do you think? I favour the option of checking in the .version files as you suggested. Based on my tests with only the So this will work with the least amount of friction. I'm going to push these changes up now to make sure it also works in CI. Once that's passed I'll finish writing a couple of outstanding unit tests for the Let me know what you think! |
fc5fd9c
to
81af341
Compare
@rpassis sounds good 👍 |
81af341
to
5cad014
Compare
This is ready for a final pass, thanks @yonaskolb and @ellneal for the feedback and suggestions! |
Looking good @rpassis. I think it will be useful to have a global option as well to opt in across the whole spec, as that is how it will most likely be used. The property on dependency would be optional, and would override this global option. |
…ting a project configuration file
…on to reflect changes
b80924c
to
1e69d70
Compare
Hey @yonaskolb global flag added, let me know if you can see any other issues with the PR. Also FWIW the diff on |
Fantastic, thanks @rpassis! Though your committed |
Interesting @yonaskolb, I think I don't understand how SwiftPM works in this regard. I did add Carthage as a dependency to the But every time I run I just tried I then went back to the copy I was working on and removed the Do you know why that happens? |
Yeah I think SPM can get into a weird state if you revert changes to the Thanks again for implementing this @rpassis! 😄 |
Hey all,
I'm opening this PR for issue #488 early to get the ball rolling and get some feedback on the solution.
The way this is currently designed, and due to our dependency on the file system to evaluate related dependencies, has made it very difficult to test the logic around including related dependencies.
At the moment I am not exactly sure how to get around it and am open to ideas.
Other than that everything else is pretty straightforward and will hopefully make sense but if you have any questions feel free to ask away!
Rog