reworked build system to use rebar, tests still use external script, moved jsx_decoder.erl template to /priv from /src
This commit is contained in:
parent
862e5db7c3
commit
a83a0a4ebc
10 changed files with 17 additions and 130 deletions
28
makefile
28
makefile
|
@ -1,23 +1,9 @@
|
||||||
compile: expand
|
compile: expand
|
||||||
./priv/jsx_compile.escript\
|
./rebar compile
|
||||||
src/jsx\
|
./priv/backends.escript clean
|
||||||
src/jsx_utf8\
|
|
||||||
src/jsx_utf16\
|
|
||||||
src/jsx_utf16le\
|
|
||||||
src/jsx_utf32\
|
|
||||||
src/jsx_utf32le
|
|
||||||
|
|
||||||
debug: expand
|
|
||||||
./priv/jsx_compile.escript -d\
|
|
||||||
src/jsx\
|
|
||||||
src/jsx_utf8\
|
|
||||||
src/jsx_utf16\
|
|
||||||
src/jsx_utf16le\
|
|
||||||
src/jsx_utf32\
|
|
||||||
src/jsx_utf32le
|
|
||||||
|
|
||||||
expand:
|
expand:
|
||||||
./priv/jsx_expand.escript utf8 utf16 utf16le utf32 utf32le
|
./priv/backends.escript create
|
||||||
|
|
||||||
test: compile
|
test: compile
|
||||||
./priv/jsx_test.escript test/cases
|
./priv/jsx_test.escript test/cases
|
||||||
|
@ -26,9 +12,5 @@ prove:
|
||||||
prove ./priv/jsx_test.escript
|
prove ./priv/jsx_test.escript
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
./priv/jsx_clean.escript
|
./rebar clean
|
||||||
|
./priv/backends.escript clean
|
||||||
install: clean compile
|
|
||||||
./priv/jsx_install.escript
|
|
||||||
|
|
||||||
force:
|
|
|
@ -22,8 +22,14 @@
|
||||||
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
%% THE SOFTWARE.
|
%% THE SOFTWARE.
|
||||||
|
|
||||||
main(Backends) ->
|
main(["create"]) ->
|
||||||
lists:foreach(fun(X) -> to_src(X) end, [ to_abf(Backend) || Backend <- Backends ]).
|
lists:foreach(
|
||||||
|
fun(X) -> to_src(X) end,
|
||||||
|
[ to_abf(Backend) || Backend <- ["utf8", "utf16", "utf16le", "utf32", "utf32le"] ]
|
||||||
|
);
|
||||||
|
|
||||||
|
main(["clean"]) ->
|
||||||
|
[ file:delete(Filename) || Filename <- ["src/jsx_utf8.erl", "src/jsx_utf16.erl", "src/jsx_utf16le.erl", "src/jsx_utf32.erl", "src/jsx_utf32le.erl"] ].
|
||||||
|
|
||||||
to_abf(Backend) ->
|
to_abf(Backend) ->
|
||||||
case os:getenv("TMPDIR") of
|
case os:getenv("TMPDIR") of
|
||||||
|
@ -32,7 +38,7 @@ to_abf(Backend) ->
|
||||||
end,
|
end,
|
||||||
Name = to_modname(Backend),
|
Name = to_modname(Backend),
|
||||||
{ok, _, ABF} = compile:file(
|
{ok, _, ABF} = compile:file(
|
||||||
"src/jsx_decoder.erl",
|
"priv/jsx_decoder.erl",
|
||||||
[binary, 'P', {outdir, Out}, {d, list_to_atom(Backend)}, {d, name, Name}]
|
[binary, 'P', {outdir, Out}, {d, list_to_atom(Backend)}, {d, name, Name}]
|
||||||
),
|
),
|
||||||
{Name, ABF}.
|
{Name, ABF}.
|
|
@ -1,28 +0,0 @@
|
||||||
#!/usr/bin/env escript
|
|
||||||
|
|
||||||
%% The MIT License
|
|
||||||
|
|
||||||
%% Copyright (c) 2010 Alisdair Sullivan <alisdairsullivan@yahoo.ca>
|
|
||||||
|
|
||||||
%% Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
%% of this software and associated documentation files (the "Software"), to deal
|
|
||||||
%% in the Software without restriction, including without limitation the rights
|
|
||||||
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
%% copies of the Software, and to permit persons to whom the Software is
|
|
||||||
%% furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
%% The above copyright notice and this permission notice shall be included in
|
|
||||||
%% all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
%% THE SOFTWARE.
|
|
||||||
|
|
||||||
|
|
||||||
main([]) ->
|
|
||||||
[ file:delete(Filename) || Filename <- filelib:wildcard("ebin/*.beam") ],
|
|
||||||
[ file:delete(Filename) || Filename <- filelib:wildcard("src/jsx_u*.erl") ].
|
|
|
@ -1,41 +0,0 @@
|
||||||
#!/usr/bin/env escript
|
|
||||||
|
|
||||||
%% The MIT License
|
|
||||||
|
|
||||||
%% Copyright (c) 2010 Alisdair Sullivan <alisdairsullivan@yahoo.ca>
|
|
||||||
|
|
||||||
%% Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
%% of this software and associated documentation files (the "Software"), to deal
|
|
||||||
%% in the Software without restriction, including without limitation the rights
|
|
||||||
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
%% copies of the Software, and to permit persons to whom the Software is
|
|
||||||
%% furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
%% The above copyright notice and this permission notice shall be included in
|
|
||||||
%% all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
%% THE SOFTWARE.
|
|
||||||
|
|
||||||
main(["-d"|Mods]) ->
|
|
||||||
compile_files(Mods, [{outdir, "ebin"}, debug_info]);
|
|
||||||
|
|
||||||
main(Mods) ->
|
|
||||||
compile_files(Mods, [{outdir, "ebin"}]).
|
|
||||||
|
|
||||||
compile_files([], _) ->
|
|
||||||
ok;
|
|
||||||
compile_files([FileName|Rest], Opts) ->
|
|
||||||
case compile:file(FileName, Opts) of
|
|
||||||
{ok, _} -> ok
|
|
||||||
; {ok, Name, Bin} -> file:write_file("ebin/" ++ atom_to_list(Name) ++ ".beam", Bin), ok
|
|
||||||
end,
|
|
||||||
compile_files(Rest, Opts).
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
|
|
||||||
-export([parse/2]).
|
-export([parse/2]).
|
||||||
|
|
||||||
-include("jsx_decoder.hrl").
|
-include("./include/jsx_decoder.hrl").
|
||||||
-include("jsx_types.hrl").
|
-include("./include/jsx_types.hrl").
|
||||||
|
|
||||||
|
|
||||||
-spec parse(JSON::json(), Opts::jsx_opts()) -> jsx_parser_result().
|
-spec parse(JSON::json(), Opts::jsx_opts()) -> jsx_parser_result().
|
|
@ -1,32 +0,0 @@
|
||||||
#!/usr/bin/env escript
|
|
||||||
|
|
||||||
%% The MIT License
|
|
||||||
|
|
||||||
%% Copyright (c) 2010 Alisdair Sullivan <alisdairsullivan@yahoo.ca>
|
|
||||||
|
|
||||||
%% Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
%% of this software and associated documentation files (the "Software"), to deal
|
|
||||||
%% in the Software without restriction, including without limitation the rights
|
|
||||||
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
%% copies of the Software, and to permit persons to whom the Software is
|
|
||||||
%% furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
%% The above copyright notice and this permission notice shall be included in
|
|
||||||
%% all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
%% THE SOFTWARE.
|
|
||||||
|
|
||||||
|
|
||||||
main([]) ->
|
|
||||||
os:cmd("mkdir -p " ++ appdir()),
|
|
||||||
os:cmd("cp -r " ++ "ebin " ++ appdir()).
|
|
||||||
|
|
||||||
appdir() ->
|
|
||||||
{ok, [{application, jsx, AppInfo}]} = file:consult("ebin/jsx.app"),
|
|
||||||
code:lib_dir() ++ "/jsx-" ++ proplists:get_value(vsn, AppInfo).
|
|
BIN
rebar
vendored
Executable file
BIN
rebar
vendored
Executable file
Binary file not shown.
|
@ -28,7 +28,7 @@
|
||||||
-export([parser/0, parser/1]).
|
-export([parser/0, parser/1]).
|
||||||
|
|
||||||
%% types for function specifications
|
%% types for function specifications
|
||||||
-include("jsx_types.hrl").
|
-include("./include/jsx_types.hrl").
|
||||||
|
|
||||||
%% opts record
|
%% opts record
|
||||||
-record(opts, {
|
-record(opts, {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue