aboutsummaryrefslogtreecommitdiff
path: root/scripts/fix-win-bazel-build.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/fix-win-bazel-build.py')
-rw-r--r--scripts/fix-win-bazel-build.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/fix-win-bazel-build.py b/scripts/fix-win-bazel-build.py
new file mode 100644
index 0000000..fcba6f3
--- /dev/null
+++ b/scripts/fix-win-bazel-build.py
@@ -0,0 +1,31 @@
+import fnmatch
+import os
+import os.path
+from shutil import copyfile
+
+matches = []
+for root, dirnames, filenames in os.walk('bazel-bin\\java\\org\\brotli'):
+ for filename in fnmatch.filter(filenames, '*.runfiles_manifest'):
+ matches.append(os.path.join(root, filename))
+
+for match in matches:
+ runfiles = match[:-len('_manifest')]
+ with open(match) as manifest:
+ for entry in manifest:
+ entry = entry.strip()
+ if not entry.startswith("org_brotli"):
+ continue
+ if entry.startswith('org_brotli/external'):
+ continue
+ (alias, space, link) = entry.partition(' ')
+ if alias.endswith('.jar') or alias.endswith('.exe'):
+ continue
+ link = link.replace('/', '\\')
+ alias = alias.replace('/', '\\')
+ dst = os.path.join(runfiles, alias)
+ if not os.path.exists(dst):
+ print(link + ' -> ' + dst)
+ parent = os.path.dirname(dst)
+ if not os.path.exists(parent):
+ os.makedirs(parent)
+ copyfile(link, dst)