godock: github.com/sqp/godock/libs/packages/build Index | Files

package build

import "github.com/sqp/godock/libs/packages/build"

Package build builds cairo-dock or applets from sources.

Index

Package Files

build.go buildconf.go nodock.go

Constants

const (
    // GroupHidden defines a group that should be hidden.
    GroupHidden = "Hidden" // TODO move to config as common
)

Variables

var (
    // IconMissing defines the optional path to the default icon package emblem.
    //
    IconMissing string

    // CmdSudo defines the command used to get root access for installation.
    //
    CmdSudo = "gksudo"
)
var (
    // AppletInfo returns an applet location and icon.
    //
    AppletInfo func(cdtype.Logger, string) (dir, icon string)

    // AppletRestart restarts an applet.
    //
    AppletRestart func(name string)

    CloseGui = func() {}
)

Set by the dock or external backend.

func Init Uses

func Init(log cdtype.Logger, file string, e error)

Init will try to load the build config data from the file, and create it if missing.

func ProcessUptime Uses

func ProcessUptime() (time.Time, error)

ProcessUptime returns the time when the process started.

func ProcessUptimeToSeconds Uses

func ProcessUptimeToSeconds(t time.Time) int

ProcessUptimeToSeconds converts a ProcessUptime to a number of seconds.

type Builder Uses

type Builder interface {
    Label() string
    Icon() string
    Build() error
    SourceDir() string
    SetProgress(func(float64)) // Need values between 0 and 1 in the renderer.
    Progress(float64)
    SetIcon(icon string)
    SetDir(dir string)
}

Builder defines the common builder interface.

func NewBuilder Uses

func NewBuilder(target SourceType, name string, log cdtype.Logger) Builder

NewBuilder creates the target renderer/builder. The name is mandatory for a single applet (internal or not).

type BuilderApplets Uses

type BuilderApplets struct {
    BuilderBase
    BuilderProgress
    MakeFlags string
}

BuilderApplets builds all Cairo-Dock plug-ins.

func (*BuilderApplets) Build Uses

func (build *BuilderApplets) Build() error

Build builds the source code.

func (*BuilderApplets) Icon Uses

func (build *BuilderApplets) Icon() string

Icon returns the icon name (or path) of the builder.

func (*BuilderApplets) Label Uses

func (build *BuilderApplets) Label() string

Label returns the builder label.

type BuilderBase Uses

type BuilderBase struct {
    // contains filtered or unexported fields
}

BuilderBase provides basic informations about a build.

func (*BuilderBase) Icon Uses

func (build *BuilderBase) Icon() string

Icon returns the icon name (or path) of the builder.

func (*BuilderBase) SetDir Uses

func (build *BuilderBase) SetDir(dir string)

SetDir sets the source path for the builder.

func (*BuilderBase) SetIcon Uses

func (build *BuilderBase) SetIcon(icon string)

SetIcon sets the icon name (or path) for the builder.

func (*BuilderBase) SetLogger Uses

func (build *BuilderBase) SetLogger(log cdtype.Logger)

SetLogger sets the builder logger.

func (*BuilderBase) SourceDir Uses

func (build *BuilderBase) SourceDir() string

SourceDir returns the source path of the builder.

type BuilderCompiled Uses

type BuilderCompiled struct {
    BuilderBase
    BuilderProgress
    Module string
}

BuilderCompiled builds external applet that must be compiled (golang or vala). A Makefile with default build will have to be provided in each applet dir.

func (*BuilderCompiled) Build Uses

func (build *BuilderCompiled) Build() error

Build builds the source code.

func (*BuilderCompiled) Label Uses

func (build *BuilderCompiled) Label() string

Label returns the builder label.

type BuilderCore Uses

type BuilderCore struct {
    BuilderBase
    BuilderProgress
    MakeFlags string
}

BuilderCore builds the dock core sources.

func (*BuilderCore) Build Uses

func (build *BuilderCore) Build() error

Build builds the source code.

func (*BuilderCore) Icon Uses

func (build *BuilderCore) Icon() string

Icon returns the icon name (or path) of the builder.

func (*BuilderCore) Label Uses

func (build *BuilderCore) Label() string

Label returns the builder label.

type BuilderGodock Uses

type BuilderGodock struct {
    BuilderBase
    BuilderProgress
    MakeFlags string
}

BuilderGodock builds the new go dock version.

func (*BuilderGodock) Build Uses

func (build *BuilderGodock) Build() error

Build builds the source code.

func (*BuilderGodock) Icon Uses

func (build *BuilderGodock) Icon() string

Icon returns the icon name (or path) of the builder.

func (*BuilderGodock) Label Uses

func (build *BuilderGodock) Label() string

Label returns the builder label.

func (BuilderGodock) SourceDir Uses

func (build BuilderGodock) SourceDir() string

SourceDir returns the source path of the builder.

type BuilderInternal Uses

type BuilderInternal struct {
    BuilderBase
    BuilderProgress
    Module string
}

BuilderInternal builds a Cairo-Dock internal applet. As C applet are provided by the plug-ins package, they are only available after the plug-ins build has been done at least once.

func (*BuilderInternal) Build Uses

func (build *BuilderInternal) Build() error

Build builds the source code.

func (*BuilderInternal) Label Uses

func (build *BuilderInternal) Label() string

Label returns the builder label.

type BuilderNull Uses

type BuilderNull struct {
    BuilderBase
    BuilderProgress
}

BuilderNull is an empty Build for fallback.

func (*BuilderNull) Build Uses

func (build *BuilderNull) Build() error

Build builds the source code.

func (*BuilderNull) Icon Uses

func (build *BuilderNull) Icon() string

Icon returns the icon name (or path) of the builder.

func (*BuilderNull) Label Uses

func (build *BuilderNull) Label() string

Label returns the builder label.

func (*BuilderNull) SourceDir Uses

func (build *BuilderNull) SourceDir() string

SourceDir returns the source path of the builder.

type BuilderProgress Uses

type BuilderProgress struct {
    // contains filtered or unexported fields
}

BuilderProgress provides a callback handler for Builders.

func (*BuilderProgress) Progress Uses

func (build *BuilderProgress) Progress(data float64)

Progress forwards data to the provided callback.

func (*BuilderProgress) SetProgress Uses

func (build *BuilderProgress) SetProgress(f func(float64))

SetProgress sets the callback to forward progress data.

type Config Uses

type Config struct {
    Counter     map[string]Counter `conf:"-"`
    CounterDB   []byte
    TotalUptime int // in seconds

    File string `conf:"-"` // File location, not saved.
    // contains filtered or unexported fields
}

Config defines the options the user can set about the GUI itself. This GUI config page will often be referred as "own config".

var Current Config

Current is the user build config live settings (what is currently active).

func (*Config) IncreaseCounter Uses

func (cs *Config) IncreaseCounter(success bool) error

IncreaseCounter updates the build counter with a new success or fail.

func (*Config) IncreaseCrash Uses

func (cs *Config) IncreaseCrash() error

IncreaseCrash increase the crash counter for the day.

func (*Config) IncreaseUptime Uses

func (cs *Config) IncreaseUptime() error

IncreaseUptime updates the uptime counter with the current process uptime. Use on program close.

func (*Config) Load Uses

func (cs *Config) Load() error

Load loads the own config settings.

func (*Config) Today Uses

func (cs *Config) Today() (Counter, bool)

Today returns today's counters in read only.

type Counter Uses

type Counter struct {
    OK    uint
    Fail  uint
    Crash uint
}

Counter counts builds and crashs.

type SourceType Uses

type SourceType int

SourceType defines the type of a builder.

const (
    TypeNull           SourceType = iota // Do nothing.
    TypeCore                             // Dock core.
    TypeApplets                          // Dock all internal applets (C).
    TypeAppletInternal                   // Dock one internal applet (C).
    TypeAppletScript                     // Dock one external applet script (bash, python, ruby).
    TypeAppletCompiled                   // Dock one external applet compiled (go, mono, vala).
    TypeGodock                           // New dock.
)

Applets build types.

func GetSourceType Uses

func GetSourceType(name string, log cdtype.Logger) SourceType

GetSourceType try to detect an applet type based on its location and content. Could be improved.

Package build imports 18 packages (graph) and is imported by 4 packages. Updated 2017-11-26. Refresh now. Tools for package owners.