Reland double gzip wrapping NOTICES to reduce on-disk installed space (#80897)
This commit is contained in:
@@ -2,8 +2,11 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:archive/archive.dart';
|
||||
import 'package:flutter_devicelab/framework/apk_utils.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
import 'package:flutter_devicelab/framework/task_result.dart';
|
||||
@@ -314,6 +317,24 @@ Future<void> main() async {
|
||||
'lib/armeabi-v7a/libflutter.so',
|
||||
], await getFilesInApk(releaseHostApk));
|
||||
|
||||
section('Check the NOTICE file is correct');
|
||||
|
||||
await inDirectory(hostApp, () async {
|
||||
final File apkFile = File(releaseHostApk);
|
||||
final Archive apk = ZipDecoder().decodeBytes(apkFile.readAsBytesSync());
|
||||
// Shouldn't be missing since we already checked it exists above.
|
||||
final ArchiveFile noticesFile = apk.findFile('assets/flutter_assets/NOTICES.Z');
|
||||
|
||||
final Uint8List licenseData = noticesFile.content as Uint8List;
|
||||
if (licenseData == null) {
|
||||
return TaskResult.failure('Invalid license file.');
|
||||
}
|
||||
final String licenseString = utf8.decode(gzip.decode(licenseData));
|
||||
if (!licenseString.contains('skia') || !licenseString.contains('Flutter Authors')) {
|
||||
return TaskResult.failure('License content missing.');
|
||||
}
|
||||
});
|
||||
|
||||
section('Check release AndroidManifest.xml');
|
||||
|
||||
final String androidManifestRelease = await getAndroidManifest(debugHostApk);
|
||||
|
||||
Reference in New Issue
Block a user