Improve console/axmol.ps1 [skip ci] [skip appveyor]

This commit is contained in:
halx99 2023-09-06 12:23:33 +08:00
parent 8cbe447974
commit c2bec92bc0
1 changed files with 28 additions and 14 deletions

View File

@ -89,25 +89,39 @@ function axmol_deploy() {
$sub_args = $args
. axmol_build @sub_args
if ($options.p -eq 'winuwp') {
$appxManifestFile = Join-Path $options.d "$BUILD_DIR/bin/$cmake_target/$optimize_flag/Appx/AppxManifest.xml"
$appxManifestFile = Join-Path $proj_dir "$BUILD_DIR/bin/$cmake_target/$optimize_flag/Appx/AppxManifest.xml"
# deploy by visual studio major program: devenv.exe
$vswherePath = Join-Path ${env:ProgramFiles(x86)} "Microsoft Visual Studio\Installer\vswhere.exe"
$devenvPath = &$vswherePath -latest -requires Microsoft.Component.MSBuild -find Common*\IDE\devenv.exe | select-object -first 1
if (Test-Path $devenvPath -PathType Leaf) {
$devenvRoot = Split-Path $devenvPath -Parent
$env:PATH = "$devenvRoot;$env:PATH"
$slnDir = Join-Path $proj_dir $BUILD_DIR
$slnFileName = (Get-ChildItem $slnDir *.sln).Name
$slnFilePath = Join-Path $slnDir $slnFileName
devenv $slnFilePath /deploy $optimize_flag /project $cmake_target /projectconfig $optimize_flag
}
[XML]$appxManifest = Get-Content $appxManifestFile
$appxIdentity = $appxManifest.Package.Identity.Name
$appxPkgFullName = (powershell -Command "(Get-AppxPackage -Name '$appxIdentity' | Select-Object -Unique 'PackageFullName').PackageFullName")
if ($appxPkgInfo ) {
if ($uninst) {
println "Uninstalling $appxPkgFullName ..."
powershell -Command "Remove-AppxPackage -Package '$appxPkgFullName'"
powershell -Command "Add-AppxPackage -Register '$appxManifestFile'"
}
}
else {
powershell -Command "Add-AppxPackage -Register '$appxManifestFile'"
}
# $appxPkgFullName = (powershell -Command "(Get-AppxPackage -Name '$appxIdentity' | Select-Object -Unique 'PackageFullName').PackageFullName")
# if ($appxPkgFullName ) {
# if ($uninst) {
# println "Uninstalling $appxPkgFullName ..."
# powershell -Command "Remove-AppxPackage -Package '$appxPkgFullName'"
# powershell -Command "Add-AppxPackage -Register '$appxManifestFile'"
# }
# }
# else {
# powershell -Command "Add-AppxPackage -Register '$appxManifestFile'"
# }
$appxPkgName = (powershell -Command "(Get-AppxPackage -Name '$appxIdentity' | Select-Object -Unique 'PackageFamilyName').PackageFamilyName")
println "axmol: Deploy $cmake_target done: $appxPkgName"
}
elseif($options.p -eq 'win32') {
$win32exePath = Join-Path $options.d "$BUILD_DIR/bin/$cmake_target/$optimize_flag/$cmake_target.exe"
$win32exePath = Join-Path $proj_dir "$BUILD_DIR/bin/$cmake_target/$optimize_flag/$cmake_target.exe"
println "axmol: Deploy $cmake_target done: $win32exePath"
}
elseif ($options.p -eq 'android') {
@ -175,7 +189,7 @@ function axmol_run() {
println "axmol: Launching $launch_wasmapp ..."
emrun $launch_wasmapp
}
println "axmol: Launch $cmake_target done, target platform is $(options.p)"
println "axmol: Launch $cmake_target done, target platform is $($options.p)"
}
$builtinPlugins = @{