flutter.buildFlutterApplication: Use extraPackageConfigSetup

This commit is contained in:
hacker1024 2023-10-26 15:41:10 +11:00 committed by FlafyDev
parent 7e043f5f28
commit af6e82b47a

View file

@ -68,6 +68,17 @@
'';
};
extraPackageConfigSetup = ''
# https://github.com/flutter/flutter/blob/3.13.8/packages/flutter_tools/lib/src/dart/pub.dart#L755
if [ "$(yq '.flutter.generate // false' pubspec.yaml)" = "true" ]; then
jq '.packages |= . + [{
name: "flutter_gen",
rootUri: "flutter_gen",
languageVersion: "2.12",
}]' "$out" | '${moreutils}/bin/sponge' "$out"
fi
'';
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ wrapGAppsHook jq yq moreutils ];
buildInputs = (args.buildInputs or [ ]) ++ [ glib ];
@ -77,15 +88,6 @@
mkdir -p build/flutter_assets/fonts
# https://github.com/flutter/flutter/blob/3.13.8/packages/flutter_tools/lib/src/dart/pub.dart#L755
if [ "$(yq '.flutter.generate // false' pubspec.yaml)" = "true" ]; then
jq '.packages |= . + [{
name: "flutter_gen",
rootUri: "flutter_gen",
languageVersion: "2.12",
}]' .dart_tool/package_config.json | sponge .dart_tool/package_config.json
fi
flutter build linux -v --release --split-debug-info="$debug" ${builtins.concatStringsSep " " (map (flag: "\"${flag}\"") flutterBuildFlags)}
runHook postBuild