Skip to content

Support installing docc plugin via env var#845

Merged
ktoso merged 2 commits into
swiftlang:mainfrom
ktoso:wip-env-enable-plugin
Jul 14, 2026
Merged

Support installing docc plugin via env var#845
ktoso merged 2 commits into
swiftlang:mainfrom
ktoso:wip-env-enable-plugin

Conversation

@ktoso

@ktoso ktoso commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

This is a workaround for swift package add-dependency not working due to swift-subprocess pulling it in explicitly:

[swift-java] -> % swift package add-dependency https://github.com/swiftlang/swift-docc-plugin --from 1.1.0
error: unable to add dependency 'https://github.com/swiftlang/swift-docc-plugin' because it already exists in the list of dependencies

even though

-> % swift package generate-documentation
error: Unknown subcommand or plugin name 'generate-documentation'
Usage: swift package <options> <subcommand>

So this is a workaround to enable the plugin in this package

This is a workaround for `swift package add-dependency` not working due
to swift-subprocess pulling it in explicitly:

```
[swift-java] -> % swift package add-dependency https://github.com/swiftlang/swift-docc-plugin --from 1.1.0
error: unable to add dependency 'https://github.com/swiftlang/swift-docc-plugin' because it already exists in the list of dependencies
```

even though

```
-> % swift package generate-documentation
error: Unknown subcommand or plugin name 'generate-documentation'
Usage: swift package <options> <subcommand>
```

So this is a workaround to enable the plugin in this package
@ktoso

ktoso commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

Related swiftpm issue swiftlang/swift-package-manager#10294

@ktoso

ktoso commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

Verified in earlier run

@ktoso ktoso merged commit ffc1580 into swiftlang:main Jul 14, 2026
42 checks passed
iCharlesHu pushed a commit to swiftlang/swift-subprocess that referenced this pull request Jul 14, 2026
Nowadays (as weird as it is) projects are not expected to have the dependency declared explicitly. It must be added ad-hoc or by the swift package index. Otherwise all kinds of tools break, including swiftlang/docs.

It would be ideal that all projects can just add the plugin, but that's not the state of the world nowadays.

Meanwhile I did workarounds in adopter projects to unbreak swiftlang/docs building with those added, more details here swiftlang/swift-java#845

cc @heckj
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.

1 participant