diff --git a/{{cookiecutter.out_dir}}/ios/Podfile b/{{cookiecutter.out_dir}}/ios/Podfile index 8547703..4cd22bb 100644 --- a/{{cookiecutter.out_dir}}/ios/Podfile +++ b/{{cookiecutter.out_dir}}/ios/Podfile @@ -66,6 +66,19 @@ end post_install do |installer| installer.pods_project.targets.each do |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| config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [ @@ -85,4 +98,4 @@ post_install do |installer| ] end end -end \ No newline at end of file +end diff --git a/{{cookiecutter.out_dir}}/macos/Podfile b/{{cookiecutter.out_dir}}/macos/Podfile index dbccf89..325d6ae 100644 --- a/{{cookiecutter.out_dir}}/macos/Podfile +++ b/{{cookiecutter.out_dir}}/macos/Podfile @@ -37,7 +37,20 @@ target 'Runner' do end 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| 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 diff --git a/{{cookiecutter.out_dir}}/macos/Runner.xcodeproj/project.pbxproj b/{{cookiecutter.out_dir}}/macos/Runner.xcodeproj/project.pbxproj index d1cc7cc..821bfde 100644 --- a/{{cookiecutter.out_dir}}/macos/Runner.xcodeproj/project.pbxproj +++ b/{{cookiecutter.out_dir}}/macos/Runner.xcodeproj/project.pbxproj @@ -11,6 +11,9 @@ isa = PBXAggregateTarget; buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; buildPhases = ( +{% if 'flet_rive' in cookiecutter.flutter.dependencies %} + A1B2C3D4E5F60718293A4B5C /* Rive Native Setup */, +{% endif %} 33CC111E2044C6BF0003C045 /* ShellScript */, ); dependencies = ( @@ -291,6 +294,27 @@ /* End PBXResourcesBuildPhase 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 */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1;