bugfix for diffWithIpa
This commit is contained in:
parent
063c14ab45
commit
0caf003b8d
@ -133,7 +133,7 @@ public class UpdateContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getBundleUrl() {
|
public String getBundleUrl() {
|
||||||
return getBundleUrl("assets://index.android.bundle");
|
return this.getBundleUrl((String)null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBundleUrl(String defaultAssetsUrl) {
|
public String getBundleUrl(String defaultAssetsUrl) {
|
||||||
|
@ -123,4 +123,14 @@ public class UpdateModule extends ReactContextBaseJavaModule{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ReactMethod
|
||||||
|
public void clearFirstTimeMark() {
|
||||||
|
UiThreadUtil.runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
updateContext.clearFirstTimeMark();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,3 +82,7 @@ export async function switchVersion({hash}) {
|
|||||||
export async function switchVersionLater({hash}) {
|
export async function switchVersionLater({hash}) {
|
||||||
HotUpdate.setNeedUpdate({hashName:hash});
|
HotUpdate.setNeedUpdate({hashName:hash});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function clearFirstTimeMark() {
|
||||||
|
HotUpdate.clearFirstTimeMark();
|
||||||
|
}
|
||||||
|
@ -45,10 +45,10 @@ async function pack(dir, output){
|
|||||||
const fullPath = path.join(root, name);
|
const fullPath = path.join(root, name);
|
||||||
const stat = fs.statSync(fullPath);
|
const stat = fs.statSync(fullPath);
|
||||||
if (stat.isFile()) {
|
if (stat.isFile()) {
|
||||||
console.log('adding: ' + rel+name);
|
//console.log('adding: ' + rel+name);
|
||||||
zipfile.addFile(fullPath, rel+name);
|
zipfile.addFile(fullPath, rel+name);
|
||||||
} else if (stat.isDirectory()) {
|
} else if (stat.isDirectory()) {
|
||||||
console.log('adding: ' + rel+name+'/');
|
//console.log('adding: ' + rel+name+'/');
|
||||||
addDirectory(fullPath, rel+name+'/');
|
addDirectory(fullPath, rel+name+'/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ async function diffWithPPK(origin, next, output) {
|
|||||||
const addedEntry = {};
|
const addedEntry = {};
|
||||||
|
|
||||||
function addEntry(fn) {
|
function addEntry(fn) {
|
||||||
console.log(fn);
|
//console.log(fn);
|
||||||
if (addedEntry[fn]) {
|
if (addedEntry[fn]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -151,11 +151,11 @@ async function diffWithPPK(origin, next, output) {
|
|||||||
addEntry(entry.fileName);
|
addEntry(entry.fileName);
|
||||||
}
|
}
|
||||||
} else if (entry.fileName === 'index.bundlejs') {
|
} else if (entry.fileName === 'index.bundlejs') {
|
||||||
console.log('Found bundle');
|
//console.log('Found bundle');
|
||||||
return readEntire(entry, nextZipfile).then( newSource => {
|
return readEntire(entry, nextZipfile).then( newSource => {
|
||||||
console.log('Begin diff');
|
//console.log('Begin diff');
|
||||||
zipfile.addBuffer(diff(originSource, newSource), 'index.bundlejs.patch');
|
zipfile.addBuffer(diff(originSource, newSource), 'index.bundlejs.patch');
|
||||||
console.log('End diff');
|
//console.log('End diff');
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// If same file.
|
// If same file.
|
||||||
@ -185,7 +185,7 @@ async function diffWithPPK(origin, next, output) {
|
|||||||
}
|
}
|
||||||
zipfile.addReadStream(readStream, entry.fileName);
|
zipfile.addReadStream(readStream, entry.fileName);
|
||||||
readStream.on('end', () => {
|
readStream.on('end', () => {
|
||||||
console.log('add finished');
|
//console.log('add finished');
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -201,7 +201,7 @@ async function diffWithPPK(origin, next, output) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log({copies, deletes});
|
//console.log({copies, deletes});
|
||||||
zipfile.addBuffer(new Buffer(JSON.stringify({copies, deletes})), '__diff.json');
|
zipfile.addBuffer(new Buffer(JSON.stringify({copies, deletes})), '__diff.json');
|
||||||
zipfile.end();
|
zipfile.end();
|
||||||
await writePromise;
|
await writePromise;
|
||||||
@ -215,11 +215,12 @@ async function diffWithPackage(origin, next, output, originBundleName, transform
|
|||||||
|
|
||||||
await enumZipEntries(origin, (entry, zipFile) => {
|
await enumZipEntries(origin, (entry, zipFile) => {
|
||||||
if (!/\/$/.test(entry.fileName)) {
|
if (!/\/$/.test(entry.fileName)) {
|
||||||
const fn = transformPackagePath(entry.filename);
|
const fn = transformPackagePath(entry.fileame);
|
||||||
if (!fn) {
|
if (!fn) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//console.log(fn);
|
||||||
// isFile
|
// isFile
|
||||||
originEntries[fn] = entry.crc32;
|
originEntries[fn] = entry.crc32;
|
||||||
originMap[entry.crc32] = fn;
|
originMap[entry.crc32] = fn;
|
||||||
@ -250,11 +251,11 @@ async function diffWithPackage(origin, next, output, originBundleName, transform
|
|||||||
// Directory
|
// Directory
|
||||||
zipfile.addEmptyDirectory(entry.fileName);
|
zipfile.addEmptyDirectory(entry.fileName);
|
||||||
} else if (entry.fileName === 'index.bundlejs') {
|
} else if (entry.fileName === 'index.bundlejs') {
|
||||||
console.log('Found bundle');
|
//console.log('Found bundle');
|
||||||
return readEntire(entry, nextZipfile).then( newSource => {
|
return readEntire(entry, nextZipfile).then( newSource => {
|
||||||
console.log('Begin diff');
|
//console.log('Begin diff');
|
||||||
zipfile.addBuffer(diff(originSource, newSource), 'index.bundlejs.patch');
|
zipfile.addBuffer(diff(originSource, newSource), 'index.bundlejs.patch');
|
||||||
console.log('End diff');
|
//console.log('End diff');
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// If same file.
|
// If same file.
|
||||||
@ -275,7 +276,7 @@ async function diffWithPackage(origin, next, output, originBundleName, transform
|
|||||||
}
|
}
|
||||||
zipfile.addReadStream(readStream, entry.fileName);
|
zipfile.addReadStream(readStream, entry.fileName);
|
||||||
readStream.on('end', () => {
|
readStream.on('end', () => {
|
||||||
console.log('add finished');
|
//console.log('add finished');
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -387,6 +388,7 @@ export const commands = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await diffWithPackage(origin, next, realOutput, 'assets/index.android.bundle');
|
await diffWithPackage(origin, next, realOutput, 'assets/index.android.bundle');
|
||||||
|
console.log(`${realOutput} generated.`);
|
||||||
},
|
},
|
||||||
|
|
||||||
async diffFromIpa({args, options}) {
|
async diffFromIpa({args, options}) {
|
||||||
@ -400,9 +402,11 @@ export const commands = {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
await diffWithPackage(origin, next, realOutput, 'index.ios.bundle', v=>{
|
await diffWithPackage(origin, next, realOutput, 'main.jsbundle', v=>{
|
||||||
const m = /^Payload\/[^/]+\/(.+)$/.exec(v);
|
const m = /^Payload\/[^/]+\/(.+)$/.exec(v);
|
||||||
return m && m[1];
|
return m && m[1];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log(`${realOutput} generated.`);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user