@@ -58,42 +58,6 @@ func WithDeprecationMessage(msg string) BundleOption {
58
58
59
59
}
60
60
61
- // NewBundle creates a new Bundle with the provided name and version, and that wraps the provided plugins.
62
- // The list of supported project versions is computed from the provided plugins.
63
- //
64
- // Deprecated: Use the NewBundle informing the options from now one. Replace its use for as the
65
- // following example. Example:
66
- //
67
- // mylanguagev1Bundle, _ := plugin.NewBundle(plugin.WithName(language.DefaultNameQualifier),
68
- // plugin.WithVersion(plugin.Version{Number: 1}),
69
- // plugin.WithPlugins(kustomizecommonv1.Plugin{}, mylanguagev1.Plugin{}),
70
- func NewBundle (name string , version Version , deprecateWarning string , plugins ... Plugin ) (Bundle , error ) {
71
- supportedProjectVersions := CommonSupportedProjectVersions (plugins ... )
72
- if len (supportedProjectVersions ) == 0 {
73
- return nil , fmt .Errorf ("in order to bundle plugins, they must all support at least one common project version" )
74
- }
75
-
76
- // Plugins may be bundles themselves, so unbundle here
77
- // NOTE(Adirio): unbundling here ensures that Bundle.Plugin always returns a flat list of Plugins instead of also
78
- // including Bundles, and therefore we don't have to use a recursive algorithm when resolving.
79
- allPlugins := make ([]Plugin , 0 , len (plugins ))
80
- for _ , plugin := range plugins {
81
- if pluginBundle , isBundle := plugin .(Bundle ); isBundle {
82
- allPlugins = append (allPlugins , pluginBundle .Plugins ()... )
83
- } else {
84
- allPlugins = append (allPlugins , plugin )
85
- }
86
- }
87
-
88
- return bundle {
89
- name : name ,
90
- version : version ,
91
- plugins : allPlugins ,
92
- supportedProjectVersions : supportedProjectVersions ,
93
- deprecateWarning : deprecateWarning ,
94
- }, nil
95
- }
96
-
97
61
// NewBundleWithOptions creates a new Bundle with the provided BundleOptions.
98
62
// The list of supported project versions is computed from the provided plugins in options.
99
63
func NewBundleWithOptions (opts ... BundleOption ) (Bundle , error ) {
@@ -149,7 +113,7 @@ func (b bundle) Plugins() []Plugin {
149
113
return b .plugins
150
114
}
151
115
152
- // Plugins implements Bundle
116
+ // DeprecationWarning return the warning message
153
117
func (b bundle ) DeprecationWarning () string {
154
118
return b .deprecateWarning
155
119
}
0 commit comments