File tree Expand file tree Collapse file tree 4 files changed +295
-3
lines changed Expand file tree Collapse file tree 4 files changed +295
-3
lines changed Original file line number Diff line number Diff line change @@ -40,3 +40,6 @@ local.properties
40
40
buck-out /
41
41
\. buckd /
42
42
* .keystore
43
+
44
+ # Other
45
+ vpnJni /* .zip
Original file line number Diff line number Diff line change 18
18
"build-vpn-lib" : " yarn build-ics-ovpn; yarn gen-vpn-lib; yarn patch-vpn-lib" ,
19
19
"build-ics-ovpn" : " sh scripts/build-ics-ovpn.sh" ,
20
20
"gen-vpn-lib" : " sh scripts/gen-vpn-lib.sh" ,
21
- "patch-vpn-lib" : " sh scripts/patch-vpn-lib.sh"
21
+ "patch-vpn-lib" : " sh scripts/patch-vpn-lib.sh" ,
22
+ "zip-vpn-jni" : " node vpnJni/zip-vpn-jni.js"
22
23
},
23
24
"repository" : {
24
25
"type" : " git" ,
38
39
"licenseFilename" : " LICENSE" ,
39
40
"readmeFilename" : " README.md" ,
40
41
"devDependencies" : {
42
+ "archiver" : " ^5.3.0" ,
41
43
"clang-format" : " ^1.4.0" ,
42
44
"prettier" : " ^2.3.2"
43
45
}
Original file line number Diff line number Diff line change
1
+ const fs = require ( 'fs' ) ;
2
+ const archiver = require ( 'archiver' ) ;
3
+
4
+ const jniLibPath = __dirname + '/../vpnLib/src/main/jniLibs' ;
5
+ const jniDirList = fs . readdirSync ( jniLibPath ) ;
6
+
7
+ jniDirList . forEach ( ( item ) => {
8
+ if ( item === '.DS_Store' ) return ;
9
+
10
+ const output = fs . createWriteStream ( `${ __dirname } /${ item } .zip` ) ;
11
+ const archive = archiver ( 'zip' , {
12
+ zlib : { level : 9 } ,
13
+ } ) ;
14
+
15
+ output . on ( 'close' , ( ) => {
16
+ const compressedSize = ( archive . pointer ( ) / 1024 / 1024 ) . toFixed ( 2 ) ;
17
+ console . log ( `Finish compressing [${ item } ] - ${ compressedSize } MB` ) ;
18
+ } ) ;
19
+
20
+ output . on ( 'end' , ( ) => {
21
+ console . log ( 'Data has been drained' ) ;
22
+ } ) ;
23
+
24
+ archive . on ( 'warning' , ( err ) => {
25
+ if ( err . code === 'ENOENT' ) {
26
+ console . log ( 'Warning ' + err ) ;
27
+ } else {
28
+ throw err ;
29
+ }
30
+ } ) ;
31
+
32
+ archive . on ( 'error' , ( err ) => {
33
+ throw err ;
34
+ } ) ;
35
+
36
+ archive . pipe ( output ) ;
37
+ archive . directory ( `${ jniLibPath } /${ item } /` , false ) ;
38
+ archive . finalize ( ) ;
39
+ } ) ;
You can’t perform that action at this time.
0 commit comments