35 lines
647 B
Go
35 lines
647 B
Go
|
package build
|
||
|
|
||
|
import "path/filepath"
|
||
|
|
||
|
// Build describes a compiler build.
|
||
|
type Build struct {
|
||
|
ExecutableName string
|
||
|
ExecutablePath string
|
||
|
WriteExecutable bool
|
||
|
}
|
||
|
|
||
|
// New creates a new build.
|
||
|
func New(directory string) (*Build, error) {
|
||
|
directory, err := filepath.Abs(directory)
|
||
|
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
executableName := filepath.Base(directory)
|
||
|
|
||
|
build := &Build{
|
||
|
ExecutableName: executableName,
|
||
|
ExecutablePath: filepath.Join(directory, executableName),
|
||
|
WriteExecutable: true,
|
||
|
}
|
||
|
|
||
|
return build, nil
|
||
|
}
|
||
|
|
||
|
// Run parses the input files and generates an executable file.
|
||
|
func (build *Build) Run() error {
|
||
|
return nil
|
||
|
}
|