Add zompify support, verup to 0.2.0
All checks were successful
Gajumaru Serialization Tests / tests (push) Successful in -2m7s

This commit is contained in:
Ulf Wiger 2026-04-16 23:26:43 +02:00
parent 4698b54832
commit 2ac9363d30
14 changed files with 76 additions and 11 deletions

View File

@ -1,6 +1,6 @@
{application,gmserialization,
[{description,"Serialization of data for the Gajumaru"},
{vsn,"0.1.2"},
{vsn,"0.2.0"},
{registered,[]},
{applications,[kernel,stdlib,crypto,base58]},
{env,[]},

View File

@ -6,7 +6,7 @@
%%% @end
%%%-------------------------------------------------------------------
-module(gmser_api_encoder).
-vsn("0.1.2").
-vsn("0.2.0").
-export([encode/2,
decode/1,

View File

@ -8,7 +8,7 @@
%%%-------------------------------------------------------------------
-module(gmser_chain_objects).
-vsn("0.1.2").
-vsn("0.2.0").
-export([ serialize/4
, deserialize/4

View File

@ -6,7 +6,7 @@
%%% @end
%%%-------------------------------------------------------------------
-module(gmser_contract_code).
-vsn("0.1.2").
-vsn("0.2.0").
-include("gmser_contract_code.hrl").

View File

@ -6,7 +6,7 @@
%%% @end
%%%-------------------------------------------------------------------
-module(gmser_delegation).
-vsn("0.1.2").
-vsn("0.2.0").
-export([ aens_preclaim_sig/3
, aens_name_sig/4

View File

@ -1,4 +1,5 @@
-module(gmser_dyn).
-vsn("0.2.0").
-export([ encode/1 %% (Term) -> rlp()
, encode/2 %% (Term, Types) -> rlp()

View File

@ -1,4 +1,5 @@
-module(gmser_dyn_types).
-vsn("0.2.0").
-export([ add_type/3 %% (Tag, Code, Template) -> Types1
, add_type/4 %% (Tag, Code, Template, Types) -> Types1

View File

@ -8,7 +8,7 @@
%%%-------------------------------------------------------------------
-module(gmser_id).
-vsn("0.1.2").
-vsn("0.2.0").
-export([ create/2
, specialize/1

View File

@ -11,7 +11,7 @@
%%%-------------------------------------------------------------------
-module(gmser_rlp).
-vsn("0.1.2").
-vsn("0.2.0").
-export([ decode/1
, decode_one/1

View File

@ -1,6 +1,6 @@
{application, gmserialization,
[{description, "Serialization of data for the Gajumaru"},
{vsn, "0.1.0"},
{vsn, "zomp"},
{registered, []},
{applications,
[kernel,

View File

@ -0,0 +1,14 @@
%% -*- erlang-mode; erlang-indent-level: 4; indent-tabs-mode: nil -*-
[{application, Name, Opts}] = CONFIG.
case lists:keyfind(vsn, 1, Opts) of
{vsn, "zomp"} ->
ZompMetaF = filename:join(filename:dirname(filename:dirname(SCRIPT)), "zomp.meta"),
{ok, ZMeta} = file:consult(ZompMetaF),
{_, {_, _, {Vmaj,Vmin,Vpatch}}} = lists:keyfind(package_id, 1, ZMeta),
VsnStr = unicode:characters_to_list(io_lib:fwrite("~w.~w.~w", [Vmaj, Vmin, Vpatch])),
Opts1 = lists:keyreplace(vsn, 1, Opts, {vsn, VsnStr}),
[{application, Name, Opts1}];
_ ->
CONFIG
end.

View File

@ -7,7 +7,7 @@
%%%-------------------------------------------------------------------
-module(gmserialization).
-vsn("0.1.2").
-vsn("0.2.0").
-export([ decode_fields/2
, decode_field/2

View File

@ -2,9 +2,9 @@
{type,lib}.
{modules,[]}.
{prefix,none}.
{author,"Hans Svensson"}.
{desc,"Serialization helpers for the Gajumaru."}.
{package_id,{"otpr","gmserialization",{0,1,2}}}.
{author,"Hans Svensson"}.
{package_id,{"otpr","gmserialization",{0,2,0}}}.
{deps,[{"otpr","eblake2",{1,0,1}},{"otpr","base58",{0,1,1}}]}.
{key_name,none}.
{a_email,[]}.

49
zompify.sh Executable file
View File

@ -0,0 +1,49 @@
#!/bin/sh
set -e
APP=$(basename "$PWD")
SRC="_build/default/lib/$APP"
DST="$PWD/_build/zomp/lib/$APP"
IGNORE_FILE="zomp.ignore"
mkdir -p "$DST"
# Remove broken symlinks
find "$SRC" -type l ! -exec test -e {} \; -delete || true
# Build ignore matcher
IGNORE_TEMP=$(mktemp)
trap "rm -f $IGNORE_TEMP" EXIT
# Expand globs in zomp.ignore to patterns suitable for grep
if [ -e "$IGNORE_FILE" ]; then
grep -v '^\s*#' "$IGNORE_FILE" | sed 's#/#\\/#g' | sed 's/\./\\./g' | sed 's/\*/.*/g' > "$IGNORE_TEMP"
fi
# Copy Git-tracked and Zomp-allowed files
git ls-files -z | while IFS= read -r -d '' file; do
# Skip if ignored
echo "$file" | grep -Eq -f "$IGNORE_TEMP" && continue
# Only copy if file exists in the build dir
if [ -e "$SRC/$file" ]; then
mkdir -p "$DST/$(dirname "$file")"
cp -a "$SRC/$file" "$DST/$file"
fi
done
rm "$IGNORE_TEMP"
# Copy metadata
cp "$PWD/zomp.meta" "$DST/"
cp "$PWD/Emakefile" "$DST/"
# copy generated schema
SCHEMA="$SRC/priv/gmhc_schema.json"
if [ -e "$SCHEMA" ]; then
mkdir -p "$DST/priv"
cp -a "$SCHEMA" "$DST/priv/$(basename "$SCHEMA")"
fi
# Clean up beam files just in case
[ -d "$DST/ebin" ] && find "$DST/ebin" -name '*.beam' -exec rm -f {} + || true