Example #1
0
func main() {
	startTime = time.Now()

	command := kingpin.MustParse(app.Parse(os.Args[1:]))
	log.SetLevel(*logLevel)
	log.SetTags(*logTags)

	switch command {
	case buildCom.FullCommand():
		if len(*buildInputs) == 0 {
			setupErr("No input files passed.")
		}

		// build the files
		outputType := parseOutputType(*buildOutputType)
		build(*buildInputs, *buildOutput, *buildCodegen, outputType, *buildOptLevel)

		printFinishedMessage(startTime, buildCom.FullCommand(), len(*buildInputs))

		// attempt to run what we built
		if *buildRun {
			if outputType != LLVMCodegen.OUTPUT_EXECUTABLE {
				setupErr("Can only use --run flag when building executable")
			}
			run(*buildOutput)
		}

	case docgenCom.FullCommand():
		docgen(*docgenInputs, *docgenDir)
		printFinishedMessage(startTime, docgenCom.FullCommand(), len(*docgenInputs))
	}
}
Example #2
0
func main() {
	startTime = time.Now()

	command := kingpin.MustParse(app.Parse(os.Args[1:]))
	log.SetLevel(*logLevel)
	log.SetTags(*logTags)

	context := NewContext()

	switch command {
	case buildCom.FullCommand():
		if *buildInput == "" {
			setupErr("No input files passed.")
		}

		context.Searchpaths = *buildSearchpaths
		context.Input = *buildInput

		outputType, err := codegen.ParseOutputType(*buildOutputType)
		if err != nil {
			fmt.Println(err)
			os.Exit(1)
		}

		// build the files
		context.Build(*buildOutput, outputType, *buildCodegen, *buildOptLevel)

		printFinishedMessage(startTime, buildCom.FullCommand(), 1)

	case docgenCom.FullCommand():
		context.Searchpaths = *docgenSearchpaths
		context.Input = *docgenInput
		context.Docgen(*docgenDir)

		printFinishedMessage(startTime, docgenCom.FullCommand(), 1)
	}
}
Example #3
0
File: main.go Project: vnev/ark
func main() {
	startTime = time.Now()

	command := kingpin.MustParse(app.Parse(os.Args[1:]))
	log.SetLevel(*logLevel)
	log.SetTags(*logTags)

	switch command {
	case buildCom.FullCommand():
		if len(*buildInputs) == 0 {
			setupErr("No input files passed.")
		}

		// build the files
		outputType := parseOutputType(*buildOutputType)
		build(*buildInputs, *buildOutput, *buildCodegen, outputType, *buildOptLevel)

		printFinishedMessage(startTime, buildCom.FullCommand(), len(*buildInputs))

	case docgenCom.FullCommand():
		docgen(*docgenInputs, *docgenDir)
		printFinishedMessage(startTime, docgenCom.FullCommand(), len(*docgenInputs))
	}
}