-
-
Notifications
You must be signed in to change notification settings - Fork 517
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
[RFC] Standard interface for defining and consuming third-party dependencies #1674
Comments
Minor note: Firefox iOS uses it for dynamic frameworks, static frameworks, and pure source files (rather than also using git submodules). |
Great RFC, @pepibumur 👏 This would be a great addition as it'd make it easier to combine various dependency managers and all the dependencies would be defined in manifests (which is great and makes it more comprehensible). Now, let me go through a few points that came up to my mind while reading this:
It's the first time I am hearing about it, but if it's something that is used why not. A lot of dependency managers use their own format, so it'd be nice to use some standard and leverage code-highlighting with
Shouldn't it be in
I think this can be omitted in the first iteration and we can add if we see the demand
Maybe
From the codebase-perspective, it'd be nice to use the APIs directly, but it might create some confusion for the users who might expect that the build is done with their currently selected toolchain, whereas if we used APIs directly, it wouldn't reflect that. Overall, I am in favor of this change, but it's a trivial feature. My suggestion is to try to use the proposed logic for SPM where we already have tight control and so it might be the easiest manager to port - and while our current solution for SPM is good, we still delegate a lot to Xcode and that means there are things we are not able to optimize for. For example one thing we could do if we have more control, is to more efficiently resolve dependencies when running |
In combination with the cache, developers won't have to use Rome anymore. I know this means moving away from the setup that they already invested in, but they'll benefit from having caching at all the levels, including for their local modules.
We can call it
There are libraries that we can use for that. The resolution of dependencies will be done by the package managers so I think we can keep their lockfiles as the source of truth:
I'll in fact play with JSON, YAML, and TOML to see which one outputs a more human-readable format. I think it's great being able to open that file and understanding it at a glance without having to make an effort to parse it. For example, if we end up with many indentations, YAML might be hard for people to process. It's hard to say though until we know more about the structure of this file.
I suggested
Agree
SPM does it. I think for the first iteration we can keep them separated, and once we validate this idea, we can think about integrating it into generate. SPM does it, so it's a behavior that developers are already getting used to.
I like the idea of starting with a dependency manager. I'd do Carthage though because it already provides the dependencies in the format that we expect: pre-compiled binaries. If that works, we can then do the SPM because it's easier to integrate with our Swift codebase. And last, I'd do CocoaPods because it's in Ruby and I think the integration will be more complex. |
This has already been done and therefore can be closed |
Need/problem
There are three dependency managers in the industry for Xcode projects: Carthage, CocoaPods, & Swift Package Manager.
Although Tuist provides an interface to integrate with them by describing their dependencies as target dependencies, the approach has proven to be problematic. Here's a list of issues that users reported:
Pods.xcodeproj
project and therefore the linking of Pods fails at build times. Some teams have mitigated this issue by running some post-generation scripts that runpod install
to integrate dependencies into the right workspace.All of this results in a bad user experience and confused users. Moreover, with more people in the industry adopting Swift Package Manager as their dependency manager, projects are starting to feel the need of doing the same and have no clear path for transitioning.
Last but not least, the fact that CocoaPods and Carthage resolve the dependencies dynamically after the project has been generated, complicates the usage of caching because it's build on the assumptions that:
Motivation
Detailed design
We'd standardise the contract between the dependency managers and Tuist. The contract would be:
Tuist/Dependencies.swift
We'd introduce a new manifest file that projects could use to list the third-party dependencies of their project:
tuist dependencies fetch/update
We'd add a new set of commands for pulling and updating dependencies. In the case of CocoaPods and SPM, it'd generate an Xcode project and then use it to build .xcframeworks. .xcframeworks would be stored under
Tuist/Dependencies
. Each subdirectory under that directory represents a dependency and contains in it both the binary, and the support files. The structure of the dependency's directory could be something along the lines of:Dependencies.resolved
Alongside the pre-compiled binaries for dependencies, Tuist would output a new file that lists the versions dependencies have been resolved to, their references, and the dependency tree.
New TargetDependency case
And last but not least, we'd add a new type of target dependency,
.thirdParty
, whose only value is the reference of the third-party dependency as it's shown in theDependencies.resolved
file:As part of building the in-memory graph, Tuist would use the information from the
Dependencies.resolved
to replace.thirdParty
with the right dependency. This could be done from a graph mappers. For example, the example above would become:Drawbacks
Alternatives
Adoption strategy
How we teach this
Unresolved questions
Dependencies.resolved
file?Dependencies.toml
so that editors can apply code-highlighting automatically?Tuist/Dependencies
the right directory for placing the binaries?thirdParty
a good name for referencing those dependencies or should we use something like.remote
instead?tuist generate
and their projects reference a third-party dependency that have not been resolved by runningtuist dependencies fetch
?The text was updated successfully, but these errors were encountered: