Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: "ubuntu-24.04"
strategy:
matrix:
otp: ["25", "26", "27"]
otp: ["25", "26", "27", "28"]

steps:
# Setup
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.7.4] - Unreleased

- Add support for OTP-28

## [0.7.3] (2024.06.06)

Expand Down
32 changes: 19 additions & 13 deletions src/packbeam_api.erl
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ filter_modules(Modules, ParsedFiles) ->
%% @private
parse_file(beam, _ModuleName, Data, IncludeLines) ->
{ok, Module, Chunks} = beam_lib:all_chunks(Data),
{UncompressedChunks, UncompressedLiterals} = uncompress_literals(Chunks),
{UncompressedChunks, UncompressedLiterals} = maybe_uncompress_literals(Chunks),
FilteredChunks = filter_chunks(UncompressedChunks, IncludeLines),
{ok, Binary} = beam_lib:build_module(FilteredChunks),
{ok, {Module, ChunkRefs}} = beam_lib:chunks(Data, [imports, exports, atoms]),
Expand Down Expand Up @@ -707,23 +707,29 @@ strip_padding(Data) ->
Data.

%% @private
uncompress_literals(Chunks) ->
maybe_uncompress_literals(Chunks) ->
case proplists:get_value("LitT", Chunks) of
undefined ->
{Chunks, undefined};
<<_Header:4/binary, Data/binary>> ->
UncompressedData = zlib:uncompress(Data),
{
lists:keyreplace(
"LitT",
1,
Chunks,
{"LitU", UncompressedData}
),
UncompressedData
}
<<0:32, Data/binary>> ->
{Chunks, Data};
<<_Size:4/binary, Data/binary>> ->
do_uncompress_literals(Chunks, Data)
end.

%% @private
do_uncompress_literals(Chunks, Data) ->
UncompressedData = zlib:uncompress(Data),
{
lists:keyreplace(
"LitT",
1,
Chunks,
{"LitU", UncompressedData}
),
UncompressedData
}.

%% @private
write_packbeam(OutputFilePath, ParsedFiles) ->
PackedData =
Expand Down