Browse Source

ft: 打包escript执行文件

master
SisMaker 4 years ago
parent
commit
533cbd1a06
9 changed files with 22 additions and 4 deletions
  1. +5
    -1
      README.md
  2. +7
    -1
      rebar.config
  3. +6
    -0
      src/genProto.erl
  4. +1
    -0
      test/gen.bat
  5. +1
    -0
      test/gen.sh
  6. BIN
      test/genProto
  7. +0
    -1
      test/genProto.bat
  8. +2
    -0
      test/genProto.cmd
  9. +0
    -1
      test/genProto.sh

+ 5
- 1
README.md View File

@ -6,7 +6,11 @@ An OTP library
Build
-----
$ rebar3 compile
$ rebar3 escriptize
Use
-----
genProto ProtoInputDir HrlOutDir ErlOutDir
# 简单描述

+ 7
- 1
rebar.config View File

@ -1,2 +1,8 @@
{erl_opts, [debug_info]}.
{deps, []}.
{deps, []}.
{escript_main_app, genProto}. % specify which app is the escript app
{escript_name, genProto}. % name of final generated escript
%%{escript_emu_args, "%%! -escript main Module\n"}. % emulator args
%%{escript_shebang, "#!/usr/bin/env escript\n"}. % executable line
%%{escript_comment, "%%\n"}. % comment at top of escript file

+ 6
- 0
src/genProto.erl View File

@ -2,6 +2,8 @@
-include("genDef.hrl").
-export([main/1]).
-export([
convertFile/1
, convert/1
@ -10,6 +12,10 @@
, convertDir/3
]).
main(Args) ->
[ProtoDir, HrlDir, ErlDir] = Args,
convertDir(ProtoDir, HrlDir, ErlDir).
convertFile(File) ->
erlang:erase(),
erlang:put(pd_errlist, []),

+ 1
- 0
test/gen.bat View File

@ -0,0 +1 @@
genProto ../proto ./ ./

+ 1
- 0
test/gen.sh View File

@ -0,0 +1 @@
protoGen ../proto ./ ./

BIN
test/genProto View File


+ 0
- 1
test/genProto.bat View File

@ -1 +0,0 @@
erl -pa ../ebin -s genProto convert ../proto ./ ./

+ 2
- 0
test/genProto.cmd View File

@ -0,0 +1,2 @@
@echo off
escript.exe "%~dpn0" %*

+ 0
- 1
test/genProto.sh View File

@ -1 +0,0 @@
erl -pa ../ebin -s protoGen convert ../proto ./ ./

Loading…
Cancel
Save