/**
*
*/
package com.kk.netty.protobuf.main;
import java.io.File;
import java.util.List;
import org.apache.log4j.PropertyConfigurator;
import com.huawei.codecc.util.command.handle.CommandHandle;
/**
* @author l00216270
*
*/
public class Test
{
/**
* @param args
*/
public static void main(String[] args)
{
PropertyConfigurator.configure("conf/log4j.properties");
// String protoFilePath = System.getProperty("user.dir") +
// File.separator + "MyInnerClassName.proto";
// String toolPath = "G:\\wtp\\eclipsejuno\\workspacejuno" +
// "\\NettyProtobufTest\\tools";
// String protoToolPath = getProtoTool(toolPath);
//
// String command = protoToolPath + " --java_out=" + System.getProperty("user.dir") +
// File.separator + "src " + protoFilePath + " --proto_path=" +
// System.getProperty("user.dir");
// List<String> results = CommandHandle.executeCommand(command);
//
// System.out.println(results);
String protoFilePath = System.getProperty("user.dir") +
File.separator + "MyInnerClassName.proto";
generateProtobuf(protoFilePath);
}
private static void generateProtobuf(String protoFilePath)
{
String toolPath = System.getProperty("user.dir") + File.separator +
"tools";
String protoToolPath = getProtoTool(toolPath);
generateProtobuf(protoFilePath, protoToolPath);
}
private static void generateProtobuf(String protoFilePath, String protoToolPath)
{
// String protoFilePath = System.getProperty("user.dir") +
// File.separator + "MyInnerClassName.proto";
// String toolPath = "G:\\wtp\\eclipsejuno\\workspacejuno" +
// "\\NettyProtobufTest\\tools";
// String protoToolPath = getProtoTool(toolPath);
String command = protoToolPath + " --java_out=" + System.getProperty("user.dir") +
File.separator + "src " + protoFilePath + " --proto_path=" +
System.getProperty("user.dir");
List<String> results = CommandHandle.executeCommand(command);
// System.out.println(results);
}
private static String getProtoTool(String toolPath)
{
return toolPath + File.separator + "protoc.exe";
}
}