minor: GenerateProtoBuf: get rid of weak warnings, add a reminder about GenerateProtoBufCompare.

This commit is contained in:
Michael Nedzelsky
2015-07-31 15:34:32 +03:00
parent 8ef5adb5bd
commit 31d5ec2370
@@ -66,7 +66,8 @@ fun main(args: Array<String>) {
execProtoc(protoPath.file, protoPath.outPath) execProtoc(protoPath.file, protoPath.outPath)
modifyAndExecProtoc(protoPath) modifyAndExecProtoc(protoPath)
} }
GenerateProtoBufCompare.generate()
println("Do not forget to run GenerateProtoBufCompare")
} }
catch (e: Throwable) { catch (e: Throwable) {
e.printStackTrace() e.printStackTrace()
@@ -81,20 +82,20 @@ fun main(args: Array<String>) {
fun checkVersion() { fun checkVersion() {
val processOutput = ExecUtil.execAndGetOutput(listOf(PROTOC_EXE, "--version"), null) val processOutput = ExecUtil.execAndGetOutput(listOf(PROTOC_EXE, "--version"), null)
val version = processOutput.getStdout().trim() val version = processOutput.stdout.trim()
if (version.isEmpty()) { if (version.isEmpty()) {
throw AssertionError("Output is empty, stderr: " + processOutput.getStderr()) throw AssertionError("Output is empty, stderr: ${processOutput.stderr}")
} }
if (version != "libprotoc 2.5.0") { if (version != "libprotoc 2.5.0") {
throw AssertionError("Expected protoc 2.5.0, but was: " + version) throw AssertionError("Expected protoc 2.5.0, but was: $version")
} }
} }
fun execProtoc(protoPath: String, outPath: String) { fun execProtoc(protoPath: String, outPath: String) {
val processOutput = ExecUtil.execAndGetOutput(listOf(PROTOC_EXE, protoPath, "--java_out=$outPath") + PROTOBUF_PROTO_PATHS.map { "--proto_path=$it" }, null) val processOutput = ExecUtil.execAndGetOutput(listOf(PROTOC_EXE, protoPath, "--java_out=$outPath") + PROTOBUF_PROTO_PATHS.map { "--proto_path=$it" }, null)
print(processOutput.getStdout()) print(processOutput.stdout)
if (processOutput.getStderr().isNotEmpty()) { if (processOutput.stderr.isNotEmpty()) {
throw AssertionError(processOutput.getStderr()) throw AssertionError(processOutput.stderr)
} }
} }
@@ -111,7 +112,6 @@ fun modifyForDebug(protoPath: ProtoPath): String {
.replace("option java_outer_classname = \"${protoPath.className}\"", .replace("option java_outer_classname = \"${protoPath.className}\"",
"option java_outer_classname = \"${protoPath.debugClassName}\"") // give different name for class "option java_outer_classname = \"${protoPath.debugClassName}\"") // give different name for class
.replace("option optimize_for = LITE_RUNTIME;", "") // using default instead .replace("option optimize_for = LITE_RUNTIME;", "") // using default instead
//.replace(".proto\"", ".debug.proto\"") // for "import" statement in proto
(listOf(EXT_OPTIONS_PROTO_PATH) + PROTO_PATHS).forEach { (listOf(EXT_OPTIONS_PROTO_PATH) + PROTO_PATHS).forEach {
val file = it.file val file = it.file
val newFile = file.replace(".proto", ".debug.proto") val newFile = file.replace(".proto", ".debug.proto")