-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiff.py
135 lines (128 loc) · 3.87 KB
/
diff.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# -*- coding: utf-8 -*-
import json
import sys
sys.path.append(sys.argv[1])
import before
import after
IGNORED = [
"android_gmaven_r8",
"android_tools",
"local_config_cc",
"local_config_cc_toolchains",
"local_config_sh",
"local_config_xcode",
"local_jdk",
"remote_coverage_tools",
"remote_java_tools",
"remote_java_tools_darwin",
"remote_java_tools_linux",
"remote_java_tools_windows",
"remotejdk10_linux",
"remotejdk10_linux_aarch64",
"remotejdk10_macos",
"remotejdk10_win",
"remotejdk11_linux",
"remotejdk11_linux_aarch64",
"remotejdk11_linux_aarch64_toolchain_config_repo",
"remotejdk11_linux_ppc64le",
"remotejdk11_linux_ppc64le_toolchain_config_repo",
"remotejdk11_linux_s390x",
"remotejdk11_linux_s390x_toolchain_config_repo",
"remotejdk11_linux_toolchain_config_repo",
"remotejdk11_macos",
"remotejdk11_macos_aarch64",
"remotejdk11_macos_aarch64_toolchain_config_repo",
"remotejdk11_macos_toolchain_config_repo",
"remotejdk11_win",
"remotejdk11_win_arm64",
"remotejdk11_win_arm64_toolchain_config_repo",
"remotejdk11_win_toolchain_config_repo",
"remotejdk14_linux",
"remotejdk14_macos",
"remotejdk14_win",
"remotejdk15_linux",
"remotejdk15_linux_toolchain_config_repo",
"remotejdk15_macos",
"remotejdk15_macos_aarch64",
"remotejdk15_macos_aarch64_toolchain_config_repo",
"remotejdk15_macos_toolchain_config_repo",
"remotejdk15_win",
"remotejdk15_win_toolchain_config_repo",
"remotejdk16_linux",
"remotejdk16_linux_toolchain_config_repo",
"remotejdk16_macos",
"remotejdk16_macos_aarch64",
"remotejdk16_macos_aarch64_toolchain_config_repo",
"remotejdk16_macos_toolchain_config_repo",
"remotejdk16_win",
"remotejdk16_win_toolchain_config_repo",
"remotejdk17_linux",
"remotejdk17_linux_aarch64",
"remotejdk17_linux_aarch64_toolchain_config_repo",
"remotejdk17_linux_toolchain_config_repo",
"remotejdk17_macos",
"remotejdk17_macos_aarch64",
"remotejdk17_macos_aarch64_toolchain_config_repo",
"remotejdk17_macos_toolchain_config_repo",
"remotejdk17_win",
"remotejdk17_win_arm64",
"remotejdk17_win_arm64_toolchain_config_repo",
"remotejdk17_win_toolchain_config_repo",
"remotejdk18_linux",
"remotejdk18_linux_aarch64",
"remotejdk18_linux_aarch64_toolchain_config_repo",
"remotejdk18_linux_toolchain_config_repo",
"remotejdk18_macos",
"remotejdk18_macos_aarch64",
"remotejdk18_macos_aarch64_toolchain_config_repo",
"remotejdk18_macos_toolchain_config_repo",
"remotejdk18_win",
"remotejdk18_win_arm64",
"remotejdk18_win_arm64_toolchain_config_repo",
"remotejdk18_win_toolchain_config_repo",
"remotejdk_linux",
"remotejdk_linux_aarch64",
"remotejdk_macos",
"remotejdk_win",
"rules_cc",
"rules_java",
"rules_license",
"rules_proto",
]
b = {}
for x in before.resolved:
if '@bazel_tools' not in x['original_rule_class']:
continue
name = x['original_attributes']['name']
if name in IGNORED:
continue
b[name] = x
a = {}
for x in after.resolved:
if '@bazel_tools' not in x['original_rule_class']:
continue
name = x['original_attributes']['name']
if name in IGNORED:
continue
a[name] = x
keys = sorted(set(list(b.keys()) + list(a.keys())))
mismatched = [k for k in keys if k not in b or k not in a]
if len(mismatched) != 0:
print("Unexpected keys:")
print(mismatched)
print("add these to IGNORED maybe?")
exit(1)
for name in keys:
xb = b[name]
xa = a[name]
d = {k: xa[k] for k in set(xa) - set(xb)}
if d:
dump = lambda x: print(json.dumps(x, indent=4, sort_keys=True))
print(name)
print("Before:")
dump(xb)
print("Before:")
dump(xa)
print("Difference:")
dump(d)
exit(2)