@@ -27,6 +27,7 @@ getJarToDexShellFilePath() {
2727 local resourcesDirPath=$( getResourcesDirPath)
2828 echo " ${resourcesDirPath} $( getFileSeparator) dex2jar-2.4$( getFileSeparator) d2j-jar2dex.sh"
2929}
30+
3031getJadxShellFilePath () {
3132 local resourcesDirPath=$( getResourcesDirPath)
3233 local fileSeparator=$( getFileSeparator)
@@ -35,12 +36,13 @@ getJadxShellFilePath() {
3536
3637 local outputPrint
3738 local exitCode
39+ local actualSha256
3840 if [[ ! -d " ${jadxDirPath} " ]]; then
39- zipFileName=" jadx-${jadxVersion} .zip"
40- decompressedDirPath=" ${resourcesDirPath}${fileSeparator} jadx-${jadxVersion} "
41- zipUrl=" https://github.com/skylot/jadx/releases/download/v${jadxVersion} /${zipFileName} "
42- zipFilePath=" ${resourcesDirPath}${fileSeparator}${zipFileName} "
43- expectedSha256=" 8280f3799c0273fe797a2bcd90258c943e451fd195f13d05400de5e6451d15ec"
41+ local zipFileName=" jadx-${jadxVersion} .zip"
42+ local decompressedDirPath=" ${resourcesDirPath}${fileSeparator} jadx-${jadxVersion} "
43+ local zipUrl=" https://github.com/skylot/jadx/releases/download/v${jadxVersion} /${zipFileName} "
44+ local zipFilePath=" ${resourcesDirPath}${fileSeparator}${zipFileName} "
45+ local expectedSha256=" 8280f3799c0273fe797a2bcd90258c943e451fd195f13d05400de5e6451d15ec"
4446 if [[ -f " ${zipFilePath} " ]]; then
4547 actualSha256=$( getFileSha256 " ${zipFilePath} " )
4648 if [[ " ${actualSha256} " != " ${expectedSha256} " ]]; then
@@ -51,32 +53,32 @@ getJadxShellFilePath() {
5153 outputPrint=" $( unzip -q -o " ${zipFilePath} " -d " ${decompressedDirPath} " 2>&1 ) "
5254 exitCode=$?
5355 if (( exitCode != 0 )) ; then
54- echo " ❌ ${zipFileName} 解压失败,原因如下:"
55- echo " ${outputPrint} "
56+ echo " ❌ ${zipFileName} 解压失败,原因如下:" >&2
57+ echo " ${outputPrint} " >&2
5658 kill -SIGTERM $$
5759 exit 1
5860 fi
5961 else
60- echo " ⏳ 检测到本地还未下载 jadx,开始下载 ${zipFileName} 文件,体积较大请耐心等待..."
62+ echo " ⏳ 检测到本地还未下载 jadx,开始下载 ${zipFileName} 文件,体积较大请耐心等待..." >&2
6163 curl -L --progress-bar -o " ${zipFilePath} " " ${zipUrl} "
6264 exitCode=$?
6365 if (( exitCode != 0 )) ; then
64- echo " ❌ ${zipFileName} 下载失败,请检查网络或稍后重试"
66+ echo " ❌ ${zipFileName} 下载失败,请检查网络或稍后重试" >&2
6567 kill -SIGTERM $$
6668 exit 1
6769 fi
6870 actualSha256=$( getFileSha256 " ${zipFilePath} " )
6971 if [[ " ${actualSha256} " != " ${expectedSha256} " ]]; then
7072 rm -f " ${zipFilePath} "
71- echo " ❌ ${zipFileName} 文件校验失败,期望值:${expectedSha256} ,实际值:${actualSha256} "
73+ echo " ❌ ${zipFileName} 文件校验失败,期望值:${expectedSha256} ,实际值:${actualSha256} " >&2
7274 kill -SIGTERM $$
7375 exit 1
7476 fi
7577 outputPrint=" $( unzip -q -o " ${zipFilePath} " -d " ${decompressedDirPath} " 2>&1 ) "
7678 exitCode=$?
7779 if (( exitCode != 0 )) ; then
78- echo " ❌ ${zipFileName} 解压失败,原因如下:"
79- echo " ${outputPrint} "
80+ echo " ❌ ${zipFileName} 解压失败,原因如下:" >&2
81+ echo " ${outputPrint} " >&2
8082 kill -SIGTERM $$
8183 exit 1
8284 fi
@@ -89,7 +91,7 @@ getJadxShellFilePath() {
8991 if [[ ! -x " ${jadxGuiShellFilePath} " ]]; then
9092 chmod +x " ${jadxGuiShellFilePath} "
9193 fi
92- jadxShellFilePath=" ${jadxDirPath}${fileSeparator} bin${fileSeparator} jadx"
94+ local jadxShellFilePath=" ${jadxDirPath}${fileSeparator} bin${fileSeparator} jadx"
9395 if [[ ! -x " ${jadxShellFilePath} " ]]; then
9496 chmod +x " ${jadxShellFilePath} "
9597 fi
@@ -150,4 +152,40 @@ getDiffuserJarFilePath() {
150152getJdGuiJarFilePath () {
151153 local resourcesDirPath=$( getResourcesDirPath)
152154 echo " ${resourcesDirPath} $( getFileSeparator) jd-gui-1.6.6.jar"
155+ }
156+
157+ getBundletoolJarFilePath () {
158+ local resourcesDirPath
159+ resourcesDirPath=$( getResourcesDirPath)
160+ local fileSeparator
161+ fileSeparator=$( getFileSeparator)
162+ local version=" 1.18.3"
163+ local jarFilePath=" ${resourcesDirPath}${fileSeparator} bundletool-${version} .jar"
164+ local expectedSha256=" a099cfa1543f55593bc2ed16a70a7c67fe54b1747bb7301f37fdfd6d91028e29"
165+ local actualSha256
166+ if [[ -f " ${jarFilePath} " ]]; then
167+ actualSha256=$( getFileSha256 " ${jarFilePath} " )
168+ if [[ " ${actualSha256} " == " ${expectedSha256} " ]]; then
169+ echo " ${jarFilePath} "
170+ return
171+ fi
172+ rm -f " ${jarFilePath} "
173+ fi
174+ local url=" https://github.com/google/bundletool/releases/download/${version} /bundletool-all-${version} .jar"
175+ echo " ⏳ 检测到本地还未下载 bundletool,开始下载 bundletool-all-${version} .jar,体积较大请耐心等待..." >&2
176+ curl -L --progress-bar -o " ${jarFilePath} " " ${url} "
177+ local exitCode=$?
178+ if (( exitCode != 0 )) ; then
179+ echo " ❌ bundletool-all-${version} .jar 下载失败,请检查网络或稍后重试" >&2
180+ kill -SIGTERM $$
181+ exit 1
182+ fi
183+ actualSha256=$( getFileSha256 " ${jarFilePath} " )
184+ if [[ " ${actualSha256} " != " ${expectedSha256} " ]]; then
185+ rm -f " ${jarFilePath} "
186+ echo " ❌ bundletool-all-${version} .jar 文件校验失败,期望值:${expectedSha256} ,实际值:${actualSha256} " >&2
187+ kill -SIGTERM $$
188+ exit 1
189+ fi
190+ echo " ${jarFilePath} "
153191}
0 commit comments