684
685
686
687 rewrapper_end = 0
688 for i
in range(
len(argv)):
689 if argv[i] == '--' and rewrapper_end == 0:
690 rewrapper_end = i + 1
691 if not '/' in argv[i + 1]:
692 argv[i + 1] = './' + argv[i + 1]
693 break
694
695 rewrapper = Rewrapper(argv)
696
697 if rewrapper.exec_root == None:
698 raise Exception('No rewrapper --exec_root was specified')
699
700 if not rewrapper.outputs:
701 raise Exception('No output files were recognized')
702
703
704 if rewrapper.no_remote:
706 return 0
707
708
710 if not rewrapper.depfiles:
711 rewrapper.depfiles = [output + '.d' for output in rewrapper.outputs]
712 output_files = rewrapper.outputs + rewrapper.depfiles
713 inputs =
find_inputs(rewrapper.entry_points, rewrapper.exec_root,
714 package_config)
716 resolve_uri(uri, rewrapper.exec_root, package_config, whole_dir=
True)
717 for uri in inputs)
718 paths.add(os.path.join('.dart_tool', 'package_config.json'))
719 for path in rewrapper.extra_paths:
720 paths.add(path)
721
722 working_directory = rewrapper.rebase('.')
723 if not any([path.startswith(working_directory)
for path
in paths]):
724 paths.add(rewrapper.rebase('build.ninja.stamp'))
725 paths = list(paths)
726 paths.sort()
727
728
729 command = [argv[1]]
730 command.append('--labels=type=tool')
731 command.append(
'--inputs=' +
','.
join(paths))
732 command.append(
'--output_files=' +
','.
join(output_files))
733
734
735
736
737
738 command += argv[2:rewrapper_end] + [
740 for arg in argv[rewrapper_end:]
741 ]
742
743
745
746
747
748 for depfile in rewrapper.depfiles:
749 lines = []
750 try:
751 with open(os.path.join(rewrapper.exec_root, depfile), 'r') as file:
752 lines = file.readlines()
753 lines = [
754 line.replace('/b/f/w', rewrapper.exec_root) for line in lines
755 ]
756 with open(os.path.join(rewrapper.exec_root, depfile), 'w') as file:
757 file.writelines(lines)
758 except FileNotFoundError:
759 pass
760
761 return 0
762
763
def run_command(command, strategy)
def rewrite_absolute(arg, exec_root, working_directory)
SIT bool any(const Vec< 1, T > &x)
static SkString join(const CommandLineFlags::StringArray &)