OLD | NEW |
1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 Google Inc. 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 from compiler.ast import Const | 5 from compiler.ast import Const |
6 from compiler.ast import Dict | 6 from compiler.ast import Dict |
7 from compiler.ast import Discard | 7 from compiler.ast import Discard |
8 from compiler.ast import List | 8 from compiler.ast import List |
9 from compiler.ast import Module | 9 from compiler.ast import Module |
10 from compiler.ast import Node | 10 from compiler.ast import Node |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 if new_dependency not in self.scheduled: | 530 if new_dependency not in self.scheduled: |
531 self.scheduled.add(new_dependency) | 531 self.scheduled.add(new_dependency) |
532 self.dependencies.append(new_dependency) | 532 self.dependencies.append(new_dependency) |
533 self.pending -= 1 | 533 self.pending -= 1 |
534 self.condition.notify() | 534 self.condition.notify() |
535 self.condition.release() | 535 self.condition.release() |
536 | 536 |
537 | 537 |
538 def LoadTargetBuildFileParallel(build_file_path, data, aux_data, | 538 def LoadTargetBuildFileParallel(build_file_path, data, aux_data, |
539 variables, includes, depth, check): | 539 variables, includes, depth, check): |
540 global parallel_state | |
541 parallel_state = ParallelState() | 540 parallel_state = ParallelState() |
542 parallel_state.condition = threading.Condition() | 541 parallel_state.condition = threading.Condition() |
543 parallel_state.dependencies = [build_file_path] | 542 parallel_state.dependencies = [build_file_path] |
544 parallel_state.scheduled = set([build_file_path]) | 543 parallel_state.scheduled = set([build_file_path]) |
545 parallel_state.pending = 0 | 544 parallel_state.pending = 0 |
546 parallel_state.data = data | 545 parallel_state.data = data |
547 parallel_state.aux_data = aux_data | 546 parallel_state.aux_data = aux_data |
548 | 547 |
549 parallel_state.condition.acquire() | 548 parallel_state.condition.acquire() |
550 while parallel_state.dependencies or parallel_state.pending: | 549 while parallel_state.dependencies or parallel_state.pending: |
(...skipping 2071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2622 ValidateRunAsInTarget(target, target_dict, build_file) | 2621 ValidateRunAsInTarget(target, target_dict, build_file) |
2623 ValidateActionsInTarget(target, target_dict, build_file) | 2622 ValidateActionsInTarget(target, target_dict, build_file) |
2624 | 2623 |
2625 # Generators might not expect ints. Turn them into strs. | 2624 # Generators might not expect ints. Turn them into strs. |
2626 TurnIntIntoStrInDict(data) | 2625 TurnIntIntoStrInDict(data) |
2627 | 2626 |
2628 # TODO(mark): Return |data| for now because the generator needs a list of | 2627 # TODO(mark): Return |data| for now because the generator needs a list of |
2629 # build files that came in. In the future, maybe it should just accept | 2628 # build files that came in. In the future, maybe it should just accept |
2630 # a list, and not the whole data dict. | 2629 # a list, and not the whole data dict. |
2631 return [flat_list, targets, data] | 2630 return [flat_list, targets, data] |
OLD | NEW |