Documentation
¶
Overview ¶
Package descriptor provides command descriptor utilities.
Index ¶
- func AbsCmdPath(setup *pb.CmdDescriptor_Setup) (string, error)
- func ClangClTarget(out []byte) (string, error)
- func ClangClVersion(out []byte) (string, error)
- func ClexeTarget(out []byte) (string, error)
- func ClexeVersion(out []byte) (string, error)
- func DartAnalyzerVersion(out []byte) (string, error)
- func IsRelocatable(setup *pb.CmdDescriptor_Setup) (bool, error)
- func JavaVersion(out []byte) (string, error)
- func Load(dir string) ([]*pb.CmdDescriptor, error)
- func Relocate(setup *pb.CmdDescriptor_Setup, cmdpath string) (*pb.CmdDescriptor_Setup, error)
- func RelocateCmd(cmdPath string, setup *pb.CmdDescriptor_Setup, ...) ([]*pb.FileSpec, error)
- func Save(dir string, desc *pb.CmdDescriptor) error
- func Target(out []byte) string
- func Version(dout, vout []byte) string
- type Config
- type Descriptor
- type FilePath
- type Runner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AbsCmdPath ¶
func AbsCmdPath(setup *pb.CmdDescriptor_Setup) (string, error)
AbsCmdPath returns absolute command path of the setup.
func ClangClTarget ¶
ClangClTarget returns clang target from output of `clang-cl.exe -###` See ClangClVersion about the expected input.
func ClangClVersion ¶
ClangClVersion returns clang version from output of `clang-cl.exe -###`.
`clang-cl -###` output is like the following:
clang version 3.5.0 (trunk 225621) Target: i686-pc-windows-msvc clang version 6.0.0 (trunk 308728) Target: x86_64-pc-windows-msvc clang version 9.0.0 (https://github.com/llvm/llvm-project/ 67510fac36d27b2e22c7cd955fc167136b737b93) Target: x86_64-pc-windows-msvc Thread model: posix InstalledDir: /var/tmp/clang/third_party/llvm-build/Release+Asserts/bin
Note that endline might be CRLF.
func ClexeTarget ¶
ClexeTarget returns target string of CL.exe.
func ClexeVersion ¶
ClexeVersion returns version string of CL.exe.
func DartAnalyzerVersion ¶ added in v0.0.8
DartAnalyzerVersion returns the dartanalyzer's version from output of `dartanalyzer --version`
func IsRelocatable ¶
func IsRelocatable(setup *pb.CmdDescriptor_Setup) (bool, error)
IsRelocatable returns true if this setup can be relocated to where client put a compiler or a subprogram. setup must have valid path type.
func JavaVersion ¶
JavaVersion returns version string of javac.
func Relocate ¶
func Relocate(setup *pb.CmdDescriptor_Setup, cmdpath string) (*pb.CmdDescriptor_Setup, error)
Relocate relocates cmdpath and setup files.
func RelocateCmd ¶
func RelocateCmd(cmdPath string, setup *pb.CmdDescriptor_Setup, subprogSetups map[string]*pb.CmdDescriptor_Setup) ([]*pb.FileSpec, error)
RelocateCmd relocates main program and subprograms if necessary. subprogSetups is a map from subprogram client path to subprogram setup. It returns commands' FileSpec to be used. Actual command path will be first FileSpec's Path.
func Save ¶
func Save(dir string, desc *pb.CmdDescriptor) error
Save saves given cmd descriptor to a file in dir.
Types ¶
type Config ¶
type Config struct { Key string // Key used for selection. Filename string // relative to pwd (prefix) in server path AbsoluteBinaryHashFrom string // use Filename for binary hash if emtpy Target string // cross target if specified Runner Runner ToClientPath func(string) (string, error) PathType pb.CmdDescriptor_PathType // compiler specific // https://clang.llvm.org/docs/CrossCompilation.html#target-triple ClangNeedTarget bool // true if -target is needed. WindowsCross bool }
Config used for setting up cmd descriptor.
type Descriptor ¶
type Descriptor struct { *pb.CmdDescriptor Runner Runner ToClientPath func(string) (string, error) PathType pb.CmdDescriptor_PathType // contains filtered or unexported fields }
Descriptor represents a command descriptor.
func (*Descriptor) Add ¶
func (d *Descriptor) Add(fname string) error
Add adds fname for command. fname should be absolute path, or relative to cwd. It will emit relative path to command if cmd is relocatable. It just adds fname as is. i.e. not resolve symlink, resolve shared obj etc.
func (*Descriptor) CmdSetup ¶
func (d *Descriptor) CmdSetup() error
CmdSetup sets up command descriptor.
type FilePath ¶
type FilePath interface { // IsAbs reports whether the path is absolute. IsAbs(path string) bool // Base returns the last element of path, typically // the filename. Base(string) string // Dir returns all but the last element of path, typically // the path's directory. // Different filepath.Dir, it won't clean "..". Dir(string) string // Join joins any number of path elements into a single path. // Different filepath.Dir, it won't clean "..". Join(...string) string // Rel returns a relative path that is lexically equivalent // to targpath when joined to basepath with an intervening separator. Rel(basepath, targpath string) (string, error) // Clean returns the shortest path name equivalent to path by purely lexical processing. Clean(path string) string // SplitElem splits path by path separator. SplitElem(path string) []string // PathSep returns the path separator. PathSep() string }
FilePath provides client's filepath.
func FilePathOf ¶
func FilePathOf(pt pb.CmdDescriptor_PathType) (FilePath, error)
FilePathOf returns FilePath of path type.
Directories
¶
Path | Synopsis |
---|---|
Package posixpath handles posix-path (Unix style; slash separeted path).
|
Package posixpath handles posix-path (Unix style; slash separeted path). |
Package winpath handles windows-path (backslash separated path).
|
Package winpath handles windows-path (backslash separated path). |