cmvr-wms/scripts/projectdev/Build-Android.ps1
lixiaolong e3860a3fd9 feat(production): 优化生产任务操作权限控制与数据查询
- 添加权限检查功能,防止未授权操作
- 实现远程搜索功能优化任务选择体验
- 集成分页查询提高大数据量性能表现
- 增强批量操作界面增加搜索筛选功能
- 完善表单验证与错误处理机制
- 重构数据过滤逻辑支持多条件组合查询
2026-10-13 09:41:46 +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-vue3')
try {$env:NODE_OPTIONS='--max-old-space-size=1024'; & 'C:/Program Files/nodejs/node.exe' 'node_modules/vite/bin/vite.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-vue3/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')