commit | 7a082bf27dd4f281099517dd5a26da0ed2592b99 | [log] [tgz] |
---|---|---|
author | Mikhail Novoseltsev <51940183+Sameri11@users.noreply.github.com> | Wed Oct 16 20:56:31 2024 +0500 |
committer | dart-internal-monorepo <dart-internal-monorepo@dart-ci-internal.iam.gserviceaccount.com> | Wed Oct 16 09:04:16 2024 -0700 |
tree | 562f450498e619e0c736689094ddd28ae38d6e6e | |
parent | 77ee7ea32165df01cccfd26d1b28d79c876f602b [diff] |
[tool] fix android studio preview's version parsing (#156293) This PR willing to fix issue when `flutter doctor` validator can't determine version of Android Studio EAP. These are before/after outputs of `flutter doctor -v` showcasing change in behaviour of validator. Each output has 3 `Android Studio` sections, 1 for stable and 2 for different EAP versions. <details> <summary>before, (stable, 3.24.3), 2 issues related to versions of Android Studio</summary> ```console [â] Flutter (Channel stable, 3.24.3, on macOS 14.7 23H124 darwin-arm64, locale en-RU) ⢠Flutter version 3.24.3 on channel stable at /Users/samer/fvm/versions/stable ⢠Upstream repository https://github.com/flutter/flutter.git ⢠Framework revision 2663184aa7 (4 weeks ago), 2024-09-11 16:27:48 -0500 ⢠Engine revision 36335019a8 ⢠Dart version 3.5.3 ⢠DevTools version 2.37.3 [â] Android toolchain - develop for Android devices (Android SDK version 34.0.0) ⢠Android SDK at /Users/samer/Library/Android/sdk ⢠Platform android-35, build-tools 34.0.0 ⢠Java binary at: /Users/samer/Library/Java/JavaVirtualMachines/jbr-17.0.7/Contents/Home/bin/java ⢠Java version OpenJDK Runtime Environment JBR-17.0.7+7-964.1-nomod (build 17.0.7+7-b964.1) ⢠All Android licenses accepted. [â] Xcode - develop for iOS and macOS (Xcode 16.0) ⢠Xcode at /Applications/Xcode-16.0.app/Contents/Developer ⢠Build 16A242d ⢠CocoaPods version 1.15.2 [â] Chrome - develop for the web ⢠Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [â] Android Studio (version 2024.1) ⢠Android Studio at /Users/samer/Applications/Android Studio Koala Feature Drop 2024.1.2.app/Contents ⢠Flutter plugin can be installed from: ð¨ https://plugins.jetbrains.com/plugin/9212-flutter ⢠Dart plugin can be installed from: ð¨ https://plugins.jetbrains.com/plugin/6351-dart ⢠Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314) [!] Android Studio (version unknown) ⢠Android Studio at /Users/samer/Applications/Android Studio Ladybug Feature Drop 2024.2.2 Canary 2.app/Contents ⢠Flutter plugin can be installed from: ð¨ https://plugins.jetbrains.com/plugin/9212-flutter ⢠Dart plugin can be installed from: ð¨ https://plugins.jetbrains.com/plugin/6351-dart â Unable to determine Android Studio version. ⢠Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11) [!] Android Studio (version unknown) ⢠Android Studio at /Users/samer/Applications/Android Studio.app/Contents ⢠Flutter plugin can be installed from: ð¨ https://plugins.jetbrains.com/plugin/9212-flutter ⢠Dart plugin can be installed from: ð¨ https://plugins.jetbrains.com/plugin/6351-dart â Unable to determine Android Studio version. ⢠Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11) [â] IntelliJ IDEA Ultimate Edition (version EAP IU-243.12818.47) ⢠IntelliJ at /Users/samer/Applications/IntelliJ IDEA Ultimate.app ⢠Flutter plugin can be installed from: ð¨ https://plugins.jetbrains.com/plugin/9212-flutter ⢠Dart plugin can be installed from: ð¨ https://plugins.jetbrains.com/plugin/6351-dart [â] VS Code (version 1.94.0) ⢠VS Code at /Applications/Visual Studio Code.app/Contents ⢠Flutter extension version 3.98.0 [â] Connected device (5 available) ⢠sdk gphone64 arm64 (mobile) ⢠emulator-5554 ⢠android-arm64 ⢠Android 15 (API 35) (emulator) ⢠iPhone (ÐÐ¸Ñ Ð°Ð¸Ð») (mobile) ⢠00008020-001254DA1E39002E ⢠ios ⢠iOS 17.6.1 21G93 ⢠macOS (desktop) ⢠macos ⢠darwin-arm64 ⢠macOS 14.7 23H124 darwin-arm64 ⢠Mac Designed for iPad (desktop) ⢠mac-designed-for-ipad ⢠darwin ⢠macOS 14.7 23H124 darwin-arm64 ⢠Chrome (web) ⢠chrome ⢠web-javascript ⢠Google Chrome 129.0.6668.90 ! Error: Browsing on the local area network for ÐÐ¸Ñ Ð°Ð¸Ð» ÐовоÑелÑÑевâs iPad. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac. The device must be opted into Developer Mode to connect wirelessly. (code -27) [â] Network resources ⢠All expected network resources are available. ! Doctor found issues in 2 categories. ``` </details> <details> <summary>after, no issues regarding Android Studio</summary> ```console [!] Flutter (Channel [user-branch], 3.26.0-1.0.pre.383, on macOS 14.7 23H124 darwin-arm64, locale en-RU) ! Flutter version 3.26.0-1.0.pre.383 on channel [user-branch] at /Users/samer/projects/flutter Currently on an unknown channel. Run `flutter channel` to switch to an official channel. If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/setup. ⢠Upstream repository git@github.com:Sameri11/flutter.git ⢠FLUTTER_GIT_URL = git@github.com:Sameri11/flutter.git ⢠Framework revision 852508425d (20 minutes ago), 2024-10-07 21:22:45 +0500 ⢠Engine revision 683a14c1f1 ⢠Dart version 3.6.0 (build 3.6.0-326.0.dev) ⢠DevTools version 2.40.0 ⢠If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades. [â] Android toolchain - develop for Android devices (Android SDK version 34.0.0) ⢠Android SDK at /Users/samer/Library/Android/sdk ⢠Platform android-35, build-tools 34.0.0 ⢠Java binary at: /Users/samer/Library/Java/JavaVirtualMachines/jbr-17.0.7/Contents/Home/bin/java ⢠Java version OpenJDK Runtime Environment JBR-17.0.7+7-964.1-nomod (build 17.0.7+7-b964.1) ⢠All Android licenses accepted. [â] Xcode - develop for iOS and macOS (Xcode 16.0) ⢠Xcode at /Applications/Xcode-16.0.app/Contents/Developer ⢠Build 16A242d ⢠CocoaPods version 1.15.2 [â] Chrome - develop for the web ⢠Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [â] Android Studio (version 2024.1) ⢠Android Studio at /Users/samer/Applications/Android Studio Koala Feature Drop 2024.1.2.app/Contents ⢠Flutter plugin can be installed from: ð¨ https://plugins.jetbrains.com/plugin/9212-flutter ⢠Dart plugin can be installed from: ð¨ https://plugins.jetbrains.com/plugin/6351-dart ⢠Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314) [â] Android Studio (version 2024.2.2) ⢠Android Studio at /Users/samer/Applications/Android Studio Ladybug Feature Drop 2024.2.2 Canary 2.app/Contents ⢠Flutter plugin can be installed from: ð¨ https://plugins.jetbrains.com/plugin/9212-flutter ⢠Dart plugin can be installed from: ð¨ https://plugins.jetbrains.com/plugin/6351-dart ⢠Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11) [â] Android Studio (version 2024.2.1) ⢠Android Studio at /Users/samer/Applications/Android Studio.app/Contents ⢠Flutter plugin can be installed from: ð¨ https://plugins.jetbrains.com/plugin/9212-flutter ⢠Dart plugin can be installed from: ð¨ https://plugins.jetbrains.com/plugin/6351-dart ⢠Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11) [â] IntelliJ IDEA Ultimate Edition (version EAP IU-243.12818.47) ⢠IntelliJ at /Users/samer/Applications/IntelliJ IDEA Ultimate.app ⢠Flutter plugin can be installed from: ð¨ https://plugins.jetbrains.com/plugin/9212-flutter ⢠Dart plugin can be installed from: ð¨ https://plugins.jetbrains.com/plugin/6351-dart [â] VS Code (version 1.94.0) ⢠VS Code at /Applications/Visual Studio Code.app/Contents ⢠Flutter extension version 3.98.0 [â] Connected device (5 available) ⢠sdk gphone64 arm64 (mobile) ⢠emulator-5554 ⢠android-arm64 ⢠Android 15 (API 35) (emulator) ⢠iPhone (ÐÐ¸Ñ Ð°Ð¸Ð») (mobile) ⢠00008020-001254DA1E39002E ⢠ios ⢠iOS 17.6.1 21G93 ⢠macOS (desktop) ⢠macos ⢠darwin-arm64 ⢠macOS 14.7 23H124 darwin-arm64 ⢠Mac Designed for iPad (desktop) ⢠mac-designed-for-ipad ⢠darwin ⢠macOS 14.7 23H124 darwin-arm64 ⢠Chrome (web) ⢠chrome ⢠web-javascript ⢠Google Chrome 129.0.6668.90 ! Error: Browsing on the local area network for ÐÐ¸Ñ Ð°Ð¸Ð» ÐовоÑелÑÑевâs iPad. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac. The device must be opted into Developer Mode to connect wirelessly. (code -27) [â] Network resources ⢠All expected network resources are available. ! Doctor found issues in 1 category. ``` </details> Logic behind these changes explained in https://github.com/flutter/flutter/issues/121925#issuecomment-2352826925 fixes #121925 **Tests**: updated existing tests by adding version checking, but I don't mind writing new ones if necessary â please tell me if so. https://dart.googlesource.com/external/github.com/flutter/flutter/+/ae6d79336e4b5428b34b1b3c21d6886c17a04887
Monorepo is:
With depot_tools installed and on your path, create a directory for your monorepo checkout and run these commands to create a gclient solution in that directory:
mkdir monorepo cd monorepo gclient config --unmanaged https://dart.googlesource.com/monorepo gclient sync -D
This gives you a checkout in the monorepo directory that contains:
monorepo/ DEPS - the DEPS used for this gclient checkout commits.json - the pinned commits for Dart, flutter/engine, and flutter/flutter tools/ - scripts used to create monorepo DEPS engine/src/ - the flutter/buildroot repo flutter/ - the flutter/engine repo out/ - the build directory, where Flutter engine builds are created third_party/ - Flutter dependencies checked out by DEPS dart/ - the Dart SDK checkout. third_party - Dart dependencies, also used by Flutter flutter/ - the flutter/flutter repo
Flutter's instructions for building the engine are at Compiling the engine
They can be followed closely, with a few changes:
goma_ctl ensure_start
is sufficient.Example build commands that work on linux:
MONOREPO_PATH=$PWD if [[ ! $PATH =~ (^|:)$MONOREPO_PATH/flutter/bin(:|$) ]]; then PATH=$MONOREPO_PATH/flutter/bin:$PATH fi export GOMA_DIR=$(dirname $(command -v gclient))/.cipd_bin goma_ctl ensure_start pushd engine/src flutter/tools/gn --goma --no-prebuilt-dart-sdk --unoptimized --full-dart-sdk autoninja -C out/host_debug_unopt popd
The Flutter commands used to build and run apps will use the locally built Flutter engine and Dart SDK, instead of the one downloaded by the Flutter tool, if the --local-engine
option is provided.
For example, to build and run the Flutter spinning square sample on the web platform,
MONOREPO_PATH=$PWD cd flutter/examples/layers flutter --local-engine=host_debug_unopt \ -d chrome run widgets/spinning_square.dart cd $MONOREPO_PATH
To build for desktop, specify the desktop platform device in flutter run
as -d macos
or -d linux
or -d windows
. You may also need to run the command
flutter create --platforms=windows,macos,linux
on existing apps, such as sample apps. New apps created with flutter create
already include these support files. Details of desktop support are at Desktop Support for Flutter
Tests in the Flutter source tree can be run with the flutter test
command, run in the directory of a package containing tests. For example:
MONOREPO_PATH=$PWD cd flutter/packages/flutter flutter test --local-engine=host_debug_unopt cd $MONOREPO_PATH
Please file an issue or email the dart-engprod team with any problems with or questions about using monorepo.
We will update this documentation to address them.
flutter
commands may download the engine and Dart SDK files for the configured channel, even though they will be using the local engine and its SDK.gclient sync
needs to be run in an administrator session, because some installed dependencies create symlinks.