Revert file naming convention of .aar files to support fuzzy matching in build.gradle (#112149)
This commit is contained in:
@@ -51,8 +51,7 @@ Future<void> main() async {
|
||||
});
|
||||
});
|
||||
|
||||
bool foundProjectNameInOldAar = false;
|
||||
bool foundProjectNameInNewAar = false;
|
||||
bool foundAarProjectName = false;
|
||||
await runModuleProjectTest((FlutterModuleProject flutterProject) async {
|
||||
section('AAR content with --obfuscate');
|
||||
|
||||
@@ -68,23 +67,21 @@ Future<void> main() async {
|
||||
]);
|
||||
});
|
||||
|
||||
section('Check old _release AAR files');
|
||||
|
||||
final String oldReleaseAar = path.join(
|
||||
final String outputAarDirectory = path.join(
|
||||
flutterProject.rootPath,
|
||||
'build/host/outputs/repo/com/example/${flutterProject.name}/flutter_release/1.0/flutter_release-1.0.aar',
|
||||
);
|
||||
final Iterable<String> filesInOldAar = await getFilesInAar(oldReleaseAar);
|
||||
final Iterable<String> aarFiles = await getFilesInAar(outputAarDirectory);
|
||||
|
||||
checkCollectionContains<String>(<String>[
|
||||
...flutterAssets,
|
||||
'jni/armeabi-v7a/libapp.so',
|
||||
], filesInOldAar);
|
||||
], aarFiles);
|
||||
|
||||
// Verify that an identifier from the Dart project code is not present
|
||||
// in the compiled binary.
|
||||
await inDirectory(flutterProject.rootPath, () async {
|
||||
await exec('unzip', <String>['-o', oldReleaseAar]);
|
||||
await exec('unzip', <String>[outputAarDirectory]);
|
||||
checkFileExists(path.join(flutterProject.rootPath, 'jni/armeabi-v7a/libapp.so'));
|
||||
final String response = await eval(
|
||||
'grep',
|
||||
@@ -92,46 +89,16 @@ Future<void> main() async {
|
||||
canFail: true,
|
||||
);
|
||||
if (response.trim().contains('matches')) {
|
||||
foundProjectNameInOldAar = true;
|
||||
}
|
||||
});
|
||||
|
||||
section('Check new -release AAR files');
|
||||
|
||||
final String newReleaseAar = path.join(
|
||||
flutterProject.rootPath,
|
||||
'build/host/outputs/repo/com/example/${flutterProject.name}/flutter/1.0/flutter-1.0-release.aar',
|
||||
);
|
||||
final Iterable<String> filesInNewAar = await getFilesInAar(newReleaseAar);
|
||||
|
||||
checkCollectionContains<String>(<String>[
|
||||
...flutterAssets,
|
||||
'jni/armeabi-v7a/libapp.so',
|
||||
], filesInNewAar);
|
||||
|
||||
await inDirectory(flutterProject.rootPath, () async {
|
||||
await exec('unzip', <String>['-o', newReleaseAar]);
|
||||
checkFileExists(path.join(flutterProject.rootPath, 'jni/armeabi-v7a/libapp.so'));
|
||||
final String response = await eval(
|
||||
'grep',
|
||||
<String>[flutterProject.name, 'jni/armeabi-v7a/libapp.so'],
|
||||
canFail: true,
|
||||
);
|
||||
if (response.trim().contains('matches')) {
|
||||
foundProjectNameInNewAar = true;
|
||||
foundAarProjectName = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
if (foundApkProjectName) {
|
||||
return TaskResult.failure('Found project name in obfuscated APK dart library');
|
||||
}
|
||||
if (foundProjectNameInOldAar) {
|
||||
return TaskResult.failure('Found project name in obfuscated AAR _release dart library');
|
||||
}
|
||||
if (foundProjectNameInNewAar) {
|
||||
return TaskResult.failure('Found project name in obfuscated AAR -release dart library');
|
||||
if (foundAarProjectName) {
|
||||
return TaskResult.failure('Found project name in obfuscated AAR dart library');
|
||||
}
|
||||
|
||||
return TaskResult.success(null);
|
||||
|
||||
@@ -95,7 +95,7 @@ Future<void> main() async {
|
||||
'repo',
|
||||
);
|
||||
|
||||
section('Check release Maven artifacts (old format)');
|
||||
section('Check release Maven artifacts');
|
||||
|
||||
checkFileExists(path.join(
|
||||
repoPath,
|
||||
@@ -108,7 +108,7 @@ Future<void> main() async {
|
||||
'flutter_release-1.0.aar',
|
||||
));
|
||||
|
||||
final String releasePomOld = path.join(
|
||||
final String releasePom = path.join(
|
||||
repoPath,
|
||||
'io',
|
||||
'flutter',
|
||||
@@ -119,7 +119,7 @@ Future<void> main() async {
|
||||
'flutter_release-1.0.pom',
|
||||
);
|
||||
|
||||
checkFileExists(releasePomOld);
|
||||
checkFileExists(releasePom);
|
||||
|
||||
checkFileExists(path.join(
|
||||
repoPath,
|
||||
@@ -143,54 +143,6 @@ Future<void> main() async {
|
||||
'plugin_with_android_release-1.0.pom',
|
||||
));
|
||||
|
||||
section('Check release Maven artifacts (new format)');
|
||||
|
||||
checkFileExists(path.join(
|
||||
repoPath,
|
||||
'io',
|
||||
'flutter',
|
||||
'devicelab',
|
||||
'hello',
|
||||
'flutter',
|
||||
'1.0',
|
||||
'flutter-1.0-release.aar',
|
||||
));
|
||||
|
||||
final String releasePomNew = path.join(
|
||||
repoPath,
|
||||
'io',
|
||||
'flutter',
|
||||
'devicelab',
|
||||
'hello',
|
||||
'flutter',
|
||||
'1.0',
|
||||
'flutter-1.0.pom',
|
||||
);
|
||||
|
||||
checkFileExists(releasePomNew);
|
||||
|
||||
checkFileExists(path.join(
|
||||
repoPath,
|
||||
'io',
|
||||
'flutter',
|
||||
'devicelab',
|
||||
'plugin_with_android',
|
||||
'plugin_with_android',
|
||||
'1.0',
|
||||
'plugin_with_android-1.0-release.aar',
|
||||
));
|
||||
|
||||
checkFileExists(path.join(
|
||||
repoPath,
|
||||
'io',
|
||||
'flutter',
|
||||
'devicelab',
|
||||
'plugin_with_android',
|
||||
'plugin_with_android',
|
||||
'1.0',
|
||||
'plugin_with_android-1.0.pom',
|
||||
));
|
||||
|
||||
section('Check AOT blobs in release POM');
|
||||
|
||||
checkFileContains(<String>[
|
||||
@@ -198,17 +150,8 @@ Future<void> main() async {
|
||||
'armeabi_v7a_release',
|
||||
'arm64_v8a_release',
|
||||
'x86_64_release',
|
||||
'plugin_with_android',
|
||||
'<relocation>', //make sure the old pom contains the <relocation> tag
|
||||
], releasePomOld);
|
||||
|
||||
checkFileContains(<String>[
|
||||
'flutter_embedding_release',
|
||||
'armeabi_v7a_release',
|
||||
'arm64_v8a_release',
|
||||
'x86_64_release',
|
||||
'plugin_with_android',
|
||||
], releasePomNew);
|
||||
'plugin_with_android_release',
|
||||
], releasePom);
|
||||
|
||||
section('Check assets in release AAR');
|
||||
|
||||
@@ -234,29 +177,7 @@ Future<void> main() async {
|
||||
)
|
||||
);
|
||||
|
||||
checkCollectionContains<String>(
|
||||
<String>[
|
||||
...flutterAssets,
|
||||
// AOT snapshots
|
||||
'jni/arm64-v8a/libapp.so',
|
||||
'jni/armeabi-v7a/libapp.so',
|
||||
'jni/x86_64/libapp.so',
|
||||
],
|
||||
await getFilesInAar(
|
||||
path.join(
|
||||
repoPath,
|
||||
'io',
|
||||
'flutter',
|
||||
'devicelab',
|
||||
'hello',
|
||||
'flutter',
|
||||
'1.0',
|
||||
'flutter-1.0-release.aar',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
section('Check debug Maven artifacts (old format)');
|
||||
section('Check debug Maven artifacts');
|
||||
|
||||
checkFileExists(path.join(
|
||||
repoPath,
|
||||
@@ -269,7 +190,7 @@ Future<void> main() async {
|
||||
'flutter_debug-1.0.aar',
|
||||
));
|
||||
|
||||
final String debugPomOld = path.join(
|
||||
final String debugPom = path.join(
|
||||
repoPath,
|
||||
'io',
|
||||
'flutter',
|
||||
@@ -280,7 +201,7 @@ Future<void> main() async {
|
||||
'flutter_debug-1.0.pom',
|
||||
);
|
||||
|
||||
checkFileExists(debugPomOld);
|
||||
checkFileExists(debugPom);
|
||||
|
||||
checkFileExists(path.join(
|
||||
repoPath,
|
||||
@@ -304,54 +225,6 @@ Future<void> main() async {
|
||||
'plugin_with_android_debug-1.0.pom',
|
||||
));
|
||||
|
||||
section('Check debug Maven artifacts (new format)');
|
||||
|
||||
checkFileExists(path.join(
|
||||
repoPath,
|
||||
'io',
|
||||
'flutter',
|
||||
'devicelab',
|
||||
'hello',
|
||||
'flutter',
|
||||
'1.0',
|
||||
'flutter-1.0-debug.aar',
|
||||
));
|
||||
|
||||
final String debugPomNew = path.join(
|
||||
repoPath,
|
||||
'io',
|
||||
'flutter',
|
||||
'devicelab',
|
||||
'hello',
|
||||
'flutter',
|
||||
'1.0',
|
||||
'flutter-1.0.pom',
|
||||
);
|
||||
|
||||
checkFileExists(debugPomNew);
|
||||
|
||||
checkFileExists(path.join(
|
||||
repoPath,
|
||||
'io',
|
||||
'flutter',
|
||||
'devicelab',
|
||||
'plugin_with_android',
|
||||
'plugin_with_android',
|
||||
'1.0',
|
||||
'plugin_with_android-1.0-debug.aar',
|
||||
));
|
||||
|
||||
checkFileExists(path.join(
|
||||
repoPath,
|
||||
'io',
|
||||
'flutter',
|
||||
'devicelab',
|
||||
'plugin_with_android',
|
||||
'plugin_with_android',
|
||||
'1.0',
|
||||
'plugin_with_android-1.0.pom',
|
||||
));
|
||||
|
||||
section('Check AOT blobs in debug POM');
|
||||
|
||||
checkFileContains(<String>[
|
||||
@@ -360,18 +233,8 @@ Future<void> main() async {
|
||||
'x86_64_debug',
|
||||
'armeabi_v7a_debug',
|
||||
'arm64_v8a_debug',
|
||||
'plugin_with_android',
|
||||
'<relocation>', //make sure the old pom contains the <relocation> tag
|
||||
], debugPomOld);
|
||||
|
||||
checkFileContains(<String>[
|
||||
'flutter_embedding_debug',
|
||||
'x86_debug',
|
||||
'x86_64_debug',
|
||||
'armeabi_v7a_debug',
|
||||
'arm64_v8a_debug',
|
||||
'plugin_with_android',
|
||||
], debugPomNew);
|
||||
'plugin_with_android_debug',
|
||||
], debugPom);
|
||||
|
||||
section('Check assets in debug AAR');
|
||||
|
||||
@@ -386,27 +249,11 @@ Future<void> main() async {
|
||||
'flutter_debug-1.0.aar',
|
||||
));
|
||||
|
||||
final Iterable<String> debugAarNew = await getFilesInAar(path.join(
|
||||
repoPath,
|
||||
'io',
|
||||
'flutter',
|
||||
'devicelab',
|
||||
'hello',
|
||||
'flutter',
|
||||
'1.0',
|
||||
'flutter-1.0-debug.aar',
|
||||
));
|
||||
|
||||
checkCollectionContains<String>(<String>[
|
||||
...flutterAssets,
|
||||
...debugAssets,
|
||||
], debugAar);
|
||||
|
||||
checkCollectionContains<String>(<String>[
|
||||
...flutterAssets,
|
||||
...debugAssets,
|
||||
], debugAarNew);
|
||||
|
||||
return TaskResult.success(null);
|
||||
} on TaskResult catch (taskResult) {
|
||||
return taskResult;
|
||||
|
||||
Reference in New Issue
Block a user