def build_all(file_data, output=None): input = clean_json(json.loads(file_data.decode('ascii', 'ignore'))) validation_warnings, validation_errors = validate_spec(input) build_data = "" build_errors = [] if not validation_errors: new_package = compile_spec(input) files = {} files.update(build_python(to_dict(new_package))) files.update(build_java(to_dict(new_package))) files.update(build_racket(to_dict(new_package))) if output is None: build_data, build_errors = build_zip(files) else: build_data, build_errors = build_dir(files, output) return validation_warnings, validation_errors, build_data, build_errors
if not fast: new_file, database_file = build_database(model) sql_file = name+".sql" build_locals(model, database_file, sql_file) database_file.close() moves = {new_file: new_folder, sql_file: new_folder} for appendix in model['metadata']['appendix']: moves[appendix['file']] = new_folder else: moves = {} return files, moves if __name__ == "__main__": import json from auxiliary import clean_json input = clean_json(json.load(open(sys.argv[1],'r'))) from validate import validate_spec warnings, errors = validate_spec(input) for warning in warnings: print("Warning!", warning) if not errors: from compile import compile_spec new_package = compile_spec(input) files = build_sql(to_dict(new_package)) from build import build_dir build_dir(files, sys.argv[2]) else: for error in errors: print("Error!", error)
elif language_target == "csv": files, moves = build_csv(compiled_dict) elif language_target == "json": files, moves = build_json(compiled_dict) elif language_target == "racket": files, moves = build_racket(compiled_dict, args.fast) elif language_target == "java": files, moves = build_java(compiled_dict, args.fast) elif language_target == "sql": files, moves = build_sql(compiled_dict, args.fast) elif language_target == "metrics": files, moves = build_metrics(compiled_dict, args.fast) elif language_target == "visualizer": files, moves = build_visualizer(compiled_dict, args.fast) elif language_target == "blockpy": files, moves = build_blockpy(compiled_dict, args.fast) else: print("Unknown language target!") break build_data, build_errors = build_dir(files, moves, args.target) if build_errors: print("\tBuild Errors!") for error in build_errors: print("\t\t", error) else: if language_target == 'java': post_build(compiled_dict, files, moves, args.target) add_to_index(args.target, language_target, compiled) if not args.prevent: rebuild_index(args.target)
if not fast: new_file, database_file = build_database(model) build_locals(model, database_file) database_file.close() moves = {new_file: new_folder} for appendix in model['metadata']['appendix']: moves[appendix['file']] = new_folder else: moves = {} return files, moves if __name__ == "__main__": import json from auxiliary import clean_json input = clean_json(json.load(open(sys.argv[1],'r'))) from validate import validate_spec warnings, errors = validate_spec(input) for warning in warnings: print "Warning!", warning if not errors: from compile import compile_spec new_package = compile_spec(input) files = build_python(to_dict(new_package)) from build import build_dir build_dir(files, sys.argv[2]) else: for error in errors: print "Error!", error