Skip to content

Commit

Permalink
v1.0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
FejZa committed Dec 4, 2024
1 parent 67ce3b4 commit d7a09d5
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 7 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.11]

### Added

- Added handling CLI arguments `-keystoreName`, `-keystorePass`, `-keystoreAliasName` and `-keystoreAliasPass` to perform signing for Android builds

## [1.0.10]

### Fixed
Expand Down
40 changes: 34 additions & 6 deletions Editor/AzurePipelinesBuildTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ public static class AzurePipelinesBuild
{
private const string OutputFileNameArgument = "-outputFileName";
private const string OutputPathArgument = "-outputPath";
private const string AndroidKeystoreNameArgument = "-keystoreName";
private const string AndroidKeystorePassArgument = "-keystorePass";
private const string AndroidKeystoreAliasNameArgument = "-keystoreAliasName";
private const string AndroidKeystoreAliasPassArgument = "-keystoreAliasPass";

public static void PerformBuild()
{
Expand All @@ -23,6 +27,30 @@ 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)
{
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))
{
PlayerSettings.Android.useCustomKeystore = true;
PlayerSettings.Android.keystoreName = androidKeystoreName;
PlayerSettings.Android.keystorePass = androidKeystorePass;
PlayerSettings.Android.keyaliasName = androidKeystoreAliasName;
PlayerSettings.Android.keyaliasPass = Dinomite.AzurePipelines.Utilities.TryGetCommandLineArgumentValue(AndroidKeystoreAliasPassArgument, out var androidKeystoreAliasPass) ?
androidKeystoreAliasPass :
androidKeystorePass;
}
else
{
// If no credentials passed, we assume the user wants to build using a development keystore auto-generated by Unity.
// We clear the custom keystore flag here in case developers have checked in a keystore config to the repository, which
// would cause the build to fail.
PlayerSettings.Android.useCustomKeystore = false;
}
}

try
{
var editorConfiguredBuildScenes = EditorBuildSettings.scenes;
Expand Down Expand Up @@ -98,8 +126,8 @@ private static string GetBuildTargetOutputFileNameAndExtension(string outputFile
case BuildTarget.StandaloneOSX:
#endif
#if !UNITY_2017_3_OR_NEWER
case BuildTarget.StandaloneOSXIntel:
case BuildTarget.StandaloneOSXIntel64:
case BuildTarget.StandaloneOSXIntel:
case BuildTarget.StandaloneOSXIntel64:
#endif
return string.Format("{0}.app", outputFileName);
case BuildTarget.iOS:
Expand All @@ -112,16 +140,16 @@ private static string GetBuildTargetOutputFileNameAndExtension(string outputFile
case BuildTarget.WSAPlayer:
case BuildTarget.StandaloneLinux64:
#if !UNITY_2018_3_OR_NEWER
case BuildTarget.PSP2:
case BuildTarget.PSP2:
#endif
case BuildTarget.PS4:
case BuildTarget.XboxOne:
#if !UNITY_2017_3_OR_NEWER
case BuildTarget.SamsungTV:
case BuildTarget.SamsungTV:
#endif
#if !UNITY_2018_1_OR_NEWER
case BuildTarget.N3DS:
case BuildTarget.WiiU:
case BuildTarget.N3DS:
case BuildTarget.WiiU:
#endif
case BuildTarget.Switch:
case BuildTarget.NoTarget:
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.10",
"version": "1.0.11",
"unity": "2018.1",
"author": "Dinomite",
"keywords": [
Expand Down

0 comments on commit d7a09d5

Please sign in to comment.