Repository navigation
Commit 5d995ed
authored
fix(cli/mobile): normalize gradlew CRLF on Windows hosts too (#16017)
* fix(cli/mobile): normalize gradlew CRLF on Windows hosts too
ensure_gradlew was gated behind #[cfg(unix)], so the CRLF-to-LF
normalization only ran on unix hosts. The CRLF rewrite itself is
platform-neutral: a CRLF gradlew breaks sh ./gradlew on every host,
including Git-Bash on Windows.
Split the function so the unix-only exec-bit fix stays gated while the
LF rewrite runs everywhere. This unblocks Windows hosts that previously
failed at the gradlew invocation with
"'gradlew' is not recognized as an internal or external command" when
gradlew carried CRLF endings.
* fix(cli/mobile): only rewrite gradlew when CRLF is actually present
OCR review: the unconditional rewrite churned the file's mtime on
every tauri android dev/build even when it was already LF, and could
fail on read-only or AV-locked files. Gate the write on the CRLF
check.
* style(cli/mobile): collapse fs::write args per rustfmt
* refactor(cli/mobile): make gradlew CRLF normalization best-effort
Hoist gradlew_path above the cfg(unix) block and downgrade CRLF
normalization failures to warnings: on Windows the CLI invokes
gradlew.bat, so a locked or read-only gradlew must not abort builds
that would otherwise succeed. Read failures are logged at debug level.
* docs(changes): add change file for gradlew CRLF normalization fix
* refactor(cli/mobile): keep hard error on unix, warn only on Windows
On unix a gradlew that cannot be rewritten will fail the build anyway
with a cryptic sh error, so restore the previous fs_context errors
there; on Windows the CLI invokes gradlew.bat, so failures only warn.
Also reword the comment to plainly state why the rewrite runs on all
platforms and reference this PR.1 parent 127aa17 commit 5d995ed
2 files changed
Lines changed: 44 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
492 | 492 | | |
493 | 493 | | |
494 | 494 | | |
495 | | - | |
496 | 495 | | |
497 | 496 | | |
498 | 497 | | |
| |||
585 | 584 | | |
586 | 585 | | |
587 | 586 | | |
588 | | - | |
589 | 587 | | |
590 | | - | |
591 | | - | |
592 | 588 | | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | | - | |
599 | | - | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
600 | 627 | | |
601 | | - | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | | - | |
608 | 628 | | |
609 | 629 | | |
610 | 630 | | |
| |||
0 commit comments