Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Side by Side Diff: mojom/generators/common/cli.go

Issue 2069943003: Mojom target for generating & building C bindings. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojom/generators/c/c_generator.go ('k') | mojom/generators/common/common.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // cli.go implements logic to create a generator config object from command 5 // cli.go implements logic to create a generator config object from command
6 // line arguments. 6 // line arguments.
7 7
8 package common 8 package common
9 9
10 import ( 10 import (
(...skipping 18 matching lines...) Expand all
29 var fileGraphFile string 29 var fileGraphFile string
30 flagSet.StringVar(&fileGraphFile, "file-graph", "-", 30 flagSet.StringVar(&fileGraphFile, "file-graph", "-",
31 "Location of the parser output. \"-\" for stdin. (default \"-\") ") 31 "Location of the parser output. \"-\" for stdin. (default \"-\") ")
32 flagSet.StringVar(&config.outputDir, "output-dir", ".", 32 flagSet.StringVar(&config.outputDir, "output-dir", ".",
33 "output directory for generated files.") 33 "output directory for generated files.")
34 flagSet.StringVar(&config.srcRootPath, "src-root-path", ".", 34 flagSet.StringVar(&config.srcRootPath, "src-root-path", ".",
35 "relative path to the root of the source tree.") 35 "relative path to the root of the source tree.")
36 flagSet.BoolVar(&config.noGenImports, "no-gen-imports", false, 36 flagSet.BoolVar(&config.noGenImports, "no-gen-imports", false,
37 "Generate code only for the files that are specified on the comm and line. "+ 37 "Generate code only for the files that are specified on the comm and line. "+
38 "By default, code is generated for all specified files a nd their transitive imports.") 38 "By default, code is generated for all specified files a nd their transitive imports.")
39 flagSet.BoolVar(&config.genTypeInfo, "generate-type-info", false,
40 "Do not generate type information inside the mojom.")
39 41
40 flagSet.Parse(args[1:]) 42 flagSet.Parse(args[1:])
41 43
42 // Compute the absolute path for the source root and the output director y. 44 // Compute the absolute path for the source root and the output director y.
43 var err error 45 var err error
44 config.srcRootPath, err = filepath.Abs(config.srcRootPath) 46 config.srcRootPath, err = filepath.Abs(config.srcRootPath)
45 if err != nil { 47 if err != nil {
46 log.Fatalln(err.Error()) 48 log.Fatalln(err.Error())
47 } 49 }
48 50
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 83
82 return 84 return
83 } 85 }
84 86
85 // generatorCliConfig implements GeneratorConfig. 87 // generatorCliConfig implements GeneratorConfig.
86 type generatorCliConfig struct { 88 type generatorCliConfig struct {
87 fileGraph *mojom_files.MojomFileGraph 89 fileGraph *mojom_files.MojomFileGraph
88 outputDir string 90 outputDir string
89 srcRootPath string 91 srcRootPath string
90 noGenImports bool 92 noGenImports bool
93 genTypeInfo bool
91 } 94 }
92 95
93 // See GeneratorConfig. 96 // See GeneratorConfig.
94 func (c *generatorCliConfig) FileGraph() *mojom_files.MojomFileGraph { 97 func (c *generatorCliConfig) FileGraph() *mojom_files.MojomFileGraph {
95 return c.fileGraph 98 return c.fileGraph
96 } 99 }
97 100
98 // See GeneratorConfig. 101 // See GeneratorConfig.
99 func (c *generatorCliConfig) OutputDir() string { 102 func (c *generatorCliConfig) OutputDir() string {
100 return c.outputDir 103 return c.outputDir
101 } 104 }
102 105
103 // See GeneratorConfig. 106 // See GeneratorConfig.
104 func (c *generatorCliConfig) SrcRootPath() string { 107 func (c *generatorCliConfig) SrcRootPath() string {
105 return c.srcRootPath 108 return c.srcRootPath
106 } 109 }
107 110
108 // See GeneratorConfig. 111 // See GeneratorConfig.
109 func (c *generatorCliConfig) GenImports() bool { 112 func (c *generatorCliConfig) GenImports() bool {
110 return !c.noGenImports 113 return !c.noGenImports
111 } 114 }
115
116 // See GeneratorConfig.
117 func (c *generatorCliConfig) GenTypeInfo() bool {
118 return c.genTypeInfo
119 }
OLDNEW
« no previous file with comments | « mojom/generators/c/c_generator.go ('k') | mojom/generators/common/common.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698