|
68 | 68 | compilationDatabaseOnly bool // Only create compilation database without actually compiling |
69 | 69 | sourceOverrides string // Path to a .json file that contains a set of replacements of the sketch source code. |
70 | 70 | dumpProfile bool // Create and print a profile configuration from the build |
| 71 | + jobs int32 // Max number of parallel jobs |
71 | 72 | // library and libraries sound similar but they're actually different. |
72 | 73 | // library expects a path to the root folder of one single library. |
73 | 74 | // libraries expects a path to a directory containing multiple libraries, similarly to the <directories.user>/libraries path. |
@@ -134,6 +135,7 @@ func NewCommand() *cobra.Command { |
134 | 135 | compileCommand.Flag("source-override").Hidden = true |
135 | 136 | compileCommand.Flags().BoolVar(&skipLibrariesDiscovery, "skip-libraries-discovery", false, "Skip libraries discovery. This flag is provided only for use in language server and other, very specific, use cases. Do not use for normal compiles") |
136 | 137 | compileCommand.Flag("skip-libraries-discovery").Hidden = true |
| 138 | + compileCommand.Flags().Int32VarP(&jobs, "jobs", "j", 0, tr("Max number of parallel compiles. If set to 0 the number of available CPUs cores will be used.")) |
137 | 139 | configuration.Settings.BindPFlag("sketch.always_export_binaries", compileCommand.Flags().Lookup("export-binaries")) |
138 | 140 |
|
139 | 141 | compileCommand.Flags().MarkDeprecated("build-properties", tr("please use --build-property instead.")) |
@@ -244,6 +246,7 @@ func runCompileCommand(cmd *cobra.Command, args []string) { |
244 | 246 | EncryptKey: encryptKey, |
245 | 247 | SkipLibrariesDiscovery: skipLibrariesDiscovery, |
246 | 248 | DoNotExpandBuildProperties: showProperties == arguments.ShowPropertiesUnexpanded, |
| 249 | + Jobs: jobs, |
247 | 250 | } |
248 | 251 | builderRes, compileError := compile.Compile(context.Background(), compileRequest, stdOut, stdErr, nil) |
249 | 252 |
|
|
0 commit comments