github.com/dolthub/dolt/go@v0.40.5-0.20240520175717-68db7794bea6/performance/utils/dolt_builder/cmd/main.go (about) 1 // Copyright 2019-2022 Dolthub, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package main 16 17 import ( 18 "context" 19 "flag" 20 "fmt" 21 "log" 22 "os" 23 24 builder "github.com/dolthub/dolt/go/performance/utils/dolt_builder" 25 ) 26 27 var profile = flag.String("profile", "", "path to profile used during build") 28 29 func main() { 30 flag.Parse() 31 commitList := os.Args[1:] 32 if *profile != "" { 33 commitList = commitList[2:] 34 } 35 if len(commitList) < 1 { 36 helpStr := "dolt-builder takes Dolt commit shas or tags as arguments\n" + 37 "and builds corresponding binaries to a path specified\n" + 38 "by DOLT_BIN\n" + 39 "If DOLT_BIN is not set, ./doltBin will be used\n" + 40 "usage: dolt-builder dccba46 4bad226 ...\n" + 41 "usage: dolt-builder v0.19.0 v0.22.6 ...\n" + 42 "set DEBUG=1 to run in debug mode\n" + 43 "use the -profile flag to supply a pprof profile\n" + 44 "which will be used to create a PGO build\n" + 45 "usage: dolt-builder -profile /path/to/profile v1.33.0\n" + 46 "only one version may be specified when supplying a profile\n" 47 fmt.Print(helpStr) 48 os.Exit(2) 49 } 50 51 err := builder.Run(context.Background(), commitList, *profile) 52 if err != nil { 53 log.Fatal(err) 54 } 55 56 os.Exit(0) 57 }