Add the brotli compressor for bsdiff
Add a new compressor interface; and the brotli compressor which is
similar to the existing bz2 one.
Also add a new CompressorType argument to PatchWriter's init function;
this allows us to choose the right compressor based on the input option
in the future.
Bug: 34220646
Test: Run bsdiff/bspatch with brotli compressor/decompressor over a
list of files from angler's system image. Make succeeds.
Change-Id: Id9a3db2d7d051dcb751a1fc362f4c3b9226e878b
diff --git a/Makefile b/Makefile
index 8ab9284..b76e3cb 100644
--- a/Makefile
+++ b/Makefile
@@ -33,8 +33,11 @@
### List of source files for each project. Keep in sync with the Android.mk.
# "bsdiff" program.
bsdiff_src_files := \
+ brotli_compressor.cc \
bsdiff.cc \
bz2_compressor.cc \
+ compressor_buffer.cc \
+ compressor_interface.cc \
diff_encoder.cc \
patch_writer.cc \
patch_writer_factory.cc \
@@ -56,6 +59,7 @@
# Unit test files.
bsdiff_common_unittests := \
+ brotli_compressor_unittest.cc \
bsdiff_unittest.cc \
bspatch_unittest.cc \
diff_encoder_unittest.cc \
@@ -69,10 +73,10 @@
testrunner.cc
-BSDIFF_LIBS := -lbz2 -ldivsufsort -ldivsufsort64
+BSDIFF_LIBS := -lbz2 -lbrotlienc -ldivsufsort -ldivsufsort64
BSDIFF_OBJS := $(bsdiff_src_files:.cc=.o)
-BSPATCH_LIBS := -lbz2
+BSPATCH_LIBS := -lbz2 -lbrotlidec
BSPATCH_OBJS := $(bspatch_src_files:.cc=.o)
UNITTEST_LIBS = -lgmock -lgtest -lpthread