Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing release script #227

Merged
merged 5 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ set(QUIC_TLS_SECRETS_SUPPORT "ON")

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/include/quicer_vsn.hrl.in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the .hrl.in file should not be in include dir, maybe put it in another directory which is not going to be packed into a hex package.

${CMAKE_CURRENT_SOURCE_DIR}/include/quicer_vsn.hrl
${CMAKE_CURRENT_SOURCE_DIR}/priv/quicer_vsn.hrl
)

configure_file(
Expand Down Expand Up @@ -167,7 +167,8 @@ add_dependencies(quicer_static msquic)
set_target_properties(quicer_nif
PROPERTIES
LIBRARY_OUTPUT_NAME quicer_nif
VERSION ${QUICER_ABI_VERSION}-${QUICER_VERSION}
VERSION ${QUICER_VERSION}
SOVERSION ${QUICER_ABI_VERSION}
)
include(GNUInstallDirs)
install(TARGETS quicer_nif LIBRARY DESTINATION ${PROJECT_SOURCE_DIR}/priv/)
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ distclean:
$(REBAR) unlock --all
rm -rf _build erl_crash.dump rebar3.crashdump
rm -rf c_build/*
rm -rf priv/*

.PHONY: xref
xref:
Expand Down
13 changes: 10 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ download() {

echo "$(cat "_packages/${PKGNAME}.sha256") _packages/${PKGNAME}" | sha256sum -c || return 1

gzip -c -d "_packages/${PKGNAME}" > "$TARGET_SO"
erlc -I include src/quicer_nif.erl
tar zxvf "_packages/${PKGNAME}" -C $(dirname "$TARGET_SO")

erlc -I include -I priv src/quicer_nif.erl
if erl -noshell -eval '[_|_]=quicer_nif:module_info(), halt(0).'; then
res=0
else
Expand All @@ -66,7 +67,7 @@ release() {
fi
mkdir -p _packages
TARGET_PKG="_packages/${PKGNAME}"
gzip -c "$TARGET_SO" > "$TARGET_PKG"
tar czvf "$TARGET_PKG" -C $(dirname "$TARGET_SO") --exclude include --exclude share --exclude .gitignore .
# use openssl but not sha256sum command because in some macos env it does not exist
if command -v openssl; then
openssl dgst -sha256 "${TARGET_PKG}" | cut -d ' ' -f 2 > "${TARGET_PKG}.sha256"
Expand All @@ -90,3 +91,9 @@ else
build
fi
fi

## workaround for emqx forked rebar3
if ([ -n $REBAR_DEPS_DIR ] && [ $(realpath -P "${REBAR_DEPS_DIR}/quicer/priv") != "${PWD}/priv" ]);
then
cp -r priv/* "${REBAR_DEPS_DIR}/quicer/priv/"
fi
8 changes: 7 additions & 1 deletion rebar.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{erl_opts, [debug_info]}.
{erl_opts, [ debug_info
, {i, "priv/"} %% for generated quicer_vsn.hrl
]}.

{pre_hooks,
[{"(linux|darwin|solaris)", compile, "make build-nif"}
Expand Down Expand Up @@ -29,6 +31,10 @@
]
}.

{artifacts, [ "priv/quicer_vsn.hrl"
, "priv/libquicer_nif.so"
]}.

{relx, [{release, {quicer, git},
[quicer]},
{dev_mode, true},
Expand Down
4 changes: 0 additions & 4 deletions src/quicer_nif.erl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
-include("quicer.hrl").
-include("quicer_types.hrl").
-include("quicer_vsn.hrl").
-include_lib("snabbkaffe/include/snabbkaffe.hrl").

-spec abi_version() -> integer().
abi_version() ->
Expand Down Expand Up @@ -103,9 +102,6 @@ init(ABIVsn) ->
ok
end;
{error, _Reason} = Res->
%% load fail, but beam will keep using current vsn if presents.
?tp_ignore_side_effects_in_prod(debug,
#{module => ?MODULE, event => init, result => Res}),
Res
end.
-spec open_lib() ->
Expand Down
Loading