|
17 | 17 | package com.tencent.tinker.build.decoder; |
18 | 18 |
|
19 | 19 |
|
| 20 | +import com.google.common.io.Files; |
| 21 | + |
20 | 22 | import com.tencent.tinker.android.dex.ClassDef; |
21 | 23 | import com.tencent.tinker.android.dex.Dex; |
22 | 24 | import com.tencent.tinker.android.dex.DexFormat; |
|
69 | 71 | */ |
70 | 72 | public class DexDiffDecoder extends BaseDecoder { |
71 | 73 | 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"; |
73 | 75 |
|
74 | 76 | private final InfoWriter logWriter; |
75 | 77 | private final InfoWriter metaWriter; |
@@ -282,14 +284,18 @@ private void generateStubModePatchDex() throws IOException { |
282 | 284 |
|
283 | 285 | // Write constructed stub mode patch dex to file and record it in meta file. |
284 | 286 | 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); |
286 | 288 |
|
287 | 289 | FileDataStore fileDataStore = new FileDataStore(dest); |
288 | 290 | dexBuilder.writeTo(fileDataStore); |
289 | 291 |
|
| 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 | + |
290 | 296 | final String md5 = MD5.getMD5(dest); |
291 | 297 |
|
292 | | - String meta = STUBMODE_PATCH_DEX_NAME + "," + "" + "," + md5 + "," + md5 + "," + 0 |
| 298 | + String meta = PREGENERATED_PATCH_DEX_NAME + "," + "" + "," + md5 + "," + md5 + "," + 0 |
293 | 299 | + "," + 0 + "," + dexMode; |
294 | 300 |
|
295 | 301 | Logger.d("\nPre-generated patch dex: %s, size:%d", dest.getAbsolutePath(), dest.length()); |
|
0 commit comments