Skip to content

Conversation

@johnbute
Copy link
Contributor

Add-dependency will update all manifest files in a swift package

Motivation:

#9248

Modifications:

Essentially, just added a function to query all possible manifest files, then apply edits to each one.

Result:

Now, add-dependency can edit multiple manifests at the same time such as swift argument parser.

@johnbute
Copy link
Contributor Author

There is still needing tests + option to specify the manifest files a user wants to add-dependencies to.

@johnbute
Copy link
Contributor Author

Furthermore, I think that on top of add-dependency, other similar subcommands, such as add-target and add-product, should also support this logic

// Find version specific manifests
do {
let packageContents = try fileSystem.getDirectoryContents(packagePath)
let regexManifestFile = try! RegEx(pattern: #"^Package@swift-(\d+)(?:\.(\d+))?(?:\.(\d+))?.swift$"#)
Copy link
Member

Choose a reason for hiding this comment

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

question: Is there some reusable regex or function that can find all of the package manifests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, sadly there is not a reusable regex. Furthermore, the only function that is used for finding package manifests only returns one (which is required for the manifest loader, as you would not load multiple manifests)

@cmcgee1024
Copy link
Member

This change looks good to me. If there were some tests I think that it can be flipped to "ready for review."

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.

2 participants