summaryrefslogtreecommitdiff
path: root/doBuild.go
blob: 5aade288def5f887b8155785213eaca2fdfbec53 (plain)
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
39
40
41
42
43
44
45
46
47
48
49
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
// Use of this source code is governed by the GPL 3.0

package main

import (
	"fmt"

	"go.wit.com/log"
)

// FORGE USES THESE TO RECOVER FROM WHEN TOOLKITS FAIL TO LOAD
// so don't delete them
func doBuild() error {
	v := []string{}
	if argv.Verbose {
		v = []string{"-v", "-x"}
	}

	gopath := argv.Dev.Build

	repo := me.forge.FindByGoPath(gopath)
	if repo == nil {
		return fmt.Errorf("rep not found: %s", gopath)
	}
	if err := me.forge.Build(repo, v); err != nil {
		log.Warn("Build failed:", repo.GetGoPath(), err)
		return err
	}
	return nil
}

func doInstall() error {
	v := []string{}
	if argv.Verbose {
		v = []string{"-v", "-x"}
	}

	gopath := argv.Dev.Install
	repo := me.forge.FindByGoPath(gopath)
	if repo == nil {
		return fmt.Errorf("rep not found: %s", gopath)
	}
	if err := me.forge.Install(repo, v); err != nil {
		log.Warn("Install failed", repo.GetGoPath(), err)
		return err
	}
	return nil
}