Skip to content

Commit

Permalink
Add Swift bindings for setting LLBuild scheduler settings
Browse files Browse the repository at this point in the history
  • Loading branch information
jakepetroules committed May 10, 2018
1 parent 64d8894 commit 39e6cf4
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions products/llbuildSwift/BuildSystemBindings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -832,5 +832,48 @@ public final class BuildSystem {
llb_disable_tracing()
}
}


public enum SchedulerAlgorithm: String {
case commandNamePriority
case fifo

init(_ algorithm: llb_scheduler_algorithm_t) {
switch algorithm {
case llb_scheduler_algorithm_command_name_priority:
self = .commandNamePriority
case llb_scheduler_algorithm_fifo:
self = .fifo
default:
self = .commandNamePriority
}
}
}

/// Get the scheduler algorithm
public static func getSchedulerLaneWidth() -> SchedulerAlgorithm {
return SchedulerAlgorithm(llb_get_scheduler_algorithm())
}

/// Set scheduler algorithm
public static func setSchedulerAlgorithm(_ algorithm: SchedulerAlgorithm) {
switch (algorithm) {
case .commandNamePriority:
llb_set_scheduler_algorithm(
llb_scheduler_algorithm_command_name_priority)
case .fifo:
llb_set_scheduler_algorithm(llb_scheduler_algorithm_fifo)
}
}

/// Get scheduler lane width
public static func getSchedulerLaneWidth() -> UInt32 {
return llb_get_scheduler_lane_width()
}

/// Set scheduler lane width
public static func setSchedulerLaneWidth(width: UInt32) {
llb_set_scheduler_lane_width(width)
}
}

0 comments on commit 39e6cf4

Please sign in to comment.