Replies: 4 comments 2 replies
-
I'm on board with the proposal. As you highlighted, it's important that we keep |
Beta Was this translation helpful? Give feedback.
-
@fortmarek can you please review this RFC as well so we can proceed on the PR? |
Beta Was this translation helpful? Give feedback.
-
@neakor I think we are good to go ahead and build what you are proposing here. Thanks for ensuring we are all aligned through an RFC proposal. |
Beta Was this translation helpful? Give feedback.
-
Thank you team for reviewing! |
Beta Was this translation helpful? Give feedback.
-
Abstract
This RFC proposes adding a new format to the
tuist graph
command. The new formatjson
instructs the CLI to output the project graph into the specified output file in JSON format. This is an addition to the existingpng
anddot
formats we already support.Rationale
The purpose of this additional output format is to allow third-party tools to parse and thereby understand the project graph. The specific use case at hand is around project changeset detection.
When building and testing large projects, especially in CI environments, in order to improve efficiency, the tooling should be able to detect and only build/test schemes that are affected by a changeset. Given a set of modified file paths which may be obtained from Git, the tooling can identify the set of packages that contain these modified files by parsing the package graph. In order to identify the Xcode projects these packages belong, the project graph needs to be parsed. Currently, there is no suitable way to output the project graph into a parsable format. The existing
png
anddot
formats are not designed for machine parsing. The manifest files themselves are written in Swift. Therefore they are not easily parsable either.Once the project graph can be output into a parsable format, many other tooling can be built beyond the use case at hand.
Using the
dump
commandThe existing
dump
command does output some information into a parsable JSON format. However, the information in the output is insufficient for the use case at hand. Specifically, the output does not contain paths of dependency packages within a project.Description
This RFC proposes two separate changes. First, a new model
struct
is added to represent the output model of the project graph. Two, thegraph
command and its corresponding services are modified to support serialization and output of this new model.New
OutputGraph
The new
OutputGraph
struct
represents the model that can be serialized and exported into JSON. This model is derived from the existingGraph
struct
. Adding this new intermediary structure decouples the Tuist internalGraph
type from the serializable type. In case the internal type were to change, the output can stay stable.Modified graph command and its services
The
graph
command'sformat
parameter now accepts a newjson
value. When this value is specified, the command and its corresponding services constructs an instance of the newOutputGraph
struct
from the existingGraph
type. This new instance is then serialized intoString
and exported to the destination file.Beta Was this translation helpful? Give feedback.
All reactions