From c2bec92bc04868bdff483a8f159ede3d48e4f310 Mon Sep 17 00:00:00 2001 From: halx99 Date: Wed, 6 Sep 2023 12:23:33 +0800 Subject: [PATCH] Improve console/axmol.ps1 [skip ci] [skip appveyor] --- tools/console/axmol.ps1 | 42 +++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/tools/console/axmol.ps1 b/tools/console/axmol.ps1 index 2fdcebb4f3..664526944c 100644 --- a/tools/console/axmol.ps1 +++ b/tools/console/axmol.ps1 @@ -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 = @{