Skip to content

Added --jobs/-j flag to compile command #2526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions internal/cli/compile/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ var (
compilationDatabaseOnly bool // Only create compilation database without actually compiling
sourceOverrides string // Path to a .json file that contains a set of replacements of the sketch source code.
dumpProfile bool // Create and print a profile configuration from the build
jobs int32 // Max number of parallel jobs
// library and libraries sound similar but they're actually different.
// library expects a path to the root folder of one single library.
// libraries expects a path to a directory containing multiple libraries, similarly to the <directories.user>/libraries path.
Expand Down Expand Up @@ -134,6 +135,7 @@ func NewCommand() *cobra.Command {
compileCommand.Flag("source-override").Hidden = true
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")
compileCommand.Flag("skip-libraries-discovery").Hidden = true
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."))
configuration.Settings.BindPFlag("sketch.always_export_binaries", compileCommand.Flags().Lookup("export-binaries"))

compileCommand.Flags().MarkDeprecated("build-properties", tr("please use --build-property instead."))
Expand Down Expand Up @@ -244,6 +246,7 @@ func runCompileCommand(cmd *cobra.Command, args []string) {
EncryptKey: encryptKey,
SkipLibrariesDiscovery: skipLibrariesDiscovery,
DoNotExpandBuildProperties: showProperties == arguments.ShowPropertiesUnexpanded,
Jobs: jobs,
}
builderRes, compileError := compile.Compile(context.Background(), compileRequest, stdOut, stdErr, nil)

Expand Down