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

Add directlyEmbedCarthageDependencies to Target #361

Merged
merged 6 commits into from
Jul 31, 2018

Conversation

brentleyjones
Copy link
Collaborator

Resolves #359.

@brentleyjones brentleyjones force-pushed the disable-copy-frameworks branch from 6a404ff to 57d7605 Compare July 25, 2018 00:27
Copies the pattern from `getAllDependenciesPlusTransitiveNeedingEmbedding`. They should be combined into one solution eventually.
Allows for choice on if `copy-frameworks` or an `Embed Frameworks` build phase should be used to embed Carthage framworks. Defaults to `true` for macOS targets to match current behavior.
…nies

If using `transitivelyLinkDependencies` this already worked. In the future `getAllDependenciesPlusTransitiveNeedingEmbedding` and `getAllCarthageDependencies` should really be the same mechanism.
@brentleyjones brentleyjones force-pushed the disable-copy-frameworks branch from 57d7605 to 0ec3b1d Compare July 25, 2018 00:57
Copy link
Collaborator

@toshi0383 toshi0383 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work! Just left a couple of comments.

}

for dependency in carthageDependencies {
guard target.type != .staticLibrary else { break }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nits: I prefer if than guard in this case.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the target type is non dependant on the dependencies, could the if go outside this loop?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to merge after this

var frameworkPath = platformPath + dependency.reference
if frameworkPath.extension == nil {
frameworkPath = Path(frameworkPath.string + ".framework")
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can always add the .framework extension, without if statement.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can list extension as part of a carthage dependency. Also, both of these are just copying what was there in the above for loop. I would like to keep both of them the same for this PR, and if they should change they can in a different one. 😁

@brentleyjones
Copy link
Collaborator Author

brentleyjones commented Jul 26, 2018

@yonaskolb instead of a configurable value I could just change the default. Thinking more about it I think the default should only use the script for iOS/tvOS/watchOS Application targets. I’m going to be updating Carthage’s docs to say the same thing based on the conversation over there. Let me know if you want the value or not (I’ll update the default in a little bit).

The only reason I can think of why someone would want a configurable value, to override that default, is if they wanted to create umbrella frameworks on iOS (which isn't really "supported" by Apple). Personally I feel safer having this as an configurable value though, since someone out there might want to change the default.

`directlyEmbedCarthageDependencies` is only `false` now for iOS/tvOS/watchOS applications.
@brentleyjones
Copy link
Collaborator Author

Carthage/Carthage#2537 for update to their docs. Re-reading them they do say to only use it in iOS/tvOS/watchOS applications.

@yonaskolb
Copy link
Owner

I'm always hesitant to add too many options, as they will need to be supported going forward, and the name will have to stick around. Especially if the outcome can be achieved with build settings. In this case though it's something you can't change with a manual build setting.

In terms of the default, what does that mean for tests that run on a device? Are there also no other cases where things need stripping?


let targetDependencies = (target.transitivelyLinkDependencies ?? project.options.transitivelyLinkDependencies) ?
getAllDependenciesPlusTransitiveNeedingEmbedding(target: target) : target.dependencies

let directlyEmbedCarthage = target.directlyEmbedCarthageDependencies ?? !(target.platform.requiresSimulatorStripping && target.type.isApp)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type.isApp actually includes tests as well. Is that on purpose?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Tests have an extension of .xctests. isApp checks for .app correct?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the getter, it includes test targets 👍
isApp is used in other places. It's ok if you want to create new property and rename the usages to be more explicit about what they are checking

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I take all that back. I was thinking of isExecutable

@brentleyjones
Copy link
Collaborator Author

You only need to strip when submitting to the App Store, so tests run on device are fine.

Sent with GitHawk

@brentleyjones
Copy link
Collaborator Author

I agree on this being an option since you can't change it with a build setting.

@brentleyjones brentleyjones merged commit 04ba465 into yonaskolb:master Jul 31, 2018
@brentleyjones brentleyjones deleted the disable-copy-frameworks branch July 31, 2018 12:49
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.

3 participants