verify-module-rename.ps1 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # 模块重命名验证脚本(PowerShell 版本)
  2. # 用于验证模块重命名是否成功
  3. Write-Host "=========================================" -ForegroundColor Cyan
  4. Write-Host "模块重命名验证" -ForegroundColor Cyan
  5. Write-Host "=========================================" -ForegroundColor Cyan
  6. Write-Host ""
  7. # 检查计数
  8. $successCount = 0
  9. $failCount = 0
  10. # 检查函数
  11. function Check-Item {
  12. param(
  13. [string]$Description,
  14. [bool]$Condition
  15. )
  16. if ($Condition) {
  17. Write-Host "✓ $Description" -ForegroundColor Green
  18. $script:successCount++
  19. } else {
  20. Write-Host "✗ $Description" -ForegroundColor Red
  21. $script:failCount++
  22. }
  23. }
  24. Write-Host "1. 检查目录结构..." -ForegroundColor Yellow
  25. Write-Host ""
  26. # 检查新目录是否存在
  27. Check-Item "yudao-module-order 目录存在" (Test-Path "yudao-module-order")
  28. Check-Item "yudao-module-product 目录存在" (Test-Path "yudao-module-product")
  29. # 检查旧目录是否已删除
  30. Check-Item "yudao-order-server 目录已删除" (-not (Test-Path "yudao-order-server"))
  31. Check-Item "yudao-product-server 目录已删除" (-not (Test-Path "yudao-product-server"))
  32. Write-Host ""
  33. Write-Host "2. 检查 POM 文件配置..." -ForegroundColor Yellow
  34. Write-Host ""
  35. # 检查根 pom.xml
  36. $rootPom = Get-Content "pom.xml" -Raw
  37. Check-Item "根 pom.xml 包含新模块声明" ($rootPom -match "yudao-module-order" -and $rootPom -match "yudao-module-product")
  38. Check-Item "根 pom.xml 不包含旧模块声明" ($rootPom -notmatch "yudao-order-server" -and $rootPom -notmatch "yudao-product-server")
  39. # 检查 yudao-server/pom.xml
  40. $serverPom = Get-Content "yudao-server/pom.xml" -Raw
  41. Check-Item "yudao-server/pom.xml 包含新模块依赖" ($serverPom -match "yudao-module-order" -and $serverPom -match "yudao-module-product")
  42. Check-Item "yudao-server/pom.xml 不包含旧模块依赖" ($serverPom -notmatch "yudao-order-server" -and $serverPom -notmatch "yudao-product-server")
  43. # 检查模块自身的 pom.xml
  44. if (Test-Path "yudao-module-order/pom.xml") {
  45. $orderPom = Get-Content "yudao-module-order/pom.xml" -Raw
  46. Check-Item "yudao-module-order/pom.xml artifactId 正确" ($orderPom -match "<artifactId>yudao-module-order</artifactId>")
  47. }
  48. if (Test-Path "yudao-module-product/pom.xml") {
  49. $productPom = Get-Content "yudao-module-product/pom.xml" -Raw
  50. Check-Item "yudao-module-product/pom.xml artifactId 正确" ($productPom -match "<artifactId>yudao-module-product</artifactId>")
  51. }
  52. Write-Host ""
  53. Write-Host "3. 检查源代码目录..." -ForegroundColor Yellow
  54. Write-Host ""
  55. # 检查源代码目录结构
  56. Check-Item "订单模块源代码目录存在" (Test-Path "yudao-module-order/src/main/java/cn/iocoder/yudao/module/order")
  57. Check-Item "生产模块源代码目录存在" (Test-Path "yudao-module-product/src/main/java/cn/iocoder/yudao/module/product")
  58. Write-Host ""
  59. Write-Host "=========================================" -ForegroundColor Cyan
  60. Write-Host "验证结果" -ForegroundColor Cyan
  61. Write-Host "=========================================" -ForegroundColor Cyan
  62. Write-Host ""
  63. Write-Host "成功: $successCount 项" -ForegroundColor Green
  64. Write-Host "失败: $failCount 项" -ForegroundColor Red
  65. Write-Host ""
  66. if ($failCount -eq 0) {
  67. Write-Host "✓ 模块重命名验证通过!" -ForegroundColor Green
  68. Write-Host ""
  69. Write-Host "下一步操作:" -ForegroundColor Yellow
  70. Write-Host " 1. mvn clean install -DskipTests"
  71. Write-Host " 2. 在 IDE 中刷新 Maven 项目"
  72. Write-Host " 3. 重启后端服务"
  73. exit 0
  74. }
  75. else {
  76. Write-Host "✗ 模块重命名验证失败,请检查上述失败项" -ForegroundColor Red
  77. Write-Host ""
  78. Write-Host "请参考 MODULE_RENAME_SUMMARY.md 文档"
  79. exit 1
  80. }