Merge branch 'development' into optimization/unused_files

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>

# Conflicts:
#	Code/Editor/IEditorImpl.cpp
#	Code/Editor/IEditorImpl.h
#	Gems/LmbrCentral/Code/Tests/lmbrcentral_editor_tests_files.cmake
This commit is contained in:
Esteban Papp
2022-01-25 15:40:30 -08:00
871 changed files with 19489 additions and 7437 deletions
+1 -1
View File
@@ -813,7 +813,7 @@ try {
}
}
pipelineProperties.add(parameters(pipelineParameters))
pipelineProperties.add(parameters(pipelineParameters.unique()))
properties(pipelineProperties)
// Stash the INCREMENTAL_BUILD_SCRIPT_PATH since all nodes will use it
@@ -35,7 +35,7 @@
"PARAMETERS": {
"CONFIGURATION":"debug",
"OUTPUT_DIRECTORY":"build\\android",
"CMAKE_OPTIONS":"-G \"Ninja Multi-Config\" -DCMAKE_TOOLCHAIN_FILE=cmake\\Platform\\Android\\Toolchain_android.cmake -DANDROID_NATIVE_API_LEVEL=21 -DLY_NDK_DIR=\"!LY_NDK_DIR!\"",
"CMAKE_OPTIONS":"-G \"Ninja Multi-Config\" -DCMAKE_TOOLCHAIN_FILE=cmake\\Platform\\Android\\Toolchain_android.cmake -DANDROID_NATIVE_API_LEVEL=24 -DLY_NDK_DIR=\"!LY_NDK_DIR!\"",
"CMAKE_LY_PROJECTS":"AutomatedTesting",
"CMAKE_TARGET":"all",
"CMAKE_BUILD_ARGS":"-j!NUMBER_OF_PROCESSORS!"
@@ -50,7 +50,7 @@
"PARAMETERS": {
"CONFIGURATION":"profile",
"OUTPUT_DIRECTORY":"build\\android",
"CMAKE_OPTIONS":"-G \"Ninja Multi-Config\" -DCMAKE_TOOLCHAIN_FILE=cmake\\Platform\\Android\\Toolchain_android.cmake -DANDROID_NATIVE_API_LEVEL=21 -DLY_NDK_DIR=\"!LY_NDK_DIR!\"",
"CMAKE_OPTIONS":"-G \"Ninja Multi-Config\" -DCMAKE_TOOLCHAIN_FILE=cmake\\Platform\\Android\\Toolchain_android.cmake -DANDROID_NATIVE_API_LEVEL=24 -DLY_NDK_DIR=\"!LY_NDK_DIR!\"",
"CMAKE_LY_PROJECTS":"AutomatedTesting",
"CMAKE_TARGET":"all",
"CMAKE_BUILD_ARGS":"-j!NUMBER_OF_PROCESSORS!"
@@ -66,7 +66,7 @@
"PARAMETERS": {
"CONFIGURATION":"profile",
"OUTPUT_DIRECTORY":"build\\android",
"CMAKE_OPTIONS":"-G \"Ninja Multi-Config\" -DCMAKE_TOOLCHAIN_FILE=cmake\\Platform\\Android\\Toolchain_android.cmake -DANDROID_NATIVE_API_LEVEL=21 -DLY_NDK_DIR=\"!LY_NDK_DIR!\" -DLY_UNITY_BUILD=FALSE",
"CMAKE_OPTIONS":"-G \"Ninja Multi-Config\" -DCMAKE_TOOLCHAIN_FILE=cmake\\Platform\\Android\\Toolchain_android.cmake -DANDROID_NATIVE_API_LEVEL=24 -DLY_NDK_DIR=\"!LY_NDK_DIR!\" -DLY_UNITY_BUILD=FALSE",
"CMAKE_LY_PROJECTS":"AutomatedTesting",
"CMAKE_TARGET":"all",
"CMAKE_BUILD_ARGS":"-j!NUMBER_OF_PROCESSORS!"
@@ -102,7 +102,7 @@
"PARAMETERS": {
"CONFIGURATION":"release",
"OUTPUT_DIRECTORY":"build\\android",
"CMAKE_OPTIONS":"-G \"Ninja Multi-Config\" -DCMAKE_TOOLCHAIN_FILE=cmake\\Platform\\Android\\Toolchain_android.cmake -DANDROID_NATIVE_API_LEVEL=21 -DLY_NDK_DIR=\"!LY_NDK_DIR!\"",
"CMAKE_OPTIONS":"-G \"Ninja Multi-Config\" -DCMAKE_TOOLCHAIN_FILE=cmake\\Platform\\Android\\Toolchain_android.cmake -DANDROID_NATIVE_API_LEVEL=24 -DLY_NDK_DIR=\"!LY_NDK_DIR!\"",
"CMAKE_LY_PROJECTS":"AutomatedTesting",
"CMAKE_TARGET":"all",
"CMAKE_BUILD_ARGS":"-j!NUMBER_OF_PROCESSORS!"
@@ -118,7 +118,7 @@
"PARAMETERS": {
"CONFIGURATION":"release",
"OUTPUT_DIRECTORY":"build\\mono_android",
"CMAKE_OPTIONS":"-G \"Ninja Multi-Config\" -DCMAKE_TOOLCHAIN_FILE=cmake\\Platform\\Android\\Toolchain_android.cmake -DANDROID_NATIVE_API_LEVEL=21 -DLY_NDK_DIR=\"!LY_NDK_DIR!\" -DLY_MONOLITHIC_GAME=TRUE",
"CMAKE_OPTIONS":"-G \"Ninja Multi-Config\" -DCMAKE_TOOLCHAIN_FILE=cmake\\Platform\\Android\\Toolchain_android.cmake -DANDROID_NATIVE_API_LEVEL=24 -DLY_NDK_DIR=\"!LY_NDK_DIR!\" -DLY_MONOLITHIC_GAME=TRUE",
"CMAKE_LY_PROJECTS":"AutomatedTesting",
"CMAKE_TARGET":"all",
"CMAKE_BUILD_ARGS":"-j!NUMBER_OF_PROCESSORS!"
+2 -2
View File
@@ -1,9 +1,9 @@
{
"ENV": {
"GRADLE_HOME": "C:/Gradle/gradle-7.0",
"NODE_LABEL": "windows-b3c8994f1",
"NODE_LABEL": "windows-a4a28adb2",
"LY_3RDPARTY_PATH": "D:/workspace/3rdParty",
"LY_NDK_DIR": "C:/ly/3rdParty/android-ndk/r21d",
"LY_NDK_DIR": "C:/Android/android-sdk/ndk/21.4.7075529",
"TIMEOUT": 30,
"WORKSPACE": "D:/workspace",
"MOUNT_VOLUME": true
@@ -185,11 +185,11 @@
"COMMAND": "build_test_linux.sh",
"PARAMETERS": {
"CONFIGURATION": "profile",
"OUTPUT_DIRECTORY": "build\\linux",
"OUTPUT_DIRECTORY": "build/linux",
"CMAKE_OPTIONS": "-G 'Ninja Multi-Config' -DLY_PARALLEL_LINK_JOBS=4",
"CMAKE_LY_PROJECTS": "AutomatedTesting",
"CMAKE_TARGET": "TEST_SUITE_awsi",
"CTEST_OPTIONS": "-L \"(SUITE_awsi)\" --no-tests=error",
"CTEST_OPTIONS": "-L (SUITE_awsi) --no-tests=error",
"TEST_RESULTS": "True"
}
},
@@ -1,5 +1,5 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
@@ -8,7 +8,7 @@
# Deploy the CDK applications for AWS gems (Linux only)
SOURCE_DIRECTORY=$(dirname "$0")
SOURCE_DIRECTORY=$PWD
PATH=$SOURCE_DIRECTORY/python:$PATH
GEM_DIRECTORY=$SOURCE_DIRECTORY/Gems
@@ -80,11 +80,14 @@ fi
# Set temporary AWS credentials from the assume role
credentials=$(aws sts assume-role --query Credentials.[SecretAccessKey,SessionToken,AccessKeyId] --output text --role-arn $ASSUME_ROLE_ARN --role-session-name o3de-Automation-session)
AWS_SECRET_ACCESS_KEY=$(echo "$credentials" | cut -d' ' -f1)
AWS_SESSION_TOKEN=$(echo "$credentials" | cut -d' ' -f2)
AWS_ACCESS_KEY_ID=$(echo "$credentials" | cut -d' ' -f3)
export AWS_SECRET_ACCESS_KEY=$(echo $credentials | cut -d' ' -f1)
export AWS_SESSION_TOKEN=$(echo $credentials | cut -d' ' -f2)
export AWS_ACCESS_KEY_ID=$(echo $credentials | cut -d' ' -f3)
O3DE_AWS_DEPLOY_ACCOUNT=$(echo "$ASSUME_ROLE_ARN" | cut -d':' -f5)
export O3DE_AWS_DEPLOY_ACCOUNT=$(echo "$ASSUME_ROLE_ARN" | cut -d':' -f5)
if [[ -z "$O3DE_AWS_PROJECT_NAME" ]]; then
export O3DE_AWS_PROJECT_NAME=$BRANCH_NAME-$PIPELINE_NAME-Linux
fi
# Bootstrap and deploy the CDK applications
echo [cdk_bootstrap] Bootstrap CDK
@@ -11,7 +11,7 @@
# 1) Node.js is installed
# 2) Node.js version >= 10.13.0, except for versions 13.0.0 - 13.6.0. A version in active long-term support is recommended.
SOURCE_DIRECTORY=$(dirname "$0")
SOURCE_DIRECTORY=$PWD
PATH=$SOURCE_DIRECTORY/python:$PATH
GEM_DIRECTORY=$SOURCE_DIRECTORY/Gems
@@ -70,12 +70,12 @@ echo [cdk_installation] Install the current version of nodejs
nvm install node
echo [cdk_installation] Install the latest version of CDK
if ! sudo npm uninstall -g aws-cdk;
if ! npm uninstall -g aws-cdk;
then
echo [cdk_bootstrap] Failed to uninstall the current version of CDK
exit 1
fi
if ! sudo npm install -g aws-cdk@latest;
if ! npm install -g aws-cdk@latest;
then
echo [cdk_bootstrap] Failed to install the latest version of CDK
exit 1
@@ -83,9 +83,13 @@ fi
# Set temporary AWS credentials from the assume role
credentials=$(aws sts assume-role --query Credentials.[SecretAccessKey,SessionToken,AccessKeyId] --output text --role-arn $ASSUME_ROLE_ARN --role-session-name o3de-Automation-session)
AWS_SECRET_ACCESS_KEY=$(echo "$credentials" | cut -d' ' -f1)
AWS_SESSION_TOKEN=$(echo "$credentials" | cut -d' ' -f2)
AWS_ACCESS_KEY_ID=$(echo "$credentials" | cut -d' ' -f3)
export AWS_SECRET_ACCESS_KEY=$(echo $credentials | cut -d' ' -f1)
export AWS_SESSION_TOKEN=$(echo $credentials | cut -d' ' -f2)
export AWS_ACCESS_KEY_ID=$(echo $credentials | cut -d' ' -f3)
if [[ -z "$O3DE_AWS_PROJECT_NAME" ]]; then
export O3DE_AWS_PROJECT_NAME=$BRANCH_NAME-$PIPELINE_NAME-Linux
fi
ERROR_EXISTS=0
DestroyCDKApplication AWSCore
@@ -16,13 +16,6 @@
},
"PIPELINE_JENKINS_PARAMETERS": {
"nightly-incremental": [
{
"parameter_name": "O3DE_AWS_PROJECT_NAME",
"parameter_type": "string",
"default_value": "",
"use_last_run_value": true,
"description": "The name of the O3DE project that stacks should be deployed for."
},
{
"parameter_name": "O3DE_AWS_DEPLOY_REGION",
"parameter_type": "string",
@@ -46,13 +39,6 @@
}
],
"nightly-clean": [
{
"parameter_name": "O3DE_AWS_PROJECT_NAME",
"parameter_type": "string",
"default_value": "",
"use_last_run_value": true,
"description": "The name of the O3DE project that stacks should be deployed for."
},
{
"parameter_name": "O3DE_AWS_DEPLOY_REGION",
"parameter_type": "string",
@@ -9,6 +9,7 @@ REM
SETLOCAL EnableDelayedExpansion
CALL "%~dp0env_windows.cmd"
IF NOT %ERRORLEVEL%==0 EXIT /b 1
IF NOT EXIST "%OUTPUT_DIRECTORY%" (
MKDIR %OUTPUT_DIRECTORY%.
@@ -21,7 +22,7 @@ ECHO [ci_build] cmake --version
cmake --version
IF ERRORLEVEL 1 (
ECHO [ci_build] CMAKE not found!
exit /b 1
EXIT /b 1
)
REM Compute half the amount of processors so some jobs can run
@@ -47,14 +48,14 @@ IF NOT EXIST CMakeCache.txt (
)
)
IF DEFINED RUN_CONFIGURE (
ECHO [ci_build] %CONFIGURE_CMD%
%CONFIGURE_CMD%
call ECHO [ci_build] %CONFIGURE_CMD%
call %CONFIGURE_CMD%
IF NOT !ERRORLEVEL!==0 GOTO :error
ECHO !CONFIGURE_CMD!> %LAST_CONFIGURE_CMD_FILE%
)
ECHO [ci_build] cmake --build . --target %CMAKE_TARGET% --config %CONFIGURATION% %CMAKE_BUILD_ARGS% -- %CMAKE_NATIVE_BUILD_ARGS%
cmake --build . --target %CMAKE_TARGET% --config %CONFIGURATION% %CMAKE_BUILD_ARGS% -- %CMAKE_NATIVE_BUILD_ARGS%
call ECHO [ci_build] cmake --build . --target %CMAKE_TARGET% --config %CONFIGURATION% %CMAKE_BUILD_ARGS% -- %CMAKE_NATIVE_BUILD_ARGS%
call cmake --build . --target %CMAKE_TARGET% --config %CONFIGURATION% %CMAKE_BUILD_ARGS% -- %CMAKE_NATIVE_BUILD_ARGS%
IF NOT %ERRORLEVEL%==0 GOTO :error
POPD
@@ -49,6 +49,10 @@ FOR /f "tokens=1,2,3" %%a IN ('CALL aws sts assume-role --query Credentials.[Sec
)
FOR /F "tokens=4 delims=:" %%a IN ("%ASSUME_ROLE_ARN%") DO SET O3DE_AWS_DEPLOY_ACCOUNT=%%a
IF "%O3DE_AWS_PROJECT_NAME%"=="" (
SET O3DE_AWS_PROJECT_NAME=%BRANCH_NAME%-%PIPELINE_NAME%-Windows
)
REM Bootstrap and deploy the CDK applications
ECHO [cdk_bootstrap] Bootstrap CDK
CALL cdk bootstrap aws://%O3DE_AWS_DEPLOY_ACCOUNT%/%O3DE_AWS_DEPLOY_REGION%
@@ -48,6 +48,9 @@ FOR /f "tokens=1,2,3" %%a IN ('CALL aws sts assume-role --query Credentials.[Sec
SET AWS_ACCESS_KEY_ID=%%c
)
FOR /F "tokens=4 delims=:" %%a IN ("%ASSUME_ROLE_ARN%") DO SET O3DE_AWS_DEPLOY_ACCOUNT=%%a
IF "%O3DE_AWS_PROJECT_NAME%"=="" (
SET O3DE_AWS_PROJECT_NAME=%BRANCH_NAME%-%PIPELINE_NAME%-Windows
)
SET ERROR_EXISTS=0
CALL :DestroyCDKApplication AWSCore,ERROR_EXISTS
+12 -7
View File
@@ -13,17 +13,21 @@ SETLOCAL EnableExtensions EnableDelayedExpansion
where /Q cmake
IF NOT %ERRORLEVEL%==0 (
ECHO [ci_build] CMake not found
GOTO :error
)
IF NOT "%COMMAND_CWD%"=="" (
ECHO [ci_build] Changing CWD to %COMMAND_CWD%
CD %COMMAND_CWD%
GOTO :errorlocal
)
REM Ending the local environment to be able to propagate the TMP/TEMP variables to the calling script
ENDLOCAL
IF NOT "%COMMAND_CWD%"=="" (
call ECHO [ci_build] Changing CWD to %COMMAND_CWD%
call CD %COMMAND_CWD%
IF ERRORLEVEL 1 (
ECHO [ci_build] Failed to change directory to %COMMAND_CWD%
GOTO :error
)
)
REM Jenkins does not defined TMP
IF "%TMP%"=="" (
IF "%WORKSPACE%"=="" (
@@ -41,6 +45,7 @@ IF "%TMP%"=="" (
EXIT /b 0
:error
:errorlocal
ENDLOCAL
:error
EXIT /b 1
@@ -16,13 +16,6 @@
},
"PIPELINE_JENKINS_PARAMETERS": {
"nightly-incremental": [
{
"parameter_name": "O3DE_AWS_PROJECT_NAME",
"parameter_type": "string",
"default_value": "",
"use_last_run_value": true,
"description": "The name of the O3DE project that stacks should be deployed for."
},
{
"parameter_name": "O3DE_AWS_DEPLOY_REGION",
"parameter_type": "string",
@@ -46,13 +39,6 @@
}
],
"nightly-clean": [
{
"parameter_name": "O3DE_AWS_PROJECT_NAME",
"parameter_type": "string",
"default_value": "",
"use_last_run_value": true,
"description": "The name of the O3DE project that stacks should be deployed for."
},
{
"parameter_name": "O3DE_AWS_DEPLOY_REGION",
"parameter_type": "string",
@@ -187,7 +187,7 @@ six==1.15.0 \
--hash=sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259 \
--hash=sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced \
# via -r requirements.txt, dateutil
urllib3==1.26.2 \
--hash=sha256:19188f96923873c92ccb987120ec4acaa12f0461fa9ce5d3d0772bc965a39e08 \
--hash=sha256:d8ff90d979214d7b4f8ce956e80f4028fc6860e4431f731ea4a8c08f23f99473 \
urllib3==1.26.5 \
--hash=sha256:753a0374df26658f99d826cfe40394a686d05985786d946fbe4165b5148f5a7c \
--hash=sha256:a7acd0977125325f516bda9735fa7142b909a8d01e8b2e4c8108d0984e6e0098 \
# via -r requirements.txt, botocore, requests
@@ -36,8 +36,8 @@ requests==2.25.1 \
traceback2==1.4.0 \
--hash=sha256:05acc67a09980c2ecfedd3423f7ae0104839eccb55fc645773e1caa0951c3030 \
--hash=sha256:8253cebec4b19094d67cc5ed5af99bf1dba1285292226e98a31929f87a5d6b23
urllib3==1.26.4 \
--hash=sha256:2f4da4594db7e1e110a944bb1b551fdf4e6c136ad42e4234131391e21eb5b0df \
--hash=sha256:e7b021f7241115872f92f43c6508082facffbd1c048e3c6e2bb9c2a157e28937
urllib3==1.26.5 \
--hash=sha256:753a0374df26658f99d826cfe40394a686d05985786d946fbe4165b5148f5a7c \
--hash=sha256:a7acd0977125325f516bda9735fa7142b909a8d01e8b2e4c8108d0984e6e0098
tempfile2==0.1.1 \
--hash=sha256:77fdd256c16804053d3d588168b79595099ea5e874c3fb171893b0ababd10340
@@ -10,16 +10,16 @@ choco install -y android-sdk
$Env:ANDROID_HOME = "C:\Android\android-sdk"
setx ANDROID_HOME "C:\Android\android-sdk"
$apis_packages = '"add-ons;addon-google_apis-google-19" "add-ons;addon-google_apis-google-21" "add-ons;addon-google_apis-google-22" "add-ons;addon-google_apis-google-23" "add-ons;addon-google_apis-google-24"'
$android_packages = '"platforms;android-19" "platforms;android-21" "platforms;android-22" "platforms;android-23" "platforms;android-24" "platforms;android-25" "platforms;android-26" "platforms;android-27" "platforms;android-28" "platforms;android-29" "platforms;android-30"'
$android_packages = '"platforms;android-28" "platforms;android-29" "platforms;android-30"'
$googleplay_packages = '"extras;google;market_apk_expansion" "extras;google;market_licensing"'
$build_tools = '"build-tools;30.0.2" "tools"'
$ndk = '"ndk;21.4.7075529"'
$sdkmanager = "C:\Android\android-sdk\tools\bin\sdkmanager.bat"
Start-Process -FilePath $sdkmanager -ArgumentList $apis_packages -NoNewWindow -Wait
Start-Process -FilePath $sdkmanager -ArgumentList $android_packages -NoNewWindow -Wait
Start-Process -FilePath $sdkmanager -ArgumentList $googleplay_packages -NoNewWindow -Wait
Start-Process -FilePath $sdkmanager -ArgumentList $build_tools -NoNewWindow -Wait
Start-Process -FilePath $sdkmanager -ArgumentList $ndk -NoNewWindow -Wait
Write-Host "Installing Gradle and Ninja"
Import-Module C:\ProgramData\chocolatey\helpers\chocolateyInstaller.psm1 #Grade needs a custom installer due to being hardcoded to C:\Programdata in Chocolatey
+49 -37
View File
@@ -644,7 +644,7 @@ def get_registered(engine_name: str = None,
except json.JSONDecodeError as e:
logger.warning(f'{engine_json} failed to load: {str(e)}')
else:
this_engines_name = engine_json_data['engine_name']
this_engines_name = engine_json_data.get('engine_name','')
if this_engines_name == engine_name:
return engine_path
engines_path = json_data.get('engines_path', {})
@@ -656,60 +656,72 @@ def get_registered(engine_name: str = None,
for project_path in projects:
project_path = pathlib.Path(project_path).resolve()
project_json = project_path / 'project.json'
with project_json.open('r') as f:
try:
project_json_data = json.load(f)
except json.JSONDecodeError as e:
logger.warning(f'{project_json} failed to load: {str(e)}')
else:
this_projects_name = project_json_data['project_name']
if this_projects_name == project_name:
return project_path
if not pathlib.Path(project_json).is_file():
logger.warning(f'{project_json} does not exist')
else:
with project_json.open('r') as f:
try:
project_json_data = json.load(f)
except json.JSONDecodeError as e:
logger.warning(f'{project_json} failed to load: {str(e)}')
else:
this_projects_name = project_json_data['project_name']
if this_projects_name == project_name:
return project_path
elif isinstance(gem_name, str):
gems = get_all_gems(project_path)
for gem_path in gems:
gem_path = pathlib.Path(gem_path).resolve()
gem_json = gem_path / 'gem.json'
with gem_json.open('r') as f:
try:
gem_json_data = json.load(f)
except json.JSONDecodeError as e:
logger.warning(f'{gem_json} failed to load: {str(e)}')
else:
this_gems_name = gem_json_data['gem_name']
if this_gems_name == gem_name:
return gem_path
if not pathlib.Path(gem_json).is_file():
logger.warning(f'{gem_json} does not exist')
else:
with gem_json.open('r') as f:
try:
gem_json_data = json.load(f)
except json.JSONDecodeError as e:
logger.warning(f'{gem_json} failed to load: {str(e)}')
else:
this_gems_name = gem_json_data['gem_name']
if this_gems_name == gem_name:
return gem_path
elif isinstance(template_name, str):
templates = get_all_templates(project_path)
for template_path in templates:
template_path = pathlib.Path(template_path).resolve()
template_json = template_path / 'template.json'
with template_json.open('r') as f:
try:
template_json_data = json.load(f)
except json.JSONDecodeError as e:
logger.warning(f'{template_path} failed to load: {str(e)}')
else:
this_templates_name = template_json_data['template_name']
if this_templates_name == template_name:
return template_path
if not pathlib.Path(template_json).is_file():
logger.warning(f'{template_json} does not exist')
else:
with template_json.open('r') as f:
try:
template_json_data = json.load(f)
except json.JSONDecodeError as e:
logger.warning(f'{template_path} failed to load: {str(e)}')
else:
this_templates_name = template_json_data['template_name']
if this_templates_name == template_name:
return template_path
elif isinstance(restricted_name, str):
restricted = get_manifest_restricted()
for restricted_path in restricted:
restricted_path = pathlib.Path(restricted_path).resolve()
restricted_json = restricted_path / 'restricted.json'
with restricted_json.open('r') as f:
try:
restricted_json_data = json.load(f)
except json.JSONDecodeError as e:
logger.warning(f'{restricted_json} failed to load: {str(e)}')
else:
this_restricted_name = restricted_json_data['restricted_name']
if this_restricted_name == restricted_name:
return restricted_path
if not pathlib.Path(restricted_json).is_file():
logger.warning(f'{restricted_json} does not exist')
else:
with restricted_json.open('r') as f:
try:
restricted_json_data = json.load(f)
except json.JSONDecodeError as e:
logger.warning(f'{restricted_json} failed to load: {str(e)}')
else:
this_restricted_name = restricted_json_data['restricted_name']
if this_restricted_name == restricted_name:
return restricted_path
elif isinstance(default_folder, str):
if default_folder == 'engines':
+35 -4
View File
@@ -29,10 +29,17 @@ class TestGetTemplatesForCreation:
def get_project_templates() -> list:
return []
@staticmethod
def get_gem_templates() -> list:
return []
@staticmethod
def get_engine_templates() -> list:
return [pathlib.Path('D:/o3de/Templates/DefaultProject'), pathlib.Path('D:/o3de/Templates/DefaultGem')]
@staticmethod
def get_all_gems(project_path: pathlib.Path = None) -> list:
return []
@pytest.mark.parametrize("expected_template_paths", [
pytest.param([])
@@ -50,17 +57,25 @@ class TestGetTemplatesForCreation:
as get_manifest_templates_patch, \
patch('o3de.manifest.get_project_templates', side_effect=self.get_project_templates)\
as get_project_templates_patch, \
patch('o3de.manifest.get_gem_templates', side_effect=self.get_gem_templates) \
as get_gem_templates_patch, \
patch('o3de.manifest.get_engine_templates', side_effect=self.get_engine_templates)\
as get_engine_templates_patch, \
patch('o3de.manifest.get_all_gems', side_effect=self.get_all_gems) \
as get_all_gems_patch, \
patch('o3de.validation.valid_o3de_template_json', return_value=True) \
as validate_template_json,\
patch('o3de.validation.valid_o3de_project_json', side_effect=validate_project_json) \
as validate_project_json,\
patch('o3de.validation.valid_o3de_gem_json', side_effect=validate_gem_json) \
as validate_gem_json:
as validate_gem_json,\
patch('o3de.manifest.load_o3de_manifest') as load_o3de_manifest_patch:
templates = manifest.get_templates_for_generic_creation()
assert templates == expected_template_paths
# make sure the o3de manifest isn't attempted to be loaded
load_o3de_manifest_patch.assert_not_called()
@pytest.mark.parametrize("expected_template_paths", [
pytest.param([pathlib.Path('D:/o3de/Templates/DefaultProject')])
@@ -78,17 +93,25 @@ class TestGetTemplatesForCreation:
as get_manifest_templates_patch, \
patch('o3de.manifest.get_project_templates', side_effect=self.get_project_templates) \
as get_project_templates_patch, \
patch('o3de.manifest.get_gem_templates', side_effect=self.get_gem_templates) \
as get_gem_templates_patch, \
patch('o3de.manifest.get_engine_templates', side_effect=self.get_engine_templates) \
as get_engine_templates_patch, \
patch('o3de.manifest.get_all_gems', side_effect=self.get_all_gems) \
as get_all_gems_patch, \
patch('o3de.validation.valid_o3de_template_json', return_value=True) \
as validate_template_json, \
patch('o3de.validation.valid_o3de_project_json', side_effect=validate_project_json) \
as validate_project_json, \
patch('o3de.validation.valid_o3de_gem_json', side_effect=validate_gem_json) \
as validate_gem_json:
as validate_gem_json,\
patch('o3de.manifest.load_o3de_manifest') as load_o3de_manifest_patch:
templates = manifest.get_templates_for_project_creation()
assert templates == expected_template_paths
# make sure the o3de manifest isn't attempted to be loaded
load_o3de_manifest_patch.assert_not_called()
@pytest.mark.parametrize("expected_template_paths", [
pytest.param([pathlib.Path('D:/o3de/Templates/DefaultGem')])
@@ -106,13 +129,21 @@ class TestGetTemplatesForCreation:
as get_manifest_templates_patch, \
patch('o3de.manifest.get_project_templates', side_effect=self.get_project_templates) \
as get_project_templates_patch, \
patch('o3de.manifest.get_gem_templates', side_effect=self.get_gem_templates) \
as get_gem_templates_patch, \
patch('o3de.manifest.get_engine_templates', side_effect=self.get_engine_templates) \
as get_engine_templates_patch, \
patch('o3de.manifest.get_all_gems', side_effect=self.get_all_gems) \
as get_all_gems_patch, \
patch('o3de.validation.valid_o3de_template_json', return_value=True) \
as validate_template_json, \
patch('o3de.validation.valid_o3de_project_json', side_effect=validate_project_json) \
as validate_project_json, \
patch('o3de.validation.valid_o3de_gem_json', side_effect=validate_gem_json) \
as validate_gem_json:
as validate_gem_json, \
patch('o3de.manifest.load_o3de_manifest') as load_o3de_manifest_patch:
templates = manifest.get_templates_for_gem_creation()
assert templates == expected_template_paths
assert templates == expected_template_paths
# make sure the o3de manifest isn't attempted to be loaded
load_o3de_manifest_patch.assert_not_called()