Exemple #1
0
func info(ctx *gb.Context, args []string) error {
	fmt.Printf("GB_PROJECT_DIR=%q\n", ctx.Projectdir())
	fmt.Printf("GB_SRC_PATH=%q\n", joinlist(ctx.Srcdirs()...))
	fmt.Printf("GB_PKG_DIR=%q\n", ctx.Pkgdir())
	fmt.Printf("GB_BIN_SUFFIX=%q\n", ctx.Suffix())
	return nil
}
Exemple #2
0
func makeenv(ctx *gb.Context) []envvar {
	return []envvar{
		{"GB_PROJECT_DIR", ctx.Projectdir()},
		{"GB_SRC_PATH", joinlist(ctx.Srcdirs()...)},
		{"GB_PKG_DIR", ctx.Pkgdir()},
		{"GB_BIN_SUFFIX", ctx.Suffix()},
		{"GB_GOROOT", runtime.GOROOT()},
	}
}
Exemple #3
0
// RelImportPaths converts a list of potentially relative import path (a path starting with .)
// to an absolute import path relative to the project root of the Context provided.
func RelImportPaths(ctx *gb.Context, paths ...string) []string {
	for i := 0; i < len(paths); i++ {
		paths[i] = relImportPath(ctx.Srcdirs()[0], paths[i])
	}
	return paths
}