aboutsummaryrefslogtreecommitdiffhomepage
path: root/main.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2019-10-31 15:39:01 +0100
committerRon Evans <[email protected]>2019-11-04 11:45:35 +0100
commite7cf75030c6fe8a21ace88be690241f7b16f998d (patch)
treee891d0fd9e635e6060d9330b23530418fe281598 /main.go
parentdff6e6566db6e42ade2b5007796de8474535c410 (diff)
downloadtinygo-e7cf75030c6fe8a21ace88be690241f7b16f998d.tar.gz
tinygo-e7cf75030c6fe8a21ace88be690241f7b16f998d.zip
main: move target specification into a separate package
Diffstat (limited to 'main.go')
-rw-r--r--main.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/main.go b/main.go
index 9f03ff361..009fcc000 100644
--- a/main.go
+++ b/main.go
@@ -17,6 +17,7 @@ import (
"syscall"
"time"
+ "github.com/tinygo-org/tinygo/compileopts"
"github.com/tinygo-org/tinygo/compiler"
"github.com/tinygo-org/tinygo/goenv"
"github.com/tinygo-org/tinygo/interp"
@@ -66,7 +67,7 @@ type BuildConfig struct {
}
// Helper function for Compiler object.
-func Compile(pkgName, outpath string, spec *TargetSpec, config *BuildConfig, action func(string) error) error {
+func Compile(pkgName, outpath string, spec *compileopts.TargetSpec, config *BuildConfig, action func(string) error) error {
if config.gc == "" && spec.GC != "" {
config.gc = spec.GC
}
@@ -335,7 +336,7 @@ func Compile(pkgName, outpath string, spec *TargetSpec, config *BuildConfig, act
}
func Build(pkgName, outpath, target string, config *BuildConfig) error {
- spec, err := LoadTarget(target)
+ spec, err := compileopts.LoadTarget(target)
if err != nil {
return err
}
@@ -369,7 +370,7 @@ func Build(pkgName, outpath, target string, config *BuildConfig) error {
}
func Test(pkgName, target string, config *BuildConfig) error {
- spec, err := LoadTarget(target)
+ spec, err := compileopts.LoadTarget(target)
if err != nil {
return err
}
@@ -396,7 +397,7 @@ func Test(pkgName, target string, config *BuildConfig) error {
}
func Flash(pkgName, target, port string, config *BuildConfig) error {
- spec, err := LoadTarget(target)
+ spec, err := compileopts.LoadTarget(target)
if err != nil {
return err
}
@@ -503,7 +504,7 @@ func Flash(pkgName, target, port string, config *BuildConfig) error {
// Note: this command is expected to execute just before exiting, as it
// modifies global state.
func FlashGDB(pkgName, target, port string, ocdOutput bool, config *BuildConfig) error {
- spec, err := LoadTarget(target)
+ spec, err := compileopts.LoadTarget(target)
if err != nil {
return err
}
@@ -594,7 +595,7 @@ func FlashGDB(pkgName, target, port string, ocdOutput bool, config *BuildConfig)
// Compile and run the given program, directly or in an emulator.
func Run(pkgName, target string, config *BuildConfig) error {
- spec, err := LoadTarget(target)
+ spec, err := compileopts.LoadTarget(target)
if err != nil {
return err
}