From 530c9a424e2d128282f735dcaabb11566b4476ea Mon Sep 17 00:00:00 2001 From: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> Date: Fri, 21 May 2021 04:11:02 -0500 Subject: [PATCH] Updating the manifest get_registered command to read the engine projects, gems, external_subdirectories, restricted and templates paths from the engine.json --- scripts/o3de/o3de/add_external_subdirectory.py | 3 ++- scripts/o3de/o3de/cmake.py | 2 +- scripts/o3de/o3de/download.py | 2 +- scripts/o3de/o3de/manifest.py | 16 ++++++++-------- scripts/o3de/o3de/register.py | 1 - .../o3de/o3de/remove_external_subdirectory.py | 4 ++-- scripts/o3de/o3de/remove_gem_cmake.py | 2 +- scripts/o3de/o3de/remove_gem_project.py | 2 +- scripts/o3de/o3de/validation.py | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/scripts/o3de/o3de/add_external_subdirectory.py b/scripts/o3de/o3de/add_external_subdirectory.py index 15dc5163c5..388f0027da 100644 --- a/scripts/o3de/o3de/add_external_subdirectory.py +++ b/scripts/o3de/o3de/add_external_subdirectory.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # """ -Contains command to add a gem to a project's cmake scripts +Contains command to add an external_subdirectory to a project's cmake scripts """ import argparse @@ -50,6 +50,7 @@ def add_external_subdirectory(external_subdir: str or pathlib.Path, logger.error(f'Add External Subdirectory Failed: {engine_path} not registered.') return 1 + engine_object.setdefault('external_subdirectories', []) while external_subdir.as_posix() in engine_object['external_subdirectories']: engine_object['external_subdirectories'].remove(external_subdir.as_posix()) diff --git a/scripts/o3de/o3de/cmake.py b/scripts/o3de/o3de/cmake.py index b5b28cbb7e..7e95a9c2fe 100644 --- a/scripts/o3de/o3de/cmake.py +++ b/scripts/o3de/o3de/cmake.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # """ -This file contains methods for introspecting data from cmake scripts +Contains methods for query CMake gem target information """ import logging diff --git a/scripts/o3de/o3de/download.py b/scripts/o3de/o3de/download.py index 218463f98b..3db2f077cd 100644 --- a/scripts/o3de/o3de/download.py +++ b/scripts/o3de/o3de/download.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # """ -This file contains functions for querying paths from ~/.o3de directory +Implements functionality for downloading o3de objecs either locally or from a URI """ import argparse diff --git a/scripts/o3de/o3de/manifest.py b/scripts/o3de/o3de/manifest.py index b3aac6d1f3..44d6ff1b61 100644 --- a/scripts/o3de/o3de/manifest.py +++ b/scripts/o3de/o3de/manifest.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # """ -This file contains functions for querying paths from ~/.o3de directory +Contains functions for data from json files such as the o3de_manifests.json, engine.json, project.json, etc... """ import json @@ -496,7 +496,7 @@ def get_registered(engine_name: str = None, return engine_path elif isinstance(project_name, str): - engine_object = find_engine_data(json_data) + enging_projects = get_engine_projects() projects = json_data['projects'].copy() projects.extend(engine_object['projects']) for project_path in projects: @@ -513,9 +513,9 @@ def get_registered(engine_name: str = None, return project_path elif isinstance(gem_name, str): - engine_object = find_engine_data(json_data) + engine_gems = get_engine_gems() gems = json_data['gems'].copy() - gems.extend(engine_object['gems']) + gems.extend(engine_gems) for gem_path in gems: gem_path = pathlib.Path(gem_path).resolve() gem_json = gem_path / 'gem.json' @@ -530,9 +530,9 @@ def get_registered(engine_name: str = None, return gem_path elif isinstance(template_name, str): - engine_object = find_engine_data(json_data) + engine_templates = get_engine_templates() templates = json_data['templates'].copy() - templates.extend(engine_object['templates']) + templates.extend(engine_templates) for template_path in templates: template_path = pathlib.Path(template_path).resolve() template_json = template_path / 'template.json' @@ -547,9 +547,9 @@ def get_registered(engine_name: str = None, return template_path elif isinstance(restricted_name, str): - engine_object = find_engine_data(json_data) + engine_restricted = get_engine_restricted() restricted = json_data['restricted'].copy() - restricted.extend(engine_object['restricted']) + restricted.extend(engine_restricted) for restricted_path in restricted: restricted_path = pathlib.Path(restricted_path).resolve() restricted_json = restricted_path / 'restricted.json' diff --git a/scripts/o3de/o3de/register.py b/scripts/o3de/o3de/register.py index e96d057e9c..d6a734e1fd 100644 --- a/scripts/o3de/o3de/register.py +++ b/scripts/o3de/o3de/register.py @@ -374,7 +374,6 @@ def register_engine_path(json_data: dict, engine_object = {} engine_object.update({'path': engine_path.as_posix()}) - engine_object.update({'restricted': []}) json_data.setdefault('engines', []).insert(0, engine_object) diff --git a/scripts/o3de/o3de/remove_external_subdirectory.py b/scripts/o3de/o3de/remove_external_subdirectory.py index 3e022d51b9..a636474fba 100644 --- a/scripts/o3de/o3de/remove_external_subdirectory.py +++ b/scripts/o3de/o3de/remove_external_subdirectory.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # """ -Contains command to add a gem to a project's cmake scripts +Implemens functinality to remove external_subdirectories from the o3de_manifests.json """ import argparse @@ -31,7 +31,7 @@ def remove_external_subdirectory(external_subdir: str or pathlib.Path, """ json_data = manifest.load_o3de_manifest() engine_object = manifest.find_engine_data(json_data, engine_path) - if not engine_object: + if not engine_object or not 'external_subdirectories' in engine_object: logger.error(f'Remove External Subdirectory Failed: {engine_path} not registered.') return 1 diff --git a/scripts/o3de/o3de/remove_gem_cmake.py b/scripts/o3de/o3de/remove_gem_cmake.py index 2def94dfbf..8f73caaad1 100644 --- a/scripts/o3de/o3de/remove_gem_cmake.py +++ b/scripts/o3de/o3de/remove_gem_cmake.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # """ -This file contains methods for removing a gem from a project's cmake scripts +Contains methods for removing a gem from a project's cmake scripts """ import argparse diff --git a/scripts/o3de/o3de/remove_gem_project.py b/scripts/o3de/o3de/remove_gem_project.py index a3e623f488..7644357042 100644 --- a/scripts/o3de/o3de/remove_gem_project.py +++ b/scripts/o3de/o3de/remove_gem_project.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # """ -This file contains methods for removing a gem from a project +Contains methods for removing a gem target from a project """ import argparse diff --git a/scripts/o3de/o3de/validation.py b/scripts/o3de/o3de/validation.py index 56839fe056..f3a5f5e376 100644 --- a/scripts/o3de/o3de/validation.py +++ b/scripts/o3de/o3de/validation.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # """ -This file contains functions for querying paths from ~/.o3de directory +This file validating o3de object json files """ import json import pathlib