45def makeFile(output_file, input_cc_file, include, var_name, lib_name, in_files):
46 part_index = []
47 bootstrap_cc_text = open(input_cc_file).
read()
48 bootstrap_cc_text = bootstrap_cc_text.replace("{{SOURCE_ARRAYS}}",
50 bootstrap_cc_text = bootstrap_cc_text.replace("{{INCLUDE}}", include)
51 bootstrap_cc_text = bootstrap_cc_text.replace("{{VAR_NAME}}", var_name)
52 main_file_found = False
53 file_count = 0
54 for string_file in in_files:
55 if string_file.endswith('.dart'):
56 file_count += 1
57 if (not main_file_found):
58 inpt = open(string_file, 'r')
59 for line in inpt:
60
61 if line.startswith('library '):
62 main_file_found = True
63 bootstrap_cc_text = bootstrap_cc_text.replace(
64 "{{LIBRARY_SOURCE_MAP}}", ' "' + lib_name + '",\n' +
65 ' source_array_' + str(file_count) + ',\n')
66 inpt.close()
67 if (main_file_found):
68 continue
69 part_index.append(' "' + lib_name + "/" + os.path.basename(
70 string_file).replace('\\', '\\\\') + '",\n')
71 part_index.append(' source_array_' + str(file_count) + ',\n\n')
72 bootstrap_cc_text = bootstrap_cc_text.replace("{{LIBRARY_SOURCE_MAP}}", '')
73 bootstrap_cc_text = bootstrap_cc_text.replace("{{PART_SOURCE_MAP}}",
75 open(output_file,
'w').
write(bootstrap_cc_text)
76 return True
77
78
static bool read(SkStream *stream, void *buffer, size_t amount)
def makeSourceArrays(in_files)
static SkString join(const CommandLineFlags::StringArray &)
void write(SkWStream *wStream, const T &text)