mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 09:23:01 +00:00
flutter: add flutter2 package
This commit is contained in:
parent
2bdae5cabd
commit
4a74e239b5
@ -4,8 +4,8 @@ let
|
||||
getPatches = dir:
|
||||
let files = builtins.attrNames (builtins.readDir dir);
|
||||
in map (f: dir + ("/" + f)) files;
|
||||
flutterDrv = { version, pname, dartVersion, hash, dartHash }: mkFlutter {
|
||||
inherit version pname;
|
||||
flutterDrv = { version, pname, dartVersion, hash, dartHash, patches }: mkFlutter {
|
||||
inherit version pname patches;
|
||||
dart = dart.override {
|
||||
version = dartVersion;
|
||||
sources = {
|
||||
@ -17,9 +17,8 @@ let
|
||||
};
|
||||
src = fetchurl {
|
||||
url = "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${version}-stable.tar.xz";
|
||||
sha256 = "sha256-MTZeWQUp4/TcPzYIT6eqIKSPUPvn2Mp/thOQzNgpTXg=";
|
||||
sha256 = hash;
|
||||
};
|
||||
patches = getPatches ./patches;
|
||||
};
|
||||
in
|
||||
{
|
||||
@ -30,5 +29,15 @@ in
|
||||
dartVersion = "2.18.2";
|
||||
hash = "sha256-MTZeWQUp4/TcPzYIT6eqIKSPUPvn2Mp/thOQzNgpTXg=";
|
||||
dartHash = "sha256-C3+YjecXLvSmJrLwi9H7TgD9Np0AArRWx3EdBrfQpTU";
|
||||
patches = getPatches ./patches/flutter3;
|
||||
};
|
||||
|
||||
v2 = flutterDrv {
|
||||
pname = "flutter";
|
||||
version = "2.10.5";
|
||||
dartVersion = "2.16.2";
|
||||
hash = "sha256-DTZwxlMUYk8NS1SaWUJolXjD+JnRW73Ps5CdRHDGnt0=";
|
||||
dartHash = "sha256-egrYd7B4XhkBiHPIFE2zopxKtQ58GqlogAKA/UeiXnI=";
|
||||
patches = getPatches ./patches/flutter2;
|
||||
};
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
diff --git a/bin/internal/shared.sh b/bin/internal/shared.sh
|
||||
index 05cba4393b..2a775bf24f 100644
|
||||
--- a/bin/internal/shared.sh
|
||||
+++ b/bin/internal/shared.sh
|
||||
@@ -217,8 +217,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 396756808e..d324a6df59 100644
|
||||
--- a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
|
||||
+++ b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
|
||||
@@ -241,7 +241,6 @@ class FlutterCommandRunner extends CommandRunner<void> {
|
||||
globals.flutterUsage.suppressAnalytics = true;
|
||||
}
|
||||
|
||||
- globals.flutterVersion.ensureVersionFile();
|
||||
final bool machineFlag = topLevelResults['machine'] as bool? ?? false;
|
||||
final bool ci = await globals.botDetector.isRunningOnBot;
|
||||
final bool redirectedCompletion = !globals.stdio.hasTerminal &&
|
||||
@@ -250,10 +249,6 @@ class FlutterCommandRunner extends CommandRunner<void> {
|
||||
final bool versionCheckFlag = topLevelResults['version-check'] as bool? ?? false;
|
||||
final bool explicitVersionCheckPassed = topLevelResults.wasParsed('version-check') && versionCheckFlag;
|
||||
|
||||
- if (topLevelResults.command?.name != 'upgrade' &&
|
||||
- (explicitVersionCheckPassed || (versionCheckFlag && !isMachine))) {
|
||||
- await globals.flutterVersion.checkFlutterVersionFreshness();
|
||||
- }
|
||||
|
||||
// See if the user specified a specific device.
|
||||
globals.deviceManager?.specifiedDeviceId = topLevelResults['device-id'] as String?;
|
@ -0,0 +1,80 @@
|
||||
diff --git a/dev/bots/prepare_package.dart b/dev/bots/prepare_package.dart
|
||||
index 468a91a954..5def6897ce 100644
|
||||
--- a/dev/bots/prepare_package.dart
|
||||
+++ b/dev/bots/prepare_package.dart
|
||||
@@ -525,7 +525,7 @@ class ArchiveCreator {
|
||||
|
||||
Future<String> _runGit(List<String> args, {Directory? workingDirectory}) {
|
||||
return _processRunner.runProcess(
|
||||
- <String>['git', ...args],
|
||||
+ <String>['git', '--git-dir', '.git', ...args],
|
||||
workingDirectory: workingDirectory ?? flutterRoot,
|
||||
);
|
||||
}
|
||||
diff --git a/packages/flutter_tools/lib/src/version.dart b/packages/flutter_tools/lib/src/version.dart
|
||||
index f2068a6ca2..99b161689e 100644
|
||||
--- a/packages/flutter_tools/lib/src/version.dart
|
||||
+++ b/packages/flutter_tools/lib/src/version.dart
|
||||
@@ -106,7 +106,7 @@ class FlutterVersion {
|
||||
String? channel = _channel;
|
||||
if (channel == null) {
|
||||
final String gitChannel = _runGit(
|
||||
- 'git rev-parse --abbrev-ref --symbolic @{u}',
|
||||
+ 'git --git-dir .git rev-parse --abbrev-ref --symbolic @{u}',
|
||||
globals.processUtils,
|
||||
_workingDirectory,
|
||||
);
|
||||
@@ -114,7 +114,7 @@ class FlutterVersion {
|
||||
if (slash != -1) {
|
||||
final String remote = gitChannel.substring(0, slash);
|
||||
_repositoryUrl = _runGit(
|
||||
- 'git ls-remote --get-url $remote',
|
||||
+ 'git --git-dir .git ls-remote --get-url $remote',
|
||||
globals.processUtils,
|
||||
_workingDirectory,
|
||||
);
|
||||
@@ -326,7 +326,7 @@ class FlutterVersion {
|
||||
/// the branch name will be returned as `'[user-branch]'`.
|
||||
String getBranchName({ bool redactUnknownBranches = false }) {
|
||||
_branch ??= () {
|
||||
- final String branch = _runGit('git rev-parse --abbrev-ref HEAD', globals.processUtils);
|
||||
+ final String branch = _runGit('git --git-dir .git rev-parse --abbrev-ref HEAD', globals.processUtils);
|
||||
return branch == 'HEAD' ? channel : branch;
|
||||
}();
|
||||
if (redactUnknownBranches || _branch!.isEmpty) {
|
||||
@@ -359,7 +359,7 @@ class FlutterVersion {
|
||||
/// wrapper that does that.
|
||||
@visibleForTesting
|
||||
static List<String> gitLog(List<String> args) {
|
||||
- return <String>['git', '-c', 'log.showSignature=false', 'log'] + args;
|
||||
+ return <String>['git', '-c', 'log.showSignature=false', '--git-dir', '.git', 'log'] + args;
|
||||
}
|
||||
|
||||
/// Gets the release date of the latest available Flutter version.
|
||||
@@ -730,7 +730,7 @@ class GitTagVersion {
|
||||
|
||||
static GitTagVersion determine(ProcessUtils processUtils, {String? workingDirectory, bool fetchTags = false, String gitRef = 'HEAD'}) {
|
||||
if (fetchTags) {
|
||||
- final String channel = _runGit('git rev-parse --abbrev-ref HEAD', processUtils, workingDirectory);
|
||||
+ final String channel = _runGit('git --git-dir .git rev-parse --abbrev-ref HEAD', processUtils, workingDirectory);
|
||||
if (channel == 'dev' || channel == 'beta' || channel == 'stable') {
|
||||
globals.printTrace('Skipping request to fetchTags - on well known channel $channel.');
|
||||
} else {
|
||||
@@ -739,7 +739,7 @@ class GitTagVersion {
|
||||
}
|
||||
// find all tags attached to the given [gitRef]
|
||||
final List<String> tags = _runGit(
|
||||
- 'git tag --points-at $gitRef', processUtils, workingDirectory).trim().split('\n');
|
||||
+ 'git --git-dir .git tag --points-at $gitRef', processUtils, workingDirectory).trim().split('\n');
|
||||
|
||||
// Check first for a stable tag
|
||||
final RegExp stableTagPattern = RegExp(r'^\d+\.\d+\.\d+$');
|
||||
@@ -760,7 +760,7 @@ class GitTagVersion {
|
||||
// recent tag and number of commits past.
|
||||
return parse(
|
||||
_runGit(
|
||||
- 'git describe --match *.*.* --long --tags $gitRef',
|
||||
+ 'git --git-dir .git describe --match *.*.* --long --tags $gitRef',
|
||||
processUtils,
|
||||
workingDirectory,
|
||||
)
|
@ -0,0 +1,72 @@
|
||||
diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart
|
||||
index ed42baea29..12941f733a 100644
|
||||
--- a/packages/flutter_tools/lib/src/asset.dart
|
||||
+++ b/packages/flutter_tools/lib/src/asset.dart
|
||||
@@ -11,11 +11,11 @@ import 'base/file_system.dart';
|
||||
import 'base/logger.dart';
|
||||
import 'base/platform.dart';
|
||||
import 'build_info.dart';
|
||||
-import 'cache.dart';
|
||||
import 'convert.dart';
|
||||
import 'dart/package_map.dart';
|
||||
import 'devfs.dart';
|
||||
import 'flutter_manifest.dart';
|
||||
+import 'globals.dart' as globals;
|
||||
import 'license_collector.dart';
|
||||
import 'project.dart';
|
||||
|
||||
@@ -504,7 +504,7 @@ class ManifestAssetBundle implements AssetBundle {
|
||||
}
|
||||
final Uri entryUri = _fileSystem.path.toUri(asset);
|
||||
result.add(_Asset(
|
||||
- baseDir: _fileSystem.path.join(Cache.flutterRoot!, 'bin', 'cache', 'artifacts', 'material_fonts'),
|
||||
+ baseDir: _fileSystem.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 defc86cc20..7fdf14d112 100644
|
||||
--- a/packages/flutter_tools/lib/src/cache.dart
|
||||
+++ b/packages/flutter_tools/lib/src/cache.dart
|
||||
@@ -22,6 +22,7 @@ import 'base/user_messages.dart';
|
||||
import 'build_info.dart';
|
||||
import 'convert.dart';
|
||||
import 'features.dart';
|
||||
+import 'globals.dart' as globals;
|
||||
|
||||
const String kFlutterRootEnvironmentVariableName = 'FLUTTER_ROOT'; // should point to //flutter/ (root of flutter/flutter repo)
|
||||
const String kFlutterEngineEnvironmentVariableName = 'FLUTTER_ENGINE'; // should point to //engine/src/ (root of flutter/engine repo)
|
||||
@@ -322,8 +323,13 @@ class Cache {
|
||||
return;
|
||||
}
|
||||
assert(_lock == null);
|
||||
+ final Directory dir = _fileSystem.directory(_fileSystem.path.join(globals.fsUtils.homeDirPath!, '.cache', 'flutter'));
|
||||
+ if (!dir.existsSync()) {
|
||||
+ dir.createSync(recursive: true);
|
||||
+ globals.os.chmod(dir, '755');
|
||||
+ }
|
||||
final File lockFile =
|
||||
- _fileSystem.file(_fileSystem.path.join(flutterRoot!, 'bin', 'cache', 'lockfile'));
|
||||
+ _fileSystem.file(_fileSystem.path.join(globals.fsUtils.homeDirPath!, '.cache', 'flutter', 'lockfile'));
|
||||
try {
|
||||
_lock = lockFile.openSync(mode: FileMode.write);
|
||||
} on FileSystemException catch (e) {
|
||||
@@ -382,8 +388,7 @@ class Cache {
|
||||
|
||||
String get devToolsVersion {
|
||||
if (_devToolsVersion == null) {
|
||||
- const String devToolsDirPath = 'dart-sdk/bin/resources/devtools';
|
||||
- final Directory devToolsDir = getCacheDir(devToolsDirPath, shouldCreate: false);
|
||||
+ final Directory devToolsDir = _fileSystem.directory(_fileSystem.path.join(flutterRoot!, 'bin/cache/dart-sdk/bin/resources/devtools'));
|
||||
if (!devToolsDir.existsSync()) {
|
||||
throw Exception('Could not find directory at ${devToolsDir.path}');
|
||||
}
|
||||
@@ -536,7 +541,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'));
|
||||
}
|
||||
}
|
||||
|
@ -13200,6 +13200,7 @@ with pkgs;
|
||||
flutterPackages =
|
||||
recurseIntoAttrs (callPackage ../development/compilers/flutter { });
|
||||
flutter = flutterPackages.stable;
|
||||
flutter2 = flutterPackages.v2;
|
||||
|
||||
fnm = callPackage ../development/tools/fnm {
|
||||
inherit (darwin.apple_sdk.frameworks) DiskArbitration Foundation Security;
|
||||
|
Loading…
Reference in New Issue
Block a user