refactor(app-packages): 重构 ApkMetaParser 为静态工具类并移除冗余字段
- 移除 ApkMetaParser 内部类 ApkMetaResult,提取为独立类 - 移除 Spring @Component 注解,所有方法改为静态方法 - 删除未使用的 maxSdk 字段及相关解析逻辑 - 移除 AppPackageServiceImpl 中注入的 ApkMetaParser 依赖 - 更新测试用例以适配静态方法调用 - 标记 parseByBundleTool 和 fillBundleIcon 方法为 @Deprecated
This commit is contained in:
1 parent
40fae0bf0d
commit
3db6c17511
5 files changed
+87
-54
No files matched your search
@@ -1,11 +1,11 @@
|
||||
package com.youlai.boot.app.packages.component;
|
||||
|
||||
import com.youlai.boot.common.util.FileUtils;
|
||||
import com.youlai.boot.app.packages.component.ApkMetaResult;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -56,7 +56,7 @@ class ApkMetaParserTest {
|
||||
|
||||
@Test
|
||||
@DisplayName("批量解析本地 apk 文件并打印元数据")
|
||||
void parseLocalApks() throws IOException {
|
||||
void parseLocalApks() {
|
||||
List<String> paths = resolveApkPaths();
|
||||
if (paths.isEmpty()) {
|
||||
System.out.println("===== 跳过测试 =====");
|
||||
@@ -67,7 +67,6 @@ class ApkMetaParserTest {
|
||||
return;
|
||||
}
|
||||
|
||||
ApkMetaParser parser = new ApkMetaParser();
|
||||
int total = paths.size();
|
||||
int success = 0;
|
||||
|
||||
@@ -85,7 +84,7 @@ class ApkMetaParserTest {
|
||||
System.out.println("文件魔数为: " + FileUtils.getMagicBytes(apkFile.getAbsolutePath(), 0, 4));
|
||||
System.out.println("文件类型为: " + new AndroidPackageTypeDetector().detect(apkFile.toPath()));
|
||||
|
||||
ApkMetaParser.ApkMetaResult result = parser.parse(apkFile);
|
||||
ApkMetaResult result = ApkMetaParser.parse(apkFile);
|
||||
assertNotNull(result, "解析结果不应为空");
|
||||
assertNotNull(result.getPackageName(), "包名不应为空");
|
||||
|
||||
@@ -97,7 +96,6 @@ class ApkMetaParserTest {
|
||||
System.out.println("minSdk : " + result.getMinSdk());
|
||||
System.out.println("targetSdk : " + result.getTargetSdk());
|
||||
System.out.println("compileSdk : " + result.getCompileSdk());
|
||||
System.out.println("maxSdk : " + result.getMaxSdk());
|
||||
System.out.println("abiList : " + result.getAbiList());
|
||||
System.out.println("permissions : " + result.getPermissions());
|
||||
System.out.println("iconPath : " + result.getIconPath());
|
||||
|
||||
Reference in new issue
Block a user