Merge pull request #109477 from thiagokokada/flutter-dart-remove-non-stable-versions

This commit is contained in:
Sandro 2021-01-28 09:27:43 +01:00 committed by GitHub
commit 7c64ac5311
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 102 additions and 237 deletions

View file

@ -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";
};
}

View file

@ -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 repository ];
buildInputs = [ git ];
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

View file

@ -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();

View file

@ -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'));
}
}

View file

@ -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;
}

View file

@ -1,89 +1,42 @@
{ lib, stdenv, fetchurl, unzip, version ? "2.7.2" }:
let
sources = let
{ stdenv
, lib
, fetchurl
, unzip
, version ? "2.10.5"
, sources ?
let
base = "https://storage.googleapis.com/dart-archive/channels";
stable_version = "stable";
dev_version = "dev";
x86_64 = "x64";
i686 = "ia32";
aarch64 = "arm64";
# Make sure that if the user overrides version parameter they're
# also need to override sources, to avoid mistakes
version = "2.10.5";
in
{
"${version}-x86_64-darwin" = fetchurl {
url = "${base}/stable/release/${version}/sdk/dartsdk-macos-${x86_64}-release.zip";
sha256 = "1vb2m25w6v901id9syan9q69fa60sxxd7qpyzq21fn5dpah0g99i";
};
"${version}-x86_64-linux" = fetchurl {
url = "${base}/stable/release/${version}/sdk/dartsdk-linux-${x86_64}-release.zip";
sha256 = "1mb6m3vxjya1dz47mdna23c2015n3bz8dvz8fwggq6k3zp0a4dsh";
};
"${version}-i686-linux" = fetchurl {
url = "${base}/stable/release/${version}/sdk/dartsdk-linux-${i686}-release.zip";
sha256 = "10g4qrwvmabrdg4i8y0wq9g7whqcpkdfp05yilflg70ybplrscf7";
};
"${version}-aarch64-linux" = fetchurl {
url = "${base}/stable/release/${version}/sdk/dartsdk-linux-${aarch64}-release.zip";
sha256 = "0js83wy496swcwia144fhxk872irb5nr6i8558hxabkdrpv1bky5";
};
}
}:
in {
"1.24.3-x86_64-darwin" = fetchurl {
url = "${base}/${stable_version}/release/${version}/sdk/dartsdk-macos-${x86_64}-release.zip";
sha256 = "1n4cq4jrms4j0yl54b3w14agcgy8dbipv5788jziwk8q06a8c69l";
};
"1.24.3-x86_64-linux" = fetchurl {
url = "${base}/${stable_version}/release/${version}/sdk/dartsdk-linux-${x86_64}-release.zip";
sha256 = "16sm02wbkj328ni0z1z4n4msi12lb8ijxzmbbfamvg766mycj8z3";
};
"1.24.3-i686-linux" = fetchurl {
url = "${base}/${stable_version}/release/${version}/sdk/dartsdk-linux-${i686}-release.zip";
sha256 = "0a559mfpb0zfd49zdcpld95h2g1lmcjwwsqf69hd9rw6j67qyyyn";
};
"1.24.3-aarch64-linux" = fetchurl {
url = "${base}/${stable_version}/release/${version}/sdk/dartsdk-linux-${aarch64}-release.zip";
sha256 = "1p5bn04gr91chcszgmw5ng8mlzgwsrdr2v7k7ppwr1slkx97fsrh";
};
"2.7.2-x86_64-darwin" = fetchurl {
url = "${base}/${stable_version}/release/${version}/sdk/dartsdk-macos-${x86_64}-release.zip";
sha256 = "111zl075qdk2zd4d4mmfkn30jmzsri9nq3nspnmc2l245gdq34jj";
};
"2.7.2-x86_64-linux" = fetchurl {
url = "${base}/${stable_version}/release/${version}/sdk/dartsdk-linux-${x86_64}-release.zip";
sha256 = "0vvsgda1smqdjn35yiq9pxx8f5haxb4hqnspcsfs6sn5c36k854v";
};
"2.7.2-i686-linux" = fetchurl {
url = "${base}/${stable_version}/release/${version}/sdk/dartsdk-linux-${i686}-release.zip";
sha256 = "0dj01d2wwrp3cc5x73vs6fzhs6db60gkbjlrw3w9j04wcx69i38m";
};
"2.7.2-aarch64-linux" = fetchurl {
url = "${base}/${stable_version}/release/${version}/sdk/dartsdk-linux-${aarch64}-release.zip";
sha256 = "1p66fkdh1kv0ypmadmg67c3y3li3aaf1lahqh2g6r6qrzbh5da2p";
};
"2.10.0-x86_64-darwin" = fetchurl {
url = "${base}/${stable_version}/release/${version}/sdk/dartsdk-macos-${x86_64}-release.zip";
sha256 = "1n4qgsax5wi7krgvvs0dy7fz39nlykiw8gr0gdacc85hgyhqg09j";
};
"2.10.0-x86_64-linux" = fetchurl {
url = "${base}/${stable_version}/release/${version}/sdk/dartsdk-linux-${x86_64}-release.zip";
sha256 = "0dncmsfbwcn3ygflhp83i6z4bvc02fbpaq1vzdzw8xdk3sbynchb";
};
"2.9.0-4.0.dev-x86_64-darwin" = fetchurl {
url = "${base}/${dev_version}/release/${version}/sdk/dartsdk-macos-${x86_64}-release.zip";
sha256 = "0gj91pbvqrxsvxaj742cllqha2z65867gggzq9hq5139vkkpfj9s";
};
"2.9.0-4.0.dev-x86_64-linux" = fetchurl {
url = "${base}/${dev_version}/release/${version}/sdk/dartsdk-linux-${x86_64}-release.zip";
sha256 = "16d9842fb3qbc0hy0zmimav9zndfkq96glgykj20xssc88qpjk2r";
};
"2.9.0-4.0.dev-i686-linux" = fetchurl {
url = "${base}/${dev_version}/release/${version}/sdk/dartsdk-linux-${i686}-release.zip";
sha256 = "105wgyxmi491c7qw0z3zhn4lv52h80ngyz4ch9dyj0sq8nndz2rc";
};
"2.9.0-4.0.dev-aarch64-linux" = fetchurl {
url = "${base}/${dev_version}/release/${version}/sdk/dartsdk-linux-${aarch64}-release.zip";
sha256 = "1x6mlmc4hccmx42k7srhma18faxpxvghjwqahna80508rdpljwgc";
};
"2.11.0-161.0.dev-x86_64-darwin" = fetchurl {
url = "${base}/${dev_version}/release/${version}/sdk/dartsdk-macos-${x86_64}-release.zip";
sha256 = "0mlwxp7jkkjafxkc4vqlgwl62y0hk1arhfrvc9hpm9dv98g3bdjj";
};
"2.11.0-161.0.dev-x86_64-linux" = fetchurl {
url = "${base}/${dev_version}/release/${version}/sdk/dartsdk-linux-${x86_64}-release.zip";
sha256 = "05difz4w2fyh2yq5p5pkrqk59jqljlxhc1i6lmy5kihh6z69r12i";
};
};
in
with lib;
assert version != null && version != "";
assert sources != null && (builtins.isAttrs sources);
stdenv.mkDerivation {
pname = "dart";
inherit version;
@ -100,13 +53,13 @@ stdenv.mkDerivation {
find $out/bin -executable -type f -exec patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) {} \;
'';
libPath = makeLibraryPath [ stdenv.cc.cc ];
libPath = lib.makeLibraryPath [ stdenv.cc.cc ];
dontStrip = true;
meta = {
meta = with lib; {
homepage = "https://www.dartlang.org/";
maintainers = with maintainers; [ grburst ];
maintainers = with maintainers; [ grburst thiagokokada ];
description = "Scalable programming language, with robust libraries and runtimes, for building web, server, and mobile apps";
longDescription = ''
Dart is a class-based, single inheritance, object-oriented language

View file

@ -117,6 +117,9 @@ mapAliases ({
cv = progress; # added 2015-09-06
d1x_rebirth = dxx-rebirth; # added 2018-04-25
d2x_rebirth = dxx-rebirth; # added 2018-04-25
dart_dev = throw "Non-stable versions of Dart have been removed."; # added 2020-01-15
dart_old = throw "Non-stable versions of Dart have been removed."; # added 2020-01-15
dart_stable = dart; # added 2020-01-15
dat = nodePackages.dat;
dbvisualizer = throw "dbvisualizer has been removed from nixpkgs, as it's unmaintained"; # added 2020-09-20
dbus_daemon = dbus.daemon; # added 2018-04-25
@ -174,6 +177,8 @@ mapAliases ({
fish-foreign-env = throw "fish-foreign-env has been replaced with fishPlugins.foreign-env"; # added 2020-12-29, modified 2021-01-10
flameGraph = flamegraph; # added 2018-04-25
flink_1_5 = throw "flink_1_5 was removed, use flink instead"; # added 2021-01-25
flutter-beta = throw "Non-stable versions of Flutter have been removed. You can use flutterPackages.mkFlutter to generate a package for other Flutter versions."; # added 2020-01-15
flutter-dev = throw "Non-stable versions of Flutter have been removed. You can use flutterPackages.mkFlutter to generate a package for other Flutter versions."; # added 2020-01-15
flvtool2 = throw "flvtool2 has been removed."; # added 2020-11-03
foldingathome = fahclient; # added 2020-09-03
font-awesome-ttf = font-awesome; # 2018-02-25

View file

@ -9596,8 +9596,6 @@ in
flutterPackages =
recurseIntoAttrs (callPackage ../development/compilers/flutter { });
flutter = flutterPackages.stable;
flutter-beta = flutterPackages.beta;
flutter-dev = flutterPackages.dev;
fpc = callPackage ../development/compilers/fpc { };
@ -29489,9 +29487,6 @@ in
spdlog = spdlog_1;
dart = callPackage ../development/interpreters/dart { };
dart_old = dart.override { version = "1.24.3"; };
dart_stable = dart.override { version = "2.7.2"; };
dart_dev = dart.override { version = "2.9.0-4.0.dev"; };
httrack = callPackage ../tools/backup/httrack { };