Documentation ¶
Overview ¶
Package genutil provides helper functions that are useful for generating GIR packages.
Index ¶
- func AddPackages(repos *gir.Repositories, pkgs []gendata.Package) error
- func AppendGoFiles(path string, contents map[string]string) error
- func CleanDirectory(path string, except []string) error
- func EnsureDirectory(path string, expects ...[]string) error
- func GenerateAll(gen *girgen.Generator, dst string, except []string) []error
- func GeneratePackages(gen *girgen.Generator, dst string, pkgs []gendata.Package) []error
- func LoadExternOverrides(mod string, repos gir.Repositories) map[string]string
- func LoadPackages(pkgs []gendata.Package) (gir.Repositories, error)
- func MajorVersion(nsp *gir.Namespace) int
- func ModulePath(module string, overrides map[string]string) func(*gir.Namespace) string
- func MustAddPackages(repos *gir.Repositories, pkgs []gendata.Package)
- func MustLoadPackages(pkgs []gendata.Package) gir.Repositories
- func PrintAddedPkgs(repos gir.Repositories)
- func StringSet(strs ...[]string) map[string]struct{}
- func WriteNamespace(ng *girgen.NamespaceGenerator, basePath string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddPackages ¶
func AddPackages(repos *gir.Repositories, pkgs []gendata.Package) error
AddPackages adds the given list of packages into the repository.
func AppendGoFiles ¶
AppendGoFiles appends the value of the given contents map into the files at its keys and run go fmt on it.
func CleanDirectory ¶
CleanDirectory cleans up the directory at the given path. Files listed inside except will not be wiped.
func EnsureDirectory ¶
EnsureDirectory ensures that all files inside the given directory path are present in the given list of string slices.
func GenerateAll ¶
GenerateAll generates all namespaces inside the given generator into the given dst path. It uses WriteNamespace to do so. The namespaces will be generated in parallel. If a versioned namespace is in the except slice, then it is skipped.
func GeneratePackages ¶
GeneratePackages generates the given pkgs list into the given dst directory. It uses WriteNamespace to do so. The namespaces will be generated in parallel. Most external GIR generators should call this.
func LoadExternOverrides ¶
func LoadExternOverrides(mod string, repos gir.Repositories) map[string]string
LoadExternOverrides creates a map of GIR versioned namespace names to the Go import path from the given list of all repositories.
func LoadPackages ¶
func LoadPackages(pkgs []gendata.Package) (gir.Repositories, error)
LoadPackages loads all GIR repositories from the given list of packages.
func MajorVersion ¶
MajorVersion returns the major version of the GIR namespace in int.
func ModulePath ¶
ModulePath crafts the full module path from the given base module path. If the overrides map is given, then the function will use that as the list of special cases.
func MustAddPackages ¶
func MustAddPackages(repos *gir.Repositories, pkgs []gendata.Package)
MustAddPackages bails if packages fail to be added.
func MustLoadPackages ¶
func MustLoadPackages(pkgs []gendata.Package) gir.Repositories
MustLoadPackages bails if packages fail to load.
func PrintAddedPkgs ¶
func PrintAddedPkgs(repos gir.Repositories)
PrintAddedPkgs prints to console the added packages.
func StringSet ¶
StringSet joins the given slices of strings into a map with the keys as the values of each of the given slices.
func WriteNamespace ¶
func WriteNamespace(ng *girgen.NamespaceGenerator, basePath string) error
WriteNamespace generates everything in the given namespace and writes it to the given basePath.
Types ¶
This section is empty.