Unverified Commit 20d9de58 authored by Stanislav Baranov's avatar Stanislav Baranov Committed by GitHub

Revert "Add support for binary compression of dynamic patches by the flutter...

Revert "Add support for binary compression of dynamic patches by the flutter tool. (#27754)" (#28031)

This reverts commit b47da6c2.
parent c90c3a18
......@@ -10,7 +10,6 @@ import 'package:meta/meta.dart';
import '../android/android_sdk.dart';
import '../application_package.dart';
import '../artifacts.dart';
import '../base/bsdiff.dart';
import '../base/common.dart';
import '../base/file_system.dart';
import '../base/logger.dart';
......@@ -499,7 +498,6 @@ Future<void> _buildGradleProjectV2(
throwToolExit('Error: Could not find baseline package ${baselineApkFile.path}.');
printStatus('Found baseline package ${baselineApkFile.path}.');
printStatus('Creating dynamic patch...');
final Archive newApk = ZipDecoder().decodeBytes(apkFile.readAsBytesSync());
final Archive oldApk = ZipDecoder().decodeBytes(baselineApkFile.readAsBytesSync());
......@@ -521,14 +519,7 @@ Future<void> _buildGradleProjectV2(
throwToolExit("Error: Dynamic patching doesn't support changes to ${newFile.name}.");
final String name = fs.path.relative(newFile.name, from: 'assets/');
if (name.contains('_snapshot_')) {
final List<int> diff = bsdiff(oldFile.content, newFile.content);
final int ratio = 100 * diff.length ~/ newFile.content.length;
printStatus('Deflated $name by ${ratio == 0 ? 99 : 100 - ratio}%');
update.addFile(ArchiveFile(name + '.bzdiff40', diff.length, diff));
} else {
update.addFile(ArchiveFile(name, newFile.content.length, newFile.content));
}
update.addFile(ArchiveFile(name, newFile.content.length, newFile.content));
}
File updateFile;
......@@ -576,8 +567,7 @@ Future<void> _buildGradleProjectV2(
updateFile.parent.createSync(recursive: true);
updateFile.writeAsBytesSync(ZipEncoder().encode(update), flush: true);
final String patchSize = getSizeAsMB(updateFile.lengthSync());
printStatus('Created dynamic patch ${updateFile.path} ($patchSize).');
printStatus('Created dynamic patch ${updateFile.path}.');
}
} else {
final File bundleFile = _findBundleFile(project, buildInfo);
......
This diff is collapsed.
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:typed_data';
import 'package:flutter_tools/src/base/bsdiff.dart';
import '../src/common.dart';
void main() {
group('Main', () {
test('generates diff', () {
final Uint8List a = Uint8List.fromList('Hello'.runes.toList());
final Uint8List b = Uint8List.fromList('World'.runes.toList());
final Uint8List c = Uint8List.fromList(bsdiff(a, b));
expect(bspatch(a, c), equals(b));
});
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment