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);
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
// 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:flutter_devicelab/framework/framework.dart';
|
||||
import 'package:flutter_devicelab/framework/host_agent.dart';
|
||||
@@ -214,6 +216,8 @@ Future<void> main() async {
|
||||
|
||||
final File objectiveCAnalyticsOutputFile = File(path.join(tempDir.path, 'analytics-objc.log'));
|
||||
final Directory objectiveCBuildDirectory = Directory(path.join(tempDir.path, 'build-objc'));
|
||||
|
||||
section('Build iOS Objective-C host app');
|
||||
await inDirectory(objectiveCHostApp, () async {
|
||||
await exec(
|
||||
'pod',
|
||||
@@ -282,6 +286,28 @@ Future<void> main() async {
|
||||
'isolate_snapshot_data',
|
||||
));
|
||||
|
||||
section('Check the NOTICE file is correct');
|
||||
|
||||
final String licenseFilePath = path.join(
|
||||
objectiveCBuildDirectory.path,
|
||||
'Host.app',
|
||||
'Frameworks',
|
||||
'App.framework',
|
||||
'flutter_assets',
|
||||
'NOTICES.Z',
|
||||
);
|
||||
checkFileExists(licenseFilePath);
|
||||
|
||||
await inDirectory(objectiveCBuildDirectory, () async {
|
||||
final Uint8List licenseData = File(licenseFilePath).readAsBytesSync();
|
||||
final String licenseString = utf8.decode(gzip.decode(licenseData));
|
||||
if (!licenseString.contains('skia') || !licenseString.contains('Flutter Authors')) {
|
||||
return TaskResult.failure('License content missing');
|
||||
}
|
||||
});
|
||||
|
||||
section('Check that the host build sends the correct analytics');
|
||||
|
||||
final String objectiveCAnalyticsOutput = objectiveCAnalyticsOutputFile.readAsStringSync();
|
||||
if (!objectiveCAnalyticsOutput.contains('cd24: ios')
|
||||
|| !objectiveCAnalyticsOutput.contains('cd25: true')
|
||||
|
||||
Reference in New Issue
Block a user