k3s/pkg/codegen/main.go

85 lines
1.7 KiB
Go
Raw Normal View History

2019-01-01 08:23:01 +00:00
package main
import (
2019-05-09 22:05:51 +00:00
"os"
bindata "github.com/go-bindata/go-bindata"
v1 "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1"
2019-05-09 22:05:51 +00:00
controllergen "github.com/rancher/wrangler/pkg/controller-gen"
"github.com/rancher/wrangler/pkg/controller-gen/args"
2019-01-01 08:23:01 +00:00
"github.com/sirupsen/logrus"
)
var (
basePackage = "github.com/k3s-io/k3s/types"
2019-01-01 08:23:01 +00:00
)
func main() {
2019-05-09 22:05:51 +00:00
os.Unsetenv("GOPATH")
2019-01-09 16:54:15 +00:00
bc := &bindata.Config{
Input: []bindata.InputConfig{
{
Path: "build/data",
Recursive: true,
},
},
Package: "data",
NoCompress: true,
NoMemCopy: true,
NoMetadata: true,
Output: "pkg/data/zz_generated_bindata.go",
}
if err := bindata.Translate(bc); err != nil {
logrus.Fatal(err)
}
2019-01-22 21:14:58 +00:00
bc = &bindata.Config{
Input: []bindata.InputConfig{
{
Path: "manifests",
Recursive: true,
2019-01-22 21:14:58 +00:00
},
},
Package: "deploy",
NoMetadata: true,
Prefix: "manifests/",
Output: "pkg/deploy/zz_generated_bindata.go",
Tags: "!no_stage",
2019-01-22 21:14:58 +00:00
}
if err := bindata.Translate(bc); err != nil {
logrus.Fatal(err)
}
bc = &bindata.Config{
Input: []bindata.InputConfig{
{
Path: "build/static",
Recursive: true,
},
},
Package: "static",
NoMetadata: true,
Prefix: "build/static/",
Output: "pkg/static/zz_generated_bindata.go",
Tags: "!no_stage",
}
if err := bindata.Translate(bc); err != nil {
logrus.Fatal(err)
}
2019-05-09 22:05:51 +00:00
controllergen.Run(args.Options{
OutputPackage: "github.com/k3s-io/k3s/pkg/generated",
2019-05-09 22:05:51 +00:00
Boilerplate: "scripts/boilerplate.go.txt",
Groups: map[string]args.Group{
"k3s.cattle.io": {
Types: []interface{}{
v1.Addon{},
v1.ETCDSnapshotFile{},
2019-05-09 22:05:51 +00:00
},
GenerateTypes: true,
GenerateClients: true,
2019-05-09 22:05:51 +00:00
},
},
})
2019-01-01 08:23:01 +00:00
}