diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2021-01-28 12:23:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-28 12:23:51 +0000 |
commit | 2e6c34fd11a81b4e3ef73df28a1b4b605a51e776 (patch) | |
tree | d5b702bb4a16ec61c680fd49321596d0fe001506 /pkgs/development/compilers | |
parent | 99c044f4e2090627c38b4a5ff0b266b18200db2d (diff) | |
parent | b43756e22b3128f9415fdcd954a5b1e3b865680a (diff) |
Merge master into staging-next
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r-- | pkgs/development/compilers/flutter/default.nix | 40 | ||||
-rw-r--r-- | pkgs/development/compilers/flutter/flutter.nix | 53 | ||||
-rw-r--r-- | pkgs/development/compilers/flutter/patches/dev/disable-auto-update.patch | 31 | ||||
-rw-r--r-- | pkgs/development/compilers/flutter/patches/dev/move-cache.patch | 64 | ||||
-rw-r--r-- | pkgs/development/compilers/flutter/patches/disable-auto-update.patch (renamed from pkgs/development/compilers/flutter/patches/stable/disable-auto-update.patch) | 0 | ||||
-rw-r--r-- | pkgs/development/compilers/flutter/patches/move-cache.patch (renamed from pkgs/development/compilers/flutter/patches/stable/move-cache.patch) | 0 | ||||
-rw-r--r-- | pkgs/development/compilers/flutter/repository.nix | 24 |
7 files changed, 62 insertions, 150 deletions
diff --git a/pkgs/development/compilers/flutter/default.nix b/pkgs/development/compilers/flutter/default.nix index 3eea7f596b6b..8572040cb0cd 100644 --- a/pkgs/development/compilers/flutter/default.nix +++ b/pkgs/development/compilers/flutter/default.nix @@ -1,40 +1,24 @@ -{ callPackage, dart }: +{ callPackage, fetchurl, dart }: + let - dart_stable = dart.override { version = "2.10.0"; }; - dart_beta = dart.override { version = "2.10.0"; }; - dart_dev = dart.override { version = "2.11.0-161.0.dev"; }; mkFlutter = opts: callPackage (import ./flutter.nix opts) { }; getPatches = dir: let files = builtins.attrNames (builtins.readDir dir); in map (f: dir + ("/" + f)) files; + version = "1.22.5"; + channel = "stable"; + filename = "flutter_linux_${version}-${channel}.tar.xz"; in { mkFlutter = mkFlutter; stable = mkFlutter rec { + inherit dart version; pname = "flutter"; - channel = "stable"; - version = "1.22.0"; - filename = "flutter_linux_${version}-${channel}.tar.xz"; - sha256Hash = "0ryrx458ss8ryhmspcfrhjvad2pl46bxh1qk5vzwzhxiqdc79vm8"; - patches = getPatches ./patches/stable; - dart = dart_stable; - }; - beta = mkFlutter rec { - pname = "flutter"; - channel = "beta"; - version = "1.22.0-12.3.pre"; - filename = "flutter_linux_${version}-${channel}.tar.xz"; - sha256Hash = "1axzz137z4lgpa09h7bjf52i6dij6a9wmjbha1182db23r09plzh"; - patches = getPatches ./patches/stable; - dart = dart_beta; - }; - dev = mkFlutter rec { - pname = "flutter"; - channel = "dev"; - version = "1.23.0-7.0.pre"; - filename = "flutter_linux_${version}-${channel}.tar.xz"; - sha256Hash = "166qb4qbv051bc71yj7c0vrkamhvzz3fp3mz318qzm947mydwjj5"; - patches = getPatches ./patches/dev; - dart = dart_dev; + patches = getPatches ./patches; + src = fetchurl { + url = "https://storage.googleapis.com/flutter_infra/releases/${channel}/linux/${filename}"; + sha256 = "1dv5kczcj9npf7xxlanmpc9ijnxa3ap46521cxn14c0i3y9295ja"; + }; + depsSha256 = "0d7vhk6axgqajy2d9ia9lc6awcnz6cc3n04r7hnh7bx4hb0jv0l1"; }; } diff --git a/pkgs/development/compilers/flutter/flutter.nix b/pkgs/development/compilers/flutter/flutter.nix index a7ec87322507..e3fcf77e391c 100644 --- a/pkgs/development/compilers/flutter/flutter.nix +++ b/pkgs/development/compilers/flutter/flutter.nix @@ -1,10 +1,9 @@ -{ channel -, pname +{ pname , version -, sha256Hash , patches , dart -, filename ? "flutter_linux_${version}-${channel}.tar.xz" +, src +, depsSha256 }: { bash @@ -13,7 +12,8 @@ , coreutils , git , runCommand -, lib, stdenv +, stdenv +, lib , fetchurl , alsaLib , dbus @@ -30,21 +30,20 @@ , nspr , nss , systemd +, callPackage }: let - drvName = "flutter-${channel}-${version}"; + repository = callPackage ./repository.nix { + inherit src pname version dart depsSha256; + }; + drvName = "flutter-${version}"; + flutter = stdenv.mkDerivation { name = "${drvName}-unwrapped"; - src = fetchurl { - url = - "https://storage.googleapis.com/flutter_infra/releases/${channel}/linux/${filename}"; - sha256 = sha256Hash; - }; - - buildInputs = [ git ]; + buildInputs = [ git repository ]; - inherit patches; + inherit src patches; postPatch = '' patchShebangs --build ./bin/ @@ -52,25 +51,25 @@ let ''; 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="${dart}" + export FLUTTER_ROOT="$(pwd)" + export FLUTTER_TOOLS_DIR="$FLUTTER_ROOT/packages/flutter_tools" + export SCRIPT_PATH="$FLUTTER_TOOLS_DIR/bin/flutter_tools.dart" - HOME=../.. # required for pub upgrade --offline, ~/.pub-cache - # path is relative otherwise it's replaced by /build/flutter + mkdir -p "$out/bin/cache" + export SNAPSHOT_PATH="$out/bin/cache/flutter_tools.snapshot" + export STAMP_PATH="$out/bin/cache/flutter_tools.stamp" - (cd "$FLUTTER_TOOLS_DIR" && ${dart}/bin/pub upgrade --offline) + export DART_SDK_PATH="${dart}" + export PUB_CACHE="${repository}" + + pushd "$FLUTTER_TOOLS_DIR" + ${dart}/bin/pub get --offline + popd local revision="$(cd "$FLUTTER_ROOT"; git rev-parse HEAD)" ${dart}/bin/dart --snapshot="$SNAPSHOT_PATH" --packages="$FLUTTER_TOOLS_DIR/.packages" "$SCRIPT_PATH" echo "$revision" > "$STAMP_PATH" echo -n "${version}" > version - - rm -rf bin/cache/{artifacts,dart-sdk,downloads} - rm -f bin/cache/*.stamp ''; installPhase = '' @@ -146,7 +145,7 @@ runCommand drvName homepage = "https://flutter.dev"; license = licenses.bsd3; platforms = [ "x86_64-linux" ]; - maintainers = with maintainers; [ babariviere ericdallo ]; + maintainers = with maintainers; [ babariviere ericdallo thiagokokada ]; }; } '' mkdir -p $out/bin diff --git a/pkgs/development/compilers/flutter/patches/dev/disable-auto-update.patch b/pkgs/development/compilers/flutter/patches/dev/disable-auto-update.patch deleted file mode 100644 index f9ac00d1d323..000000000000 --- a/pkgs/development/compilers/flutter/patches/dev/disable-auto-update.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff --git a/bin/internal/shared.sh b/bin/internal/shared.sh -index 22efe87443..c6954575c5 100644 ---- a/bin/internal/shared.sh -+++ b/bin/internal/shared.sh -@@ -212,8 +212,6 @@ function shared::execute() { - # FLUTTER_TOOL_ARGS="--enable-asserts $FLUTTER_TOOL_ARGS" - # FLUTTER_TOOL_ARGS="$FLUTTER_TOOL_ARGS --observe=65432" - -- upgrade_flutter 7< "$PROG_NAME" -- - BIN_NAME="$(basename "$PROG_NAME")" - case "$BIN_NAME" in - flutter*) -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 fb1616ba96..b973b3fd58 100644 ---- a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart -+++ b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart -@@ -291,13 +291,6 @@ class FlutterCommandRunner extends CommandRunner<void> { - globals.flutterUsage.suppressAnalytics = true; - } - -- 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(); diff --git a/pkgs/development/compilers/flutter/patches/dev/move-cache.patch b/pkgs/development/compilers/flutter/patches/dev/move-cache.patch deleted file mode 100644 index eb6ff5cf582e..000000000000 --- a/pkgs/development/compilers/flutter/patches/dev/move-cache.patch +++ /dev/null @@ -1,64 +0,0 @@ -diff --git a/dev/devicelab/lib/framework/runner.dart b/dev/devicelab/lib/framework/runner.dart -index a059a8e992..b664a7070c 100644 ---- a/dev/devicelab/lib/framework/runner.dart -+++ b/dev/devicelab/lib/framework/runner.dart -@@ -137,7 +137,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 36714c5fb4..c0cc049ee1 100644 ---- a/packages/flutter_tools/lib/src/asset.dart -+++ b/packages/flutter_tools/lib/src/asset.dart -@@ -6,6 +6,7 @@ import 'package:meta/meta.dart'; - import 'package:package_config/package_config.dart'; - import 'package:yaml/yaml.dart'; - -+import 'base/common.dart'; - import 'base/context.dart'; - import 'base/file_system.dart'; - import 'base/utils.dart'; -@@ -397,7 +398,7 @@ List<_Asset> _getMaterialAssets(String fontSet) { - for (final Map<dynamic, dynamic> font in (family['fonts'] as List<dynamic>).cast<Map<dynamic, dynamic>>()) { - 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, - package: null, -diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart -index aaca036d78..43ff428f8d 100644 ---- a/packages/flutter_tools/lib/src/cache.dart -+++ b/packages/flutter_tools/lib/src/cache.dart -@@ -226,8 +226,15 @@ 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) { -@@ -330,7 +337,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')); - } - } - diff --git a/pkgs/development/compilers/flutter/patches/stable/disable-auto-update.patch b/pkgs/development/compilers/flutter/patches/disable-auto-update.patch index 35ce5b367350..35ce5b367350 100644 --- a/pkgs/development/compilers/flutter/patches/stable/disable-auto-update.patch +++ b/pkgs/development/compilers/flutter/patches/disable-auto-update.patch diff --git a/pkgs/development/compilers/flutter/patches/stable/move-cache.patch b/pkgs/development/compilers/flutter/patches/move-cache.patch index dc77496edb31..dc77496edb31 100644 --- a/pkgs/development/compilers/flutter/patches/stable/move-cache.patch +++ b/pkgs/development/compilers/flutter/patches/move-cache.patch diff --git a/pkgs/development/compilers/flutter/repository.nix b/pkgs/development/compilers/flutter/repository.nix new file mode 100644 index 000000000000..0f8de0a912f1 --- /dev/null +++ b/pkgs/development/compilers/flutter/repository.nix @@ -0,0 +1,24 @@ +{ lib, stdenv, dart, fetchurl, src, pname, version, depsSha256 }: + +stdenv.mkDerivation { + inherit src version; + + pname = "${pname}-deps"; + buildInputs = [ dart ]; + + buildPhase = '' + export PUB_CACHE="$out" + export FLUTTER_ROOT="$(pwd)" + export FLUTTER_TOOLS_DIR="$FLUTTER_ROOT/packages/flutter_tools" + + pushd "$FLUTTER_TOOLS_DIR" + ${dart}/bin/pub get + ''; + + dontInstall = true; + dontFixup = true; + + outputHashAlgo = "sha256"; + outputHashMode = "recursive"; + outputHash = depsSha256; +} |