Skip to content

plugins: Pass correct dependency origin information to plugins #7506

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

Merged
merged 2 commits into from
Apr 29, 2024

Conversation

euanh
Copy link
Contributor

@euanh euanh commented Apr 26, 2024

Motivation:

SwiftPM sends information about the origin of each package dependency to the plugin process, but the PluginContext passed to the plugin function incorrectly shows all origins as root.

Modifications:

The necessary information is included correctly in the serialized structure sent to the plugin by SwiftPM. The startup wrapper code in the plugin process correctly deserializes it but does not copy it into the final PluginContext struct which is passed to the plugin function; instead, origin is hard-coded to .root.

This change copies the dependency information into the final context struct.

Result:

Plugins receive correct information about package dependencies - local, with a local path, or repository with a URL, version number and revision hash.

SwiftPM sends information about the origin of each package dependency
in the plugin context, but the PluginContext passed to the plugin
function incorrectly showed all origins as 'root'.   This happened
because the origin field was hard-coded to 'root' in the plugin-side
deserialization function.
@euanh
Copy link
Contributor Author

euanh commented Apr 26, 2024

@swift-ci test

@euanh euanh marked this pull request as ready for review April 29, 2024 07:31
euanh added a commit to euanh/swift-package-manager that referenced this pull request Apr 29, 2024
Cherry pick of swiftlang#7506

SwiftPM sends information about the origin of each package dependency
in the plugin context, but the PluginContext passed to the plugin
function incorrectly showed all origins as 'root'.   This happened
because the origin field was hard-coded to 'root' in the plugin-side
deserialization function.
@euanh euanh enabled auto-merge (squash) April 29, 2024 07:49
@MaxDesiatov
Copy link
Contributor

@swift-ci test

Copy link
Contributor

@MaxDesiatov MaxDesiatov left a comment

Choose a reason for hiding this comment

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

Thanks! 🙏

euanh added a commit to euanh/swift-package-manager that referenced this pull request Apr 29, 2024
Cherry pick of swiftlang#7506

SwiftPM sends information about the origin of each package dependency
in the plugin context, but the PluginContext passed to the plugin
function incorrectly showed all origins as 'root'.   This happened
because the origin field was hard-coded to 'root' in the plugin-side
deserialization function.
@MaxDesiatov
Copy link
Contributor

@swift-ci test windows

@euanh euanh merged commit b0b652c into swiftlang:main Apr 29, 2024
5 checks passed
MaxDesiatov pushed a commit that referenced this pull request Apr 30, 2024
…7511)

Cherry pick of #7506

**Explanation**: SwiftPM sends information about the origin of each
package dependency to the plugin process, but the `PluginContext` passed
to the plugin function incorrectly shows all origins as `root`.
**Scope**: Isolated to `PackagePlugin/PluginContextDeserializer.swift`
**Risk**: Low, isolated to plugins.
**Testing**: Existing end-to-end automated test was modified to cover
the fix.
**Issue**: rdar://127104161
**Reviewer**: @MaxDesiatov 

### Modifications:

The necessary information is included correctly in the serialized
structure sent to the plugin by SwiftPM. The startup wrapper code in the
plugin process correctly deserializes it but does not copy it into the
final `PluginContext` struct which is passed to the plugin function;
instead, `origin` is hard-coded to `.root`.

This change copies the dependency information into the final context
struct.

### Result:

Plugins receive correct information about package dependencies -
`local`, with a local path, or `repository` with a URL, version number
and revision hash.
@euanh euanh deleted the fix-plugin-dependency-origin branch April 30, 2024 15:47
furby-tm pushed a commit to wabiverse/swift-package-manager that referenced this pull request May 15, 2024
…lang#7506)

### Motivation:

SwiftPM sends information about the origin of each package dependency to
the plugin process, but the `PluginContext` passed to the plugin
function incorrectly shows all origins as `root`.

### Modifications:

The necessary information is included correctly in the serialized
structure sent to the plugin by SwiftPM. The startup wrapper code in the
plugin process correctly deserializes it but does not copy it into the
final `PluginContext` struct which is passed to the plugin function;
instead, `origin` is hard-coded to `.root`.

This change copies the dependency information into the final context
struct.

### Result:

Plugins receive correct information about package dependencies -
`local`, with a local path, or `repository` with a URL, version number
and revision hash.
furby-tm pushed a commit to wabiverse/swift-package-manager that referenced this pull request May 15, 2024
…lang#7506)

### Motivation:

SwiftPM sends information about the origin of each package dependency to
the plugin process, but the `PluginContext` passed to the plugin
function incorrectly shows all origins as `root`.

### Modifications:

The necessary information is included correctly in the serialized
structure sent to the plugin by SwiftPM. The startup wrapper code in the
plugin process correctly deserializes it but does not copy it into the
final `PluginContext` struct which is passed to the plugin function;
instead, `origin` is hard-coded to `.root`.

This change copies the dependency information into the final context
struct.

### Result:

Plugins receive correct information about package dependencies -
`local`, with a local path, or `repository` with a URL, version number
and revision hash.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants