## R2: writes the Godot engine's own licence and the notices of the third-party code ## built into it, as the engine reports them (Engine.get_license_text(), ## get_copyright_info(), get_license_info()). The MIT licence and the others need these ## notices to travel with the binary, so the release package and the .deb ship this file. ## ## tools/godot.sh --script res://tools/engine_licenses.gd -- --out=PATH extends SceneTree func _init() -> void: var out: String = "" for arg: String in OS.get_cmdline_user_args(): if arg.begins_with("--out="): out = arg.get_slice("=", 1) if out.is_empty(): printerr("engine_licenses: --out=PATH is required") quit(2) return var file: FileAccess = FileAccess.open(out, FileAccess.WRITE) if file == null: printerr("engine_licenses: can't write %s" % out) quit(1) return file.store_string(text()) file.close() quit(0) static func text() -> String: var version: Dictionary = Engine.get_version_info() var lines: PackedStringArray = PackedStringArray() lines.append("Tidewall runs on the Godot Engine %s (https://godotengine.org)." % version["string"]) lines.append("The engine's licence, and the copyright notices and licences of the") lines.append("third-party code built into it, as the engine itself reports them.") lines.append("") lines.append("=" .repeat(78)) lines.append("Godot Engine") lines.append("=" .repeat(78)) lines.append("") lines.append(Engine.get_license_text().strip_edges()) lines.append("") lines.append("=" .repeat(78)) lines.append("Components") lines.append("=" .repeat(78)) for component: Dictionary in Engine.get_copyright_info(): lines.append("") lines.append("%s" % component["name"]) for part: Dictionary in component["parts"]: lines.append(" Files: %s" % ", ".join(PackedStringArray(part["files"]))) for holder: String in part["copyright"]: lines.append(" Copyright: %s" % holder) lines.append(" License: %s" % part["license"]) lines.append("") lines.append("=" .repeat(78)) lines.append("Licence texts") lines.append("=" .repeat(78)) var licenses: Dictionary = Engine.get_license_info() var names: Array = licenses.keys() names.sort() for name: String in names: lines.append("") lines.append("-" .repeat(78)) lines.append(name) lines.append("-" .repeat(78)) lines.append("") lines.append(String(licenses[name]).strip_edges()) lines.append("") return "\n".join(lines)