当前仓库属于关闭状态,部分功能使用受限,详情请查阅 仓库状态说明
2 Star 1 Fork 0

10km / idl-generator-cli
关闭

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-2-Clause

idl-generator-cli

swift2thrift-generator-cli(0.14.2)基础上定制idl文件生成,将primitive封装类型(Integer,Long,Boolean...)的参数和字段在生成的IDL文件中默认指定为optional,将primitive类型的参数和字段默认指定为required.

命令行参数与swift提供的swift2thrift-generator-cli保持一致,增加了一个命令行参数-primitiveOptional(默认true),当指定为false时生成的idl文件与swift2thrift-generator-cli完全一致。

Usage: Swift2ThriftGenerator [options] <Swift-class-name...>
  Options:
    -allow_multiple_packages
       Allow input classes to reside in different packages. The value of this
       flag defines the generated java.swift namespace. Note that Swift classes
       generated from the resultant Thrift file will all reside in one Java package
    -package, -default_package
       Default package for unqualified classes
       Default: <empty string>
    -map
       Map of external type or service to include file
    -namespace
       Namespace for a particular language to include
    -out
       Thrift IDL output file, defaults to stdout
    -primitiveOptional
       Generate optional field and parameter  from the  wrap type of primitive
       type(such as Integer,Long...)
       Default: true
    -recursive
       Generate all types transitively reachable from the specified types and
       services
       Default: false
    -v, -verbose
       Show verbose messages
       Default: false

使用示例(注意以下为windows bat脚本,路径分隔符为windows下的;):

set MYCLASS=target\classes;..\db\target\classes;..\simplemq\target\classes
java -cp lib\idl-generator-cli-1.0-SNAPSHOT-standalone.jar;%MYCLASS% ^
    com.gitee.l0km.thrift.swift2thrift.generator.Main ^
    -namespace py gdface.thrift ^
    -namespace java com.gdface 
    -namespace cpp gdface ^
    -out IFaceLog.thrift ^
    -package net.gdface.facelog.service BaseFaceLog ^
    -recursive
  1. MYCLASS 定义要生成idl文件的class路径(claspath)
  2. -namespace 用于指定生成对应语言(java,cpp,python...)代码的名字空间
  3. -out 指定生成的idl文件名
  4. -package 指定生成servcie接口的类包名 BaseFaceLog就是的service定义类名
  5. -recursive 指定生成service相关的所有引用类型的idl

关于参数的更详细权威的用法说明参见原版swift2thrift-generator-cli《thrift:swift 命令行生成 IDL文件及Client java代码过程》

Copyright (c) 2017, 10km All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

项目已经代码移到 https://gitee.com/l0km/idl-generator 展开 收起
Java
BSD-2-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/l0km/idl-generator-cli.git
git@gitee.com:l0km/idl-generator-cli.git
l0km
idl-generator-cli
idl-generator-cli
master

搜索帮助