## Compiles every project script and exits non-zero if any fails. ## Run with: tools/godot.sh --script res://tools/parse_all.gd extends SceneTree const SKIP_DIRS: Array[String] = ["res://tools/godot", "res://test/fixtures"] func _initialize() -> void: var paths: Array[String] = [] _collect("res://", paths) var failed: int = 0 for path: String in paths: var script: GDScript = load(path) as GDScript if script == null or not script.can_instantiate(): printerr("PARSE FAIL: %s" % path) failed += 1 print("Parsed %d scripts, %d failed." % [paths.size(), failed]) quit(1 if failed > 0 or paths.is_empty() else 0) func _collect(dir_path: String, out: Array[String]) -> void: if dir_path.trim_suffix("/") in SKIP_DIRS: return for name: String in DirAccess.get_files_at(dir_path): if name.ends_with(".gd"): out.append(dir_path.path_join(name)) for name: String in DirAccess.get_directories_at(dir_path): if not name.begins_with("."): _collect(dir_path.path_join(name), out)