Switch to androidExportType instead of exportGoogleAndroidProject
parent
5484744bfc
commit
bd714da1a6
14
action.yml
14
action.yml
|
|
@ -22,7 +22,7 @@ inputs:
|
||||||
buildName:
|
buildName:
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
description: 'Name of the build.'
|
description: 'Name of the build. Should not include a file extension.'
|
||||||
buildsPath:
|
buildsPath:
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
|
|
@ -50,7 +50,13 @@ inputs:
|
||||||
androidAppBundle:
|
androidAppBundle:
|
||||||
required: false
|
required: false
|
||||||
default: 'false'
|
default: 'false'
|
||||||
description: 'Whether to build .aab instead of .apk'
|
description: '[Deprecated] Use androidExportType instead. Whether to build .aab instead of .apk'
|
||||||
|
androidExportType:
|
||||||
|
required: false
|
||||||
|
default: 'androidPackage'
|
||||||
|
description:
|
||||||
|
'The android export type. Should be androidPackage for apk,
|
||||||
|
androidAppBundle for aab, or androidStudioProject for an android studio project.'
|
||||||
androidKeystoreName:
|
androidKeystoreName:
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
|
|
@ -75,10 +81,6 @@ inputs:
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
description: 'The android target API level.'
|
description: 'The android target API level.'
|
||||||
exportAsGoogleAndroidProject:
|
|
||||||
required: false
|
|
||||||
default: 'false'
|
|
||||||
description: 'To export Google Android Studio project.'
|
|
||||||
sshAgent:
|
sshAgent:
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ namespace UnityBuilderAction.Input
|
||||||
{
|
{
|
||||||
public static void Apply(Dictionary<string, string> options)
|
public static void Apply(Dictionary<string, string> options)
|
||||||
{
|
{
|
||||||
EditorUserBuildSettings.buildAppBundle = options["customBuildPath"].EndsWith(".aab");
|
|
||||||
#if UNITY_2019_1_OR_NEWER
|
#if UNITY_2019_1_OR_NEWER
|
||||||
if (options.TryGetValue("androidKeystoreName", out string keystoreName) && !string.IsNullOrEmpty(keystoreName))
|
if (options.TryGetValue("androidKeystoreName", out string keystoreName) && !string.IsNullOrEmpty(keystoreName))
|
||||||
{
|
{
|
||||||
|
|
@ -36,10 +35,24 @@ namespace UnityBuilderAction.Input
|
||||||
}
|
}
|
||||||
PlayerSettings.Android.targetSdkVersion = targetSdkVersion;
|
PlayerSettings.Android.targetSdkVersion = targetSdkVersion;
|
||||||
}
|
}
|
||||||
if (options.TryGetValue("exportAsGoogleAndroidProject", out string exportAsGoogleAndroidProject) &&
|
|
||||||
!string.IsNullOrEmpty(exportAsGoogleAndroidProject))
|
if (options.TryGetValue("androidExportType", out string androidExportType) && !string.IsNullOrEmpty(androidExportType))
|
||||||
{
|
{
|
||||||
EditorUserBuildSettings.exportAsGoogleAndroidProject = bool.Parse(exportAsGoogleAndroidProject);
|
switch (androidExportType)
|
||||||
|
{
|
||||||
|
case "androidStudioProject":
|
||||||
|
EditorUserBuildSettings.exportAsGoogleAndroidProject = true;
|
||||||
|
EditorUserBuildSettings.buildAppBundle = false;
|
||||||
|
break;
|
||||||
|
case "androidAppBundle":
|
||||||
|
EditorUserBuildSettings.buildAppBundle = true;
|
||||||
|
EditorUserBuildSettings.exportAsGoogleAndroidProject = false;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
EditorUserBuildSettings.exportAsGoogleAndroidProject = false;
|
||||||
|
EditorUserBuildSettings.buildAppBundle = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -226,7 +226,7 @@ const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
||||||
class BuildParameters {
|
class BuildParameters {
|
||||||
static create() {
|
static create() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const buildFile = this.parseBuildFile(input_1.default.buildName, input_1.default.targetPlatform, input_1.default.androidAppBundle, input_1.default.exportAsGoogleAndroidProject);
|
const buildFile = this.parseBuildFile(input_1.default.buildName, input_1.default.targetPlatform, input_1.default.androidExportType);
|
||||||
const editorVersion = unity_versioning_1.default.determineUnityVersion(input_1.default.projectPath, input_1.default.unityVersion);
|
const editorVersion = unity_versioning_1.default.determineUnityVersion(input_1.default.projectPath, input_1.default.unityVersion);
|
||||||
const buildVersion = yield versioning_1.default.determineBuildVersion(input_1.default.versioningStrategy, input_1.default.specifiedVersion);
|
const buildVersion = yield versioning_1.default.determineBuildVersion(input_1.default.versioningStrategy, input_1.default.specifiedVersion);
|
||||||
const androidVersionCode = android_versioning_1.default.determineVersionCode(buildVersion, input_1.default.androidVersionCode);
|
const androidVersionCode = android_versioning_1.default.determineVersionCode(buildVersion, input_1.default.androidVersionCode);
|
||||||
|
|
@ -270,7 +270,7 @@ class BuildParameters {
|
||||||
androidKeyaliasPass: input_1.default.androidKeyaliasPass,
|
androidKeyaliasPass: input_1.default.androidKeyaliasPass,
|
||||||
androidTargetSdkVersion: input_1.default.androidTargetSdkVersion,
|
androidTargetSdkVersion: input_1.default.androidTargetSdkVersion,
|
||||||
androidSdkManagerParameters,
|
androidSdkManagerParameters,
|
||||||
exportAsGoogleAndroidProject: input_1.default.exportAsGoogleAndroidProject,
|
androidExportType: input_1.default.androidExportType,
|
||||||
customParameters: input_1.default.customParameters,
|
customParameters: input_1.default.customParameters,
|
||||||
sshAgent: input_1.default.sshAgent,
|
sshAgent: input_1.default.sshAgent,
|
||||||
gitPrivateToken: input_1.default.gitPrivateToken || (yield github_cli_1.GithubCliReader.GetGitHubAuthToken()),
|
gitPrivateToken: input_1.default.gitPrivateToken || (yield github_cli_1.GithubCliReader.GetGitHubAuthToken()),
|
||||||
|
|
@ -313,12 +313,19 @@ class BuildParameters {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static parseBuildFile(filename, platform, androidAppBundle, exportAsGoogleAndroidProject) {
|
static parseBuildFile(filename, platform, androidExportType) {
|
||||||
if (platform_1.default.isWindows(platform)) {
|
if (platform_1.default.isWindows(platform)) {
|
||||||
return `${filename}.exe`;
|
return `${filename}.exe`;
|
||||||
}
|
}
|
||||||
if (platform_1.default.isAndroid(platform) && exportAsGoogleAndroidProject !== 'true') {
|
if (platform_1.default.isAndroid(platform)) {
|
||||||
return androidAppBundle ? `${filename}.aab` : `${filename}.apk`;
|
switch (androidExportType) {
|
||||||
|
case `androidPackage`:
|
||||||
|
return `${filename}.apk`;
|
||||||
|
case `androidAppBundle`:
|
||||||
|
return `${filename}.aab`;
|
||||||
|
case `androidStudioProject`:
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
@ -6636,7 +6643,7 @@ class ImageEnvironmentFactory {
|
||||||
{ name: 'ANDROID_KEYALIAS_PASS', value: parameters.androidKeyaliasPass },
|
{ name: 'ANDROID_KEYALIAS_PASS', value: parameters.androidKeyaliasPass },
|
||||||
{ name: 'ANDROID_TARGET_SDK_VERSION', value: parameters.androidTargetSdkVersion },
|
{ name: 'ANDROID_TARGET_SDK_VERSION', value: parameters.androidTargetSdkVersion },
|
||||||
{ name: 'ANDROID_SDK_MANAGER_PARAMETERS', value: parameters.androidSdkManagerParameters },
|
{ name: 'ANDROID_SDK_MANAGER_PARAMETERS', value: parameters.androidSdkManagerParameters },
|
||||||
{ name: 'EXPORT_AS_GOOGLE_ANDROID_PROJECT', value: parameters.exportAsGoogleAndroidProject },
|
{ name: 'ANDROID_EXPORT_TYPE', value: parameters.androidExportType },
|
||||||
{ name: 'CUSTOM_PARAMETERS', value: parameters.customParameters },
|
{ name: 'CUSTOM_PARAMETERS', value: parameters.customParameters },
|
||||||
{ name: 'CHOWN_FILES_TO', value: parameters.chownFilesTo },
|
{ name: 'CHOWN_FILES_TO', value: parameters.chownFilesTo },
|
||||||
{ name: 'GITHUB_REF', value: process.env.GITHUB_REF },
|
{ name: 'GITHUB_REF', value: process.env.GITHUB_REF },
|
||||||
|
|
@ -7206,6 +7213,17 @@ class Input {
|
||||||
const input = Input.getInput('androidAppBundle') || false;
|
const input = Input.getInput('androidAppBundle') || false;
|
||||||
return input === 'true';
|
return input === 'true';
|
||||||
}
|
}
|
||||||
|
static get androidExportType() {
|
||||||
|
// TODO: remove this in V3
|
||||||
|
const exportType = Input.getInput('androidExportType');
|
||||||
|
if (exportType) {
|
||||||
|
return exportType || 'androidPackage';
|
||||||
|
}
|
||||||
|
return Input.androidAppBundle ? 'androidAppBundle' : 'androidPackage';
|
||||||
|
// End TODO
|
||||||
|
// Use this in V3 when androidAppBundle is removed
|
||||||
|
// return Input.getInput('androidExportType') || 'androidPackage';
|
||||||
|
}
|
||||||
static get androidKeystoreName() {
|
static get androidKeystoreName() {
|
||||||
return Input.getInput('androidKeystoreName') || '';
|
return Input.getInput('androidKeystoreName') || '';
|
||||||
}
|
}
|
||||||
|
|
@ -7224,9 +7242,6 @@ class Input {
|
||||||
static get androidTargetSdkVersion() {
|
static get androidTargetSdkVersion() {
|
||||||
return Input.getInput('androidTargetSdkVersion') || '';
|
return Input.getInput('androidTargetSdkVersion') || '';
|
||||||
}
|
}
|
||||||
static get exportAsGoogleAndroidProject() {
|
|
||||||
return Input.getInput('exportAsGoogleAndroidProject') || 'false';
|
|
||||||
}
|
|
||||||
static get sshAgent() {
|
static get sshAgent() {
|
||||||
return Input.getInput('sshAgent') || '';
|
return Input.getInput('sshAgent') || '';
|
||||||
}
|
}
|
||||||
|
|
@ -7615,7 +7630,7 @@ class SetupMac {
|
||||||
process.env.ANDROID_KEYALIAS_PASS = buildParameters.androidKeyaliasPass;
|
process.env.ANDROID_KEYALIAS_PASS = buildParameters.androidKeyaliasPass;
|
||||||
process.env.ANDROID_TARGET_SDK_VERSION = buildParameters.androidTargetSdkVersion;
|
process.env.ANDROID_TARGET_SDK_VERSION = buildParameters.androidTargetSdkVersion;
|
||||||
process.env.ANDROID_SDK_MANAGER_PARAMETERS = buildParameters.androidSdkManagerParameters;
|
process.env.ANDROID_SDK_MANAGER_PARAMETERS = buildParameters.androidSdkManagerParameters;
|
||||||
process.env.EXPORT_AS_GOOGLE_ANDROID_PROJECT = buildParameters.exportAsGoogleAndroidProject;
|
process.env.ANDROID_EXPORT_TYPE = buildParameters.androidExportType;
|
||||||
process.env.CUSTOM_PARAMETERS = buildParameters.customParameters;
|
process.env.CUSTOM_PARAMETERS = buildParameters.customParameters;
|
||||||
process.env.CHOWN_FILES_TO = buildParameters.chownFilesTo;
|
process.env.CHOWN_FILES_TO = buildParameters.chownFilesTo;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -147,7 +147,7 @@ echo ""
|
||||||
-androidKeyaliasName "$ANDROID_KEYALIAS_NAME" \
|
-androidKeyaliasName "$ANDROID_KEYALIAS_NAME" \
|
||||||
-androidKeyaliasPass "$ANDROID_KEYALIAS_PASS" \
|
-androidKeyaliasPass "$ANDROID_KEYALIAS_PASS" \
|
||||||
-androidTargetSdkVersion "$ANDROID_TARGET_SDK_VERSION" \
|
-androidTargetSdkVersion "$ANDROID_TARGET_SDK_VERSION" \
|
||||||
-exportAsGoogleAndroidProject "$EXPORT_AS_GOOGLE_ANDROID_PROJECT" \
|
-androidExportType "$ANDROID_EXPORT_TYPE" \
|
||||||
$CUSTOM_PARAMETERS
|
$CUSTOM_PARAMETERS
|
||||||
|
|
||||||
# Catch exit code
|
# Catch exit code
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ unity-editor \
|
||||||
-androidKeyaliasName "$ANDROID_KEYALIAS_NAME" \
|
-androidKeyaliasName "$ANDROID_KEYALIAS_NAME" \
|
||||||
-androidKeyaliasPass "$ANDROID_KEYALIAS_PASS" \
|
-androidKeyaliasPass "$ANDROID_KEYALIAS_PASS" \
|
||||||
-androidTargetSdkVersion "$ANDROID_TARGET_SDK_VERSION" \
|
-androidTargetSdkVersion "$ANDROID_TARGET_SDK_VERSION" \
|
||||||
-exportAsGoogleAndroidProject "$EXPORT_AS_GOOGLE_ANDROID_PROJECT" \
|
-androidExportType "$ANDROID_EXPORT_TYPE" \
|
||||||
$CUSTOM_PARAMETERS
|
$CUSTOM_PARAMETERS
|
||||||
|
|
||||||
# Catch exit code
|
# Catch exit code
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ $_, $customParametersArray = Invoke-Expression('Write-Output -- "" ' + $Env:CUST
|
||||||
-androidKeyaliasName $Env:ANDROID_KEYALIAS_NAME `
|
-androidKeyaliasName $Env:ANDROID_KEYALIAS_NAME `
|
||||||
-androidKeyaliasPass $Env:ANDROID_KEYALIAS_PASS `
|
-androidKeyaliasPass $Env:ANDROID_KEYALIAS_PASS `
|
||||||
-androidTargetSdkVersion $Env:ANDROID_TARGET_SDK_VERSION `
|
-androidTargetSdkVersion $Env:ANDROID_TARGET_SDK_VERSION `
|
||||||
-exportAsGoogleAndroidProject $Env:EXPORT_AS_GOOGLE_ANDROID_PROJECT `
|
-androidExportType $Env:ANDROID_EXPORT_TYPE `
|
||||||
$customParametersArray `
|
$customParametersArray `
|
||||||
-logfile | Out-Host
|
-logfile | Out-Host
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,21 +109,30 @@ describe('BuildParameters', () => {
|
||||||
test.each([Platform.types.Android])('appends apk for %s', async (targetPlatform) => {
|
test.each([Platform.types.Android])('appends apk for %s', async (targetPlatform) => {
|
||||||
jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(targetPlatform);
|
jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(targetPlatform);
|
||||||
jest.spyOn(Input, 'buildName', 'get').mockReturnValue(targetPlatform);
|
jest.spyOn(Input, 'buildName', 'get').mockReturnValue(targetPlatform);
|
||||||
jest.spyOn(Input, 'androidAppBundle', 'get').mockReturnValue(false);
|
jest.spyOn(Input, 'androidExportType', 'get').mockReturnValue('androidPackage');
|
||||||
await expect(BuildParameters.create()).resolves.toEqual(
|
await expect(BuildParameters.create()).resolves.toEqual(
|
||||||
expect.objectContaining({ buildFile: `${targetPlatform}.apk` }),
|
expect.objectContaining({ buildFile: `${targetPlatform}.apk` }),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.each([Platform.types.Android])('appends aab for %s', async (targetPlatform) => {
|
test.each([Platform.types.Android])('appends apk for %s', async (targetPlatform) => {
|
||||||
jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(targetPlatform);
|
jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(targetPlatform);
|
||||||
jest.spyOn(Input, 'buildName', 'get').mockReturnValue(targetPlatform);
|
jest.spyOn(Input, 'buildName', 'get').mockReturnValue(targetPlatform);
|
||||||
jest.spyOn(Input, 'androidAppBundle', 'get').mockReturnValue(true);
|
jest.spyOn(Input, 'androidExportType', 'get').mockReturnValue('androidAppBundle');
|
||||||
await expect(BuildParameters.create()).resolves.toEqual(
|
await expect(BuildParameters.create()).resolves.toEqual(
|
||||||
expect.objectContaining({ buildFile: `${targetPlatform}.aab` }),
|
expect.objectContaining({ buildFile: `${targetPlatform}.aab` }),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test.each([Platform.types.Android])('appends apk for %s', async (targetPlatform) => {
|
||||||
|
jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(targetPlatform);
|
||||||
|
jest.spyOn(Input, 'buildName', 'get').mockReturnValue(targetPlatform);
|
||||||
|
jest.spyOn(Input, 'androidExportType', 'get').mockReturnValue('androidStudioProject');
|
||||||
|
await expect(BuildParameters.create()).resolves.toEqual(
|
||||||
|
expect.objectContaining({ buildFile: `${targetPlatform}` }),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('returns the build method', async () => {
|
it('returns the build method', async () => {
|
||||||
const mockValue = 'Namespace.ClassName.BuildMethod';
|
const mockValue = 'Namespace.ClassName.BuildMethod';
|
||||||
jest.spyOn(Input, 'buildMethod', 'get').mockReturnValue(mockValue);
|
jest.spyOn(Input, 'buildMethod', 'get').mockReturnValue(mockValue);
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class BuildParameters {
|
||||||
public androidKeyaliasPass!: string;
|
public androidKeyaliasPass!: string;
|
||||||
public androidTargetSdkVersion!: string;
|
public androidTargetSdkVersion!: string;
|
||||||
public androidSdkManagerParameters!: string;
|
public androidSdkManagerParameters!: string;
|
||||||
public exportAsGoogleAndroidProject!: string;
|
public androidExportType!: string;
|
||||||
|
|
||||||
public customParameters!: string;
|
public customParameters!: string;
|
||||||
public sshAgent!: string;
|
public sshAgent!: string;
|
||||||
|
|
@ -77,12 +77,7 @@ class BuildParameters {
|
||||||
public unityHubVersionOnMac!: string;
|
public unityHubVersionOnMac!: string;
|
||||||
|
|
||||||
static async create(): Promise<BuildParameters> {
|
static async create(): Promise<BuildParameters> {
|
||||||
const buildFile = this.parseBuildFile(
|
const buildFile = this.parseBuildFile(Input.buildName, Input.targetPlatform, Input.androidExportType);
|
||||||
Input.buildName,
|
|
||||||
Input.targetPlatform,
|
|
||||||
Input.androidAppBundle,
|
|
||||||
Input.exportAsGoogleAndroidProject,
|
|
||||||
);
|
|
||||||
const editorVersion = UnityVersioning.determineUnityVersion(Input.projectPath, Input.unityVersion);
|
const editorVersion = UnityVersioning.determineUnityVersion(Input.projectPath, Input.unityVersion);
|
||||||
const buildVersion = await Versioning.determineBuildVersion(Input.versioningStrategy, Input.specifiedVersion);
|
const buildVersion = await Versioning.determineBuildVersion(Input.versioningStrategy, Input.specifiedVersion);
|
||||||
const androidVersionCode = AndroidVersioning.determineVersionCode(buildVersion, Input.androidVersionCode);
|
const androidVersionCode = AndroidVersioning.determineVersionCode(buildVersion, Input.androidVersionCode);
|
||||||
|
|
@ -127,7 +122,7 @@ class BuildParameters {
|
||||||
androidKeyaliasPass: Input.androidKeyaliasPass,
|
androidKeyaliasPass: Input.androidKeyaliasPass,
|
||||||
androidTargetSdkVersion: Input.androidTargetSdkVersion,
|
androidTargetSdkVersion: Input.androidTargetSdkVersion,
|
||||||
androidSdkManagerParameters,
|
androidSdkManagerParameters,
|
||||||
exportAsGoogleAndroidProject: Input.exportAsGoogleAndroidProject,
|
androidExportType: Input.androidExportType,
|
||||||
customParameters: Input.customParameters,
|
customParameters: Input.customParameters,
|
||||||
sshAgent: Input.sshAgent,
|
sshAgent: Input.sshAgent,
|
||||||
gitPrivateToken: Input.gitPrivateToken || (await GithubCliReader.GetGitHubAuthToken()),
|
gitPrivateToken: Input.gitPrivateToken || (await GithubCliReader.GetGitHubAuthToken()),
|
||||||
|
|
@ -170,18 +165,20 @@ class BuildParameters {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static parseBuildFile(
|
static parseBuildFile(filename: string, platform: string, androidExportType: string): string {
|
||||||
filename: string,
|
|
||||||
platform: string,
|
|
||||||
androidAppBundle: boolean,
|
|
||||||
exportAsGoogleAndroidProject: string,
|
|
||||||
) {
|
|
||||||
if (Platform.isWindows(platform)) {
|
if (Platform.isWindows(platform)) {
|
||||||
return `${filename}.exe`;
|
return `${filename}.exe`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Platform.isAndroid(platform) && exportAsGoogleAndroidProject !== 'true') {
|
if (Platform.isAndroid(platform)) {
|
||||||
return androidAppBundle ? `${filename}.aab` : `${filename}.apk`;
|
switch (androidExportType) {
|
||||||
|
case `androidPackage`:
|
||||||
|
return `${filename}.apk`;
|
||||||
|
case `androidAppBundle`:
|
||||||
|
return `${filename}.aab`;
|
||||||
|
case `androidStudioProject`:
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return filename;
|
return filename;
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ class Parameter {
|
||||||
}
|
}
|
||||||
|
|
||||||
class ImageEnvironmentFactory {
|
class ImageEnvironmentFactory {
|
||||||
public static getEnvVarString(parameters, additionalVariables: any[] = []) {
|
public static getEnvVarString(parameters: BuildParameters, additionalVariables: any[] = []) {
|
||||||
const environmentVariables = ImageEnvironmentFactory.getEnvironmentVariables(parameters, additionalVariables);
|
const environmentVariables = ImageEnvironmentFactory.getEnvironmentVariables(parameters, additionalVariables);
|
||||||
let string = '';
|
let string = '';
|
||||||
for (const p of environmentVariables) {
|
for (const p of environmentVariables) {
|
||||||
|
|
@ -50,7 +50,7 @@ class ImageEnvironmentFactory {
|
||||||
{ name: 'ANDROID_KEYALIAS_PASS', value: parameters.androidKeyaliasPass },
|
{ name: 'ANDROID_KEYALIAS_PASS', value: parameters.androidKeyaliasPass },
|
||||||
{ name: 'ANDROID_TARGET_SDK_VERSION', value: parameters.androidTargetSdkVersion },
|
{ name: 'ANDROID_TARGET_SDK_VERSION', value: parameters.androidTargetSdkVersion },
|
||||||
{ name: 'ANDROID_SDK_MANAGER_PARAMETERS', value: parameters.androidSdkManagerParameters },
|
{ name: 'ANDROID_SDK_MANAGER_PARAMETERS', value: parameters.androidSdkManagerParameters },
|
||||||
{ name: 'EXPORT_AS_GOOGLE_ANDROID_PROJECT', value: parameters.exportAsGoogleAndroidProject },
|
{ name: 'ANDROID_EXPORT_TYPE', value: parameters.androidExportType },
|
||||||
{ name: 'CUSTOM_PARAMETERS', value: parameters.customParameters },
|
{ name: 'CUSTOM_PARAMETERS', value: parameters.customParameters },
|
||||||
{ name: 'CHOWN_FILES_TO', value: parameters.chownFilesTo },
|
{ name: 'CHOWN_FILES_TO', value: parameters.chownFilesTo },
|
||||||
{ name: 'GITHUB_REF', value: process.env.GITHUB_REF },
|
{ name: 'GITHUB_REF', value: process.env.GITHUB_REF },
|
||||||
|
|
|
||||||
|
|
@ -161,6 +161,65 @@ describe('Input', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('androidExportType', () => {
|
||||||
|
it('returns the default value', () => {
|
||||||
|
expect(Input.androidExportType).toStrictEqual('androidPackage');
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO: Remove "and androidAppBundle is not set" in v3
|
||||||
|
test.each`
|
||||||
|
input | expected
|
||||||
|
${'androidPackage'} | ${'androidPackage'}
|
||||||
|
${'androidAppBundle'} | ${'androidAppBundle'}
|
||||||
|
${'androidStudioProject'} | ${'androidStudioProject'}
|
||||||
|
`('returns $expected when $input is passed and androidAppBundle is not set', (exportType) => {
|
||||||
|
const spy = jest.spyOn(core, 'getInput').mockReturnValue(exportType);
|
||||||
|
expect(Input.androidExportType).toStrictEqual(exportType);
|
||||||
|
expect(spy).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO: Remove in v3
|
||||||
|
test.each`
|
||||||
|
input | expected
|
||||||
|
${'androidPackage'} | ${'androidPackage'}
|
||||||
|
${'androidAppBundle'} | ${'androidAppBundle'}
|
||||||
|
${'androidStudioProject'} | ${'androidStudioProject'}
|
||||||
|
`('returns $expected when $input is passed and overrides androidAppBundle if it is set', (exportType) => {
|
||||||
|
const spy = jest.spyOn(Input, 'getInput');
|
||||||
|
spy.mockImplementationOnce(() => {
|
||||||
|
return exportType;
|
||||||
|
});
|
||||||
|
|
||||||
|
spy.mockImplementationOnce(() => {
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
expect(Input.androidExportType).toStrictEqual(exportType);
|
||||||
|
expect(spy).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO: Remove in v3
|
||||||
|
test.each`
|
||||||
|
input | expected
|
||||||
|
${'true'} | ${'androidAppBundle'}
|
||||||
|
${'false'} | ${'androidPackage'}
|
||||||
|
`(
|
||||||
|
'returns $expected when androidExportType is undefined and androidAppBundle is set to $input',
|
||||||
|
({ input, expected }) => {
|
||||||
|
const spy = jest.spyOn(Input, 'getInput');
|
||||||
|
spy.mockImplementationOnce(() => {
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
|
||||||
|
spy.mockImplementationOnce(() => {
|
||||||
|
return input;
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(Input.androidExportType).toStrictEqual(expected);
|
||||||
|
expect(spy).toHaveBeenCalledTimes(2);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
describe('androidKeystoreName', () => {
|
describe('androidKeystoreName', () => {
|
||||||
it('returns the default value', () => {
|
it('returns the default value', () => {
|
||||||
expect(Input.androidKeystoreName).toStrictEqual('');
|
expect(Input.androidKeystoreName).toStrictEqual('');
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,22 @@ class Input {
|
||||||
return input === 'true';
|
return input === 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get androidExportType() {
|
||||||
|
// TODO: remove this in V3
|
||||||
|
const exportType = Input.getInput('androidExportType');
|
||||||
|
|
||||||
|
if (exportType) {
|
||||||
|
return exportType || 'androidPackage';
|
||||||
|
}
|
||||||
|
|
||||||
|
return Input.androidAppBundle ? 'androidAppBundle' : 'androidPackage';
|
||||||
|
|
||||||
|
// End TODO
|
||||||
|
|
||||||
|
// Use this in V3 when androidAppBundle is removed
|
||||||
|
// return Input.getInput('androidExportType') || 'androidPackage';
|
||||||
|
}
|
||||||
|
|
||||||
static get androidKeystoreName() {
|
static get androidKeystoreName() {
|
||||||
return Input.getInput('androidKeystoreName') || '';
|
return Input.getInput('androidKeystoreName') || '';
|
||||||
}
|
}
|
||||||
|
|
@ -163,10 +179,6 @@ class Input {
|
||||||
return Input.getInput('androidTargetSdkVersion') || '';
|
return Input.getInput('androidTargetSdkVersion') || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
static get exportAsGoogleAndroidProject() {
|
|
||||||
return Input.getInput('exportAsGoogleAndroidProject') || 'false';
|
|
||||||
}
|
|
||||||
|
|
||||||
static get sshAgent() {
|
static get sshAgent() {
|
||||||
return Input.getInput('sshAgent') || '';
|
return Input.getInput('sshAgent') || '';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@ class SetupMac {
|
||||||
process.env.ANDROID_KEYALIAS_PASS = buildParameters.androidKeyaliasPass;
|
process.env.ANDROID_KEYALIAS_PASS = buildParameters.androidKeyaliasPass;
|
||||||
process.env.ANDROID_TARGET_SDK_VERSION = buildParameters.androidTargetSdkVersion;
|
process.env.ANDROID_TARGET_SDK_VERSION = buildParameters.androidTargetSdkVersion;
|
||||||
process.env.ANDROID_SDK_MANAGER_PARAMETERS = buildParameters.androidSdkManagerParameters;
|
process.env.ANDROID_SDK_MANAGER_PARAMETERS = buildParameters.androidSdkManagerParameters;
|
||||||
process.env.EXPORT_AS_GOOGLE_ANDROID_PROJECT = buildParameters.exportAsGoogleAndroidProject;
|
process.env.ANDROID_EXPORT_TYPE = buildParameters.androidExportType;
|
||||||
process.env.CUSTOM_PARAMETERS = buildParameters.customParameters;
|
process.env.CUSTOM_PARAMETERS = buildParameters.customParameters;
|
||||||
process.env.CHOWN_FILES_TO = buildParameters.chownFilesTo;
|
process.env.CHOWN_FILES_TO = buildParameters.chownFilesTo;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue