-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
flutter: init 1.12.13+hotfix.8 #76420
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| { callPackage }: | ||
|
|
||
| let | ||
| mkFlutter = opts: callPackage (import ./flutter.nix opts) { }; | ||
| getPatches = dir: | ||
| let files = builtins.attrNames (builtins.readDir dir); | ||
| in map (f: dir + ("/" + f)) files; | ||
| in { | ||
| stable = mkFlutter { | ||
| pname = "flutter"; | ||
| channel = "stable"; | ||
| version = "1.12.13+hotfix.8"; | ||
| sha256Hash = "01ik4xckr3fp65sq4g0g6wy5b9i0r49l643xmbxa6z9k21sby46d"; | ||
| patches = getPatches ./patches/stable; | ||
| }; | ||
| beta = mkFlutter { | ||
| pname = "flutter-beta"; | ||
| channel = "beta"; | ||
| version = "1.14.6"; | ||
| sha256Hash = "1a79pr741zkr39p5gc3p9x59d70vm60hpz2crgc53ysglj4ycigy"; | ||
| patches = getPatches ./patches/beta; | ||
| }; | ||
| dev = mkFlutter { | ||
| pname = "flutter-dev"; | ||
| channel = "dev"; | ||
| version = "1.15.3"; | ||
| sha256Hash = "06mawwqf7q7wdmzlyxlrlblhnnk4ckf3vp92lplippdh3d52r93i"; | ||
| patches = getPatches ./patches/dev; | ||
| }; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| { channel, pname, version, sha256Hash, patches }: | ||
|
|
||
| { bash, buildFHSUserEnv, cacert, coreutils, git, makeWrapper, runCommand, stdenv | ||
| , fetchurl, alsaLib, dbus, expat, libpulseaudio, libuuid, libX11, libxcb | ||
| , libXcomposite, libXcursor, libXdamage, libXfixes, libGL, nspr, nss, systemd }: | ||
|
|
||
| let | ||
| drvName = "flutter-${channel}-${version}"; | ||
| flutter = stdenv.mkDerivation { | ||
| name = "${drvName}-unwrapped"; | ||
|
|
||
| src = fetchurl { | ||
| url = | ||
| "https://storage.googleapis.com/flutter_infra/releases/${channel}/linux/flutter_linux_v${version}-${channel}.tar.xz"; | ||
| sha256 = sha256Hash; | ||
| }; | ||
|
|
||
| buildInputs = [ makeWrapper git ]; | ||
|
|
||
| inherit patches; | ||
|
|
||
| postPatch = '' | ||
| patchShebangs --build ./bin/ | ||
| find ./bin/ -executable -type f -exec patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) {} \; | ||
| ''; | ||
|
|
||
| buildPhase = '' | ||
| FLUTTER_ROOT=$(pwd) | ||
| FLUTTER_TOOLS_DIR="$FLUTTER_ROOT/packages/flutter_tools" | ||
| SNAPSHOT_PATH="$FLUTTER_ROOT/bin/cache/flutter_tools.snapshot" | ||
| STAMP_PATH="$FLUTTER_ROOT/bin/cache/flutter_tools.stamp" | ||
| SCRIPT_PATH="$FLUTTER_TOOLS_DIR/bin/flutter_tools.dart" | ||
| DART_SDK_PATH="$FLUTTER_ROOT/bin/cache/dart-sdk" | ||
|
|
||
| DART="$DART_SDK_PATH/bin/dart" | ||
| PUB="$DART_SDK_PATH/bin/pub" | ||
|
|
||
| HOME=../.. # required for pub upgrade --offline, ~/.pub-cache | ||
| # path is relative otherwise it's replaced by /build/flutter | ||
|
|
||
| (cd "$FLUTTER_TOOLS_DIR" && "$PUB" upgrade --offline) | ||
|
|
||
| local revision="$(cd "$FLUTTER_ROOT"; git rev-parse HEAD)" | ||
| "$DART" --snapshot="$SNAPSHOT_PATH" --packages="$FLUTTER_TOOLS_DIR/.packages" "$SCRIPT_PATH" | ||
| echo "$revision" > "$STAMP_PATH" | ||
| echo -n "${version}" > version | ||
|
|
||
| rm -rf bin/cache/{artifacts,downloads} | ||
| rm -f bin/cache/*.stamp | ||
| ''; | ||
|
|
||
| installPhase = '' | ||
| mkdir -p $out | ||
| cp -r . $out | ||
| ''; | ||
| }; | ||
|
|
||
| # Wrap flutter inside an fhs user env to allow execution of binary, | ||
| # like adb from $ANDROID_HOME or java from android-studio. | ||
| fhsEnv = buildFHSUserEnv { | ||
| name = "${drvName}-fhs-env"; | ||
| multiPkgs = pkgs: [ | ||
| # Flutter only use these certificates | ||
| (runCommand "fedoracert" { } '' | ||
| mkdir -p $out/etc/pki/tls/ | ||
| ln -s ${cacert}/etc/ssl/certs $out/etc/pki/tls/certs | ||
| '') | ||
| pkgs.zlib | ||
| ]; | ||
| targetPkgs = pkgs: | ||
| with pkgs; [ | ||
| bash | ||
| curl | ||
| git | ||
| unzip | ||
| which | ||
| xz | ||
|
|
||
| # flutter test requires this lib | ||
| libGLU | ||
|
|
||
| # for android emulator | ||
| alsaLib | ||
| dbus | ||
| expat | ||
| libpulseaudio | ||
| libuuid | ||
| libX11 | ||
| libxcb | ||
| libXcomposite | ||
| libXcursor | ||
| libXdamage | ||
| libXfixes | ||
| libGL | ||
| nspr | ||
| nss | ||
| systemd | ||
| ]; | ||
| }; | ||
|
|
||
| in runCommand drvName { | ||
| startScript = '' | ||
| #!${bash}/bin/bash | ||
| export PUB_CACHE=''${PUB_CACHE:-"$HOME/.pub-cache"} | ||
| export ANDROID_EMULATOR_USE_SYSTEM_LIBS=1 | ||
| ${fhsEnv}/bin/${drvName}-fhs-env ${flutter}/bin/flutter --no-version-check "$@" | ||
| ''; | ||
| preferLocalBuild = true; | ||
| allowSubstitutes = false; | ||
| passthru = { unwrapped = flutter; }; | ||
| meta = with stdenv.lib; { | ||
| description = | ||
| "Flutter is Google's SDK for building mobile, web and desktop with Dart."; | ||
| longDescription = '' | ||
| Flutter is Google’s UI toolkit for building beautiful, | ||
| natively compiled applications for mobile, web, and desktop from a single codebase. | ||
| ''; | ||
| homepage = "https://flutter.dev"; | ||
| license = licenses.bsd3; | ||
| platforms = [ "x86_64-linux" ]; | ||
| maintainers = with maintainers; [ babariviere ]; | ||
| }; | ||
| } '' | ||
| mkdir -p $out/bin | ||
|
|
||
| echo -n "$startScript" > $out/bin/${pname} | ||
| chmod +x $out/bin/${pname} | ||
| '' |
31 changes: 31 additions & 0 deletions
31
pkgs/development/compilers/flutter/patches/beta/disable-auto-update.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| diff --git a/bin/flutter b/bin/flutter | ||
| index e0c18e235..2c3fb7ddd 100755 | ||
| --- a/bin/flutter | ||
| +++ b/bin/flutter | ||
| @@ -185,8 +185,6 @@ fi | ||
| # FLUTTER_TOOL_ARGS="--enable-asserts $FLUTTER_TOOL_ARGS" | ||
| # FLUTTER_TOOL_ARGS="$FLUTTER_TOOL_ARGS --observe=65432" | ||
|
|
||
| -(upgrade_flutter) 3< "$PROG_NAME" | ||
| - | ||
| # FLUTTER_TOOL_ARGS isn't quoted below, because it is meant to be considered as | ||
| # separate space-separated args. | ||
| "$DART" --packages="$FLUTTER_TOOLS_DIR/.packages" $FLUTTER_TOOL_ARGS "$SNAPSHOT_PATH" "$@" | ||
| diff --git a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart | ||
| index 99455ae64..f5b0cb59c 100644 | ||
| --- a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart | ||
| +++ b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart | ||
| @@ -301,13 +301,6 @@ class FlutterCommandRunner extends CommandRunner<void> { | ||
| } | ||
|
|
||
| _checkFlutterCopy(); | ||
| - try { | ||
| - await globals.flutterVersion.ensureVersionFile(); | ||
| - } on FileSystemException catch (e) { | ||
| - globals.printError('Failed to write the version file to the artifact cache: "$e".'); | ||
| - globals.printError('Please ensure you have permissions in the artifact cache directory.'); | ||
| - throwToolExit('Failed to write the version file'); | ||
| - } | ||
| final bool machineFlag = topLevelResults['machine'] as bool; | ||
| if (topLevelResults.command?.name != 'upgrade' && topLevelResults['version-check'] as bool && !machineFlag) { | ||
| await globals.flutterVersion.checkFlutterVersionFreshness(); |
63 changes: 63 additions & 0 deletions
63
pkgs/development/compilers/flutter/patches/beta/move-cache.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| diff --git a/dev/devicelab/lib/framework/runner.dart b/dev/devicelab/lib/framework/runner.dart | ||
| index 8e511eefd..fbc7d6ac3 100644 | ||
| --- a/dev/devicelab/lib/framework/runner.dart | ||
| +++ b/dev/devicelab/lib/framework/runner.dart | ||
| @@ -126,7 +126,7 @@ Future<void> cleanupSystem() async { | ||
| print('\nTelling Gradle to shut down (JAVA_HOME=$javaHome)'); | ||
| final String gradlewBinaryName = Platform.isWindows ? 'gradlew.bat' : 'gradlew'; | ||
| final Directory tempDir = Directory.systemTemp.createTempSync('flutter_devicelab_shutdown_gradle.'); | ||
| - recursiveCopy(Directory(path.join(flutterDirectory.path, 'bin', 'cache', 'artifacts', 'gradle_wrapper')), tempDir); | ||
| + recursiveCopy(Directory(path.join(homeDirPath, '.cache', 'flutter', 'artifacts', 'gradle_wrapper')), tempDir); | ||
| copy(File(path.join(path.join(flutterDirectory.path, 'packages', 'flutter_tools'), 'templates', 'app', 'android.tmpl', 'gradle', 'wrapper', 'gradle-wrapper.properties')), Directory(path.join(tempDir.path, 'gradle', 'wrapper'))); | ||
| if (!Platform.isWindows) { | ||
| await exec( | ||
| diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart | ||
| index 79b06949f..9040ba0a8 100644 | ||
| --- a/packages/flutter_tools/lib/src/asset.dart | ||
| +++ b/packages/flutter_tools/lib/src/asset.dart | ||
| @@ -6,6 +6,7 @@ import 'dart:async'; | ||
|
|
||
| import 'package:yaml/yaml.dart'; | ||
|
|
||
| +import 'base/common.dart'; | ||
| import 'base/context.dart'; | ||
| import 'base/file_system.dart'; | ||
| import 'base/utils.dart'; | ||
| @@ -325,7 +326,7 @@ List<_Asset> _getMaterialAssets(String fontSet) { | ||
| for (final Map<dynamic, dynamic> font in family['fonts']) { | ||
| final Uri entryUri = globals.fs.path.toUri(font['asset'] as String); | ||
| result.add(_Asset( | ||
| - baseDir: globals.fs.path.join(Cache.flutterRoot, 'bin', 'cache', 'artifacts', 'material_fonts'), | ||
| + baseDir: globals.fs.path.join(homeDirPath, '.cache', 'flutter', 'artifacts', 'material_fonts'), | ||
| relativeUri: Uri(path: entryUri.pathSegments.last), | ||
| entryUri: entryUri, | ||
| )); | ||
| diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart | ||
| index 715189938..5afb2a0db 100644 | ||
| --- a/packages/flutter_tools/lib/src/cache.dart | ||
| +++ b/packages/flutter_tools/lib/src/cache.dart | ||
| @@ -189,8 +189,14 @@ class Cache { | ||
| return; | ||
| } | ||
| assert(_lock == null); | ||
| + | ||
| + final Directory dir = globals.fs.directory(globals.fs.path.join(homeDirPath, '.cache', 'flutter')); | ||
| + if (!dir.existsSync()) { | ||
| + dir.createSync(recursive: true); | ||
| + os.chmod(dir, '755'); | ||
| + } | ||
| final File lockFile = | ||
| - globals.fs.file(globals.fs.path.join(flutterRoot, 'bin', 'cache', 'lockfile')); | ||
| + globals.fs.file(globals.fs.path.join(homeDirPath, '.cache', 'flutter', 'lockfile')); | ||
| try { | ||
| _lock = lockFile.openSync(mode: FileMode.write); | ||
| } on FileSystemException catch (e) { | ||
| @@ -290,7 +296,7 @@ class Cache { | ||
| if (_rootOverride != null) { | ||
| return _fileSystem.directory(_fileSystem.path.join(_rootOverride.path, 'bin', 'cache')); | ||
| } else { | ||
| - return _fileSystem.directory(_fileSystem.path.join(flutterRoot, 'bin', 'cache')); | ||
| + return _fileSystem.directory(_fileSystem.path.join(homeDirPath, '.cache', 'flutter')); | ||
| } | ||
| } | ||
|
|
1 change: 1 addition & 0 deletions
1
pkgs/development/compilers/flutter/patches/dev/disable-auto-update.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../beta/disable-auto-update.patch |
63 changes: 63 additions & 0 deletions
63
pkgs/development/compilers/flutter/patches/dev/move-cache.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| diff --git a/dev/devicelab/lib/framework/runner.dart b/dev/devicelab/lib/framework/runner.dart | ||
| index 8e511eefd..fbc7d6ac3 100644 | ||
| --- a/dev/devicelab/lib/framework/runner.dart | ||
| +++ b/dev/devicelab/lib/framework/runner.dart | ||
| @@ -126,7 +126,7 @@ Future<void> cleanupSystem() async { | ||
| print('\nTelling Gradle to shut down (JAVA_HOME=$javaHome)'); | ||
| final String gradlewBinaryName = Platform.isWindows ? 'gradlew.bat' : 'gradlew'; | ||
| final Directory tempDir = Directory.systemTemp.createTempSync('flutter_devicelab_shutdown_gradle.'); | ||
| - recursiveCopy(Directory(path.join(flutterDirectory.path, 'bin', 'cache', 'artifacts', 'gradle_wrapper')), tempDir); | ||
| + recursiveCopy(Directory(path.join(globals.fsUtils.homeDirPath, '.cache', 'flutter', 'artifacts', 'gradle_wrapper')), tempDir); | ||
| copy(File(path.join(path.join(flutterDirectory.path, 'packages', 'flutter_tools'), 'templates', 'app', 'android.tmpl', 'gradle', 'wrapper', 'gradle-wrapper.properties')), Directory(path.join(tempDir.path, 'gradle', 'wrapper'))); | ||
| if (!Platform.isWindows) { | ||
| await exec( | ||
| diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart | ||
| index 79b06949f..9040ba0a8 100644 | ||
| --- a/packages/flutter_tools/lib/src/asset.dart | ||
| +++ b/packages/flutter_tools/lib/src/asset.dart | ||
| @@ -6,6 +6,7 @@ import 'dart:async'; | ||
|
|
||
| import 'package:yaml/yaml.dart'; | ||
|
|
||
| +import 'base/common.dart'; | ||
| import 'base/context.dart'; | ||
| import 'base/file_system.dart'; | ||
| import 'base/utils.dart'; | ||
| @@ -325,7 +326,7 @@ List<_Asset> _getMaterialAssets(String fontSet) { | ||
| for (final Map<dynamic, dynamic> font in family['fonts']) { | ||
| final Uri entryUri = globals.fs.path.toUri(font['asset'] as String); | ||
| result.add(_Asset( | ||
| - baseDir: globals.fs.path.join(Cache.flutterRoot, 'bin', 'cache', 'artifacts', 'material_fonts'), | ||
| + baseDir: globals.fs.path.join(globals.fsUtils.homeDirPath, '.cache', 'flutter', 'artifacts', 'material_fonts'), | ||
| relativeUri: Uri(path: entryUri.pathSegments.last), | ||
| entryUri: entryUri, | ||
| )); | ||
| diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart | ||
| index 715189938..5afb2a0db 100644 | ||
| --- a/packages/flutter_tools/lib/src/cache.dart | ||
| +++ b/packages/flutter_tools/lib/src/cache.dart | ||
| @@ -189,8 +189,14 @@ class Cache { | ||
| return; | ||
| } | ||
| assert(_lock == null); | ||
| + | ||
| + final Directory dir = globals.fs.directory(globals.fs.path.join(globals.fsUtils.homeDirPath, '.cache', 'flutter')); | ||
| + if (!dir.existsSync()) { | ||
| + dir.createSync(recursive: true); | ||
| + globals.os.chmod(dir, '755'); | ||
| + } | ||
| final File lockFile = | ||
| - globals.fs.file(globals.fs.path.join(flutterRoot, 'bin', 'cache', 'lockfile')); | ||
| + globals.fs.file(globals.fs.path.join(globals.fsUtils.homeDirPath, '.cache', 'flutter', 'lockfile')); | ||
| try { | ||
| _lock = lockFile.openSync(mode: FileMode.write); | ||
| } on FileSystemException catch (e) { | ||
| @@ -290,7 +296,7 @@ class Cache { | ||
| if (_rootOverride != null) { | ||
| return _fileSystem.directory(_fileSystem.path.join(_rootOverride.path, 'bin', 'cache')); | ||
| } else { | ||
| - return _fileSystem.directory(_fileSystem.path.join(flutterRoot, 'bin', 'cache')); | ||
| + return _fileSystem.directory(_fileSystem.path.join(globals.fsUtils.homeDirPath, '.cache', 'flutter')); | ||
| } | ||
| } | ||
|
|
31 changes: 31 additions & 0 deletions
31
pkgs/development/compilers/flutter/patches/stable/disable-auto-update.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| diff --git a/bin/flutter b/bin/flutter | ||
| index 3955f8f39..1e7573d30 100755 | ||
| --- a/bin/flutter | ||
| +++ b/bin/flutter | ||
| @@ -185,8 +185,6 @@ fi | ||
| # FLUTTER_TOOL_ARGS="--enable-asserts $FLUTTER_TOOL_ARGS" | ||
| # FLUTTER_TOOL_ARGS="$FLUTTER_TOOL_ARGS --observe=65432" | ||
|
|
||
| -(upgrade_flutter) 3< "$PROG_NAME" | ||
| - | ||
| # FLUTTER_TOOL_ARGS isn't quoted below, because it is meant to be considered as | ||
| # separate space-separated args. | ||
| "$DART" --packages="$FLUTTER_TOOLS_DIR/.packages" $FLUTTER_TOOL_ARGS "$SNAPSHOT_PATH" "$@" | ||
| diff --git a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart | ||
| index 5e45819d9..ab748b059 100644 | ||
| --- a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart | ||
| +++ b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart | ||
| @@ -377,13 +377,6 @@ class FlutterCommandRunner extends CommandRunner<void> { | ||
| } | ||
|
|
||
| _checkFlutterCopy(); | ||
| - try { | ||
| - await FlutterVersion.instance.ensureVersionFile(); | ||
| - } on FileSystemException catch (e) { | ||
| - printError('Failed to write the version file to the artifact cache: "$e".'); | ||
| - printError('Please ensure you have permissions in the artifact cache directory.'); | ||
| - throwToolExit('Failed to write the version file'); | ||
| - } | ||
| if (topLevelResults.command?.name != 'upgrade' && topLevelResults['version-check'] as bool) { | ||
| await FlutterVersion.instance.checkFlutterVersionFreshness(); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.