genutil

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2021 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package genutil provides helper functions that are useful for generating GIR packages.

Index

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

func AppendGoFiles(path string, contents map[string]string) error

AppendGoFiles appends the value of the given contents map into the files at its keys and run go fmt on it.

func CleanDirectory

func CleanDirectory(path string, except []string) error

CleanDirectory cleans up the directory at the given path. Files listed inside except will not be wiped.

func EnsureDirectory

func EnsureDirectory(path string, expects ...[]string) error

EnsureDirectory ensures that all files inside the given directory path are present in the given list of string slices.

func GenerateAll

func GenerateAll(gen *girgen.Generator, dst string, except []string) []error

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

func GeneratePackages(gen *girgen.Generator, dst string, pkgs []gendata.Package) []error

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

func MajorVersion(nsp *gir.Namespace) int

MajorVersion returns the major version of the GIR namespace in int.

func ModulePath

func ModulePath(module string, overrides map[string]string) func(*gir.Namespace) string

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

func StringSet(strs ...[]string) map[string]struct{}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL