-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcontext.go
38 lines (30 loc) · 1001 Bytes
/
context.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main
// Context contains all the build system states that have to be remembered.
type Context struct {
// Name is the name of the project.
Name string
// Final binary type we want to link.
Type LinkType
// SourceFiles contains paths to all the .c and .cpp files that have to be compiled.
SourceFiles []string
// ObjectPath is the intermediate folder where object files should be stored.
ObjectPath string
// Compiler is an abstract interface used for compiling and linking on multiple platforms.
Compiler Compiler
CompilerErrors int
CompilerOptions *CompilerOptions
CompilerWorkerChannel chan CompilerWorkerTask
CompilerWorkerFinished chan int
}
// NewContext creates a new context with initial values.
func NewContext() (*Context, error) {
compiler, err := getCompiler()
if err != nil {
return nil, err
}
return &Context{
Compiler: compiler,
CompilerOptions: &CompilerOptions{},
SourceFiles: make([]string, 0),
}, nil
}