Skip to content

Commit

Permalink
Merge pull request #83 from sisong/CI
Browse files Browse the repository at this point in the history
optimize diff speed
  • Loading branch information
sisong committed Nov 1, 2022
2 parents 474cbb8 + 64d01d6 commit a4dfa55
Show file tree
Hide file tree
Showing 38 changed files with 965 additions and 151 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: ci
on: [push, pull_request]
jobs:
make-build:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- name: makeAll
run: |
git submodule update --init --recursive
make -j
clang-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: installClang
run: |
sudo apt-get install -y llvm clang
- name: makeByClang
run: |
git submodule update --init --recursive
make CL=1 -j
xcode-build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: buildByXcode
run: |
git submodule update --init --recursive
xcodebuild -workspace builds/xcode/ApkDiffPatch.xcworkspace -scheme ApkNormalized -configuration Release OBJROOT=$PWD/bin SYMROOT=$PWD/bin
xcodebuild -workspace builds/xcode/ApkDiffPatch.xcworkspace -scheme ZipDiff -configuration Release OBJROOT=$PWD/bin SYMROOT=$PWD/bin
xcodebuild -workspace builds/xcode/ApkDiffPatch.xcworkspace -scheme ZipPatch -configuration Release OBJROOT=$PWD/bin SYMROOT=$PWD/bin
ndk-build:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: nttld/[email protected]
with:
ndk-version: r16b
- name: buildByAndroidNDK
run: |
git submodule update --init --recursive
cd ./builds/android_ndk_jni_mk
ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk NDK_APPLICATION_MK=./Application.mk
vc-build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: microsoft/[email protected]
with:
msbuild-architecture: x64
- name: buildByVC
run: |
git submodule update --init --recursive
msbuild builds/vc2019/ApkDiffPatch.sln -t:rebuild -verbosity:diag -property:Configuration=Release
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ xcshareddata
*.sdf
*.ipch
xcuserdata/
builds/vc2019/Release/
builds/vc2019/x64/
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion HDiffPatch
Submodule HDiffPatch updated 111 files
43 changes: 38 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# args
STATIC_CPP := 0
# used clang?
CL := 0
# build with -m32?
M32 := 0
# build for out min size
MINS := 0

ZLIB_OBJ := \
zlib1.2.11/adler32.o \
zlib1.2.11/compress.o \
Expand Down Expand Up @@ -36,7 +45,9 @@ ZIPDIFF_OBJ := \
src/diff/DiffData.o \
src/diff/Differ.o \
src/diff/OldRef.o \
HDiffPatch/libHDiffPatch/HPatchLite/hpatch_lite.o \
HDiffPatch/libHDiffPatch/HDiff/diff.o \
HDiffPatch/libHDiffPatch/HDiff/match_block.o \
HDiffPatch/libHDiffPatch/HDiff/private_diff/bytes_rle.o \
HDiffPatch/libHDiffPatch/HDiff/private_diff/suffix_string.o \
HDiffPatch/libHDiffPatch/HDiff/private_diff/compress_detect.o \
Expand All @@ -49,24 +60,46 @@ ZIPDIFF_OBJ := \
lzma/C/LzmaEnc.o \
lzma/C/LzFind.o \
lzma/C/LzFindMt.o \
lzma/C/LzFindOpt.o \
lzma/C/CpuArch.o \
lzma/C/MtCoder.o \
lzma/C/MtDec.o \
lzma/C/Threads.o \
$(ZIPPATCH_OBJ)

CFLAGS += -O2 -DNDEBUG -D_IS_USED_PTHREAD=1
CXXFLAGS += -O2 -DNDEBUG -D_IS_USED_PTHREAD=1
DEF_FLAGS := -O3 -DNDEBUG -D_IS_USED_MULTITHREAD=1 -D_IS_USED_PTHREAD=1
CFLAGS += $(DEF_FLAGS)
CXXFLAGS += $(DEF_FLAGS) -std=c++11

LINK_LIB := -lpthread # link pthread
ifeq ($(M32),0)
else
LINK_LIB += -m32
endif
ifeq ($(MINS),0)
else
LINK_LIB += -Wl,--gc-sections,--as-needed
endif
ifeq ($(CL),1)
CXX := clang++
CC := clang
endif
ifeq ($(STATIC_CPP),0)
LINK_LIB += -lstdc++
else
LINK_LIB += -static-libstdc++
endif

.PHONY: all clean

all: ApkNormalized ZipDiff ZipPatch

ApkNormalized: $(APKNORM_OBJ)
$(CXX) $(APKNORM_OBJ) -lpthread -o ApkNormalized
$(CXX) $(APKNORM_OBJ) $(LINK_LIB) -o ApkNormalized
ZipDiff: $(ZIPDIFF_OBJ)
$(CXX) $(ZIPDIFF_OBJ) -lpthread -o ZipDiff
$(CXX) $(ZIPDIFF_OBJ) $(LINK_LIB) -o ZipDiff
ZipPatch: src/zip_patch.o $(ZIPPATCH_OBJ)
$(CXX) src/zip_patch.o $(ZIPPATCH_OBJ) -lpthread -o ZipPatch
$(CXX) src/zip_patch.o $(ZIPPATCH_OBJ) $(LINK_LIB) -o ZipPatch

clean:
-rm -f ApkNormalized ZipDiff ZipPatch src/zip_patch.o $(ZIPDIFF_OBJ) $(APKNORM_OBJ)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# [ApkDiffPatch]
[![release](https://img.shields.io/badge/release-v1.4.1-blue.svg)](https://github.com/sisong/ApkDiffPatch/releases)
[![release](https://img.shields.io/badge/release-v1.5.0-blue.svg)](https://github.com/sisong/ApkDiffPatch/releases)
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/sisong/ApkDiffPatch/blob/master/LICENSE)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-blue.svg)](https://github.com/sisong/ApkDiffPatch/pulls)
[![+issue Welcome](https://img.shields.io/github/issues-raw/sisong/ApkDiffPatch?color=green&label=%2Bissue%20welcome)](https://github.com/sisong/ApkDiffPatch/issues)

[![Build Status](https://travis-ci.org/sisong/ApkDiffPatch.svg?branch=master)](https://travis-ci.org/sisong/ApkDiffPatch)
[![Build Status](https://github.com/sisong/ApkDiffPatch/workflows/ci/badge.svg?branch=master)](https://github.com/sisong/ApkDiffPatch/actions?query=workflow%3Aci+branch%3Amaster)
[![Build status](https://ci.appveyor.com/api/projects/status/u5tbrqwl72875r6h/branch/master?svg=true)](https://ci.appveyor.com/project/sisong/apkdiffpatch/branch/master)

a C++ library and command-line tools for Zip(Jar,Apk) file Diff & Patch; create minimal delta/differential; support [Jar sign](Apk v1 sign) & [Apk v2 sign] & [Apk v3 sign] .
Expand Down
10 changes: 6 additions & 4 deletions builds/android_ndk_jni_mk/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ Src_Files := $(LOCAL_PATH)/apk_patch_jni.cpp \

LOCAL_SRC_FILES := $(Src_Files) $(Lzma_Files) $(Zlib_Files) $(Hdp_Files) $(Adp_Files)

DEF_FLAGS := -O2 -D_7ZIP_ST -D_IS_USED_MULTITHREAD=1 -D_IS_USED_PTHREAD=1
LOCAL_LDLIBS := -llog
LOCAL_CFLAGS := -Os -DANDROID_NDK -DNDEBUG -D_IS_USED_MULTITHREAD=1 -D_IS_USED_PTHREAD=1 -D_IS_NEED_CACHE_OLD_BY_COVERS=0
ifneq ($(TARGET_ARCH_ABI),armeabi)
LOCAL_CFLAGS += -DUNALIGNED_OK
endif
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
DEF_FLAGS += -D_LZMA_DEC_OPT
LOCAL_CFLAGS += -D_LZMA_DEC_OPT
endif

LOCAL_LDLIBS := -llog -landroid
LOCAL_CFLAGS := -DANDROID_NDK $(DEF_FLAGS)
include $(BUILD_SHARED_LIBRARY)

11 changes: 9 additions & 2 deletions builds/android_ndk_jni_mk/Android_DEBUG.mk
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,15 @@ ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
DEF_FLAGS += -D_LZMA_DEC_OPT
endif

LOCAL_LDLIBS := -llog -landroid
LOCAL_CFLAGS := -DANDROID_NDK $(DEF_FLAGS)
LOCAL_LDLIBS := -llog
LOCAL_CFLAGS := -Os -DANDROID_NDK -DNDEBUG -D_IS_USED_MULTITHREAD=1 -D_IS_USED_PTHREAD=1 -D_IS_NEED_CACHE_OLD_BY_COVERS=0
ifneq ($(TARGET_ARCH_ABI),armeabi)
LOCAL_CFLAGS += -DUNALIGNED_OK
endif
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
LOCAL_CFLAGS += -D_LZMA_DEC_OPT
endif

LOCAL_SANITIZE := address
include $(BUILD_SHARED_LIBRARY)

8 changes: 0 additions & 8 deletions builds/android_ndk_jni_mk/Application_symbol.mk

This file was deleted.

18 changes: 12 additions & 6 deletions builds/codeblocks/ZipDiff.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,11 @@
<Option compilerVar="CC" />
</Unit>
<Unit filename="../../HDiffPatch/libHDiffPatch/HDiff/diff.cpp" />
<Unit filename="../../HDiffPatch/libHDiffPatch/HDiff/match_block.cpp" />
<Unit filename="../../HDiffPatch/libHDiffPatch/HDiff/private_diff/bytes_rle.cpp" />
<Unit filename="../../HDiffPatch/libHDiffPatch/HDiff/private_diff/compress_detect.cpp" />
<Unit filename="../../HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../../HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort64.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../../HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.cpp" />
<Unit filename="../../HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort64.cpp" />
<Unit filename="../../HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/adler_roll.c">
<Option compilerVar="CC" />
</Unit>
Expand All @@ -72,17 +69,26 @@
<Unit filename="../../HDiffPatch/libHDiffPatch/HPatch/patch.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../../HDiffPatch/libHDiffPatch/HPatchLite/hpatch_lite.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../../HDiffPatch/libParallel/parallel_channel.cpp" />
<Unit filename="../../HDiffPatch/libParallel/parallel_import.cpp" />
<Unit filename="../../lzma/C/Alloc.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../../lzma/C/CpuArch.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../../lzma/C/LzFind.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../../lzma/C/LzFindMt.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../../lzma/C/LzFindOpt.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../../lzma/C/Lzma2Dec.c">
<Option compilerVar="CC" />
</Unit>
Expand Down
1 change: 0 additions & 1 deletion builds/codeblocks/ZipPatch.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
<Linker>
<Add library="pthread" />
</Linker>
<Unit filename="../../HDiffPatch/compress_parallel.cpp" />
<Unit filename="../../HDiffPatch/file_for_patch.c">
<Option compilerVar="CC" />
</Unit>
Expand Down
4 changes: 2 additions & 2 deletions builds/vc/ApkDiffPatch.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ApkNormalized", "ApkNormalized.vcxproj", "{B7BA5C32-5DC9-431D-BFD7-35ED679CD797}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZipPatch", "ZipPatch.vcxproj", "{69753A53-0320-4AF9-ADE7-A70F0C38358F}"
Expand Down
8 changes: 8 additions & 0 deletions builds/vc/ApkNormalized.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,30 @@
<UseDebugLibraries>true</UseDebugLibraries>
<CLRSupport>false</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CLRSupport>false</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CLRSupport>false</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CLRSupport>false</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand All @@ -89,17 +93,21 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IntDir>$(Configuration)\obj\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IntDir>$(Platform)\$(Configuration)\obj\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<IntDir>$(Configuration)\obj\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<IntDir>$(Platform)\$(Configuration)\obj\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
Expand Down
Loading

0 comments on commit a4dfa55

Please sign in to comment.