MakeCompileConfigFile 生成编译器配置(程序使用)
(c *cli.Context)
| 12 | |
| 13 | // MakeCompileConfigFile 生成编译器配置(程序使用) |
| 14 | func MakeCompileConfigFile(c *cli.Context) error { |
| 15 | config := provider.CompileCommands |
| 16 | output := c.String("output") |
| 17 | if output == "" { |
| 18 | output = "./compilers.json" |
| 19 | } |
| 20 | s, err := os.Stat(output) |
| 21 | if s != nil || os.IsExist(err) { |
| 22 | log.Fatal("output file exists") |
| 23 | return nil |
| 24 | } |
| 25 | fp, err := os.OpenFile(output, os.O_WRONLY|os.O_CREATE, 0644) |
| 26 | if err != nil { |
| 27 | log.Fatalf("open output file error: %s\n", err.Error()) |
| 28 | return nil |
| 29 | } |
| 30 | defer fp.Close() |
| 31 | _, err = fp.WriteString(utils.ObjectToJSONStringFormatted(config)) |
| 32 | if err != nil { |
| 33 | return err |
| 34 | } |
| 35 | return nil |
| 36 | } |
| 37 | |
| 38 | // MakeJITMemoryConfigFile 生成JIT内存宽限配置 |
| 39 | func MakeJITMemoryConfigFile(c *cli.Context) error { |
nothing calls this directly
no test coverage detected