mirror of
https://gitlab.silvrtree.co.uk/martind2000/aodb.git
synced 2025-03-13 03:40:01 +00:00
75 lines
2.1 KiB
PowerShell
75 lines
2.1 KiB
PowerShell
param(
|
|
[String] $Debug = [System.Convert]::ToBoolean('false'),
|
|
[String] $VersionOverride = $GITVERSION_NUGETVERSIONV2
|
|
)
|
|
|
|
$Debug = [System.Convert]::ToBoolean($Debug)
|
|
|
|
function RenameAPK($debug, $VersionOverride, $BuildOutputPath, $CordovaOutputAPK)
|
|
{
|
|
$debugAppender = ""
|
|
if($debug)
|
|
{
|
|
$debugAppender = "-debug"
|
|
}
|
|
|
|
##Move and Rename the build with either Semantic Versioning or the VersionOverride
|
|
if($VersionOverride)
|
|
{
|
|
$newPackageName = "AODB.Mobile-" + $VersionOverride + $debugAppender + ".apk";
|
|
Rename-Item $BuildOutputPath$CordovaOutputApk $newPackageName
|
|
}
|
|
elseif($GITVERSION_NUGETVERSIONV2)
|
|
{
|
|
$newPackageName = "AODB.Mobile-" + $GITVERSION.NUGETVERSIONV2 + $debugAppender + ".apk";
|
|
Rename-Item $BuildOutputPath$CordovaOutputApk $newPackageName
|
|
}
|
|
else
|
|
{
|
|
$newPackageName = "PRM.Mobile-0.0.1" + $debugAppender + ".apk"
|
|
Rename-Item $BuildOutputPath$CordovaOutputApk $newPackageName
|
|
}
|
|
|
|
return $newPackageName
|
|
}
|
|
|
|
function CopyAPK($BuildOutputPath, $PackageName)
|
|
{
|
|
if(Test-Path apk)
|
|
{
|
|
Copy-Item $BuildOutputPath$PackageName apk\$PackageName
|
|
}
|
|
else
|
|
{
|
|
New-Item -ItemType Directory apk
|
|
Copy-Item $BuildOutputPath$PackageName apk\$PackageName
|
|
}
|
|
}
|
|
|
|
##Reset based on Package.JSON Plugins and Platforms.
|
|
ionic state reset
|
|
|
|
##Update Config.xml Version
|
|
$configXmlPath = "config.xml";
|
|
$xml = [xml](Get-Content $configXmlPath);
|
|
$xml.widget.version = $VersionOverride;
|
|
$xml.Save($configXmlPath);
|
|
|
|
$BuildOutputPath = "platforms\android\build\outputs\apk\"
|
|
##Build Release
|
|
ionic build --release --buildConfig '.\tooling\IonicBuild\CordovaConfig.json'
|
|
$CordovaOutputReleaseApk = "android-release.apk"
|
|
$ReleasePackageName = RenameAPK $false $versionOverride $BuildOutputPath $CordovaOutputReleaseApk
|
|
CopyAPK $BuildOutputPath $ReleasePackageName
|
|
|
|
if($Debug)
|
|
{
|
|
ionic build
|
|
$CordovaOutputDebugApk = "android-debug.apk"
|
|
$DebugPackageName = RenameAPK $true $versionOverride $BuildOutputPath $CordovaOutputDebugApk
|
|
CopyAPK $BuildOutputPath $DebugPackageName
|
|
}
|
|
|
|
exit
|
|
|