diff --git a/testing/flutter/APKBUILD b/testing/flutter/APKBUILD index ceb1789d5b0..e52c647d76e 100644 --- a/testing/flutter/APKBUILD +++ b/testing/flutter/APKBUILD @@ -2,13 +2,13 @@ # Maintainer: lauren n. liberda pkgname=flutter # upgrade checklist: https://md.sdomi.pl/Q-ECZTJ2Qqyp3ahfJuYSBw -pkgver=3.27.0 +pkgver=3.29.0 pkgrel=0 pkgdesc="Cross-platform apps, built in Omelas" url="https://flutter.dev/" arch="aarch64 x86_64" # officially supported for linux desktop license="BSD-3-Clause" -_dartver=3.6.0 +_dartver=3.7.0 _depends_common=" bash clang @@ -80,13 +80,12 @@ case "$_dartver" in ;; esac -_enginever=83bacfc52569459a4a654727cad2546820cb0d6a +_enginever=f73bfc4522dd0bc87bbcdb4bb3088082755c5e87 _materialfontsver=3012db47f3130e62f7cc0beabff968a33cbec8d8 _gradlewver=fd5c1f2c013565a3bea56ada6df9d2b8e96d56aa options="!check" # idk no attempt to build tests even with --enable-unittests source=" - https://github.com/flutter/flutter/archive/refs/tags/$_canonver/flutter-$_canonver.tar.gz - https://ab-sn.lnl.gay/flutter-engine-$_enginever.tar.zst + https://ab-sn.lnl.gay/flutter-$_canonver.tar.zst fonts-$_materialfontsver.zip.noauto::https://storage.googleapis.com/flutter_infra_release/flutter/fonts/$_materialfontsver/fonts.zip gradle-wrapper-$_gradlewver.tar.gz.noauto::https://storage.googleapis.com/flutter_infra_release/gradle-wrapper/$_gradlewver/gradle-wrapper.tgz @@ -101,14 +100,15 @@ source=" pmos-if-touch-is-a-mouse-then-mouse-is-touch.patch + geometry-floats.patch.engine git-revision.patch.engine target-musl.patch.engine musl-no-execinfo.patch.engine musl-no-mallinfo.patch.engine + not-in-git.patch.engine no-vpython.patch.engine shared-libcxx.patch.engine libstdc++13.patch.engine - libstdc++14.patch.engine system-icu.patch.engine unbundle.patch.engine unbundle-icu.patch.engine @@ -128,7 +128,7 @@ case "$CARCH" in x86_64) _flutter_arch="x64" ;; aarch64) _flutter_arch="arm64" ;; esac -_out="$srcdir"/flutter-engine-$_enginever/out +_out="$builddir"/engine/src/out _modes='release profile debug' _release_out="$_out"/linux_release_$_flutter_arch _debug_out="$_out"/linux_debug_$_flutter_arch @@ -140,14 +140,17 @@ snapshot() { cd "$srcdir" rm -rf src - rm -rf flutter-engine-$_enginever - rm -f flutter-engine-$_enginever.tar - rm -f flutter-engine-$_enginever.tar.zst + rm -rf flutter-$_canonver + rm -f flutter-$_canonver.tar + rm -f flutter-$_canonver.tar.zst + + mkdir flutter-$_canonver + cd flutter-$_canonver echo " solutions = [{ - 'name': 'src/flutter', - 'url': 'https://github.com/flutter/engine.git@$_enginever', + 'name': '.', + 'url': 'https://github.com/flutter/flutter.git@$_canonver', 'custom_vars': { 'download_android_deps': False, 'download_dart_sdk': True, @@ -159,27 +162,27 @@ target_cpu_only = True gclient sync --no-history --nohooks --tpot-cipd-ignore-platformed - for elf in $(scanelf -RA -F "%F" src); do + for elf in $(scanelf -RA -F "%F" .); do rm -f "$elf" done - mv src flutter-engine-$_enginever + cd .. msg "generating tarball.." - tar -cf flutter-engine-$_enginever.tar \ + tar -cf flutter-$_canonver.tar \ --exclude="ChangeLog*" \ --exclude=".build-id" \ --exclude-backups \ --exclude-caches-all \ --exclude-vcs \ - flutter-engine-$_enginever + flutter-$_canonver - zstd --auto-threads=logical --ultra --long -22 -T"${ZSTD_LIMIT:-0}" -vv flutter-engine-$_enginever.tar -o "$SRCDEST"/flutter-engine-$_enginever.tar.zst - mcli cp "$SRCDEST"/flutter-engine-$_enginever.tar.zst "$_distbucket" + zstd --auto-threads=logical --ultra --long -22 -T"${ZSTD_LIMIT:-0}" -vv flutter-$_canonver.tar -o "$SRCDEST"/flutter-$_canonver.tar.zst + mcli cp "$SRCDEST"/flutter-$_canonver.tar.zst "$_distbucket" } prepare() { - dos2unix "$srcdir"/flutter-engine-$_enginever/flutter/third_party/vulkan_memory_allocator/include/vk_mem_alloc.h + dos2unix engine/src/flutter/third_party/vulkan_memory_allocator/include/vk_mem_alloc.h default_prepare @@ -188,11 +191,11 @@ prepare() { case "$x" in *.patch.engine) msg "$x" - patch -p1 -i "$srcdir"/$x -d "$srcdir"/flutter-engine-$_enginever + patch -p1 -i "$srcdir"/$x -d engine/src ;; *.patch.dart) msg "$x" - patch -p1 -i "$srcdir"/$x -d "$srcdir"/flutter-engine-$_enginever/flutter/third_party/dart + patch -p1 -i "$srcdir"/$x -d engine/src/flutter/third_party/dart ;; esac done @@ -207,7 +210,7 @@ prepare() { mkdir bin/cache ( - cd "$srcdir"/flutter-engine-$_enginever + cd engine/src # bind dart build mkdir -p flutter/third_party/dart/tools/sdks/dart-sdk/ @@ -263,7 +266,7 @@ prepare() { build() { ( - cd "$srcdir"/flutter-engine-$_enginever + cd engine/src # shellcheck disable=2089 local gn_args=" @@ -318,7 +321,7 @@ build() { check() { ( - cd "$srcdir"/flutter-engine-$_enginever + cd engine/src ln -s ./linux_debug_$_flutter_arch ./out/linux_debug_unopt @@ -337,7 +340,7 @@ package() { # our dart mkdir -p "$pkgdir"/usr/lib/flutter/bin/cache/ ln -s ../../../dart "$pkgdir"/usr/lib/flutter/bin/cache/dart-sdk - _devtoolsver="$(grep 'devtools_rev' "$srcdir/dart-sdk-$_dartcanonver/DEPS" | head -n1 | awk -F\" '{ print $4 }')" + _devtoolsver="$(grep 'devtools_rev' engine/src/flutter/third_party/dart/DEPS | head -n1 | awk -F\" '{ print $4 }')" cat > "$pkgdir"/usr/lib/flutter/bin/cache/flutter.version.json < #include #include ---- ./flutter/third_party/tonic/filesystem/filesystem/file.h.orig -+++ ./flutter/third_party/tonic/filesystem/filesystem/file.h -@@ -5,6 +5,7 @@ - #ifndef FILESYSTEM_FILE_H_ - #define FILESYSTEM_FILE_H_ - -+#include - #include - #include - ---- ./flutter/impeller/geometry/size.h.orig -+++ ./flutter/impeller/geometry/size.h -@@ -6,6 +6,7 @@ - - #include - #include -+#include - #include - #include - #include ---- ./flutter/runtime/dart_service_isolate.h.orig -+++ ./flutter/runtime/dart_service_isolate.h -@@ -6,6 +6,7 @@ - #define FLUTTER_RUNTIME_DART_SERVICE_ISOLATE_H_ - - #include -+#include - #include - #include - #include ---- ./flutter/flow/paint_region.h.orig -+++ ./flutter/flow/paint_region.h -@@ -5,6 +5,7 @@ - #ifndef FLUTTER_FLOW_PAINT_REGION_H_ - #define FLUTTER_FLOW_PAINT_REGION_H_ - -+#include - #include - #include - #include "flutter/fml/logging.h" ---- ./flutter/vulkan/vulkan_surface.h.orig -+++ ./flutter/vulkan/vulkan_surface.h -@@ -5,6 +5,8 @@ - #ifndef FLUTTER_VULKAN_VULKAN_SURFACE_H_ - #define FLUTTER_VULKAN_VULKAN_SURFACE_H_ - -+#include -+ - #include "flutter/fml/macros.h" - #include "flutter/vulkan/procs/vulkan_handle.h" - #include "third_party/skia/include/core/SkSize.h" ---- ./flutter/shell/platform/glfw/flutter_glfw.cc.orig -+++ ./flutter/shell/platform/glfw/flutter_glfw.cc -@@ -7,6 +7,7 @@ - #include - - #include -+#include - #include - #include - #include ---- ./flutter/fml/cpu_affinity.cc.orig -+++ ./flutter/fml/cpu_affinity.cc -@@ -5,6 +5,7 @@ - #include "flutter/fml/cpu_affinity.h" - #include "flutter/fml/build_config.h" - -+#include - #include - #include - #include ---- ./flutter/fml/cpu_affinity.h.orig -+++ ./flutter/fml/cpu_affinity.h -@@ -4,6 +4,7 @@ - - #pragma once - -+#include - #include - #include - #include ---- ./flutter/impeller/geometry/path.h.orig -+++ ./flutter/impeller/geometry/path.h -@@ -6,6 +6,7 @@ - #define FLUTTER_IMPELLER_GEOMETRY_PATH_H_ - - #include -+#include - #include - #include - #include ---- ./flutter/impeller/core/runtime_types.h.orig -+++ ./flutter/impeller/core/runtime_types.h -@@ -6,6 +6,7 @@ - #define FLUTTER_IMPELLER_CORE_RUNTIME_TYPES_H_ - - #include -+#include - #include - #include - #include ---- ./flutter/impeller/typographer/rectangle_packer.h.orig -+++ ./flutter/impeller/typographer/rectangle_packer.h -@@ -9,6 +9,7 @@ - #include "impeller/geometry/scalar.h" - - #include -+#include - - namespace impeller { - ---- ./flutter/impeller/typographer/rectangle_packer.cc.orig -+++ ./flutter/impeller/typographer/rectangle_packer.cc -@@ -5,6 +5,7 @@ - #include "impeller/typographer/rectangle_packer.h" - - #include -+#include - #include - - #include "flutter/fml/logging.h" diff --git a/testing/flutter/libstdc++14.patch.engine b/testing/flutter/libstdc++14.patch.engine deleted file mode 100644 index 45f0532a87a..00000000000 --- a/testing/flutter/libstdc++14.patch.engine +++ /dev/null @@ -1,10 +0,0 @@ ---- ./flutter/fml/synchronization/sync_switch.cc.orig -+++ ./flutter/fml/synchronization/sync_switch.cc -@@ -5,6 +5,7 @@ - #include "flutter/fml/synchronization/sync_switch.h" - - #include -+#include - - namespace fml { - diff --git a/testing/flutter/no-runtime-download.patch b/testing/flutter/no-runtime-download.patch index 4814ab14933..d75ed0139d3 100644 --- a/testing/flutter/no-runtime-download.patch +++ b/testing/flutter/no-runtime-download.patch @@ -1,6 +1,6 @@ --- a/packages/flutter_tools/lib/src/cache.dart +++ b/packages/flutter_tools/lib/src/cache.dart -@@ -926,26 +926,6 @@ +@@ -1009,31 +1010,6 @@ } Future checkForArtifacts(String? engineVersion) async { @@ -9,7 +9,10 @@ - - bool exists = false; - for (final String pkgName in getPackageDirs()) { -- exists = await cache.doesRemoteExist('Checking package $pkgName is available...', Uri.parse('$url$pkgName.zip')); +- exists = await cache.doesRemoteExist( +- 'Checking package $pkgName is available...', +- Uri.parse('$url$pkgName.zip'), +- ); - if (!exists) { - return false; - } @@ -18,8 +21,10 @@ - for (final List toolsDir in getBinaryDirs()) { - final String cacheDir = toolsDir[0]; - final String urlPath = toolsDir[1]; -- exists = await cache.doesRemoteExist('Checking $cacheDir tools are available...', -- Uri.parse(url + urlPath)); +- exists = await cache.doesRemoteExist( +- 'Checking $cacheDir tools are available...', +- Uri.parse(url + urlPath), +- ); - if (!exists) { - return false; - } @@ -27,12 +32,3 @@ return true; } -@@ -1036,6 +1016,8 @@ - Directory location, - void Function(File, Directory) extractor, - ) async { -+ throwToolExit('Tried to download $url. Report on aports.'); -+ - final String downloadPath = flattenNameSubdirs(url, _fileSystem); - final File tempFile = _createDownloadFile(downloadPath); - Status status; diff --git a/testing/flutter/not-in-git.patch.engine b/testing/flutter/not-in-git.patch.engine new file mode 100644 index 00000000000..dda9fd3dc8e --- /dev/null +++ b/testing/flutter/not-in-git.patch.engine @@ -0,0 +1,13 @@ +--- ./flutter/tools/pub_get_offline.py.orig ++++ ./flutter/tools/pub_get_offline.py +@@ -148,10 +148,6 @@ + SRC_ROOT, 'flutter', 'third_party', 'dart', 'tools', 'sdks', 'dart-sdk', 'bin' + ) + +- # Delete all package_config.json files. These may be stale. +- # Required ones will be regenerated fresh below. +- delete_config_files() +- + # Ensure all relevant packages are listed in ALL_PACKAGES. + unlisted = find_unlisted_packages() + if len(unlisted) > 0: diff --git a/testing/flutter/system-dart.patch b/testing/flutter/system-dart.patch index 702109107d8..fad185cdf2a 100644 --- a/testing/flutter/system-dart.patch +++ b/testing/flutter/system-dart.patch @@ -1,21 +1,15 @@ Thanks a lot, Braid --- ./packages/flutter_tools/bin/tool_backend.dart.orig +++ ./packages/flutter_tools/bin/tool_backend.dart -@@ -69,12 +69,9 @@ +@@ -73,7 +73,7 @@ exit(1); } final String flutterExecutable = pathJoin([ - flutterRoot, + '/usr', 'bin', -- if (Platform.isWindows) -- 'flutter.bat' -- else -- 'flutter', -+ 'flutter', + if (Platform.isWindows) 'flutter.bat' else 'flutter', ]); - final String bundlePlatform = targetPlatform.startsWith('windows') ? 'windows' : targetPlatform; - final String target = '${buildMode}_bundle_${bundlePlatform}_assets'; --- ./packages/flutter_tools/bin/tool_backend.sh.orig +++ ./packages/flutter_tools/bin/tool_backend.sh @@ -3,7 +3,4 @@ @@ -43,15 +37,15 @@ Thanks a lot, Braid @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + +import 'dart:io' as io show Platform; + import 'package:file/memory.dart'; import 'package:meta/meta.dart'; import 'package:process/process.dart'; -@@ -1176,50 +1176,7 @@ +@@ -1463,60 +1465,9 @@ } - + String _getDartSdkPath() { - final String builtPath = _fileSystem.path.join(_hostEngineOutPath, 'dart-sdk'); - if (_fileSystem.isDirectorySync(_fileSystem.path.join(builtPath, 'bin'))) { @@ -59,16 +53,25 @@ Thanks a lot, Braid - } - - // If we couldn't find a built dart sdk, let's look for a prebuilt one. -- final String prebuiltPath = _fileSystem.path.join(_getFlutterPrebuiltsPath(), _getPrebuiltTarget(), 'dart-sdk'); +- final String prebuiltPath = _fileSystem.path.join( +- _getFlutterPrebuiltsPath(), +- _getPrebuiltTarget(), +- 'dart-sdk', +- ); - if (_fileSystem.isDirectorySync(prebuiltPath)) { - return prebuiltPath; - } - -- throw ToolExit('Unable to find a built dart sdk at: "$builtPath" or a prebuilt dart sdk at: "$prebuiltPath"'); -- } -- +- throwToolExit( +- 'Unable to find a built dart sdk at: "$builtPath" or a prebuilt dart sdk at: "$prebuiltPath"', +- ); ++ return io.Platform.environment['DART_ROOT'] ?? '/usr/lib/dart'; + } + - String _getFlutterPrebuiltsPath() { -- final String engineSrcPath = _fileSystem.path.dirname(_fileSystem.path.dirname(_hostEngineOutPath)); +- final String engineSrcPath = _fileSystem.path.dirname( +- _fileSystem.path.dirname(_hostEngineOutPath), +- ); - return _fileSystem.path.join(engineSrcPath, 'flutter', 'prebuilts'); - } - @@ -97,18 +100,19 @@ Thanks a lot, Braid - case TargetPlatform.tester: - throwToolExit('Unsupported host platform: $hostPlatform'); - } -+ return io.Platform.environment['DART_ROOT'] ?? '/usr/lib/dart'; - } - +- } +- String _getFlutterWebSdkPath() { -@@ -1382,7 +1343,7 @@ - + return _fileSystem.path.join(localEngineInfo.targetOutPath, 'flutter_web_sdk'); + } +@@ -1889,7 +1840,7 @@ + /// Locate the Dart SDK. String _dartSdkPath(Cache cache) { - return cache.getRoot().childDirectory('dart-sdk').path; + return io.Platform.environment['DART_ROOT'] ?? '/usr/lib/dart'; } - + class _TestArtifacts implements Artifacts { --- ./packages/flutter_tools/lib/src/cache.dart.orig +++ ./packages/flutter_tools/lib/src/cache.dart @@ -177,18 +181,24 @@ Thanks a lot, Braid +++ ./packages/flutter_tools/lib/src/dart/language_version.dart @@ -3,6 +3,7 @@ // found in the LICENSE file. - + import 'dart:async'; +import 'dart:io' as io show Platform; - + import 'package:file/file.dart'; import 'package:package_config/package_config.dart'; -@@ -26,7 +27,7 @@ - } +@@ -27,7 +28,13 @@ // Either reading the file or parsing the version could fail on a corrupt Dart SDK. // let it crash so it shows up in crash logging. -- final File versionFile = fileSystem.file(fileSystem.path.join(flutterRoot, 'bin', 'cache', 'dart-sdk', 'version')); -+ final File versionFile = fileSystem.file(io.Platform.environment['DART_ROOT'] ?? '/usr/lib/dart'); + final File versionFile = fileSystem.file( +- fileSystem.path.join(flutterRoot, 'bin', 'cache', 'dart-sdk', 'version'), ++ fileSystem.path.join( ++ io.Platform.environment['DART_ROOT'] ?? '/usr/lib/dart', ++ 'bin', ++ 'cache', ++ 'dart-sdk', ++ 'version', ++ ), + ); if (!versionFile.existsSync() && _inUnitTest()) { return LanguageVersion(2, 12); - } diff --git a/testing/flutter/unbundle-icu.patch.dart b/testing/flutter/unbundle-icu.patch.dart index 66438149163..80e26913958 100644 --- a/testing/flutter/unbundle-icu.patch.dart +++ b/testing/flutter/unbundle-icu.patch.dart @@ -39,8 +39,8 @@ index 90dc09a0c02..8f88873dc18 100644 ] extra_deps = [ - ":icudtl_cc", - "..:libdart_precompiled_runtime", - "../platform:libdart_platform_precompiled_runtime", + "..:libdart_aotruntime", + "../platform:libdart_platform_aotruntime", ] + if (dart_embed_icu_data) { + extra_deps += [ ":icudtl_cc" ] diff --git a/testing/flutter/unbundle-icu.patch.engine b/testing/flutter/unbundle-icu.patch.engine index 3e43099485c..8b4b2fe4fa1 100644 --- a/testing/flutter/unbundle-icu.patch.engine +++ b/testing/flutter/unbundle-icu.patch.engine @@ -54,15 +54,15 @@ diff --git a/flutter/impeller/toolkit/interop/typography_context.cc b/flutter/im index ed863fa61e..737d087907 100644 --- a/flutter/impeller/toolkit/interop/typography_context.cc +++ b/flutter/impeller/toolkit/interop/typography_context.cc -@@ -7,7 +7,6 @@ - #include - +@@ -9,7 +9,6 @@ #include "flutter/fml/icu_util.h" + #include "flutter/third_party/txt/src/txt/platform.h" + #include "impeller/base/validation.h" -#include "impeller/toolkit/interop/embedded_icu_data.h" namespace impeller::interop { -@@ -15,9 +14,7 @@ +@@ -17,9 +16,7 @@ : collection_(std::make_shared()) { static std::once_flag sICUInitOnceFlag; std::call_once(sICUInitOnceFlag, []() { @@ -71,5 +71,5 @@ index ed863fa61e..737d087907 100644 - fml::icu::InitializeICUFromMapping(std::move(icu_data)); + fml::icu::InitializeICU("/usr/lib/flutter/icudtl.dat"); }); + // The fallback for all fonts. Looks in platform specific locations. collection_->SetupDefaultFontManager(0u); - } diff --git a/testing/flutter/unbundle.patch b/testing/flutter/unbundle.patch index 8dc368813c3..2d257524874 100644 --- a/testing/flutter/unbundle.patch +++ b/testing/flutter/unbundle.patch @@ -1,21 +1,22 @@ --- a/packages/flutter_tools/lib/src/build_system/targets/linux.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/linux.dart -@@ -19,7 +19,6 @@ +@@ -18,7 +18,7 @@ + import 'native_assets.dart'; /// The only files/subdirectories we care out. - const List _kLinuxArtifacts = [ -- 'libflutter_linux_gtk.so', - ]; +-const List _kLinuxArtifacts = ['libflutter_linux_gtk.so']; ++const List _kLinuxArtifacts = []; const String _kLinuxDepfile = 'linux_engine_sources.d'; -@@ -79,10 +78,6 @@ + +@@ -76,10 +76,6 @@ outputDirectory: outputDirectory, artifacts: _kLinuxArtifacts, clientSourcePaths: [headersPath], - icuDataPath: environment.artifacts.getArtifactPath( - Artifact.icuData, - platform: targetPlatform, -- ) +- ), ); - final DepfileService depfileService = DepfileService( - fileSystem: environment.fileSystem, + environment.depFileService.writeToFile(depfile, environment.buildDir.childFile(_kLinuxDepfile)); + } diff --git a/testing/flutter/version.patch b/testing/flutter/version.patch index d9690a2cfa9..6eae25cb3d3 100644 --- a/testing/flutter/version.patch +++ b/testing/flutter/version.patch @@ -1,6 +1,6 @@ --- ./packages/flutter_tools/lib/src/version.dart.orig +++ ./packages/flutter_tools/lib/src/version.dart -@@ -91,7 +91,7 @@ +@@ -76,7 +76,7 @@ }) { final File versionFile = getVersionFile(fs, flutterRoot); @@ -9,7 +9,7 @@ final _FlutterVersionFromFile? version = _FlutterVersionFromFile.tryParseFromFile( versionFile, flutterRoot: flutterRoot, -@@ -110,11 +110,7 @@ +@@ -95,11 +95,7 @@ } } @@ -22,16 +22,17 @@ return FlutterVersion.fromRevision( clock: clock, -@@ -145,7 +141,7 @@ +@@ -127,7 +123,8 @@ workingDirectory: flutterRoot, fetchTags: fetchTags, ); - final String frameworkVersion = gitTagVersion.frameworkVersionFor(frameworkRevision); -+ final String frameworkVersion = globals.fs.file(globals.fs.path.join(Cache.flutterRoot!, 'version')).readAsStringSync(); ++ final String frameworkVersion = ++ globals.fs.file(globals.fs.path.join(Cache.flutterRoot!, 'version')).readAsStringSync(); return _FlutterVersionGit._( clock: clock, flutterRoot: flutterRoot, -@@ -217,11 +213,7 @@ +@@ -192,11 +189,7 @@ // TODO(fujino): calculate this relative to frameworkCommitDate for // _FlutterVersionFromFile so we don't need a git call. String get frameworkAge { @@ -44,12 +45,15 @@ } void ensureVersionFile(); -@@ -301,43 +293,7 @@ +@@ -281,44 +274,7 @@ /// Returns null if the cached version is out-of-date or missing, and we are /// unable to reach the server to get the latest version. Future _getLatestAvailableFlutterDate() async { - globals.cache.checkLockAcquired(); -- final VersionCheckStamp versionCheckStamp = await VersionCheckStamp.load(globals.cache, globals.logger); +- final VersionCheckStamp versionCheckStamp = await VersionCheckStamp.load( +- globals.cache, +- globals.logger, +- ); - - final DateTime now = _clock.now(); - if (versionCheckStamp.lastTimeVersionWasChecked != null) { @@ -80,16 +84,14 @@ - globals.printTrace('Failed to check Flutter version in the remote repository: $error'); - // Still update the timestamp to avoid us hitting the server on every single - // command if for some reason we cannot connect (eg. we may be offline). -- await versionCheckStamp.store( -- newTimeVersionWasChecked: now, -- ); +- await versionCheckStamp.store(newTimeVersionWasChecked: now); - return null; - } + return null; } /// The date of the latest framework commit in the remote repository. -@@ -421,32 +377,13 @@ +@@ -404,30 +360,13 @@ bool lenient = false, required String? workingDirectory, }) { @@ -103,94 +105,95 @@ - try { - // Don't plumb 'lenient' through directly so that we can print an error - // if something goes wrong. -- return _runSync( -- args, -- lenient: false, -- workingDirectory: workingDirectory, -- ); +- return _runSync(args, lenient: false, workingDirectory: workingDirectory); - } on VersionCheckError catch (e) { - if (lenient) { - final DateTime dummyDate = DateTime.fromMillisecondsSinceEpoch(0); -- globals.printError('Failed to find the latest git commit date: $e\n' -- 'Returning $dummyDate instead.'); +- globals.printError( +- 'Failed to find the latest git commit date: $e\n' +- 'Returning $dummyDate instead.', +- ); - // Return something that DateTime.parse() can parse. - return dummyDate.toString(); - } else { - rethrow; - } - } -+ final File versionFile = globals.fs.file(globals.fs.path.join(workingDirectory!, 'bin', 'cache', 'flutter.version.json')); ++ final File versionFile = globals.fs.file( ++ globals.fs.path.join(workingDirectory!, 'bin', 'cache', 'flutter.version.json'), ++ ); + -+ final _FlutterVersionFromFile version = _FlutterVersionFromFile.tryParseFromFile( -+ versionFile, -+ flutterRoot: workingDirectory, -+ )!; ++ final _FlutterVersionFromFile version = ++ _FlutterVersionFromFile.tryParseFromFile(versionFile, flutterRoot: workingDirectory)!; + return version.frameworkCommitDate; } class _FlutterVersionFromFile extends FlutterVersion { -@@ -472,11 +472,6 @@ +@@ -513,9 +452,7 @@ + final String devToolsVersion; @override - void ensureVersionFile() { -- _ensureLegacyVersionFile( -- fs: fs, -- flutterRoot: flutterRoot, -- frameworkVersion: frameworkVersion, -- ); - } +- void ensureVersionFile() { +- _ensureLegacyVersionFile(fs: fs, flutterRoot: flutterRoot, frameworkVersion: frameworkVersion); +- } ++ void ensureVersionFile() {} } -@@ -544,17 +539,6 @@ + class _FlutterVersionGit extends FlutterVersion { +@@ -586,27 +523,14 @@ + } @override - void ensureVersionFile() { -- _ensureLegacyVersionFile( -- fs: fs, -- flutterRoot: flutterRoot, -- frameworkVersion: frameworkVersion, -- ); +- void ensureVersionFile() { +- _ensureLegacyVersionFile(fs: fs, flutterRoot: flutterRoot, frameworkVersion: frameworkVersion); - - const JsonEncoder encoder = JsonEncoder.withIndent(' '); - final File newVersionFile = FlutterVersion.getVersionFile(fs, flutterRoot); - if (!newVersionFile.existsSync()) { - newVersionFile.writeAsStringSync(encoder.convert(toJson())); - } - } +- } ++ void ensureVersionFile() {} } -@@ -563,10 +547,6 @@ + void _ensureLegacyVersionFile({ + required FileSystem fs, required String flutterRoot, required String frameworkVersion, - }) { +-}) { - final File legacyVersionFile = fs.file(fs.path.join(flutterRoot, 'version')); - if (!legacyVersionFile.existsSync()) { - legacyVersionFile.writeAsStringSync(frameworkVersion); - } - } +-} ++}) {} /// Checks if the provided [version] is tracking a standard remote. -@@ -639,49 +566,7 @@ + /// +@@ -632,52 +556,6 @@ /// /// Returns [VersionCheckError] if the tracking remote is not standard. - VersionCheckError? run(){ + VersionCheckError? run() { - final String? flutterGit = platform.environment['FLUTTER_GIT_URL']; - final String? repositoryUrl = version.repositoryUrl; - - if (repositoryUrl == null) { - return VersionCheckError( - 'The tool could not determine the remote upstream which is being ' -- 'tracked by the SDK.' +- 'tracked by the SDK.', - ); - } - - // Strip `.git` suffix before comparing the remotes -- final List sanitizedStandardRemotes = [ -- // If `FLUTTER_GIT_URL` is set, use that as standard remote. -- if (flutterGit != null) flutterGit -- // Else use the predefined standard remotes. -- else ..._standardRemotes, -- ].map((String remote) => stripDotGit(remote)).toList(); +- final List sanitizedStandardRemotes = +- [ +- // If `FLUTTER_GIT_URL` is set, use that as standard remote. +- if (flutterGit != null) +- flutterGit +- // Else use the predefined standard remotes. +- else +- ..._standardRemotes, +- ].map((String remote) => stripDotGit(remote)).toList(); - - final String sanitizedRepositoryUrl = stripDotGit(repositoryUrl); - @@ -205,7 +208,7 @@ - 'Either remove "FLUTTER_GIT_URL" from the environment or set it to ' - '"$repositoryUrl". ' - 'If this is intentional, it is recommended to use "git" directly to ' -- 'manage the SDK.' +- 'manage the SDK.', - ); - } - // If `FLUTTER_GIT_URL` is unset, inform to set the environment variable. @@ -214,26 +217,22 @@ - 'Set the environment variable "FLUTTER_GIT_URL" to ' - '"$repositoryUrl". ' - 'If this is intentional, it is recommended to use "git" directly to ' -- 'manage the SDK.' +- 'manage the SDK.', - ); - } -+ // the worse shit any code says about us, the worse for that code. return null; } -@@ -853,10 +738,7 @@ +@@ -844,7 +722,7 @@ } String _runGit(String command, ProcessUtils processUtils, String? workingDirectory) { -- return processUtils.runSync( -- command.split(' '), -- workingDirectory: workingDirectory, -- ).stdout.trim(); +- return processUtils.runSync(command.split(' '), workingDirectory: workingDirectory).stdout.trim(); + return ''; } /// Runs [command] in the root of the Flutter installation and returns the -@@ -880,7 +762,7 @@ +@@ -871,7 +749,7 @@ if (revision == null) { return ''; } @@ -242,22 +241,30 @@ } /// Version of Flutter SDK parsed from Git. -@@ -941,42 +823,10 @@ +@@ -932,46 +810,10 @@ bool fetchTags = false, - String gitRef = 'HEAD' + String gitRef = 'HEAD', }) { - if (fetchTags) { -- final String channel = _runGit('git symbolic-ref --short HEAD', processUtils, workingDirectory); +- final String channel = _runGit( +- 'git symbolic-ref --short HEAD', +- processUtils, +- workingDirectory, +- ); - if (!kDevelopmentChannels.contains(channel) && kOfficialChannels.contains(channel)) { - globals.printTrace('Skipping request to fetchTags - on well known channel $channel.'); - } else { -- final String flutterGit = platform.environment['FLUTTER_GIT_URL'] ?? 'https://github.com/flutter/flutter.git'; +- final String flutterGit = +- platform.environment['FLUTTER_GIT_URL'] ?? 'https://github.com/flutter/flutter.git'; - _runGit('git fetch $flutterGit --tags -f', processUtils, workingDirectory); - } - } - // find all tags attached to the given [gitRef] - final List tags = _runGit( -- 'git tag --points-at $gitRef', processUtils, workingDirectory).trim().split('\n'); +- 'git tag --points-at $gitRef', +- processUtils, +- workingDirectory, +- ).trim().split('\n'); - - // Check first for a stable tag - final RegExp stableTagPattern = RegExp(r'^\d+\.\d+\.\d+$'); @@ -277,12 +284,8 @@ // If we're not currently on a tag, use git describe to find the most // recent tag and number of commits past. return parse( -- _runGit( -- 'git describe --match *.*.* --long --tags $gitRef', -- processUtils, -- workingDirectory, -- ) -+ globals.fs.file(globals.fs.path.join(Cache.flutterRoot!, 'version')).readAsStringSync() +- _runGit('git describe --match *.*.* --long --tags $gitRef', processUtils, workingDirectory), ++ globals.fs.file(globals.fs.path.join(Cache.flutterRoot!, 'version')).readAsStringSync(), ); } - \ No newline at end of file +