Skip to content

Commit

Permalink
change to "base plugin"
Browse files Browse the repository at this point in the history
  • Loading branch information
mfridman committed Dec 5, 2024
1 parent f2ad326 commit a2edfb7
Show file tree
Hide file tree
Showing 5 changed files with 641 additions and 642 deletions.
6 changes: 3 additions & 3 deletions private/bufpkg/bufremoteplugin/bufremoteplugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func PluginRegistryToProtoRegistryConfig(pluginRegistry *bufremotepluginconfig.R
goConfig := &registryv1alpha1.GoConfig{}
goConfig.MinimumVersion = pluginRegistry.Go.MinVersion
if pluginRegistry.Go.BasePluginIdentity != nil {
goConfig.BasePluginName = pluginRegistry.Go.BasePluginIdentity.IdentityString()
goConfig.BasePlugin = pluginRegistry.Go.BasePluginIdentity.IdentityString()
}
if pluginRegistry.Go.Deps != nil {
goConfig.RuntimeLibraries = make([]*registryv1alpha1.GoConfig_RuntimeLibrary, 0, len(pluginRegistry.Go.Deps))
Expand Down Expand Up @@ -252,8 +252,8 @@ func ProtoRegistryConfigToPluginRegistry(config *registryv1alpha1.RegistryConfig
case config.GetGoConfig() != nil:
goConfig := &bufremotepluginconfig.GoRegistryConfig{}
goConfig.MinVersion = config.GetGoConfig().GetMinimumVersion()
if config.GetGoConfig().GetBasePluginName() != "" {
basePluginIdentity, err := bufremotepluginref.PluginIdentityForString(config.GetGoConfig().GetBasePluginName())
if config.GetGoConfig().GetBasePlugin() != "" {
basePluginIdentity, err := bufremotepluginref.PluginIdentityForString(config.GetGoConfig().GetBasePlugin())
if err != nil {
return nil, err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ type ExternalGoRegistryConfig struct {
Module string `json:"module,omitempty" yaml:"module,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
} `json:"deps,omitempty" yaml:"deps,omitempty"`
BasePluginName string `json:"base_plugin_name,omitempty" yaml:"base_plugin_name,omitempty"`
BasePlugin string `json:"base_plugin,omitempty" yaml:"base_plugin,omitempty"`
}

// ExternalNPMRegistryConfig is the external registry configuration for a JavaScript NPM plugin.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,17 +280,17 @@ func newGoRegistryConfig(
// If a base plugin name is specified, it must also exist in the top-level plugin dependencies
// list.
var basePluginIdentity bufremotepluginref.PluginIdentity
if externalGoRegistryConfig.BasePluginName != "" {
if externalGoRegistryConfig.BasePlugin != "" {
var err error
basePluginIdentity, err = pluginIdentityForStringWithOverrideRemote(externalGoRegistryConfig.BasePluginName, overrideRemote)
basePluginIdentity, err = pluginIdentityForStringWithOverrideRemote(externalGoRegistryConfig.BasePlugin, overrideRemote)
if err != nil {
return nil, fmt.Errorf("failed to parse base plugin: %w", err)
}
ok := slices.ContainsFunc(pluginDependencies, func(ref bufremotepluginref.PluginReference) bool {
return ref.IdentityString() == basePluginIdentity.IdentityString()
})
if !ok {
return nil, fmt.Errorf("base plugin %q not found in plugin dependencies", externalGoRegistryConfig.BasePluginName)
return nil, fmt.Errorf("base plugin %q not found in plugin dependencies", externalGoRegistryConfig.BasePlugin)
}
}
return &GoRegistryConfig{
Expand Down
Loading

0 comments on commit a2edfb7

Please sign in to comment.