Skip to content

Commit

Permalink
v1.0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
FejZa committed Dec 5, 2024
1 parent d7a09d5 commit a509068
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.12]

### Added

- Added handling CLI argument `-buildAppBundle` to produce an .abb file instead of .apk when building for Android

## [1.0.11]

### Added
Expand Down
8 changes: 6 additions & 2 deletions Editor/AzurePipelinesBuildTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public static class AzurePipelinesBuild
private const string AndroidKeystorePassArgument = "-keystorePass";
private const string AndroidKeystoreAliasNameArgument = "-keystoreAliasName";
private const string AndroidKeystoreAliasPassArgument = "-keystoreAliasPass";
private const string AndroidBuildAppBundleArgument = "-buildAppBundle";

public static void PerformBuild()
{
Expand All @@ -27,9 +28,9 @@ public static void PerformBuild()
return;
}

// When building for Android, check for custom keystore signing credentials and apply them prior to building the project.
if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android)
{
// When building for Android, check for custom keystore signing credentials and apply them prior to building the project.
if (Dinomite.AzurePipelines.Utilities.TryGetCommandLineArgumentValue(AndroidKeystoreNameArgument, out var androidKeystoreName) &&
Dinomite.AzurePipelines.Utilities.TryGetCommandLineArgumentValue(AndroidKeystorePassArgument, out var androidKeystorePass) &&
Dinomite.AzurePipelines.Utilities.TryGetCommandLineArgumentValue(AndroidKeystoreAliasNameArgument, out var androidKeystoreAliasName))
Expand All @@ -49,6 +50,9 @@ public static void PerformBuild()
// would cause the build to fail.
PlayerSettings.Android.useCustomKeystore = false;
}

// When building for Android, we might want to build an .aab for the Play Store instead of an .apk file.
EditorUserBuildSettings.buildAppBundle = Dinomite.AzurePipelines.Utilities.CommandLineArgumentExists(AndroidBuildAppBundleArgument);
}

try
Expand Down Expand Up @@ -118,7 +122,7 @@ private static string GetBuildTargetOutputFileNameAndExtension(string outputFile
switch (EditorUserBuildSettings.activeBuildTarget)
{
case BuildTarget.Android:
return string.Format("{0}.apk", outputFileName);
return string.Format("{0}.{1}", outputFileName, EditorUserBuildSettings.buildAppBundle ? "aab" : "apk");
case BuildTarget.StandaloneWindows64:
case BuildTarget.StandaloneWindows:
return string.Format("{0}.exe", outputFileName);
Expand Down
17 changes: 16 additions & 1 deletion Editor/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,28 @@ namespace Dinomite.AzurePipelines
{
public static class Utilities
{
public static bool CommandLineArgumentExists(string argumentName)
{
var commandLineArguments = System.Environment.GetCommandLineArgs();

for (var i = 0; i < commandLineArguments.Length; i++)
{
if (string.Equals(commandLineArguments[i], argumentName))
{
return true;
}
}

return false;
}

public static bool TryGetCommandLineArgumentValue(string argumentName, out string value)
{
var commandLineArguments = System.Environment.GetCommandLineArgs();

for (var i = 0; i < commandLineArguments.Length; i++)
{
if (commandLineArguments[i] == argumentName && i + 1 < commandLineArguments.Length)
if (string.Equals(commandLineArguments[i], argumentName) && i + 1 < commandLineArguments.Length)
{
value = commandLineArguments[i + 1];
return true;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "games.dinomite.azurepipelines",
"displayName": "Dinomite.AzurePipelines",
"description": "A Unity package containing build scripts for use with the Unity Tools for Azure DevOps extension.",
"version": "1.0.11",
"version": "1.0.12",
"unity": "2018.1",
"author": "Dinomite",
"keywords": [
Expand Down

0 comments on commit a509068

Please sign in to comment.