Skip to content

fix: Avoid flutter_build script calling rm on windows - #4490

Merged
nielsenko merged 1 commit into
serverpod:mainfrom
nielsenko:fix-serverpod-create-no-rm-on-windows
Jan 19, 2026
Merged

nielsenko merged 1 commit into
serverpod:mainfrom
nielsenko:fix-serverpod-create-no-rm-on-windows

Conversation

@nielsenko

@nielsenko nielsenko commented Dec 21, 2025 •

Copy link
Copy Markdown
Collaborator

Adds platform-specific flutter_build scripts for the server template.

  • Replaces single cross-platform command with separate windows and posix variants
  • Windows script uses native commands (rmdir, xcopy, backslash paths)
  • POSIX script uses the --output flag directly (works on non-Windows platforms)

Fixes #4489
Fixes #4466

Pre-launch Checklist

  • I read the Contribute page and followed the process outlined there for submitting PRs.
  • This update contains only one single feature or bug fix and nothing else. (If you are submitting multiple fixes, please make multiple PRs.)
  • I read and followed the Dart Style Guide and formatted the code with dart format.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///), and made sure that the documentation follows the same style as other Serverpod documentation. I checked spelling and grammar.
  • I added new tests to check the change I am making.
  • All existing and new tests are passing.
  • Any breaking changes are documented below.

If you need help, consider asking for advice on the discussion board.

Breaking changes

None.

Summary by CodeRabbit

  • Chores
    • Improved Flutter build configuration with platform-specific handling for Windows and POSIX systems.
    • Enhanced build process reliability and cross-platform output directory management.

✏️ Tip: You can customize this high-level summary in your review settings.

@nielsenko

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Dec 21, 2025

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@nielsenko nielsenko changed the title fix: flutter_build script calling rm on windows fix: Avoid flutter_build script calling rm on windows Dec 21, 2025
@coderabbitai

coderabbitai Bot commented Dec 21, 2025 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Two template pubspec.yaml files are updated to replace a single platform-agnostic flutter_build command with platform-specific configurations: a windows branch that removes and rebuilds the web directory, and a posix branch that builds directly to the server web directory.

Changes

Cohort / File(s) Summary
Flutter build platform-specific configuration
templates/pubspecs/templates/serverpod_templates/projectname_server/pubspec.yaml, templates/serverpod_templates/projectname_server/pubspec.yaml
Replaced single-line flutter_build command with platform-specific map containing windows and posix branches; windows branch removes existing build artifacts before rebuilding, posix branch builds directly to output directory

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Identical configuration pattern applied to both files
  • Straightforward YAML restructuring with no logic complexity
  • Changes are self-contained configuration modifications

Possibly related issues

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing the flutter_build script to avoid calling rm on Windows, which is the primary objective addressed by the platform-specific configuration changes.
Linked Issues check ✅ Passed The PR directly addresses both linked issues by replacing the cross-platform rm command with platform-specific scripts: Windows uses rmdir/move, and POSIX uses --output flag, eliminating Unix-only rm usage and potential build step failures.
Out of Scope Changes check ✅ Passed All changes are scoped to the flutter_build script configuration in pubspec.yaml files, directly addressing the Windows compatibility and build stability issues outlined in the linked issues with no extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed PR description is mostly complete with clear explanation, linked issues, and comprehensive checklist completion.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
templates/serverpod_templates/projectname_server/pubspec.yaml (1)

35-47: Platform-specific approach successfully addresses Windows compatibility issues.

The split into windows and posix branches correctly resolves the rm command issue on Windows by using native batch commands. Windows batch commands have accepted both path separators since DOS 2.0, so the current command flow is valid: if web\app doesn't exist, the if exist command succeeds and the chain continues; if it exists, rmdir runs and the chain continues on success.

Consider normalizing path separators for consistency (optional): The Windows command currently mixes backslashes early in the command with forward slashes in the move destination (move web\app ../projectname_server/web/app). While this works, using consistent backslashes throughout improves readability:

      windows: >-
        if exist web\app rmdir /S /Q web\app
        && cd ..\projectname_flutter
        && flutter build web --base-href /app/ --wasm
-       && move web\app ../projectname_server/web/app
+       && move web\app ..\projectname_server\web\app

Important: Make changes to the files in the templates/ directory, then run the update_pubspecs command to generate the pubspec.yaml files. Also verify that example projects still work by running example servers with dart bin/main.dart --apply-migrations before submitting the PR.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 19e6a9c and 32f7d96.

📒 Files selected for processing (2)
  • templates/pubspecs/templates/serverpod_templates/projectname_server/pubspec.yaml (1 hunks)
  • templates/serverpod_templates/projectname_server/pubspec.yaml (1 hunks)
🧰 Additional context used
🧠 Learnings (10)
📓 Common learnings
Learnt from: CR
Repo: serverpod/serverpod PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-11T03:56:54.151Z
Learning: Update pubspec files from templates using 'util/update_pubspecs' after template changes
Learnt from: tp
Repo: serverpod/serverpod PR: 3721
File: util/pub_get_all:0-0
Timestamp: 2025-06-27T08:39:36.440Z
Learning: In the Serverpod project, `dart pub get` commands work fine on Flutter packages both locally and in CI environments, even when the package has `flutter: sdk: flutter` dependencies in pubspec.yaml. The technical constraint of Flutter SDK dependencies causing `dart pub` failures may not apply in all environments or recent Dart versions.
📚 Learning: 2025-06-27T08:39:36.440Z
Learnt from: tp
Repo: serverpod/serverpod PR: 3721
File: util/pub_get_all:0-0
Timestamp: 2025-06-27T08:39:36.440Z
Learning: In the Serverpod project, `dart pub get` commands work fine on Flutter packages both locally and in CI environments, even when the package has `flutter: sdk: flutter` dependencies in pubspec.yaml. The technical constraint of Flutter SDK dependencies causing `dart pub` failures may not apply in all environments or recent Dart versions.

Applied to files:

  • templates/serverpod_templates/projectname_server/pubspec.yaml
  • templates/pubspecs/templates/serverpod_templates/projectname_server/pubspec.yaml
📚 Learning: 2025-12-11T03:56:54.151Z
Learnt from: CR
Repo: serverpod/serverpod PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-11T03:56:54.151Z
Learning: Update pubspec files from templates using 'util/update_pubspecs' after template changes

Applied to files:

  • templates/serverpod_templates/projectname_server/pubspec.yaml
  • templates/pubspecs/templates/serverpod_templates/projectname_server/pubspec.yaml
📚 Learning: 2025-08-25T19:46:58.073Z
Learnt from: tp
Repo: serverpod/serverpod PR: 3917
File: modules/new_serverpod_auth/serverpod_auth_idp/serverpod_auth_idp_server/analysis_options.yaml:3-6
Timestamp: 2025-08-25T19:46:58.073Z
Learning: In Serverpod, test tool paths like `test/integration/test_tools/serverpod_test_tools.dart` are configured per project in the "generator.yaml" file and managed by a generator system, so they don't need to be updated manually across all files at once.

Applied to files:

  • templates/serverpod_templates/projectname_server/pubspec.yaml
  • templates/pubspecs/templates/serverpod_templates/projectname_server/pubspec.yaml
📚 Learning: 2025-12-11T03:56:54.151Z
Learnt from: CR
Repo: serverpod/serverpod PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-11T03:56:54.151Z
Learning: Verify example projects still work before submitting PR by running example servers with 'dart bin/main.dart --apply-migrations'

Applied to files:

  • templates/serverpod_templates/projectname_server/pubspec.yaml
  • templates/pubspecs/templates/serverpod_templates/projectname_server/pubspec.yaml
📚 Learning: 2025-12-11T03:56:54.151Z
Learnt from: CR
Repo: serverpod/serverpod PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-11T03:56:54.151Z
Learning: Applies to **/*.dart : Run 'dart format .' to format all code before committing

Applied to files:

  • templates/serverpod_templates/projectname_server/pubspec.yaml
  • templates/pubspecs/templates/serverpod_templates/projectname_server/pubspec.yaml
📚 Learning: 2025-06-17T11:44:37.288Z
Learnt from: tp
Repo: serverpod/serverpod PR: 3666
File: modules/new_serverpod_auth/serverpod_auth_migration/serverpod_auth_migration_client/CHANGELOG.md:1-7
Timestamp: 2025-06-17T11:44:37.288Z
Learning: Changes to README.md and CHANGELOG.md files made by the util/update_pubspecs script can be safely ignored during code review, as these files are auto-generated by copying from a single source rather than being manually authored.

Applied to files:

  • templates/pubspecs/templates/serverpod_templates/projectname_server/pubspec.yaml
📚 Learning: 2025-06-17T11:44:37.288Z
Learnt from: tp
Repo: serverpod/serverpod PR: 3666
File: modules/new_serverpod_auth/serverpod_auth_migration/serverpod_auth_migration_client/CHANGELOG.md:1-7
Timestamp: 2025-06-17T11:44:37.288Z
Learning: The util/update_pubspecs script automatically copies the root CHANGELOG.md to all packages/modules and README_subpackage.md to all modules as README.md. These file changes should be ignored during code review as they are auto-generated distribution of shared content, not manual authoring that requires review.

Applied to files:

  • templates/pubspecs/templates/serverpod_templates/projectname_server/pubspec.yaml
📚 Learning: 2025-07-02T16:07:50.947Z
Learnt from: tp
Repo: serverpod/serverpod PR: 3747
File: modules/new_serverpod_auth/serverpod_auth_migration/serverpod_auth_migration_server/lib/src/business/migrating_email_endpoint_base.dart:4-4
Timestamp: 2025-07-02T16:07:50.947Z
Learning: In Serverpod, tp prefers importing the full package (e.g., 'package:serverpod_auth_migration_server/serverpod_auth_migration_server.dart') as a baseline rather than using smaller local imports, even within the same package where it might be considered a "self-import".

Applied to files:

  • templates/pubspecs/templates/serverpod_templates/projectname_server/pubspec.yaml
📚 Learning: 2025-06-17T11:40:09.088Z
Learnt from: tp
Repo: serverpod/serverpod PR: 3666
File: modules/new_serverpod_auth/serverpod_auth_migration/serverpod_auth_migration_client/CHANGELOG.md:1-7
Timestamp: 2025-06-17T11:40:09.088Z
Learning: CHANGELOG.md files in the serverpod_auth_migration modules (client and server) are auto-generated and cannot be manually modified during the development process.

Applied to files:

  • templates/pubspecs/templates/serverpod_templates/projectname_server/pubspec.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (46)
  • GitHub Check: Module integration tests in modules/serverpod_auth/serverpod_auth_idp/serverpod_auth_idp_server with Flutter 3.32.0
  • GitHub Check: Module integration tests in modules/serverpod_auth/serverpod_auth_core/serverpod_auth_core_server with Flutter 3.32.0
  • GitHub Check: Module integration tests in tests/serverpod_auth_test/serverpod_auth_test_server with Flutter 3.32.0
  • GitHub Check: Module integration tests in modules/serverpod_auth/serverpod_auth_idp/serverpod_auth_idp_server with Flutter 3.38.4
  • GitHub Check: Module integration tests in tests/serverpod_auth_test/serverpod_auth_test_server with Flutter 3.38.4
  • GitHub Check: Module integration tests in tests/serverpod_test_nonvector/serverpod_test_nonvector_server with Flutter 3.38.4
  • GitHub Check: Module integration tests in tests/serverpod_test_nonvector/serverpod_test_nonvector_server with Flutter 3.32.0
  • GitHub Check: CLI e2e tests (3.38.4, ubuntu-latest, 2, tests/serverpod_cli_e2e_test)
  • GitHub Check: Serverpod concurrent integration tests (server) (3.38.4)
  • GitHub Check: CLI e2e tests (3.38.4, ubuntu-latest, 1, tests/serverpod_cli_e2e_test)
  • GitHub Check: CLI e2e tests (3.32.0, ubuntu-latest, 1, tests/serverpod_cli_e2e_test)
  • GitHub Check: CLI e2e tests (3.38.4, ubuntu-latest, 0, tests/serverpod_cli_e2e_test)
  • GitHub Check: CLI e2e tests (3.32.0, ubuntu-latest, 2, tests/serverpod_cli_e2e_test)
  • GitHub Check: Bootstrap tests (3.38.4, ubuntu-latest, tests/bootstrap_project)
  • GitHub Check: Bootstrap tests (3.32.0, windows-latest, tests/bootstrap_project)
  • GitHub Check: Bootstrap tests (3.38.4, windows-latest, tests/bootstrap_project)
  • GitHub Check: CLI e2e tests (3.32.0, ubuntu-latest, 0, tests/serverpod_cli_e2e_test)
  • GitHub Check: Bootstrap tests (3.32.0, ubuntu-latest, tests/bootstrap_project)
  • GitHub Check: Serverpod integration tests (server) (3.32.0)
  • GitHub Check: Serverpod integration tests (flutter)
  • GitHub Check: Migration e2e tests (3.32.0)
  • GitHub Check: Serverpod concurrent integration tests (server) (3.32.0)
  • GitHub Check: Serverpod E2E web tests (3.32.0)
  • GitHub Check: Unit tests Web (3.32.0, windows-latest)
  • GitHub Check: Serverpod integration tests (server) (3.38.4)
  • GitHub Check: Version change test
  • GitHub Check: Migration e2e tests (3.38.4)
  • GitHub Check: Unit tests Web (3.38.4, windows-latest)
  • GitHub Check: Unit tests IO (3.32.0, windows-latest)
  • GitHub Check: Unit tests IO (3.38.4, ubuntu-latest)
  • GitHub Check: Unit tests IO (3.38.4, windows-latest)
  • GitHub Check: Unit tests IO (3.32.0, ubuntu-latest)
  • GitHub Check: dart analyze downgrade (3.38.4, ubuntu-latest)
  • GitHub Check: serverpod generate (3.32.0)
  • GitHub Check: dart analyze latest (3.38.4, ubuntu-latest)
  • GitHub Check: Serverpod E2E web tests (3.38.4)
  • GitHub Check: Flutter unit tests (3.32.0, windows-latest, packages/serverpod_flutter)
  • GitHub Check: serverpod generate (3.38.4)
  • GitHub Check: dart analyze (3.32.0, windows-latest)
  • GitHub Check: dart analyze latest (3.38.4, windows-latest)
  • GitHub Check: dart analyze downgrade (3.32.0, ubuntu-latest)
  • GitHub Check: dart analyze downgrade (3.38.4, windows-latest)
  • GitHub Check: Serverpod E2E IO tests (3.38.4)
  • GitHub Check: dart analyze downgrade (3.32.0, windows-latest)
  • GitHub Check: Serverpod E2E IO tests (3.32.0)
  • GitHub Check: dart analyze (3.32.0, ubuntu-latest)
🔇 Additional comments (1)
templates/pubspecs/templates/serverpod_templates/projectname_server/pubspec.yaml (1)

35-47: Platform-specific configuration mirrors the main template correctly.

The flutter_build changes in this pubspecs template file are identical to the main template, which is expected and correct. The same platform-specific approach addresses Windows compatibility issues by avoiding Unix-specific commands.

Same optional refinement applies here: consider uniform path separators (backslashes) in the Windows move command for consistency.

@nielsenko
nielsenko force-pushed the fix-serverpod-create-no-rm-on-windows branch 3 times, most recently from 31d98d9 to 80bf6e3 Compare December 22, 2025 14:53
@nielsenko
nielsenko force-pushed the fix-serverpod-create-no-rm-on-windows branch 5 times, most recently from d7a3c3d to 4bf4c54 Compare January 9, 2026 13:09
@nielsenko
nielsenko force-pushed the fix-serverpod-create-no-rm-on-windows branch from 4bf4c54 to 4507a5a Compare January 19, 2026 10:44
@nielsenko nielsenko self-assigned this Jan 19, 2026
@nielsenko
nielsenko force-pushed the fix-serverpod-create-no-rm-on-windows branch from 4507a5a to 583e46f Compare January 19, 2026 10:54
@nielsenko
nielsenko force-pushed the fix-serverpod-create-no-rm-on-windows branch from 583e46f to 23ca85b Compare January 19, 2026 11:10
@nielsenko
nielsenko marked this pull request as ready for review January 19, 2026 12:33

@marcelomendoncasoares marcelomendoncasoares left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🪟

@nielsenko
nielsenko merged commit 8164fb6 into serverpod:main Jan 19, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 19, 2026
@nielsenko
nielsenko deleted the fix-serverpod-create-no-rm-on-windows branch August 20, 2026 15:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

serverpod create tries to use rm on windows and fails fail during "serverpod create", when or after flutter web builld

2 participants