[MM-37664] Remove deprecated Backend field from plugin manifest (#18064)

Этот коммит содержится в:
Ben Schumacher
2021-08-13 19:41:32 +02:00
коммит произвёл GitHub
родитель d447d9b64a
Коммит cbba2f1cca
8 изменённых файлов: 19 добавлений и 87 удалений

Просмотреть файл

@@ -176,9 +176,6 @@ type Manifest struct {
// Server defines the server-side portion of your plugin.
Server *ManifestServer `json:"server,omitempty" yaml:"server,omitempty"`
// Backend is a deprecated flag for defining the server-side portion of your plugin. Going forward, use Server instead.
Backend *ManifestServer `json:"backend,omitempty" yaml:"backend,omitempty"`
// If your plugin extends the web app, you'll need to define webapp.
Webapp *ManifestWebapp `json:"webapp,omitempty" yaml:"webapp,omitempty"`
@@ -278,11 +275,6 @@ func (m *Manifest) ClientManifest() *Manifest {
func (m *Manifest) GetExecutableForRuntime(goOs, goArch string) string {
server := m.Server
// Support the deprecated backend parameter.
if server == nil {
server = m.Backend
}
if server == nil {
return ""
}
@@ -301,7 +293,7 @@ func (m *Manifest) GetExecutableForRuntime(goOs, goArch string) string {
}
func (m *Manifest) HasServer() bool {
return m.Server != nil || m.Backend != nil
return m.Server != nil
}
func (m *Manifest) HasWebapp() bool {

Просмотреть файл

@@ -707,44 +707,6 @@ func TestManifestGetExecutableForRuntime(t *testing.T) {
"amd64",
"path/to/executable",
},
{
"deprecated backend field, ignored since server present",
&Manifest{
Server: &ManifestServer{
Executables: map[string]string{
"linux-amd64": "linux-amd64/path/to/executable",
"darwin-amd64": "darwin-amd64/path/to/executable",
"windows-amd64": "windows-amd64/path/to/executable",
"linux-arm64": "linux-arm64/path/to/executable",
},
},
Backend: &ManifestServer{
Executables: map[string]string{
"linux-amd64": "linux-amd64/path/to/executable",
"darwin-amd64": "darwin-amd64/path/to/executable",
"windows-amd64": "windows-amd64/path/to/executable",
},
},
},
"linux",
"amd64",
"linux-amd64/path/to/executable",
},
{
"deprecated backend field used, since no server present",
&Manifest{
Backend: &ManifestServer{
Executables: map[string]string{
"linux-amd64": "linux-amd64/path/to/executable",
"darwin-amd64": "darwin-amd64/path/to/executable",
"windows-amd64": "windows-amd64/path/to/executable",
},
},
},
"linux",
"amd64",
"linux-amd64/path/to/executable",
},
}
for _, testCase := range testCases {
@@ -798,28 +760,6 @@ func TestManifestHasServer(t *testing.T) {
},
true,
},
{
"single executable defined via deprecated backend",
&Manifest{
Backend: &ManifestServer{
Executable: "path/to/executable",
},
},
true,
},
{
"multiple executables defined via deprecated backend",
&Manifest{
Backend: &ManifestServer{
Executables: map[string]string{
"linux-amd64": "linux-amd64/path/to/executable",
"darwin-amd64": "darwin-amd64/path/to/executable",
"windows-amd64": "windows-amd64/path/to/executable",
},
},
},
true,
},
}
for _, testCase := range testCases {