Skip to content

Commit 49cab9e

Browse files
committed
[tinker] Copy pre-generated patch dex to tempPatchedDexes directory.
1 parent 8883448 commit 49cab9e

File tree

1 file changed

+9
-3
lines changed
  • tinker-build/tinker-patch-lib/src/main/java/com/tencent/tinker/build/decoder

1 file changed

+9
-3
lines changed

tinker-build/tinker-patch-lib/src/main/java/com/tencent/tinker/build/decoder/DexDiffDecoder.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
package com.tencent.tinker.build.decoder;
1818

1919

20+
import com.google.common.io.Files;
21+
2022
import com.tencent.tinker.android.dex.ClassDef;
2123
import com.tencent.tinker.android.dex.Dex;
2224
import com.tencent.tinker.android.dex.DexFormat;
@@ -69,7 +71,7 @@
6971
*/
7072
public class DexDiffDecoder extends BaseDecoder {
7173
private static final String TEST_DEX_NAME = "test.dex";
72-
private static final String STUBMODE_PATCH_DEX_NAME = "changed_classes.dex";
74+
private static final String PREGENERATED_PATCH_DEX_NAME = "changed_classes.dex";
7375

7476
private final InfoWriter logWriter;
7577
private final InfoWriter metaWriter;
@@ -282,14 +284,18 @@ private void generateStubModePatchDex() throws IOException {
282284

283285
// Write constructed stub mode patch dex to file and record it in meta file.
284286
final String dexMode = config.mDexRaw ? "raw" : "jar";
285-
final File dest = new File(config.mTempResultDir + "/" + STUBMODE_PATCH_DEX_NAME);
287+
final File dest = new File(config.mTempResultDir + "/" + PREGENERATED_PATCH_DEX_NAME);
286288

287289
FileDataStore fileDataStore = new FileDataStore(dest);
288290
dexBuilder.writeTo(fileDataStore);
289291

292+
final File tempPreGeneratedPatchDexPath = new File(config.mOutFolder + File.separator + TypedValue.DEX_TEMP_PATCH_DIR + File.separator + "pre-generated");
293+
ensureDirectoryExist(tempPreGeneratedPatchDexPath);
294+
Files.copy(dest, new File(tempPreGeneratedPatchDexPath, PREGENERATED_PATCH_DEX_NAME));
295+
290296
final String md5 = MD5.getMD5(dest);
291297

292-
String meta = STUBMODE_PATCH_DEX_NAME + "," + "" + "," + md5 + "," + md5 + "," + 0
298+
String meta = PREGENERATED_PATCH_DEX_NAME + "," + "" + "," + md5 + "," + md5 + "," + 0
293299
+ "," + 0 + "," + dexMode;
294300

295301
Logger.d("\nPre-generated patch dex: %s, size:%d", dest.getAbsolutePath(), dest.length());

0 commit comments

Comments
 (0)