Rive hacks for iOS and macOS (#68) (#69)

* Update flet dependency override to version 0.80.2

Changed the flet dependency override from a git reference to a specific version (0.80.2) in pubspec.yaml. This simplifies dependency management and ensures compatibility with the latest release.

* Add Rive Native setup build phase for macOS

Introduces a conditional shell script build phase to run 'rive_native:setup' during the build process if 'flet_rive' is present in Flutter dependencies. This ensures proper setup of Rive Native for macOS builds.

* Update rive_native setup script to run from project root

Modified the shell script in the Xcode project to change directory to the project root before running the rive_native setup. This ensures the setup script executes in the correct context for macOS builds.

* Fix rive_native setup script path in macOS Podfile

Ensures the rive_native setup script runs from the project root by setting PROJECT_ROOT and changing directory, allowing pubspec.yaml to be found in CI environments.

* Update flet dependency to use custom git ref

Switched flet dependency from a fixed version to a git reference pointing to the 'rive-0-14-0' branch. This allows using the latest changes from that branch instead of the published version.

* Update flet dependency to use main branch

Changed the flet dependency override from the 'rive-0-14-0' branch to 'main' to ensure the latest updates from the main branch are used.

* Fix rive_native setup script path in Podfile

Ensures the rive_native setup script runs from the project root by updating its shell script phase in the Podfile. This change helps CI environments locate pubspec.yaml correctly.
This commit is contained in:
Feodor Fitsner 2026-01-22 12:30:34 -08:00 committed by GitHub
parent 6a895c2866
commit f97e3ac64b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 51 additions and 1 deletions

View File

@ -66,6 +66,19 @@ end
post_install do |installer| post_install do |installer|
installer.pods_project.targets.each do |target| installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target) flutter_additional_ios_build_settings(target)
# Ensure rive_native's setup script runs from the project root so pubspec.yaml is found in CI.
if target.name == 'rive_native'
target.shell_script_build_phases.each do |phase|
script = phase.shell_script
next unless script&.include?('rive_native:setup')
next if script.include?('PROJECT_ROOT="${SRCROOT}/../.."')
phase.shell_script = script.sub(
"set -e\n",
"set -e\nPROJECT_ROOT=\"${SRCROOT}/../..\"\ncd \"$PROJECT_ROOT\"\n"
)
end
end
target.build_configurations.each do |config| target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [ config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [

View File

@ -37,7 +37,20 @@ target 'Runner' do
end end
post_install do |installer| post_install do |installer|
# Ensure rive_native's setup script runs from the project root so pubspec.yaml is found in CI.
installer.pods_project.targets.each do |target| installer.pods_project.targets.each do |target|
flutter_additional_macos_build_settings(target) flutter_additional_macos_build_settings(target)
next unless target.name == 'rive_native'
target.shell_script_build_phases.each do |phase|
script = phase.shell_script
next unless script&.include?('rive_native:setup')
next if script.include?('PROJECT_ROOT="${SRCROOT}/../.."')
phase.shell_script = script.sub(
"set -e\n",
"set -e\nPROJECT_ROOT=\"${SRCROOT}/../..\"\ncd \"$PROJECT_ROOT\"\n"
)
end
end end
end end

View File

@ -11,6 +11,9 @@
isa = PBXAggregateTarget; isa = PBXAggregateTarget;
buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */;
buildPhases = ( buildPhases = (
{% if 'flet_rive' in cookiecutter.flutter.dependencies %}
A1B2C3D4E5F60718293A4B5C /* Rive Native Setup */,
{% endif %}
33CC111E2044C6BF0003C045 /* ShellScript */, 33CC111E2044C6BF0003C045 /* ShellScript */,
); );
dependencies = ( dependencies = (
@ -291,6 +294,27 @@
/* End PBXResourcesBuildPhase section */ /* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */
{% if 'flet_rive' in cookiecutter.flutter.dependencies %}
A1B2C3D4E5F60718293A4B5C /* Rive Native Setup */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Rive Native Setup";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\nPROJECT_ROOT=\"${PROJECT_DIR}/..\"\ncd \"$PROJECT_ROOT\"\nDART_BIN=\"${FLUTTER_ROOT}/bin/dart\"\nif [ ! -x \"$DART_BIN\" ]; then\n DART_BIN=\"$(command -v dart || true)\"\nfi\nif [ -z \"$DART_BIN\" ]; then\n echo \"error: dart not found; cannot run rive_native:setup\" >&2\n exit 1\nfi\necho \"Running rive_native setup for macos...\"\n\"$DART_BIN\" run rive_native:setup --verbose --clean --platform macos\n";
};
{% endif %}
3399D490228B24CF009A79C7 /* ShellScript */ = { 3399D490228B24CF009A79C7 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1; alwaysOutOfDate = 1;