Skip to content

Commit cb0d7ae

Browse files
committed
replace lib names
1 parent db628c5 commit cb0d7ae

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

library/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ afterEvaluate {
2424
from components.java
2525
groupId = 'com.mcal'
2626
artifactId = 'nmmp'
27-
version = "1.2.1"
27+
version = "1.2.2"
2828
}
2929
}
3030
}

library/src/main/java/com/nmmedit/apkprotect/ApkProtect.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ private static void writeApkVerifierFile(String packageName, File source, ApkVer
199199
}
200200
}
201201

202-
public static void writeCmakeFile(File cmakeTemp, String libName) throws IOException {
202+
public static void writeCmakeFile(File cmakeTemp, String libNmmpName, String libVmName) throws IOException {
203203
final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(
204204
new FileInputStream(cmakeTemp), StandardCharsets.UTF_8));
205205

@@ -208,7 +208,10 @@ public static void writeCmakeFile(File cmakeTemp, String libName) throws IOExcep
208208
String libNameFormat = "set\\(LIBNAME_PLACEHOLDER \"%s\"\\)";
209209

210210
//替换原本libname
211-
lines = lines.replaceAll(String.format(libNameFormat, "nmmp"), String.format(libNameFormat, libName));
211+
lines = lines.replaceAll(String.format(libNameFormat, "nmmp"), String.format(libNameFormat, libNmmpName));
212+
213+
libNameFormat = "set\\(LIBNMMVM_NAME \"nmmvm\" CACHE INTERNAL \"lib nmmvm name\"\\)";
214+
lines = lines.replaceAll(String.format(libNameFormat, "nmmvm"), String.format(libNameFormat, libVmName));
212215

213216
try (FileWriter fileWriter = new FileWriter(cmakeTemp)) {
214217
fileWriter.write(lines);
@@ -556,7 +559,7 @@ private void generateCSources(String packageName) throws IOException {
556559
writeApkVerifierFile(packageName, source, apkVerifyCodeGenerator);
557560
} else if (source.getName().equals("CMakeLists.txt")) {
558561
//处理cmake里配置的本地库名
559-
writeCmakeFile(source, Prefs.getVmName());
562+
writeCmakeFile(source, Prefs.getNmmpName(), Prefs.getVmName());
560563
}
561564
}
562565
}

0 commit comments

Comments
 (0)