Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions bazel_to_cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ def make_shell_script(self, **kwargs):
def exports_files(self, files, **kwargs):
pass

def package(self, **kwargs):
pass

def proto_library(self, **kwargs):
pass

Expand Down Expand Up @@ -258,13 +261,19 @@ def GetDict(obj):
ret = {}
for k in dir(obj):
if not k.startswith("_"):
ret[k] = getattr(obj, k);
ret[k] = getattr(obj, k)
return ret

globs = GetDict(converter)

execfile("WORKSPACE", GetDict(WorkspaceFileFunctions(converter)))
execfile("BUILD", GetDict(BuildFileFunctions(converter)))
def exec_file(filepath, globals_=None, locals_=None):
with open(filepath) as f:
code = compile(f.read(), filepath, "exec")
exec(code, globals_, locals_)

exec_file("WORKSPACE", GetDict(WorkspaceFileFunctions(converter)))
exec_file("BUILD", GetDict(BuildFileFunctions(converter)))

with open(sys.argv[1], "w") as f:
output_file = sys.argv[1] if len(sys.argv) > 0 else "CMakeLists.txt"
with open(output_file, "w") as f:
f.write(converter.convert())