Skip to content

Commit

Permalink
support obfuscation #1385 #1397
Browse files Browse the repository at this point in the history
  • Loading branch information
lingol committed Sep 9, 2024
1 parent 47d3c08 commit 934b7fc
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 6 deletions.
2 changes: 1 addition & 1 deletion OpenHarmony/MMKV/BuildProfile.ets
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ export default class BuildProfile {
static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
static readonly DEBUG = DEBUG;
static readonly TARGET_NAME = TARGET_NAME;
}
}
7 changes: 4 additions & 3 deletions OpenHarmony/MMKV/build-profile.json5
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
"arkOptions": {
"obfuscation": {
"ruleOptions": {
"enable": false, // looks like we don't gain much from this
"enable": true,
"files": [
"./obfuscation-rules.txt"
]
}
}
},
"consumerFiles": "./consumer-rules.txt"
},
},
"nativeLib": {
"debugSymbol": {
Expand Down
30 changes: 30 additions & 0 deletions OpenHarmony/MMKV/consumer-rules.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Define project specific obfuscation rules here.
# You can include the obfuscation configuration files in the current module's build-profile.json5.
#
# For more details, see
# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md

# Obfuscation options:
# -disable-obfuscation: disable all obfuscations
# -enable-property-obfuscation: obfuscate the property names
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
# -compact: remove unnecessary blank spaces and all line feeds
# -remove-log: remove all console.* statements
# -print-namecache: print the name cache that contains the mapping from the old names to new names
# -apply-namecache: reuse the given cache file

# Keep options:
# -keep-property-name: specifies property names that you want to keep
# -keep-global-name: specifies names that you want to keep in the global scope

-keep
./src/main/ets/utils/MMKV.ets
./src/main/ets/utils/MMKVLogLevel.ets
./src/main/ets/utils/NativeBuffer.ets
./src/main/ets/utils/Util.ts

-keep-file-name
MMKV
MMKVLogLevel
NativeBuffer
Util
14 changes: 13 additions & 1 deletion OpenHarmony/MMKV/obfuscation-rules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,16 @@

# Keep options:
# -keep-property-name: specifies property names that you want to keep
# -keep-global-name: specifies names that you want to keep in the global scope
# -keep-global-name: specifies names that you want to keep in the global scope

-keep
./src/main/ets/utils/MMKV.ets
./src/main/ets/utils/MMKVLogLevel.ets
./src/main/ets/utils/NativeBuffer.ets
./src/main/ets/utils/Util.ts

-keep-file-name
MMKV
MMKVLogLevel
NativeBuffer
Util
6 changes: 5 additions & 1 deletion OpenHarmony/entry/obfuscation-rules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@

# Keep options:
# -keep-property-name: specifies property names that you want to keep
# -keep-global-name: specifies names that you want to keep in the global scope
# -keep-global-name: specifies names that you want to keep in the global scope
-enable-property-obfuscation
-enable-toplevel-obfuscation
-enable-filename-obfuscation
-enable-export-obfuscation

0 comments on commit 934b7fc

Please sign in to comment.