-
Notifications
You must be signed in to change notification settings - Fork 7
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
Now custom configuration types are supported #4
Conversation
… preserving coding adapter
… package generate-xcodeproj
Fixes #1 . |
Also, a nice improvement is that now if there is multiple libraries using #if canImport(LibraryOneConfig)
import LibraryOneConfig
LibraryOneConfig().write()
#endif
#if canImport(LibraryTwoConfig)
import LibraryTwoConfig
LibraryTwoConfig().write()
#endif |
But now there is another problem. If my package which depends on my dependency does not need |
You got this 👍 |
…r PackageConfigs target and build it to have listed dependencies dylibs also build
Made it all work. Now mkdir -p ./Sources/PackageConfigs/
touch ./Sources/PackageConfigs/PackageConfigs.swift
swift build --target PackageConfigs And user is now expected to define any dependencies that require .target(name: "PackageConfigs", dependencies: [
"PackageConfig",
"SomeLibraryConfig",
]), What this achieves is that being present in a target assures that we get all of the dylibs of the listed libraries built when we run the executable. # after adding or changing the `PackageConfigs` target
swift run resolve
# creates empty source for the target and builds it which gives us all of it's dylibs
swift run package-config
# and now user can run the dependency he wished
swift run some-executable
|
Done. After that user can run So a correct definition in the I think this way of achieving this functionality is ok. |
|
Ohh. Figured out another problem 😒. Can not have two or more different packages |
Figured out since |
It works.
|
@orta I think it's done. |
Here is test example project with two of my own libraries used depending on PackageConfig from my fork. rm -rf .build
rm -rf test.xcodeproj
rm -rf Package.resolved
swift run package-config
swift package generate-xcodeproj
swift run phase
swift run ignore
// swift-tools-version:4.2
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "test",
products: [
.library(name: "test", targets: ["test"]),
],
dependencies: [
.package(url: "https://github.com/IgorMuzyka/phase", .branch("master")),
.package(url: "https://github.com/IgorMuzyka/ignore", .branch("master")),
],
targets: [
.target(name: "test", dependencies: []),
.testTarget(name: "testTests",dependencies: ["test"]),
.target(name: "PackageConfigs", dependencies: [
"PhaseConfig",
"IgnoreConfig",
]),
]
)
#if canImport(PhaseConfig)
import PhaseConfig
PhaseConfig(phases: []).write()
#endif
#if canImport(IgnoreConfig)
import IgnoreConfig
IgnoreConfig(excludedTargets: ["test", "testTests"]).write()
#endif This succeeds and results in xcode project with applied changes from running executables. |
Hmm running |
( Sorry, I'm at the react native core dev summit hacking - will try get you a proper run through tomorrow. I sent you a collaborator invite too, looks interesting ) |
Thats fine. Already accepted invite. Have fun at the conference. |
Alright, cool, I've given this a review - I think it all makes sense. Let's call this version 0.9.0 to give some chance to make API breaking changes in production, but I think this makes sense! |
Awesome 👍🏻👍🏻👍🏻👍🏻👍🏻 |
Would you add a tag with version?) |
Now it all works.
You can define custom config types and use them within libraries and
Package.swift
(no external dependencies needed this time).Updated readme.
@orta please check.