cmvr-wms/scripts/projectdev/Build-Android.ps1
lixiaolong ca1f5a27f9 feat(mobile): 优化移动端界面和功能
- 添加移动工作空间对话框全屏样式支持
- 更新应用主视图以支持桌面视口布局
- 重构Excel导入对话框增加预览和校验功能
- 在移动端主页增加生产与交付模块和项目借还功能
- 移动端库存列表显示项目名称和成品标识
- 增加入库记录批量操作和撤销功能
- 优化分页组件在桌面视口中的滚动行为
- 更新路由配置和数据库连接配置
- 调整仓库领域模型移除预期日期字段
- 优化智能代理服务的正则匹配和出库类型处理
2026-10-12 16:41:42 +08:00

26 lines
2.0 KiB
PowerShell

param([switch]$SkipWebBuild)
$ErrorActionPreference='Stop'
$taskRoot=(Resolve-Path (Join-Path $PSScriptRoot '../..')).Path
$env:JAVA_HOME=Join-Path $env:USERPROFILE '.jdks/ms-17.0.19'
$env:ANDROID_HOME=Join-Path $taskRoot '.codex-tmp/android-sdk'
$env:GRADLE_USER_HOME=Join-Path $taskRoot '.codex-tmp/gradle-cache'
$taskSocketDirectory=(Join-Path $taskRoot '.codex-tmp').Replace('\','/')
$env:GRADLE_OPTS="-Djdk.net.unixdomain.tmpdir=$taskSocketDirectory"
$env:JAVA_TOOL_OPTIONS="-Djdk.net.unixdomain.tmpdir=$taskSocketDirectory"
$taskGradle=Join-Path $taskRoot '.codex-tmp/android-tools/gradle-8.11.1/bin/gradle.bat'
if (!(Test-Path -LiteralPath $taskGradle)) { throw 'Install Gradle 8.11.1 in the local android-tools directory.' }
if (!$SkipWebBuild) {
Push-Location (Join-Path $taskRoot 'ruoyi-ui')
try {$env:NODE_OPTIONS='--openssl-legacy-provider'; & 'C:/Program Files/nodejs/node.exe' 'node_modules/@vue/cli-service/bin/vue-cli-service.js' build; if($LASTEXITCODE -ne 0){throw 'Web build failed'}} finally {Pop-Location}
}
$taskAssets=Join-Path $taskRoot 'android-app/app/src/main/assets'
New-Item -ItemType Directory -Path $taskAssets -Force | Out-Null
$taskBundle=Join-Path $taskAssets 'web.zip'
$taskWebFiles=Get-ChildItem -LiteralPath (Join-Path $taskRoot 'ruoyi-ui/dist') | Where-Object { $_.Name -ne 'mobile-update.json' -and $_.Name -notmatch '^web-[a-f0-9]+\.zip$' } | Select-Object -ExpandProperty FullName
Compress-Archive -Path $taskWebFiles -DestinationPath $taskBundle -Force
& 'C:/Program Files/nodejs/node.exe' (Join-Path $PSScriptRoot 'mobile-update.cjs')
if($LASTEXITCODE -ne 0){throw 'Page update packaging failed'}
Push-Location (Join-Path $taskRoot 'android-app')
try {& $taskGradle "-Dorg.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -Djdk.net.unixdomain.tmpdir=$taskSocketDirectory" --no-daemon testDebugUnitTest assembleDebug; if($LASTEXITCODE -ne 0){throw 'Android build or tests failed'}} finally {Pop-Location}
Write-Output (Join-Path $taskRoot 'android-app/app/build/outputs/apk/debug/app-debug.apk')