401 |
401 |
402 private def echo(msg: String) { java.lang.System.out.println(msg) } |
402 private def echo(msg: String) { java.lang.System.out.println(msg) } |
403 private def sleep(): Unit = Thread.sleep(500) |
403 private def sleep(): Unit = Thread.sleep(500) |
404 |
404 |
405 def build(all_sessions: Boolean, build_images: Boolean, max_jobs: Int, |
405 def build(all_sessions: Boolean, build_images: Boolean, max_jobs: Int, |
406 list_only: Boolean, system_mode: Boolean, timing: Boolean, verbose: Boolean, |
406 no_build: Boolean, system_mode: Boolean, timing: Boolean, verbose: Boolean, |
407 more_dirs: List[Path], more_options: List[String], sessions: List[String]): Int = |
407 more_dirs: List[Path], more_options: List[String], sessions: List[String]): Int = |
408 { |
408 { |
409 val options = (Options.init() /: more_options)(_.define_simple(_)) |
409 val options = (Options.init() /: more_options)(_.define_simple(_)) |
410 val queue = find_sessions(options, all_sessions, sessions, more_dirs) |
410 val queue = find_sessions(options, all_sessions, sessions, more_dirs) |
411 val deps = dependencies(queue) |
411 val deps = dependencies(queue) |
449 loop(pending - name, running - name, results + (name -> rc)) |
449 loop(pending - name, running - name, results + (name -> rc)) |
450 } |
450 } |
451 else if (running.size < (max_jobs max 1)) { |
451 else if (running.size < (max_jobs max 1)) { |
452 pending.dequeue(running.isDefinedAt(_)) match { |
452 pending.dequeue(running.isDefinedAt(_)) match { |
453 case Some((name, info)) => |
453 case Some((name, info)) => |
454 if (list_only) { |
454 if (no_build && verbose) { |
455 echo(name + " in " + info.dir) |
455 echo(name + " in " + info.dir) |
456 loop(pending - name, running, results + (name -> 0)) |
456 loop(pending - name, running, results + (name -> 0)) |
457 } |
457 } |
458 else if (info.parent.map(results(_)).forall(_ == 0)) { |
458 else if (info.parent.map(results(_)).forall(_ == 0)) { |
459 val output = |
459 val output = |
486 args.toList match { |
486 args.toList match { |
487 case |
487 case |
488 Properties.Value.Boolean(all_sessions) :: |
488 Properties.Value.Boolean(all_sessions) :: |
489 Properties.Value.Boolean(build_images) :: |
489 Properties.Value.Boolean(build_images) :: |
490 Properties.Value.Int(max_jobs) :: |
490 Properties.Value.Int(max_jobs) :: |
491 Properties.Value.Boolean(list_only) :: |
491 Properties.Value.Boolean(no_build) :: |
492 Properties.Value.Boolean(system_mode) :: |
492 Properties.Value.Boolean(system_mode) :: |
493 Properties.Value.Boolean(timing) :: |
493 Properties.Value.Boolean(timing) :: |
494 Properties.Value.Boolean(verbose) :: |
494 Properties.Value.Boolean(verbose) :: |
495 Command_Line.Chunks(more_dirs, options, sessions) => |
495 Command_Line.Chunks(more_dirs, options, sessions) => |
496 build(all_sessions, build_images, max_jobs, list_only, system_mode, timing, |
496 build(all_sessions, build_images, max_jobs, no_build, system_mode, timing, |
497 verbose, more_dirs.map(Path.explode), options, sessions) |
497 verbose, more_dirs.map(Path.explode), options, sessions) |
498 case _ => error("Bad arguments:\n" + cat_lines(args)) |
498 case _ => error("Bad arguments:\n" + cat_lines(args)) |
499 } |
499 } |
500 } |
500 } |
501 } |
501 } |