示例#1
0
文件: main.go 项目: e8vm/shanhu
func main() {
	flag.Parse()

	switch {
	case *initDB:
		if *useMysql {
			log.Fatal("todo")
		}
		if err := repolite.Create(*dbPath); err != nil {
			log.Fatal(err)
		}
	case *addGoPkg != "":
		addBuild(gorepo.Build(*addGoPkg))
	case *addGPkg != "":
		abs, err := filepath.Abs(*addGPkg)
		if err != nil {
			log.Fatal(err)
		}
		base := filepath.Base(abs)
		if base == "os8" || base == "~os8" {
			addBuild(grepo.Build(abs, "~os8"))
		} else if base == "toys" || base == "~toys" {
			addBuild(grepo.Build(abs, "~toys"))
		} else {
			log.Fatalf("unrecognized base: %s", base)
		}
	default:
		log.Print("(did nothing)")
	}
}
示例#2
0
文件: main.go 项目: e8vm/shanhu
func main() {
	flag.Parse()

	hash, err := gorepo.GitCommitHash(*projPath)
	if err != nil {
		log.Print(err)
	}
	log.Print(hash)

	b, errs := gorepo.Build(*projPath)
	for _, err := range errs {
		log.Print(err)
	}
	if len(errs) > 0 {
		log.Fatal("building failed")
	}

	enc := json.NewEncoder(os.Stdout)
	if err := enc.Encode(b.Deps); err != nil {
		log.Fatal(err)
	}
}