58 lines
1.8 KiB
Lua
58 lines
1.8 KiB
Lua
print("Compiling protobuf files...")
|
|
print("Changed: ", json.encode_pretty(auResourceCompiler.changedFiles))
|
|
print("Unchanged: ", json.encode_pretty(auResourceCompiler.unchangedFiles))
|
|
|
|
if (#auResourceCompiler.changedFiles == 0) then return end
|
|
|
|
local function escapeBinaryPath(bin)
|
|
bin = path.translate(bin, path.getDefaultSeparator())
|
|
bin = os.realpath(bin)
|
|
|
|
if (os.host() == "windows") then
|
|
return "\"" .. bin .. "\""
|
|
end
|
|
|
|
return bin:gsub(" ", "\\ ")
|
|
end
|
|
|
|
local compiler = nil
|
|
|
|
if (os.host() == "windows") then
|
|
compiler = path.join(Aurora.Settings.sAbsWin32, "protoc.exe")
|
|
elseif (os.isfile("protoc")) then
|
|
compiler = "protoc"
|
|
else
|
|
compiler = path.join(Aurora.Settings.sRelUnixBins, "protoc")
|
|
end
|
|
|
|
compiler = escapeBinaryPath(compiler)
|
|
|
|
local cmd = compiler
|
|
|
|
cmd = cmd .. " --cpp_out=\"" .. auResourceCompiler.arguments.targetBase .. "\""
|
|
|
|
if (auResourceCompiler.arguments.grpc) then
|
|
cmd = cmd .. " --grpc_out=\"" .. auResourceCompiler.arguments.targetBase .. "\""
|
|
|
|
if (os.host() == "windows") then
|
|
local plugin = os.realpath(path.join(Aurora.Settings.sAbsWin32, "grpc_cpp_plugin.exe"))
|
|
cmd = cmd .. " --plugin=protoc-gen-grpc=\"" .. plugin .."\""
|
|
end
|
|
end
|
|
|
|
if (auResourceCompiler.arguments.auRPC) then
|
|
cmd = cmd .. " --aurpc_out=\"" .. auResourceCompiler.arguments.targetBase .. "\""
|
|
|
|
if (os.host() == "windows") then
|
|
local plugin = os.realpath(path.join(Aurora.Settings.sAbsWin32, "aurpc_cpp_plugin.exe"))
|
|
cmd = cmd .. " --plugin=protoc-gen-aurpc=\"" .. plugin .."\""
|
|
end
|
|
end
|
|
|
|
cmd = cmd .. " --proto_path=\"" .. auResourceCompiler.arguments.basePath .. "\""
|
|
|
|
auForEach(auResourceCompiler.changedFiles, function(file)
|
|
cmd = cmd .. " \"" .. file .. "\""
|
|
end)
|
|
|
|
resourceRunAndExit(cmd) |