Skip to content

Commit

Permalink
Merge pull request #2293 from leancodepl/create-android-config-on-pat…
Browse files Browse the repository at this point in the history
…rol-build

Create android config in patrol android_test_backend
  • Loading branch information
pdenert authored Aug 7, 2024
2 parents 9505c17 + 26f021a commit 121c1cd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
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

0 comments on commit 121c1cd

Please sign in to comment.