Add support for Swift Package Manager #1032
Reference in New Issue
Block a user
No description provided.
Delete Branch "swiftpm"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR addresses #965
Objective was to add support for swiftpm, while at the same time keeping the change set minimal. The "trick" here is to add a public header file that is used from Package.swift.
Note: this PR does not intend to expose YogaKit through SPM, only yoga itself.
@@ -0,0 +7,4 @@
#pragma once
#ifdef __OBJC__
Is it possible to use the SWIFT_PACKAGE preprocessor flag here to make it even safer?
Ping #921
@@ -0,0 +7,4 @@
#pragma once
#ifdef __OBJC__
Does not seem to be defined at the time the public header is compiled. Only when the code that's part of the package is built.
We are deprecating YogaKit as part of the Yoga 2.0 release. We are still going to release a new revision based on the current state of the repo, but won't be accepting new contributions, since we are going to be removing it from the repo after.
@NickGerleman this wasn't for YogaKit though. You keep updating the CocoaPods package, why can't you make a SPM package too?
Oh yes it does look like I mistagged this.
My initial focus has been on rejuvenating the packages that Yoga is already published to, so Maven Central, CocoaPods, NPM. I do think SPM is a good target, and likely not too much burden to add. Though if we do add it, I think we will need to add some continuous validation for it, else it will atrophy. That is something that has been missing from the various PRs I have seen.
Apart from the validation, I have wanted there to be someone on the team with understanding of new infra before we decide to support it. So, after the contribution, we can continue to support it. I don't think anyone has looked into that as much yet.
cc @cipolleschi in case you have thoughts on this.
Hi there, thanks @NickGerleman for tagging me.
I'm highly supportive of this change. Yoga is one of the few React Native packages that we can use independently and it makes a lot of sense to me to offer also a Swift PM alternative.
Also, the setup is fairly simple and I really like the folder with the public umbrella header.
I have not spent a lot of time thinking about how to validate it, though. One simple way could be to have an example app that import the dependency as a package and exercise it.
Another way could be to automatically generate the Package.swift from the podspec.
I don't have a strong opinion, although the second could be better in the long run.
I'll leave the decision to you.
I'm very happy about this happening. It is a first step toward embracing more modern languages. I left a couple of comments to update a couple of values, but I'll leave you the last word on those.
@@ -0,0 +1,35 @@
// swift-tools-version:5.3
we can probably use a more recent version of swift-tools here. At least
5.8
, until Xcode 15 become stable.@@ -0,0 +31,4 @@
]
)
],
cxxLanguageStandard: .cxx14
this should probably be
.cxx17
, as this is the version we are typically using internally.@@ -0,0 +31,4 @@
]
)
],
cxxLanguageStandard: .cxx14
Yoga is targeting C++14 for a little bit longer. There was some unhappiness when I tried to bump from C++ 11 directly to 17.
LLVM has had C++ 17 support for almost six years though, so I do plan for us to do a bump later this year. Same rules for same infra, and unlocking more support.
See https://github.com/facebook/yoga/pull/1203 for discussion
@@ -0,0 +1,35 @@
// swift-tools-version:5.3
We should maybe consider bumping this in CocoaPods as well then, which is currently set on 5.1
This can be closed now we have
ef5784aca6
wasPull request closed