Documentation ¶
Index ¶
- Constants
- Variables
- func ModuleName(name string) string
- func PartID(name string) string
- type AdaMod
- type Builder
- func (b *Builder) Build(parts ...string) error
- func (b *Builder) CompileFile(filename string) error
- func (b *Builder) FindBuilderPart(filename string) (*BuilderPart, string, error)
- func (b *Builder) Get(varName string) string
- func (b *Builder) GetBuilderParts(parts ...string) ([]*BuilderPart, error)
- func (b *Builder) PrettyPrint(filename string) error
- func (b *Builder) StartVsCode(partname string, generateTasks, generateSettings, generateLaunch bool) error
- type BuilderPart
- func (bp *BuilderPart) AllDirs() []string
- func (bp *BuilderPart) AllFiles() ([]string, error)
- func (bp *BuilderPart) CollectBuilderParts(set *PartSet) error
- func (bp *BuilderPart) CreatePartDirectories() error
- func (bp *BuilderPart) Dictionaries(dictionaries *hit) error
- func (bp *BuilderPart) FindFile(filename string) (string, error)
- func (bp *BuilderPart) FqPartName() string
- func (bp *BuilderPart) GenerateAllGprs() error
- func (bp *BuilderPart) GenerateGpr() error
- func (bp *BuilderPart) Get(varname string) string
- func (bp *BuilderPart) GprFile() string
- func (bp *BuilderPart) LinkerOptions(options *hit) error
- func (bp *BuilderPart) SourceFileListFilename() string
- type ConfigData
- type LaunchData
- type ModulePart
- type ModuleSet
- type PartSet
- type Registry
- type SettingsData
- type TasksData
- type TmplData
- type Toolchain
- type VariableSet
- type VsCodeTemplateData
Constants ¶
const TestFilePattern = `test\_.*\.ad[bs]`
TestFilePattern is the pattern test files have
Variables ¶
var DefaultVariableSet = VariableSet{
"BuildDir": "${ModulePath}/.build",
"ObjDir": "${BuildDir}/${Target}/obj",
"LibDir": "${BuildDir}/${Target}/lib",
"ExeDir": "${BuildDir}/${Target}/exe",
"GprDir": "${BuildDir}/${Target}/gpr",
}
DefaultVariableSet is the default variable set
Functions ¶
func ModuleName ¶
ModuleName returns the module name part of the builder part name
Types ¶
type AdaMod ¶
type AdaMod struct { // Name of the modules Name string Dictionary string Parts []*ModulePart // contains filtered or unexported fields }
AdaMod is a description of an ada module
func (*AdaMod) DefaultExePartID ¶
DefaultExePartID returns the fully qualified part id of the default part of the module
func (*AdaMod) DefaultLibraryPartID ¶
DefaultLibraryPartID returns the fully qualified part id of the default part of the module
func (*AdaMod) FqPartID ¶
FqPartID returns the fully qualified part id of the part
func (*AdaMod) Part ¶
func (a *AdaMod) Part(id string) *ModulePart
Part returns the part associated with id, or nil else
type Builder ¶
type Builder struct { Module *AdaMod Variables VariableSet Parts PartSet // contains filtered or unexported fields }
Builder knows how to build gpr files and ada artifacts
func NewBuilder ¶
NewBuilder creates a new Builder for the module at ModulePath
func (*Builder) Build ¶
Build builds parts defined as fully qualified part names
func (*Builder) CompileFile ¶
CompileFile compiles one file part of the b.Module
func (*Builder) FindBuilderPart ¶
func (b *Builder) FindBuilderPart(filename string) (*BuilderPart, string, error)
FindBuilderPart returns the builder part that contains the filename
func (*Builder) GetBuilderParts ¶
func (b *Builder) GetBuilderParts(parts ...string) ([]*BuilderPart, error)
GetBuilderParts returns the builder parts that are associated with the part names. The parts will be fully loaded
func (*Builder) PrettyPrint ¶
PrettyPrint formats the code of the files in filePath. If no files specified, the entire module is formatted
type BuilderPart ¶
type BuilderPart struct { Name string // 'test_runner', 'libjson'... Main string // name of main file ModuleRef *ModulePart SourceFilesAbs []string ImportedParts []*BuilderPart CompilerOptions []string Builder *Builder }
BuilderPart contains information about a specific part in the module There exists a tree structure of BuilderParts that reflect the structure of ModuleParts.
func (*BuilderPart) AllDirs ¶
func (bp *BuilderPart) AllDirs() []string
AllDirs returns all source directories for the part, relative to the root of the module
func (*BuilderPart) AllFiles ¶
func (bp *BuilderPart) AllFiles() ([]string, error)
AllFiles returns all files in the BuilderPart
func (*BuilderPart) CollectBuilderParts ¶
func (bp *BuilderPart) CollectBuilderParts(set *PartSet) error
CollectBuilderParts collects the parts needed to build the part.
func (*BuilderPart) CreatePartDirectories ¶
func (bp *BuilderPart) CreatePartDirectories() error
CreatePartDirectories makes sure the directories to store exe, lib and object files exists prior calling gprbuild.
func (*BuilderPart) Dictionaries ¶
func (bp *BuilderPart) Dictionaries(dictionaries *hit) error
Dictionaries returns the conglomerated list of dictionaries affecting this builder part
func (*BuilderPart) FindFile ¶
func (bp *BuilderPart) FindFile(filename string) (string, error)
FindFile returns the full path of the filename, or the empty string, if the filename is beneath any of the source directories specified in the part.
func (*BuilderPart) FqPartName ¶
func (bp *BuilderPart) FqPartName() string
FqPartName returns the fully qualified partname in the form <moduleName>:<partName>
func (*BuilderPart) GenerateAllGprs ¶
func (bp *BuilderPart) GenerateAllGprs() error
GenerateAllGprs generates all the neccessary GPR files needed to build this part
func (*BuilderPart) GenerateGpr ¶
func (bp *BuilderPart) GenerateGpr() error
GenerateGpr generates a GPR file. All data needed by the template is in the BuilderPart or the Modules variables. It also generates the associated list of source files
func (*BuilderPart) GprFile ¶
func (bp *BuilderPart) GprFile() string
GprFile returns the corresponding gpr filename for the part
func (*BuilderPart) LinkerOptions ¶
func (bp *BuilderPart) LinkerOptions(options *hit) error
LinkerOptions returns the conglomerated list of linker options
func (*BuilderPart) SourceFileListFilename ¶
func (bp *BuilderPart) SourceFileListFilename() string
SourceFileListFilename returns the name of file to contain a list of sources for the project.
type ConfigData ¶
ConfigData ...
type LaunchData ¶
LaunchData contains data for the tmplVsCodeLaunch template
type ModulePart ¶
type ModulePart struct { Name string `yaml:",omitempty"` // library or exec ModuleType string `yaml:"module_type,omitempty"` // The name of the main file Main string `yaml:",omitempty"` // Path to the main entitity in the part (Executable .adb file) Path string `yaml:",omitempty"` // Imports can either be relative to the ModulesPath or absolute // An import is specified using <mod>:<part>, where mod is the // name of the module and part is the name of the part. If part // is omitted, the first library part is selected of the module // If an executable doesn't specify any import, it will always import // the first library part of it's own module // Examples: // - uuid (Relative to either ADA_MODULES_PATH, or ./uuid. First library) // - xml:sax (library sax of xml) // - /home/adam/src/modA:lib1 (Fully qualified) // - :lib (reference to containing modules 'lib' library) Imports []string `yaml:",omitempty"` // GprImports can either be relative to the system gpr search path or // absolute GprImports []string `yaml:"gpr_imports,omitempty"` // Sources is a regular expression that selects files to include. // It is are always relative to the module dir // Example: // sources: src/**/*.ad[sb] # all adb/ads files in any subdirectory of src // sources: src/windows_*.ad[sb] # all ada files starting with windows_ in the src directory. Sources []string `yaml:"sources,omitempty"` // SkipSources contains patterns of files that should be skipped. // test_*.adb is always part of this list SkipSources []string `yaml:"skip_source,omitempty"` // Options that is needed to provide the linker LinkerOptions []string `yaml:"linker_options,omitempty"` // Options for compiler CompilerOptions []string `yaml:"compiler_options,omitempty"` // Parent module Parent *AdaMod `yaml:",omitempty"` }
ModulePart describes a part of a module
type ModuleSet ¶
type ModuleSet []*AdaMod
ModuleSet is a set of ada modules. All unique. It's an error to try to add a module with a name that already exists, but with a different path
type PartSet ¶
type PartSet []*BuilderPart
PartSet is a set of build parts. All unique.
func (*PartSet) Get ¶
func (s *PartSet) Get(partQualifier string) *BuilderPart
Get returns a part from a fully qualified part spec "Mod:PartID" If no part found then return nil
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is a registry of AdaModules. Primary key is the absolute file location of the module.
func NewRegistry ¶
NewRegistry creates a new registry to store AdaMods in
func (*Registry) AbsModPath ¶
AbsModPath returns the absolute path to the module
func (*Registry) AddExtraPath ¶
AddExtraPath adds an extra mapping between a module name and an absolute path
func (*Registry) Get ¶
Get returns a module corresponding to the path p. First check if it's already in the registry else try load it.
func (*Registry) Load ¶
Load a adamod.yml file into an AdaMod
type SettingsData ¶
type SettingsData struct {
ProjectFile string
}
SettingsData contains data for the tmplVsCodeSettings template
type TmplData ¶
type TmplData struct { Builder *Builder Module *AdaMod BuilderPart BuilderPart ModulePart ModulePart }
TmplData contains the data needed for the templates
func NewTmplData ¶
func NewTmplData(b *Builder, a *AdaMod, builderPart BuilderPart, modPart ModulePart, name string) TmplData
NewTmplData returns a new tmplData struct filled with values
type Toolchain ¶
type Toolchain struct {
// contains filtered or unexported fields
}
Toolchain is the toolchain used to build
func NewToolchain ¶
NewToolchain creates a new toolchain for the target. It will verify that the tools needed exists.
func (*Toolchain) Gprbuild ¶
Gprbuild uses gprbuild to build someting
type VariableSet ¶
VariableSet is a set of variables that can contain references to other variables in the set.
func (*VariableSet) Resolve ¶
func (set *VariableSet) Resolve(s string) string
Resolve a variable in the set. The set will be updated
func (*VariableSet) ResolveAll ¶
func (set *VariableSet) ResolveAll()
ResolveAll will resolve all varibles in the set
type VsCodeTemplateData ¶
type VsCodeTemplateData struct { Folder string Launch *LaunchData Settings *SettingsData Config *ConfigData Tasks *TasksData }
VsCodeTemplateData ...
func (*VsCodeTemplateData) CreateVsCodeFiles ¶
func (d *VsCodeTemplateData) CreateVsCodeFiles() error
CreateVsCodeFiles creates settings for vscode that is compatible with adamod
func (*VsCodeTemplateData) Generate ¶
func (d *VsCodeTemplateData) Generate(tmpl string, data interface{}, filename ...string) error
Generate a file from a template and data