flutter/packages/flutter_tools/test
Gray Mackall c49ec359a2
Add handler for jlink error when using Java 21 (#157132)
Fixes https://github.com/flutter/flutter/issues/156304.
Also fixes https://github.com/flutter/flutter/issues/155449.

Unfortunately, because the error handler only sees one line at a time, it is hard to make this handling any more specific than this. If we run in to another jlink related error (unlikely) between now and when we phase out support for AGP 8.2.0 and below, we might have trouble differentiating them. We should delete the error handler when we phase out support for those versions.

Example of handled error output:
```
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':shared_preferences_android:compileReleaseJavaWithJavac'.
> Could not resolve all files for configuration ':shared_preferences_android:androidJdkImage'.
   > Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for JdkImageTransform: /Users/mackall/Library/Android/sdk/platforms/android-34/core-for-system-modules.jar.
         > Error while executing process /Users/mackall/Desktop/JDKs/21/jdk-21.0.2.jdk/Contents/Home/bin/jlink with arguments {--module-path /Users/mackall/.gradle/caches/8.9/transforms/2890fec03da42154757073d3208548e5-79660961-f91d-4df2-90bc-b9a3f2a270bd/transformed/output/temp/jmod --add-modules java.base --output /Users/mackall/.gradle/caches/8.9/transforms/2890fec03da42154757073d3208548e5-79660961-f91d-4df2-90bc-b9a3f2a270bd/transformed/output/jdkImage --disable-plugin system-modules}

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 1s
Running Gradle task 'assembleRelease'...                         2,100ms

┌─ Flutter Fix ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ [!] This is likely due to a known bug in Android Gradle Plugin (AGP) versions less than 8.2.1, when                                   │
│   1. setting a value for SourceCompatibility and                                                                                      │
│   2. using Java 21 or above.                                                                                                          │
│ To fix this error, please upgrade your AGP version to at least 8.2.1. The version of AGP that your project uses is likely defined in: │
│ /Users/mackall/development/BugTesting/fifth/android/settings.gradle,                                                                  │
│ in the 'plugins' closure (by the number following "com.android.application").                                                         │
│  Alternatively, if your project was created with an older version of the templates, it is likely                                      │
│ in the buildscript.dependencies closure of the top-level build.gradle:                                                                │
│ /Users/mackall/development/BugTesting/fifth/android/build.gradle,                                                                     │
│ by the number following "com.android.tools.build:gradle:".                                                                            │
│                                                                                                                                       │
│ For more information, see:                                                                                                            │
│ https://b.corp.google.com/issues/294137077                                                                                            │
│ https://github.com/flutter/flutter/issues/156304                                                                                      │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Gradle task assembleRelease failed with exit code 1
```
2024-10-18 19:06:16 +00:00
..
android_java11_integration.shard Reland "Update template/test compileSdk, targetSdk, ndk versions" (#153795) 2024-08-21 18:27:00 +00:00
android_preview_integration.shard Reland "Upgrade template Gradle, App AGP, Module AGP, and Kotlin versions, and tests"... but no longer upgrade module AGP version (#151433) 2024-07-10 21:37:26 +00:00
commands.shard Arrow syntax for getters (#156483) 2024-10-17 19:25:14 +00:00
data make asset_test.dart tests not dependent on context (#141331) 2024-01-11 18:08:07 +00:00
general.shard Add handler for jlink error when using Java 21 (#157132) 2024-10-18 19:06:16 +00:00
host_cross_arch.shard Assert macOS framework artifact contains xcprivacy manifest (#155189) 2024-09-23 17:12:31 +00:00
integration.shard pattern-matching refactor (#154753) 2024-10-03 18:21:04 +00:00
src Launch DDS using DartDevelopmentServiceLauncher (#154015) 2024-08-29 16:16:27 -04:00
web.shard Migrate apple-mobile-web-* to mobile-web-*. (#154964) 2024-09-11 00:39:51 +00:00