flutter335: init at 3.35.0-0.3.pre (#432951)
This commit is contained in:
@@ -165,7 +165,11 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
NIX_CFLAGS_COMPILE = [
|
||||
"-I${finalAttrs.toolchain}/include"
|
||||
]
|
||||
++ lib.optional (!isOptimized) "-U_FORTIFY_SOURCE";
|
||||
++ lib.optional (!isOptimized) "-U_FORTIFY_SOURCE"
|
||||
++ lib.optionals (lib.versionAtLeast flutterVersion "3.35") [
|
||||
"-Wno-macro-redefined"
|
||||
"-Wno-error=macro-redefined"
|
||||
];
|
||||
|
||||
nativeCheckInputs = lib.optionals stdenv.hostPlatform.isLinux [
|
||||
xorg.xorgserver
|
||||
@@ -254,6 +258,13 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
done
|
||||
|
||||
popd
|
||||
''
|
||||
# error: 'close_range' is missing exception specification 'noexcept(true)'
|
||||
+ lib.optionalString (lib.versionAtLeast flutterVersion "3.35") ''
|
||||
substituteInPlace src/flutter/third_party/dart/runtime/bin/process_linux.cc \
|
||||
--replace-fail "(unsigned int first, unsigned int last, int flags)" "(unsigned int first, unsigned int last, int flags) noexcept(true)"
|
||||
''
|
||||
+ ''
|
||||
popd
|
||||
'';
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
systemPlatform,
|
||||
buildDartApplication,
|
||||
runCommand,
|
||||
writeTextFile,
|
||||
git,
|
||||
which,
|
||||
dart,
|
||||
@@ -11,8 +12,22 @@
|
||||
flutterSrc,
|
||||
patches ? [ ],
|
||||
pubspecLock,
|
||||
engineVersion,
|
||||
}:
|
||||
|
||||
let
|
||||
# https://github.com/flutter/flutter/blob/17c92b7ba68ea609f4eb3405211d019c9dbc4d27/engine/src/flutter/tools/engine_tool/test/commands/stamp_command_test.dart#L125
|
||||
engine_stamp = writeTextFile {
|
||||
name = "engine_stamp";
|
||||
text = builtins.toJSON {
|
||||
build_date = "2025-06-27T12:30:00.000Z";
|
||||
build_time_ms = 1751027400000;
|
||||
git_revision = engineVersion;
|
||||
git_revision_date = "2025-06-27T17:11:53-07:00";
|
||||
content_hash = "1111111111111111111111111111111111111111";
|
||||
};
|
||||
};
|
||||
in
|
||||
buildDartApplication.override { inherit dart; } rec {
|
||||
pname = "flutter-tools";
|
||||
inherit version;
|
||||
@@ -32,6 +47,12 @@ buildDartApplication.override { inherit dart; } rec {
|
||||
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
substituteInPlace lib/src/ios/xcodeproj.dart \
|
||||
--replace-fail arm64e arm64
|
||||
''
|
||||
# need network
|
||||
+ lib.optionalString (lib.versionAtLeast version "3.35.0") ''
|
||||
cp ${engine_stamp} ../../bin/cache/engine_stamp.json
|
||||
substituteInPlace lib/src/flutter_cache.dart \
|
||||
--replace-fail "registerArtifact(FlutterEngineStamp(this, logger));" ""
|
||||
'';
|
||||
|
||||
# When the JIT snapshot is being built, the application needs to run.
|
||||
|
||||
@@ -54,10 +54,14 @@ let
|
||||
|
||||
flutterTools =
|
||||
args.flutterTools or (callPackage ./flutter-tools.nix {
|
||||
inherit dart version;
|
||||
inherit
|
||||
dart
|
||||
engineVersion
|
||||
patches
|
||||
pubspecLock
|
||||
version
|
||||
;
|
||||
flutterSrc = src;
|
||||
inherit patches;
|
||||
inherit pubspecLock;
|
||||
systemPlatform = stdenv.hostPlatform.system;
|
||||
});
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+95
@@ -0,0 +1,95 @@
|
||||
Prevent crashes due to missing or incomplete package_graph.json
|
||||
|
||||
Modify package graph parsing to safely handle missing package_graph.json file
|
||||
and missing dependencies or devDependencies entries by using empty defaults
|
||||
instead of throwing errors.
|
||||
|
||||
--- a/packages/flutter_tools/lib/src/package_graph.dart
|
||||
+++ b/packages/flutter_tools/lib/src/package_graph.dart
|
||||
@@ -36,18 +36,9 @@
|
||||
isExclusiveDevDependency: true,
|
||||
);
|
||||
|
||||
- final List<String>? dependencies = packageGraph.dependencies[project.manifest.appName];
|
||||
- if (dependencies == null) {
|
||||
- throwToolExit('''
|
||||
-Failed to parse ${packageGraph.file.path}: dependencies for `${project.manifest.appName}` missing.
|
||||
-Try running `flutter pub get`''');
|
||||
- }
|
||||
- final List<String>? devDependencies = packageGraph.devDependencies[project.manifest.appName];
|
||||
- if (devDependencies == null) {
|
||||
- throwToolExit('''
|
||||
-Failed to parse ${packageGraph.file.path}: devDependencies for `${project.manifest.appName}` missing.
|
||||
-Try running `flutter pub get`''');
|
||||
- }
|
||||
+ final List<String> dependencies = packageGraph.dependencies[project.manifest.appName] ?? <String>[];
|
||||
+ final List<String> devDependencies = packageGraph.devDependencies[project.manifest.appName] ?? <String>[];
|
||||
+
|
||||
final packageNamesToVisit = <String>[...dependencies, ...devDependencies];
|
||||
while (packageNamesToVisit.isNotEmpty) {
|
||||
final String current = packageNamesToVisit.removeLast();
|
||||
@@ -55,13 +46,7 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
- final List<String>? dependencies = packageGraph.dependencies[current];
|
||||
-
|
||||
- if (dependencies == null) {
|
||||
- throwToolExit('''
|
||||
-Failed to parse ${packageGraph.file.path}: dependencies for `$current` missing.
|
||||
-Try running `flutter pub get`''');
|
||||
- }
|
||||
+ final List<String> dependencies = packageGraph.dependencies[current] ?? <String>[];
|
||||
packageNamesToVisit.addAll(dependencies);
|
||||
|
||||
result[current] = Dependency(
|
||||
@@ -89,7 +74,7 @@
|
||||
currentDependency.rootUri,
|
||||
isExclusiveDevDependency: false,
|
||||
);
|
||||
- packageNamesToVisit.addAll(packageGraph.dependencies[current]!);
|
||||
+ packageNamesToVisit.addAll(packageGraph.dependencies[current] ?? <String>[]);
|
||||
}
|
||||
return result.values.toList();
|
||||
}
|
||||
@@ -147,6 +132,9 @@
|
||||
final File file = project.packageConfig.fileSystem.file(
|
||||
project.packageConfig.uri.resolve('package_graph.json'),
|
||||
);
|
||||
+ if (!file.existsSync()) {
|
||||
+ return PackageGraph(file, <String>[], <String, List<String>>{}, <String, List<String>>{});
|
||||
+ }
|
||||
try {
|
||||
return PackageGraph.fromJson(file, jsonDecode(file.readAsStringSync()));
|
||||
} on IOException catch (e) {
|
||||
|
||||
--- a/packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart
|
||||
+++ b/packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart
|
||||
@@ -384,7 +384,12 @@
|
||||
}
|
||||
|
||||
Future<bool> _nativeBuildRequired(FlutterNativeAssetsBuildRunner buildRunner) async {
|
||||
- final List<String> packagesWithNativeAssets = await buildRunner.packagesWithNativeAssets();
|
||||
+ late final List<String> packagesWithNativeAssets;
|
||||
+ try {
|
||||
+ packagesWithNativeAssets = await buildRunner.packagesWithNativeAssets();
|
||||
+ } catch (error) {
|
||||
+ packagesWithNativeAssets = <String>[];
|
||||
+ }
|
||||
if (packagesWithNativeAssets.isEmpty) {
|
||||
globals.logger.printTrace(
|
||||
'No packages with native assets. Skipping native assets compilation.',
|
||||
@@ -412,7 +417,12 @@
|
||||
FileSystem fileSystem,
|
||||
FlutterNativeAssetsBuildRunner buildRunner,
|
||||
) async {
|
||||
- final List<String> packagesWithNativeAssets = await buildRunner.packagesWithNativeAssets();
|
||||
+ late final List<String> packagesWithNativeAssets;
|
||||
+ try {
|
||||
+ packagesWithNativeAssets = await buildRunner.packagesWithNativeAssets();
|
||||
+ } catch (error) {
|
||||
+ packagesWithNativeAssets = <String>[];
|
||||
+ }
|
||||
if (packagesWithNativeAssets.isEmpty) {
|
||||
globals.logger.printTrace(
|
||||
'No packages with native assets. Skipping native assets compilation.',
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
diff --git a/packages/flutter_tools/lib/src/flutter_cache.dart b/packages/flutter_tools/lib/src/flutter_cache.dart
|
||||
index df67547..eacc7c4 100644
|
||||
--- a/packages/flutter_tools/lib/src/flutter_cache.dart
|
||||
+++ b/packages/flutter_tools/lib/src/flutter_cache.dart
|
||||
@@ -51,16 +51,6 @@ class FlutterCache extends Cache {
|
||||
registerArtifact(IosUsbArtifacts(artifactName, this, platform: platform));
|
||||
}
|
||||
registerArtifact(FontSubsetArtifacts(this, platform: platform));
|
||||
- registerArtifact(
|
||||
- PubDependencies(
|
||||
- logger: logger,
|
||||
- // flutter root and pub must be lazily initialized to avoid accessing
|
||||
- // before the version is determined.
|
||||
- flutterRoot: () => Cache.flutterRoot!,
|
||||
- pub: () => pub,
|
||||
- projectFactory: projectFactory,
|
||||
- ),
|
||||
- );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart
|
||||
index e4e474ab6e..5548599802 100644
|
||||
--- a/packages/flutter_tools/lib/src/runner/flutter_command.dart
|
||||
+++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart
|
||||
@@ -1693,7 +1693,7 @@ Run 'flutter -h' (or 'flutter <command> -h') for available flutter commands and
|
||||
|
||||
// Populate the cache. We call this before pub get below so that the
|
||||
// sky_engine package is available in the flutter cache for pub to find.
|
||||
- if (shouldUpdateCache) {
|
||||
+ if (false) {
|
||||
// First always update universal artifacts, as some of these (e.g.
|
||||
// ios-deploy on macOS) are required to determine `requiredArtifacts`.
|
||||
final bool offline;
|
||||
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 a1104da..1749d65 100644
|
||||
--- a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
|
||||
+++ b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
|
||||
@@ -444,12 +444,8 @@ class FlutterCommandRunner extends CommandRunner<void> {
|
||||
globals.analytics.suppressTelemetry();
|
||||
}
|
||||
|
||||
- globals.flutterVersion.ensureVersionFile();
|
||||
final bool machineFlag =
|
||||
topLevelResults[FlutterGlobalOptions.kMachineFlag] as bool? ?? false;
|
||||
- if (await _shouldCheckForUpdates(topLevelResults, topLevelMachineFlag: machineFlag)) {
|
||||
- await globals.flutterVersion.checkFlutterVersionFreshness();
|
||||
- }
|
||||
|
||||
// See if the user specified a specific device.
|
||||
final String? specifiedDeviceId =
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
From 6df275df3b8694daf16302b407520e3b1dee6724 Mon Sep 17 00:00:00 2001
|
||||
From: Philip Hayes <philiphayes9@gmail.com>
|
||||
Date: Thu, 12 Sep 2024 13:23:00 -0700
|
||||
Subject: [PATCH] fix: cleanup xcode_backend.sh to fix iOS build w/
|
||||
`NixOS/nixpkgs` flutter
|
||||
|
||||
This patch cleans up `xcode_backend.sh`. It now effectively just runs
|
||||
`exec $FLUTTER_ROOT/bin/dart ./xcode_backend.dart`.
|
||||
|
||||
The previous `xcode_backend.sh` tries to discover `$FLUTTER_ROOT` from
|
||||
argv[0], even though its presence is already guaranteed (the wrapped
|
||||
`xcode_backend.dart` also relies on this env).
|
||||
|
||||
When using nixpkgs flutter, the flutter SDK directory is composed of several
|
||||
layers, joined together using symlinks (called a `symlinkJoin`). Without this
|
||||
patch, the auto-discover traverses the symlinks into the wrong layer, and so it
|
||||
uses an "unwrapped" `dart` command instead of a "wrapped" dart that sets some
|
||||
important envs/flags (like `$FLUTTER_ROOT`).
|
||||
|
||||
Using the "unwrapped" dart then manifests in this error when compiling, since
|
||||
it doesn't see the ios build-support artifacts:
|
||||
|
||||
```
|
||||
$ flutter run -d iphone
|
||||
Running Xcode build...
|
||||
Xcode build done. 6.4s
|
||||
Failed to build iOS app
|
||||
Error (Xcode): Target debug_unpack_ios failed: Error: Flutter failed to create a directory at "/<nix-store>/XXXX-flutter-3.24.1-unwrapped/bin/cache/artifacts".
|
||||
```
|
||||
---
|
||||
packages/flutter_tools/bin/xcode_backend.sh | 25 ++++-----------------
|
||||
1 file changed, 4 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/packages/flutter_tools/bin/xcode_backend.sh b/packages/flutter_tools/bin/xcode_backend.sh
|
||||
index 2889d7c8e4..48b9d06c6e 100755
|
||||
--- a/packages/flutter_tools/bin/xcode_backend.sh
|
||||
+++ b/packages/flutter_tools/bin/xcode_backend.sh
|
||||
@@ -13,24 +13,7 @@
|
||||
# exit on error, or usage of unset var
|
||||
set -euo pipefail
|
||||
|
||||
-# Needed because if it is set, cd may print the path it changed to.
|
||||
-unset CDPATH
|
||||
-
|
||||
-function follow_links() (
|
||||
- cd -P "$(dirname -- "$1")"
|
||||
- file="$PWD/$(basename -- "$1")"
|
||||
- while [[ -h "$file" ]]; do
|
||||
- cd -P "$(dirname -- "$file")"
|
||||
- file="$(readlink -- "$file")"
|
||||
- cd -P "$(dirname -- "$file")"
|
||||
- file="$PWD/$(basename -- "$file")"
|
||||
- done
|
||||
- echo "$file"
|
||||
-)
|
||||
-
|
||||
-PROG_NAME="$(follow_links "${BASH_SOURCE[0]}")"
|
||||
-BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
|
||||
-FLUTTER_ROOT="$BIN_DIR/../../.."
|
||||
-DART="$FLUTTER_ROOT/bin/dart"
|
||||
-
|
||||
-"$DART" "$BIN_DIR/xcode_backend.dart" "$@" "ios"
|
||||
+# Run `dart ./xcode_backend.dart` with the dart from $FLUTTER_ROOT.
|
||||
+dart="${FLUTTER_ROOT}/bin/dart"
|
||||
+xcode_backend_dart="${BASH_SOURCE[0]%.sh}.dart"
|
||||
+exec "${dart}" "${xcode_backend_dart}" "$@" "ios"
|
||||
--
|
||||
2.46.0
|
||||
@@ -4868,6 +4868,7 @@ with pkgs;
|
||||
);
|
||||
flutterPackages = flutterPackages-bin;
|
||||
flutter = flutterPackages.stable;
|
||||
flutter335 = flutterPackages.v3_35;
|
||||
flutter332 = flutterPackages.v3_32;
|
||||
flutter329 = flutterPackages.v3_29;
|
||||
flutter327 = flutterPackages.v3_27;
|
||||
|
||||
Reference in New Issue
Block a user