39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
"""javaps one class across every cached bucket jar, filtered by a regex.
|
|
|
|
The companion to probe-api.py: that one watches a fixed list of members and
|
|
feeds docs/PORTING.md's tables, this one answers a one-off question while
|
|
writing an adapter.
|
|
|
|
python3 tools/probe-class.py net.minecraft.client.gui.Gui 'render\\('
|
|
"""
|
|
|
|
import re
|
|
import sys
|
|
|
|
from importlib.machinery import SourceFileLoader
|
|
from pathlib import Path
|
|
|
|
probe = SourceFileLoader("probe", str(Path(__file__).with_name("probe-api.py"))).load_module()
|
|
|
|
|
|
def main():
|
|
if len(sys.argv) < 2:
|
|
sys.exit("usage: probe-class.py <class[,class...]> [regex]")
|
|
class_names = sys.argv[1].split(",")
|
|
pattern = sys.argv[2] if len(sys.argv) > 2 else r"."
|
|
for version, jar in probe.jars():
|
|
print(f"===== {version}")
|
|
for class_name in class_names:
|
|
members = probe.dump(jar, class_name, pattern)
|
|
if members is None:
|
|
print(f" -- {class_name}: ABSENT")
|
|
continue
|
|
print(f" -- {class_name}")
|
|
for member in members:
|
|
print(f" {member}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|