test(build): plugin dirs, install resolution and summer.yaml edits

- TestPluginDirs and TestEffectiveFramework over go list JSON fixtures and
  git checkouts; TestResolveInstall against an in-memory registry;
  TestAppendManifestPlugins for the in-place summer.yaml edit
- fix: a package of the application's own module was reported as a
  submodule with the application's git describe; it is in-app (local)
- fix: summer.yaml items written as '-   id:' keep their spacing when
  plugin:add or plugin:install appends to them
This commit is contained in:
Jakub Zych
2026-10-29 21:22:47 +01:00
parent 9109e5b139
commit 7de774b0b3
5 changed files with 830 additions and 10 deletions

View File

@@ -132,7 +132,7 @@ func resolvePluginInfo(ctx context.Context, appDir string, m Manifest) ([]party.
if w := readPluginYAML(pkg.Dir, info); w != "" {
warnings = append(warnings, fmt.Sprintf("plugin metadata: %s: %s", p.ID, w))
}
pluginVersion(ctx, pkg, info)
pluginVersion(ctx, appDir, pkg, info)
}
return infos, warnings
}
@@ -163,8 +163,10 @@ func readPluginYAML(dir string, info *party.Info) string {
// pluginVersion sets info.Source and info.Version (D-07): the module
// version for a plugin from the module cache, git describe for a plugin
// directory that is its own repository, nothing for an in-app plugin.
func pluginVersion(ctx context.Context, pkg listedPackage, info *party.Info) {
// directory that is its own repository, nothing for an in-app plugin. A
// package of the application's own module is in-app even though the
// application directory is the top level of a repository.
func pluginVersion(ctx context.Context, appDir string, pkg listedPackage, info *party.Info) {
mod := pkg.Module
switch {
case mod == nil:
@@ -178,7 +180,10 @@ func pluginVersion(ctx context.Context, pkg listedPackage, info *party.Info) {
if root == "" {
root = pkg.Dir
}
if isOwnRepository(ctx, root) {
if abs, err := filepath.Abs(appDir); err == nil {
appDir = abs
}
if !samePath(root, appDir) && isOwnRepository(ctx, root) {
info.Source = party.SourceSubmodule
info.Version = gitDescribe(ctx, root)
} else {