Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create android config in patrol android_test_backend #2293

Merged
merged 2 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/patrol_cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## 3.1.0
- Add `tags` and `exclude-tags`. (#2286)
- Run `flutter build apk --config-only` during android build.(#2293)

This version requires version 3.10.0 of `patrol` package.

Expand Down
16 changes: 16 additions & 0 deletions packages/patrol_cli/lib/src/android/android_test_backend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class AndroidTestBackend {
late final String? javaPath;

Future<void> build(AndroidAppOptions options) async {
await buildApkConfigOnly(options.flutter.command.executable);
await loadJavaPathFromFlutterDoctor(options.flutter.command.executable);

await _disposeScope.run((scope) async {
Expand Down Expand Up @@ -149,6 +150,21 @@ class AndroidTestBackend {
javaPath = await javaCompleterPath.future;
}

/// Execute `flutter build apk --config-only` to generate the gradlew file.
///
/// This fix issue: https://github.com/leancodepl/patrol/issues/1668
Future<void> buildApkConfigOnly(String commandExecutable) async {
await _processManager.start(
[
commandExecutable,
'build',
'apk',
'--config-only',
],
runInShell: true,
);
}

/// Executes the tests of the given [options] on the given [device].
///
/// [build] must be called before this method.
Expand Down
Loading