Ver Fonte

improvements to edit gem workflow

Signed-off-by: T.J. Kotha <[email protected]>
T.J. Kotha há 2 anos atrás
pai
commit
b18fadeca0

+ 1 - 1
Code/Tools/ProjectManager/Source/CreateAGemScreen.h

@@ -50,11 +50,11 @@ namespace O3DE::ProjectManager
     protected slots:
         void HandleBackButton();
         void HandleNextButton();
+        void HandleGemDetailsTab();
         
 
     private slots:
         void HandleGemTemplateSelectionTab();
-        void HandleGemDetailsTab();
         void HandleGemCreatorDetailsTab();
 
     protected:

+ 2 - 0
Code/Tools/ProjectManager/Source/EditAGemScreen.cpp

@@ -107,6 +107,8 @@ namespace O3DE::ProjectManager
         m_originURL->lineEdit()->setText(oldGemInfo.m_originURL);
         m_repositoryURL->lineEdit()->setText(oldGemInfo.m_repoUri);
 
+        HandleGemDetailsTab();
+
         m_oldGemName = oldGemInfo.m_name;
 
         //load the supported platforms

+ 2 - 1
Code/Tools/ProjectManager/Source/PythonBindings.cpp

@@ -917,7 +917,8 @@ namespace O3DE::ProjectManager
                     "new_requirements"_a = QString_To_Py_String(newGemInfo.m_requirement),
                     "new_documentation_url"_a = QString_To_Py_String(newGemInfo.m_documentationLink),
                     "new_license"_a = QString_To_Py_String(newGemInfo.m_licenseText),
-                    "new_license_url"_a = QString_To_Py_String(newGemInfo.m_licenseLink),   
+                    "new_license_url"_a = QString_To_Py_String(newGemInfo.m_licenseLink),
+                    "new_repo_uri"_a = QString_To_Py_String(newGemInfo.m_repoUri),
                     "replace_tags"_a = QStringList_To_Py_List(newGemInfo.m_features), //the python code seems to interpret these lists as space separated
                     "replace_platforms"_a = QStringList_To_Py_List(newGemInfo.GetPlatformsAsStringList()))
                     ;

+ 12 - 9
scripts/o3de/o3de/gem_properties.py

@@ -58,6 +58,7 @@ def edit_gem_props(gem_path: pathlib.Path = None,
                    new_documentation_url: str = None,
                    new_license: str = None,
                    new_license_url: str = None,
+                   new_repo_uri: str = None,
                    new_tags: list or str = None,
                    remove_tags: list or str = None,
                    replace_tags: list or str = None,
@@ -87,24 +88,26 @@ def edit_gem_props(gem_path: pathlib.Path = None,
                          f' characters, and start with a letter.  {new_name}')
             return 1
         update_key_dict['gem_name'] = new_name
-    if new_display:
+    if new_display is not None:
         update_key_dict['display_name'] = new_display
-    if new_origin:
+    if new_origin is not None:
         update_key_dict['origin'] = new_origin
-    if new_type:
+    if new_type is not None:
         update_key_dict['type'] = new_type
-    if new_summary:
+    if new_summary is not None:
         update_key_dict['summary'] = new_summary
-    if new_icon:
+    if new_icon is not None:
         update_key_dict['icon_path'] = new_icon
-    if new_requirements:
+    if new_requirements is not None:
         update_key_dict['requirements'] = new_requirements
-    if new_documentation_url:
+    if new_documentation_url is not None:
         update_key_dict['documentation_url'] = new_documentation_url
-    if new_license:
+    if new_license is not None:
         update_key_dict['license'] = new_license
-    if new_license_url:
+    if new_license_url is not None:
         update_key_dict['license_url'] = new_license_url
+    if new_repo_uri is not None:
+        update_key_dict['repo_uri'] = new_repo_uri
 
     update_key_dict['user_tags'] = update_values_in_key_list(gem_json_data.get('user_tags', []), new_tags,
                                                      remove_tags, replace_tags)

+ 8 - 6
scripts/o3de/tests/test_gem_properties.py

@@ -50,27 +50,27 @@ def init_gem_json_data(request):
 class TestEditGemProperties:
     @pytest.mark.parametrize("gem_path, gem_name, gem_new_name, gem_display, gem_origin,\
                             gem_type, gem_summary, gem_icon, gem_requirements, gem_documentation_url,\
-                            gem_license, gem_license_url, add_tags, remove_tags, replace_tags,\
+                            gem_license, gem_license_url, gem_repo_uri, add_tags, remove_tags, replace_tags,\
                             expected_tags, add_platforms, remove_platforms, replace_platforms, expected_platforms,\
                             expected_result", [
         pytest.param(pathlib.PurePath('D:/TestProject'),
                      None, 'TestGem2', 'New Gem Name', 'O3DE', 'Code', 'Gem that exercises Default Gem Template',
                      'new_preview.png', 'Do this extra thing', 'https://o3de.org/docs/user-guide/gems/',
-                     'Apache 2.0', 'https://www.apache.org/licenses/LICENSE-2.0',
+                     'Apache 2.0', 'https://www.apache.org/licenses/LICENSE-2.0', "https://github.com/o3de/o3de.git",
                      ['Physics', 'Rendering', 'Scripting'], None, None, ['TestGem', 'Physics', 'Rendering', 'Scripting'],
                      ['Windows', 'MacOS', 'Linux'], None, None, ['Windows', 'MacOS', 'Linux'],
                      0),
         pytest.param(None,
                      'TestGem2', None, 'New Gem Name', 'O3DE', 'Asset', 'Gem that exercises Default Gem Template',
                      'new_preview.png', 'Do this extra thing', 'https://o3de.org/docs/user-guide/gems/', 
-                     'Apache 2.0', 'https://www.apache.org/licenses/LICENSE-2.0',
+                     'Apache 2.0', 'https://www.apache.org/licenses/LICENSE-2.0', None,
                      None, ['Physics'], None, ['TestGem', 'Rendering', 'Scripting'], 
                      ['Windows', 'MacOS'], ['Linux'], None, ['Windows', 'MacOS'],
                      0),
         pytest.param(None,
                      'TestGem2', None, 'New Gem Name', 'O3DE', 'Tool', 'Gem that exercises Default Gem Template',
                      'new_preview.png', 'Do this extra thing', 'https://o3de.org/docs/user-guide/gems/',
-                     'Apache 2.0', 'https://www.apache.org/licenses/LICENSE-2.0',
+                     'Apache 2.0', 'https://www.apache.org/licenses/LICENSE-2.0',"https://github.com/o3de/o3de.git",
                      None, None, ['Animation', 'TestGem'], ['Animation', 'TestGem'],
                      ['Windows'], None, ['MacOS', 'Linux'], ['MacOS', 'Linux'],
                      0)
@@ -78,7 +78,7 @@ class TestEditGemProperties:
     )
     def test_edit_gem_properties(self, gem_path, gem_name, gem_new_name, gem_display, gem_origin,
                                     gem_type, gem_summary, gem_icon, gem_requirements, 
-                                    gem_documentation_url, gem_license, gem_license_url, add_tags, remove_tags,
+                                    gem_documentation_url, gem_license, gem_license_url, gem_repo_uri, add_tags, remove_tags,
                                     replace_tags, expected_tags, add_platforms, remove_platforms, replace_platforms,
                                     expected_platforms, expected_result):
 
@@ -97,7 +97,7 @@ class TestEditGemProperties:
                 patch('o3de.manifest.get_registered', side_effect=get_gem_path) as get_registered_patch:
             result = gem_properties.edit_gem_props(gem_path, gem_name, gem_new_name, gem_display, gem_origin,
                                                    gem_type, gem_summary, gem_icon, gem_requirements,
-                                                   gem_documentation_url, gem_license, gem_license_url,
+                                                   gem_documentation_url, gem_license, gem_license_url, gem_repo_uri,
                                                    add_tags, remove_tags, replace_tags,
                                                    add_platforms, remove_platforms, replace_platforms)
             assert result == expected_result
@@ -121,6 +121,8 @@ class TestEditGemProperties:
                 assert self.gem_json.data.get('license', '') == gem_license
             if gem_license_url:
                 assert self.gem_json.data.get('license_url', '') == gem_license_url
+            if gem_repo_uri:
+                assert self.gem_json.data.get('repo_uri', '') == gem_repo_uri
 
             assert set(self.gem_json.data.get('user_tags', [])) == set(expected_tags)