@bravemobile/react-native-code-push 13.0.0 → 13.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CodePush.podspec +35 -3
- package/README.md +115 -3
- package/THIRD-PARTY-NOTICES +96 -0
- package/android/app/build.gradle +19 -0
- package/android/app/proguard-rules.pro +5 -0
- package/android/app/src/main/cpp/CMakeLists.txt +38 -0
- package/android/app/src/main/cpp/binarypatch_jni.c +181 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/BinaryPatchAttempt.java +92 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/BinaryPatchResult.java +64 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java +1 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushBinaryPatch.java +293 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushConstants.java +25 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +12 -2
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateManager.java +159 -4
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java +13 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/HDiffPatchNative.java +52 -0
- package/android/app/src/test/java/com/microsoft/codepush/react/CodePushBinaryPatchTest.java +393 -0
- package/android/app/src/test/java/com/microsoft/codepush/react/CodePushUpdateManagerBinaryPatchTest.java +207 -0
- package/android/app/src/test/java/com/microsoft/codepush/react/CodePushUpdateManagerDownloadTest.java +449 -0
- package/android/codepush-export.gradle +115 -0
- package/cli/commands/bundleCommand/bundleCodePush.ts +39 -7
- package/cli/commands/bundleCommand/index.ts +9 -1
- package/cli/commands/releaseCommand/addToReleaseHistory.ts +7 -0
- package/cli/commands/releaseCommand/index.test.ts +118 -0
- package/cli/commands/releaseCommand/index.ts +20 -2
- package/cli/commands/releaseCommand/release.test.ts +582 -0
- package/cli/commands/releaseCommand/release.ts +232 -15
- package/cli/dist/commands/bundleCommand/bundleCodePush.js +26 -7
- package/cli/dist/commands/bundleCommand/index.js +5 -1
- package/cli/dist/commands/releaseCommand/addToReleaseHistory.js +6 -1
- package/cli/dist/commands/releaseCommand/index.js +8 -1
- package/cli/dist/commands/releaseCommand/index.test.js +96 -0
- package/cli/dist/commands/releaseCommand/release.js +165 -17
- package/cli/dist/commands/releaseCommand/release.test.js +367 -0
- package/cli/dist/functions/makeBinaryPatchBundle.js +248 -0
- package/cli/dist/functions/makeBinaryPatchBundle.test.js +321 -0
- package/cli/dist/functions/makeCodePushBundle.js +4 -2
- package/cli/dist/functions/runHermesEmitBinaryCommand.js +48 -1
- package/cli/dist/functions/runHermesEmitBinaryCommand.test.js +100 -0
- package/cli/dist/jest.globalSetup.js +38 -0
- package/cli/dist/utils/binaryPatch.js +86 -0
- package/cli/dist/utils/binaryPatch.test.js +190 -0
- package/cli/functions/makeBinaryPatchBundle.test.ts +410 -0
- package/cli/functions/makeBinaryPatchBundle.ts +367 -0
- package/cli/functions/makeCodePushBundle.ts +4 -2
- package/cli/functions/runHermesEmitBinaryCommand.test.ts +124 -0
- package/cli/functions/runHermesEmitBinaryCommand.ts +57 -1
- package/cli/jest.globalSetup.ts +43 -0
- package/cli/utils/binaryPatch.test.ts +234 -0
- package/cli/utils/binaryPatch.ts +103 -0
- package/cpp/binarypatch/binarypatch_zstd_decompressor.c +187 -0
- package/cpp/binarypatch/binarypatch_zstd_decompressor.h +47 -0
- package/cpp/binarypatch/vendor/HDiffPatch/libHDiffPatch/HPatch/checksum_plugin.h +52 -0
- package/cpp/binarypatch/vendor/HDiffPatch/libHDiffPatch/HPatch/hpatch_mt/hpatch_mt.h +147 -0
- package/cpp/binarypatch/vendor/HDiffPatch/libHDiffPatch/HPatch/patch.c +3315 -0
- package/cpp/binarypatch/vendor/HDiffPatch/libHDiffPatch/HPatch/patch.h +268 -0
- package/cpp/binarypatch/vendor/HDiffPatch/libHDiffPatch/HPatch/patch_private.h +297 -0
- package/cpp/binarypatch/vendor/HDiffPatch/libHDiffPatch/HPatch/patch_types.h +434 -0
- package/cpp/binarypatch/vendor/zstd/common/allocations.h +55 -0
- package/cpp/binarypatch/vendor/zstd/common/bits.h +205 -0
- package/cpp/binarypatch/vendor/zstd/common/bitstream.h +454 -0
- package/cpp/binarypatch/vendor/zstd/common/compiler.h +464 -0
- package/cpp/binarypatch/vendor/zstd/common/cpu.h +249 -0
- package/cpp/binarypatch/vendor/zstd/common/debug.c +30 -0
- package/cpp/binarypatch/vendor/zstd/common/debug.h +107 -0
- package/cpp/binarypatch/vendor/zstd/common/entropy_common.c +340 -0
- package/cpp/binarypatch/vendor/zstd/common/error_private.c +64 -0
- package/cpp/binarypatch/vendor/zstd/common/error_private.h +158 -0
- package/cpp/binarypatch/vendor/zstd/common/fse.h +625 -0
- package/cpp/binarypatch/vendor/zstd/common/fse_decompress.c +315 -0
- package/cpp/binarypatch/vendor/zstd/common/huf.h +277 -0
- package/cpp/binarypatch/vendor/zstd/common/mem.h +422 -0
- package/cpp/binarypatch/vendor/zstd/common/pool.c +371 -0
- package/cpp/binarypatch/vendor/zstd/common/pool.h +81 -0
- package/cpp/binarypatch/vendor/zstd/common/portability_macros.h +171 -0
- package/cpp/binarypatch/vendor/zstd/common/threading.c +182 -0
- package/cpp/binarypatch/vendor/zstd/common/threading.h +142 -0
- package/cpp/binarypatch/vendor/zstd/common/xxhash.c +18 -0
- package/cpp/binarypatch/vendor/zstd/common/xxhash.h +7094 -0
- package/cpp/binarypatch/vendor/zstd/common/zstd_common.c +48 -0
- package/cpp/binarypatch/vendor/zstd/common/zstd_deps.h +123 -0
- package/cpp/binarypatch/vendor/zstd/common/zstd_internal.h +324 -0
- package/cpp/binarypatch/vendor/zstd/common/zstd_trace.h +156 -0
- package/cpp/binarypatch/vendor/zstd/decompress/huf_decompress.c +1944 -0
- package/cpp/binarypatch/vendor/zstd/decompress/zstd_ddict.c +244 -0
- package/cpp/binarypatch/vendor/zstd/decompress/zstd_ddict.h +44 -0
- package/cpp/binarypatch/vendor/zstd/decompress/zstd_decompress.c +2410 -0
- package/cpp/binarypatch/vendor/zstd/decompress/zstd_decompress_block.c +2209 -0
- package/cpp/binarypatch/vendor/zstd/decompress/zstd_decompress_block.h +73 -0
- package/cpp/binarypatch/vendor/zstd/decompress/zstd_decompress_internal.h +240 -0
- package/cpp/binarypatch/vendor/zstd/zstd.h +3206 -0
- package/cpp/binarypatch/vendor/zstd/zstd_errors.h +107 -0
- package/ios/CodePush/CodePush.h +18 -1
- package/ios/CodePush/CodePush.mm +16 -1
- package/ios/CodePush/CodePushBinaryPatch.h +80 -0
- package/ios/CodePush/CodePushBinaryPatch.m +473 -0
- package/ios/CodePush/CodePushPackage.m +183 -2
- package/ios/CodePush/CodePushUpdateUtils.m +49 -1
- package/package.json +10 -3
- package/scripts/binary-patch/build-hdiffpatch.sh +86 -0
- package/scripts/export-embedded-bundle.sh +76 -0
- package/src/CodePush.js +46 -3
- package/src/CodePush.test.js +382 -0
- package/src/package-mixins.js +20 -2
- package/typings/react-native-code-push.d.ts +77 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// hpatch_mt.h
|
|
2
|
+
// hpatch
|
|
3
|
+
/*
|
|
4
|
+
The MIT License (MIT)
|
|
5
|
+
Copyright (c) 2025 HouSisong
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person
|
|
8
|
+
obtaining a copy of this software and associated documentation
|
|
9
|
+
files (the "Software"), to deal in the Software without
|
|
10
|
+
restriction, including without limitation the rights to use,
|
|
11
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the
|
|
13
|
+
Software is furnished to do so, subject to the following
|
|
14
|
+
conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be
|
|
17
|
+
included in all copies of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
20
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
21
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
22
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
23
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
24
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
25
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
26
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
27
|
+
*/
|
|
28
|
+
#ifndef hpatch_mt_h
|
|
29
|
+
#define hpatch_mt_h
|
|
30
|
+
#include "../patch_types.h"
|
|
31
|
+
#ifdef __cplusplus
|
|
32
|
+
extern "C" {
|
|
33
|
+
#endif
|
|
34
|
+
|
|
35
|
+
typedef struct{
|
|
36
|
+
hpatch_byte writeNew_isMT; //0 or 1; if 1, start a thread for write to newData
|
|
37
|
+
hpatch_byte readOld_isMT; //0 or 1; if 1, start a thread for read from oldData
|
|
38
|
+
hpatch_byte readDiff_isMT; //0 or 1; if 1, start a thread for read from diffData
|
|
39
|
+
hpatch_byte decompressDiff_isMT; //0 or 1; if 1, start a thread for decompress diffData
|
|
40
|
+
//patch func run in main thread
|
|
41
|
+
} hpatchMTSets_t;
|
|
42
|
+
|
|
43
|
+
static const hpatchMTSets_t hpatchMTSets_no ={0,0,0,0};
|
|
44
|
+
static const hpatchMTSets_t hpatchMTSets_full={1,1,1,1};
|
|
45
|
+
static hpatch_force_inline
|
|
46
|
+
size_t _hpatchMTSets_threadNum(const hpatchMTSets_t mtsets){
|
|
47
|
+
return mtsets.writeNew_isMT+mtsets.readOld_isMT+mtsets.readDiff_isMT+mtsets.decompressDiff_isMT+1; }
|
|
48
|
+
|
|
49
|
+
static hpatch_force_inline
|
|
50
|
+
hpatchMTSets_t hpatch_getMTSets(hpatch_StreamPos_t newSize,hpatch_StreamPos_t oldSize,hpatch_StreamPos_t diffSize,
|
|
51
|
+
const hpatch_TDecompress* decompressPlugin,size_t kCacheCount,size_t stepMemSize,
|
|
52
|
+
size_t temp_cacheSumSize,size_t maxThreadNum,hpatchMTSets_t mtsets){
|
|
53
|
+
#if (_IS_USED_MULTITHREAD)
|
|
54
|
+
hpatchMTSets_t _hpatch_getMTSets(hpatch_StreamPos_t newSize,hpatch_StreamPos_t oldSize,hpatch_StreamPos_t diffSize,
|
|
55
|
+
const hpatch_TDecompress* decompressPlugin,size_t kCacheCount,
|
|
56
|
+
hpatch_size_t windowOldBufSize,size_t stepMemSize,
|
|
57
|
+
size_t temp_cacheSumSize,size_t maxThreadNum,hpatchMTSets_t mtsets,hpatch_BOOL isWindow);
|
|
58
|
+
if (maxThreadNum<=1) return hpatchMTSets_no;
|
|
59
|
+
return _hpatch_getMTSets(newSize,oldSize,diffSize,decompressPlugin,kCacheCount,0,stepMemSize,
|
|
60
|
+
temp_cacheSumSize,maxThreadNum,mtsets,hpatch_FALSE);
|
|
61
|
+
#else
|
|
62
|
+
return hpatchMTSets_no;
|
|
63
|
+
#endif
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
#define _kCacheSgCount 3 //patch for singleCompressedDiff need cache count
|
|
68
|
+
hpatch_BOOL _patch_single_stream_mt(sspatch_listener_t* listener,
|
|
69
|
+
const hpatch_TStreamOutput* __out_newData,
|
|
70
|
+
const hpatch_TStreamInput* oldData,
|
|
71
|
+
const hpatch_TStreamInput* singleCompressedDiff,
|
|
72
|
+
hpatch_StreamPos_t diffInfo_pos,
|
|
73
|
+
sspatch_coversListener_t* coversListener,
|
|
74
|
+
size_t maxThreadNum,hpatchMTSets_t hpatchMTSets);
|
|
75
|
+
hpatch_BOOL _patch_single_compressed_diff_mt(const hpatch_TStreamOutput* out_newData,
|
|
76
|
+
const hpatch_TStreamInput* oldData,
|
|
77
|
+
const hpatch_TStreamInput* singleCompressedDiff,
|
|
78
|
+
hpatch_StreamPos_t diffData_pos,
|
|
79
|
+
hpatch_StreamPos_t uncompressedSize,
|
|
80
|
+
hpatch_StreamPos_t compressedSize,
|
|
81
|
+
hpatch_TDecompress* decompressPlugin,
|
|
82
|
+
hpatch_StreamPos_t coverCount,hpatch_size_t stepMemSize,
|
|
83
|
+
unsigned char* temp_cache,unsigned char* temp_cache_end,
|
|
84
|
+
sspatch_coversListener_t* coversListener,
|
|
85
|
+
size_t maxThreadNum,hpatchMTSets_t mtsets);
|
|
86
|
+
|
|
87
|
+
#if (_IS_USED_MULTITHREAD)
|
|
88
|
+
|
|
89
|
+
struct hpatch_mt_manager_t;
|
|
90
|
+
|
|
91
|
+
struct hpatch_mt_manager_t* hpatch_mt_manager_open(const hpatch_TStreamOutput** pout_newData,
|
|
92
|
+
const hpatch_TStreamInput** poldData,
|
|
93
|
+
const hpatch_TStreamInput** psingleCompressedDiff,
|
|
94
|
+
hpatch_StreamPos_t* pdiffData_pos,
|
|
95
|
+
hpatch_StreamPos_t* pdiffData_posEnd,
|
|
96
|
+
hpatch_StreamPos_t uncompressedSize,
|
|
97
|
+
hpatch_TDecompress** pdecompressPlugin,
|
|
98
|
+
size_t stepMemSize,
|
|
99
|
+
unsigned char** ptemp_cache,unsigned char** ptemp_cache_end,
|
|
100
|
+
sspatch_coversListener_t** pcoversListener,
|
|
101
|
+
hpatch_BOOL isOnStepCoversInThread,
|
|
102
|
+
size_t kCacheCount,
|
|
103
|
+
hpatchMTSets_t mtsets);
|
|
104
|
+
|
|
105
|
+
hpatch_BOOL hpatch_mt_manager_close(struct hpatch_mt_manager_t* self,hpatch_BOOL isOnError);
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
struct hpatch_mt_manager_win_t;
|
|
110
|
+
struct hcache_window_old_mt_t;
|
|
111
|
+
|
|
112
|
+
static hpatch_force_inline
|
|
113
|
+
hpatchMTSets_t hpatch_getMTSets_win(hpatch_StreamPos_t newSize,hpatch_StreamPos_t oldSize,hpatch_StreamPos_t diffSize,
|
|
114
|
+
const hpatch_TDecompress* decompressPlugin,size_t kCacheCount,
|
|
115
|
+
hpatch_size_t windowOldBufSize, hpatch_size_t stepMemSize,
|
|
116
|
+
size_t temp_cacheSumSize,size_t maxThreadNum,hpatchMTSets_t mtsets){
|
|
117
|
+
#if (_IS_USED_MULTITHREAD)
|
|
118
|
+
if (maxThreadNum<=1) return hpatchMTSets_no;
|
|
119
|
+
hpatchMTSets_t _hpatch_getMTSets(hpatch_StreamPos_t newSize,hpatch_StreamPos_t oldSize,hpatch_StreamPos_t diffSize,
|
|
120
|
+
const hpatch_TDecompress* decompressPlugin,size_t kCacheCount,
|
|
121
|
+
hpatch_size_t windowOldBufSize,size_t stepMemSize,
|
|
122
|
+
size_t temp_cacheSumSize,size_t maxThreadNum,hpatchMTSets_t mtsets,hpatch_BOOL isWindow);
|
|
123
|
+
return _hpatch_getMTSets(newSize,oldSize,diffSize,decompressPlugin,kCacheCount,windowOldBufSize,stepMemSize,
|
|
124
|
+
temp_cacheSumSize,maxThreadNum,mtsets,hpatch_TRUE);
|
|
125
|
+
#else
|
|
126
|
+
return hpatchMTSets_no;
|
|
127
|
+
#endif
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
struct hpatch_mt_manager_win_t* hpatch_mt_manager_win_open(const hpatch_TStreamOutput** pout_newData,
|
|
131
|
+
const hpatch_TStreamInput** poldData,const hpatch_TStreamInput** pwindowDiffStream,
|
|
132
|
+
hpatch_StreamPos_t* pdiffData_pos, hpatch_StreamPos_t* pdiffData_posEnd,
|
|
133
|
+
hpatch_StreamPos_t uncompressedSize, hpatch_TDecompress** pdecompressPlugin,
|
|
134
|
+
hpatch_StreamPos_t windowCount,hpatch_size_t windowOldBufSize, hpatch_size_t stepMemSize,
|
|
135
|
+
unsigned char** ptemp_cache, unsigned char** ptemp_cache_end,
|
|
136
|
+
size_t kCacheCount, hpatchMTSets_t mtsets);
|
|
137
|
+
|
|
138
|
+
struct hcache_window_old_mt_t* hpatch_mt_manager_win_oldCache(struct hpatch_mt_manager_win_t* self);
|
|
139
|
+
|
|
140
|
+
hpatch_BOOL hpatch_mt_manager_win_close(struct hpatch_mt_manager_win_t* self,hpatch_BOOL isOnError);
|
|
141
|
+
|
|
142
|
+
#endif // _IS_USED_MULTITHREAD
|
|
143
|
+
|
|
144
|
+
#ifdef __cplusplus
|
|
145
|
+
}
|
|
146
|
+
#endif
|
|
147
|
+
#endif //hpatch_mt_h
|