Use the maven-publish plugin to publish AAR files. (#101276)

This commit is contained in:
Elsabe Ros
2022-04-13 07:19:08 +02:00
committed by GitHub
parent 58fe098376
commit 2b0255f0d9
8 changed files with 292 additions and 115 deletions

View File

@@ -67,21 +67,45 @@ Future<void> main() async {
]);
});
final String outputAarDirectory = path.join(
final String outputAarDirectoryOld = path.join(
flutterProject.rootPath,
'build/host/outputs/repo/com/example/${flutterProject.name}/flutter_release/1.0/flutter_release-1.0.aar',
);
final Iterable<String> aarFiles = await getFilesInAar(outputAarDirectory);
final Iterable<String> oldAarFiles = await getFilesInAar(outputAarDirectoryOld);
checkCollectionContains<String>(<String>[
...flutterAssets,
'jni/armeabi-v7a/libapp.so',
], aarFiles);
], oldAarFiles);
final String outputAarDirectoryNew = path.join(
flutterProject.rootPath,
'build/host/outputs/repo/com/example/${flutterProject.name}/flutter/1.0/flutter-1.0-release.aar',
);
final Iterable<String> newAarFiles = await getFilesInAar(outputAarDirectoryNew);
checkCollectionContains<String>(<String>[
...flutterAssets,
'jni/armeabi-v7a/libapp.so',
], newAarFiles);
// 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>[outputAarDirectory]);
await exec('unzip', <String>[outputAarDirectoryOld]);
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')) {
foundAarProjectName = true;
}
});
await inDirectory(flutterProject.rootPath, () async {
await exec('unzip', <String>[outputAarDirectoryNew]);
checkFileExists(path.join(flutterProject.rootPath, 'jni/armeabi-v7a/libapp.so'));
final String response = await eval(
'grep',

View File

@@ -98,7 +98,7 @@ Future<void> main() async {
'repo',
);
section('Check release Maven artifacts');
section('Check release Maven artifacts (old format)');
checkFileExists(path.join(
repoPath,
@@ -111,7 +111,7 @@ Future<void> main() async {
'flutter_release-1.0.aar',
));
final String releasePom = path.join(
final String releasePomOld = path.join(
repoPath,
'io',
'flutter',
@@ -122,7 +122,7 @@ Future<void> main() async {
'flutter_release-1.0.pom',
);
checkFileExists(releasePom);
checkFileExists(releasePomOld);
checkFileExists(path.join(
repoPath,
@@ -146,6 +146,54 @@ 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>[
@@ -153,8 +201,17 @@ Future<void> main() async {
'armeabi_v7a_release',
'arm64_v8a_release',
'x86_64_release',
'plugin_with_android_release',
], releasePom);
'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);
section('Check assets in release AAR');
@@ -180,7 +237,29 @@ Future<void> main() async {
)
);
section('Check debug Maven artifacts');
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)');
checkFileExists(path.join(
repoPath,
@@ -193,7 +272,7 @@ Future<void> main() async {
'flutter_debug-1.0.aar',
));
final String debugPom = path.join(
final String debugPomOld = path.join(
repoPath,
'io',
'flutter',
@@ -204,7 +283,7 @@ Future<void> main() async {
'flutter_debug-1.0.pom',
);
checkFileExists(debugPom);
checkFileExists(debugPomOld);
checkFileExists(path.join(
repoPath,
@@ -228,6 +307,54 @@ 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>[
@@ -236,8 +363,18 @@ Future<void> main() async {
'x86_64_debug',
'armeabi_v7a_debug',
'arm64_v8a_debug',
'plugin_with_android_debug',
], debugPom);
'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);
section('Check assets in debug AAR');
@@ -252,11 +389,27 @@ 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;