Loading pkgs/development/compilers/flutter/engine/package.nix +11 −1 Original line number Diff line number Diff line Loading @@ -174,7 +174,11 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ python3 (python3.withPackages ( ps: with ps; [ pyyaml ] )) (tools.vpython python3) gitMinimal pkg-config Loading Loading @@ -295,6 +299,12 @@ stdenv.mkDerivation (finalAttrs: { export TERM=dumb ${lib.optionalString (lib.versionAtLeast flutterVersion "3.29") '' # ValueError: ZIP does not support timestamps before 1980 substituteInPlace src/flutter/build/zip.py \ --replace-fail "zipfile.ZipFile(args.output, 'w', zipfile.ZIP_DEFLATED)" "zipfile.ZipFile(args.output, 'w', zipfile.ZIP_DEFLATED, strict_timestamps=False)" ''} ninja -C $out/out/$outName -j$NIX_BUILD_CORES runHook postBuild Loading pkgs/development/compilers/flutter/engine/source.nix +38 −17 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ runCommand "flutter-engine-source-${version}-${buildPlatform.system}-${targetPla gclient = writeText "flutter-engine-${version}.gclient" '' solutions = [{ "managed": False, "name": "src/flutter", "name": "${lib.optionalString (lib.versionAtLeast flutterVersion "3.29") "engine/"}src/flutter", "url": "${url}", "custom_vars": { "download_fuchsia_deps": False, Loading Loading @@ -86,17 +86,37 @@ runCommand "flutter-engine-source-${version}-${buildPlatform.system}-${targetPla (hashes."${buildPlatform.system}" or { })."${targetPlatform.system}" or (throw "Hash not set for ${targetPlatform.system} on ${buildPlatform.system}"); } ( '' source ${../../../../build-support/fetchgit/deterministic-git} export -f clean_git export -f make_deterministic_repo '' + ( if lib.versionAtLeast flutterVersion "3.29" then '' mkdir -p source cp $gclient source/.gclient cd source '' else '' mkdir -p $out cp $gclient $out/.gclient cd $out '' ) + '' export PATH=$PATH:$depot_tools python3 $depot_tools/gclient.py sync --no-history --shallow --nohooks -j $NIX_BUILD_CORES '' + lib.optionalString (lib.versionAtLeast flutterVersion "3.29") '' cp -r engine/src/flutter/third_party/* engine/src/flutter/engine/src/flutter/third_party/ mv engine/src/flutter/engine $out '' + '' find $out -name '.git' -exec rm -rf {} \; || true rm -rf $out/src/{buildtools,fuchsia} Loading @@ -106,3 +126,4 @@ runCommand "flutter-engine-source-${version}-${buildPlatform.system}-${targetPla rm -rf $out/.cipd $out/.gclient $out/.gclient_entries $out/.gclient_previous_custom_vars $out/.gclient_previous_sync_commits '' ) pkgs/development/compilers/flutter/flutter.nix +5 −9 Original line number Diff line number Diff line Loading @@ -3,7 +3,11 @@ version, engineVersion, engineHashes ? { }, engineUrl ? "https://github.com/flutter/engine.git@${engineVersion}", engineUrl ? if lib.versionAtLeast version "3.29" then "https://github.com/flutter/flutter.git@${engineVersion}" else "https://github.com/flutter/engine.git@${engineVersion}", enginePatches ? [ ], engineRuntimeModes ? [ "release" Loading Loading @@ -99,14 +103,6 @@ let echo "$(git rev-parse HEAD)" > bin/cache/flutter_tools.stamp ln -s '${flutterTools}/share/flutter_tools.snapshot' bin/cache/flutter_tools.snapshot # Some of flutter_tools's dependencies contain static assets. The # application attempts to read its own package_config.json to find these # assets at runtime. # TODO: Remove this once Flutter 3.24 is the lowest version in Nixpkgs. # https://github.com/flutter/flutter/pull/150340 makes it redundant. mkdir -p packages/flutter_tools/.dart_tool ln -s '${flutterTools.pubcache}/package_config.json' packages/flutter_tools/.dart_tool/package_config.json echo -n "${version}" > version cat <<EOF > bin/cache/flutter.version.json { Loading pkgs/development/compilers/flutter/update/get-engine-hashes.nix.in +1 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ let buildPlatform = lib.systems.elaborate buildPlatform; flutterVersion = version; version = engineVersion; url = "https://github.com/flutter/engine.git@${engineVersion}"; url = "https://github.com/flutter/flutter.git@${engineVersion}"; hashes."${buildPlatform}"."${targetPlatform}" = lib.fakeSha256; }) systemPlatforms) Loading pkgs/development/compilers/flutter/update/update.py +6 −4 Original line number Diff line number Diff line Loading @@ -203,7 +203,7 @@ def get_pubspec_lock(flutter_compact_version, flutter_src): return yaml.safe_load(pubspec_lock_yaml) def get_engine_swiftshader_rev(engine_version): with urllib.request.urlopen(f"https://github.com/flutter/engine/raw/{engine_version}/DEPS") as f: with urllib.request.urlopen(f"https://github.com/flutter/flutter/raw/{engine_version}/DEPS") as f: deps = f.read().decode('utf-8') pattern = re.compile(r"Var\('swiftshader_git'\) \+ '\/SwiftShader\.git' \+ '@' \+ \'([0-9a-fA-F]{40})\'\,") rev = pattern.findall(deps)[0] Loading Loading @@ -257,7 +257,7 @@ def update_all_packages(): new_content = [ "flutterPackages-bin = recurseIntoAttrs (callPackage ../development/compilers/flutter { });", "flutterPackages-source = recurseIntoAttrs (callPackage ../development/compilers/flutter { useNixpkgsEngine = true; });", "flutterPackages = flutterPackages-bin;" "flutterPackages = flutterPackages-bin;", "flutter = flutterPackages.stable;", ] + [f"flutter{version.replace('_', '')} = flutterPackages.v{version};" for version in versions] Loading Loading @@ -305,15 +305,17 @@ def find_versions(flutter_version=None, channel=None): tags = subprocess.Popen(['git', 'ls-remote', '--tags', 'https://github.com/flutter/engine.git'], 'https://github.com/flutter/flutter.git'], stdout=subprocess.PIPE, text=True).communicate()[0].strip() try: engine_hash = next( flutter_hash = next( filter( lambda line: line.endswith(f'refs/tags/{flutter_version}'), tags.splitlines())).split('refs')[0].strip() engine_hash = urllib.request.urlopen(f'https://github.com/flutter/flutter/raw/{flutter_hash}/bin/internal/engine.version').read().decode('utf-8').strip() except StopIteration: exit( f"Couldn't find Engine hash for Flutter version: {flutter_version}") Loading Loading
pkgs/development/compilers/flutter/engine/package.nix +11 −1 Original line number Diff line number Diff line Loading @@ -174,7 +174,11 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ python3 (python3.withPackages ( ps: with ps; [ pyyaml ] )) (tools.vpython python3) gitMinimal pkg-config Loading Loading @@ -295,6 +299,12 @@ stdenv.mkDerivation (finalAttrs: { export TERM=dumb ${lib.optionalString (lib.versionAtLeast flutterVersion "3.29") '' # ValueError: ZIP does not support timestamps before 1980 substituteInPlace src/flutter/build/zip.py \ --replace-fail "zipfile.ZipFile(args.output, 'w', zipfile.ZIP_DEFLATED)" "zipfile.ZipFile(args.output, 'w', zipfile.ZIP_DEFLATED, strict_timestamps=False)" ''} ninja -C $out/out/$outName -j$NIX_BUILD_CORES runHook postBuild Loading
pkgs/development/compilers/flutter/engine/source.nix +38 −17 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ runCommand "flutter-engine-source-${version}-${buildPlatform.system}-${targetPla gclient = writeText "flutter-engine-${version}.gclient" '' solutions = [{ "managed": False, "name": "src/flutter", "name": "${lib.optionalString (lib.versionAtLeast flutterVersion "3.29") "engine/"}src/flutter", "url": "${url}", "custom_vars": { "download_fuchsia_deps": False, Loading Loading @@ -86,17 +86,37 @@ runCommand "flutter-engine-source-${version}-${buildPlatform.system}-${targetPla (hashes."${buildPlatform.system}" or { })."${targetPlatform.system}" or (throw "Hash not set for ${targetPlatform.system} on ${buildPlatform.system}"); } ( '' source ${../../../../build-support/fetchgit/deterministic-git} export -f clean_git export -f make_deterministic_repo '' + ( if lib.versionAtLeast flutterVersion "3.29" then '' mkdir -p source cp $gclient source/.gclient cd source '' else '' mkdir -p $out cp $gclient $out/.gclient cd $out '' ) + '' export PATH=$PATH:$depot_tools python3 $depot_tools/gclient.py sync --no-history --shallow --nohooks -j $NIX_BUILD_CORES '' + lib.optionalString (lib.versionAtLeast flutterVersion "3.29") '' cp -r engine/src/flutter/third_party/* engine/src/flutter/engine/src/flutter/third_party/ mv engine/src/flutter/engine $out '' + '' find $out -name '.git' -exec rm -rf {} \; || true rm -rf $out/src/{buildtools,fuchsia} Loading @@ -106,3 +126,4 @@ runCommand "flutter-engine-source-${version}-${buildPlatform.system}-${targetPla rm -rf $out/.cipd $out/.gclient $out/.gclient_entries $out/.gclient_previous_custom_vars $out/.gclient_previous_sync_commits '' )
pkgs/development/compilers/flutter/flutter.nix +5 −9 Original line number Diff line number Diff line Loading @@ -3,7 +3,11 @@ version, engineVersion, engineHashes ? { }, engineUrl ? "https://github.com/flutter/engine.git@${engineVersion}", engineUrl ? if lib.versionAtLeast version "3.29" then "https://github.com/flutter/flutter.git@${engineVersion}" else "https://github.com/flutter/engine.git@${engineVersion}", enginePatches ? [ ], engineRuntimeModes ? [ "release" Loading Loading @@ -99,14 +103,6 @@ let echo "$(git rev-parse HEAD)" > bin/cache/flutter_tools.stamp ln -s '${flutterTools}/share/flutter_tools.snapshot' bin/cache/flutter_tools.snapshot # Some of flutter_tools's dependencies contain static assets. The # application attempts to read its own package_config.json to find these # assets at runtime. # TODO: Remove this once Flutter 3.24 is the lowest version in Nixpkgs. # https://github.com/flutter/flutter/pull/150340 makes it redundant. mkdir -p packages/flutter_tools/.dart_tool ln -s '${flutterTools.pubcache}/package_config.json' packages/flutter_tools/.dart_tool/package_config.json echo -n "${version}" > version cat <<EOF > bin/cache/flutter.version.json { Loading
pkgs/development/compilers/flutter/update/get-engine-hashes.nix.in +1 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ let buildPlatform = lib.systems.elaborate buildPlatform; flutterVersion = version; version = engineVersion; url = "https://github.com/flutter/engine.git@${engineVersion}"; url = "https://github.com/flutter/flutter.git@${engineVersion}"; hashes."${buildPlatform}"."${targetPlatform}" = lib.fakeSha256; }) systemPlatforms) Loading
pkgs/development/compilers/flutter/update/update.py +6 −4 Original line number Diff line number Diff line Loading @@ -203,7 +203,7 @@ def get_pubspec_lock(flutter_compact_version, flutter_src): return yaml.safe_load(pubspec_lock_yaml) def get_engine_swiftshader_rev(engine_version): with urllib.request.urlopen(f"https://github.com/flutter/engine/raw/{engine_version}/DEPS") as f: with urllib.request.urlopen(f"https://github.com/flutter/flutter/raw/{engine_version}/DEPS") as f: deps = f.read().decode('utf-8') pattern = re.compile(r"Var\('swiftshader_git'\) \+ '\/SwiftShader\.git' \+ '@' \+ \'([0-9a-fA-F]{40})\'\,") rev = pattern.findall(deps)[0] Loading Loading @@ -257,7 +257,7 @@ def update_all_packages(): new_content = [ "flutterPackages-bin = recurseIntoAttrs (callPackage ../development/compilers/flutter { });", "flutterPackages-source = recurseIntoAttrs (callPackage ../development/compilers/flutter { useNixpkgsEngine = true; });", "flutterPackages = flutterPackages-bin;" "flutterPackages = flutterPackages-bin;", "flutter = flutterPackages.stable;", ] + [f"flutter{version.replace('_', '')} = flutterPackages.v{version};" for version in versions] Loading Loading @@ -305,15 +305,17 @@ def find_versions(flutter_version=None, channel=None): tags = subprocess.Popen(['git', 'ls-remote', '--tags', 'https://github.com/flutter/engine.git'], 'https://github.com/flutter/flutter.git'], stdout=subprocess.PIPE, text=True).communicate()[0].strip() try: engine_hash = next( flutter_hash = next( filter( lambda line: line.endswith(f'refs/tags/{flutter_version}'), tags.splitlines())).split('refs')[0].strip() engine_hash = urllib.request.urlopen(f'https://github.com/flutter/flutter/raw/{flutter_hash}/bin/internal/engine.version').read().decode('utf-8').strip() except StopIteration: exit( f"Couldn't find Engine hash for Flutter version: {flutter_version}") Loading