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

Always embed and link frameworks for macOS #82

Conversation

toshi0383
Copy link
Collaborator

Replaces #79.
XcodeGen currently don't support embedding Carthage frameworks.
SeeAlso: https://github.com/Carthage/Carthage#if-youre-building-for-os-x

project.yml

...
targets:
  LGTM:
    platform: macOS
    type: application
    sources:
      - LGTM
    dependencies:
      - target: LGTMKit_macOS
      - carthage: APIKit
      - carthage: Alamofire
      - carthage: Himotoki
      - carthage: MASPreferences
      - carthage: Nuke
      - carthage: Realm
      - carthage: RealmSwift
      - carthage: Result
      - carthage: RxCocoa
      - carthage: RxSwift
      - carthage: SwiftyUserDefaults
      - carthage: Toast
...

Before

screen shot 2017-10-01 at 9 32 42

After

screen shot 2017-10-01 at 9 33 20

@yonaskolb
Copy link
Owner

This would also embed carthage frameworks in framework targets. Is that ok?

@toshi0383
Copy link
Collaborator Author

Ohh I'll fix it.

@toshi0383
Copy link
Collaborator Author

Fixed in 99e5113 🙏

@yonaskolb
Copy link
Owner

What happens to those frameworks that have carthage dependencies though. They have to be embedded somewhere right?

Should this be moved down to where the carthage copy-frameworks is created, and then embed all the carthage frameworks from all targets?

It would be a good to have create a new macOS target in the TestProject fixture to test that this stuff works

@toshi0383
Copy link
Collaborator Author

Should this be moved down to where the carthage copy-frameworks is created, and then embed all the carthage frameworks from all targets?

No, because user can just add all dependencies flattened in project.yml.
I think that's how Carthage works, too. Carthage flattens out all frameworks into Carthage/Build/$platform.
(I don't think we should parse Cartfile.resolved to know nested dependencies graph either. That's Carthage's job. 👍)

    dependencies:
      - target: LGTMKit_macOS
      - carthage: APIKit // <- depends on Result
      - carthage: Result

@toshi0383 toshi0383 force-pushed the ts-always-embed-and-link-frameworks-for-macos branch from 99e5113 to d1ec3f2 Compare October 1, 2017 11:15
@yonaskolb
Copy link
Owner

I don't mean embed all carthage frameworks, just looking through the ones that the app target is dependendant one, like the generated script phase does. This means someone can say that a framework has a carthage dependency, without having to also add it to all targets that have that framework as a dependency

@toshi0383 toshi0383 force-pushed the ts-always-embed-and-link-frameworks-for-macos branch from d1ec3f2 to d03fb77 Compare October 4, 2017 13:23
@yonaskolb
Copy link
Owner

Can this be moved down to here so it embeds all the relevant carthage frameworks. https://github.com/yonaskolb/XcodeGen/blob/master/Sources/XcodeGenKit/PBXProjGenerator.swift#L392

This is so the target can embed all the carthage dependencies that are linked in all of that target's target dependencies. This is to support the use case where carthage dependencies are defined on the frameworks that need it and not on the application targets.

That whole carthage code will need to be moved up before copyFiles so the embeds can be included in that

@toshi0383 toshi0383 added the WIP label Oct 13, 2017
@toshi0383 toshi0383 force-pushed the ts-always-embed-and-link-frameworks-for-macos branch from 3e2c622 to d03fb77 Compare October 13, 2017 20:42
@toshi0383 toshi0383 removed the WIP label Oct 13, 2017
@toshi0383
Copy link
Collaborator Author

Can we do that in separated PR?
I couldn't make it work correctly.

@yonaskolb
Copy link
Owner

What was the issue?

@yonaskolb yonaskolb merged commit fd2bf39 into yonaskolb:master Oct 13, 2017
@toshi0383
Copy link
Collaborator Author

It correctly embeds nested carthage framework, but doesn't link.
screen shot 2017-10-14 at 6 11 34

Maybe you want to take over ?

@toshi0383 toshi0383 deleted the ts-always-embed-and-link-frameworks-for-macos branch October 13, 2017 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants