diff --git a/Gems/AtomContent/CMakeLists.txt b/Gems/AtomContent/CMakeLists.txt index 4d5680a30d..79842f462c 100644 --- a/Gems/AtomContent/CMakeLists.txt +++ b/Gems/AtomContent/CMakeLists.txt @@ -8,3 +8,7 @@ # remove or modify any license notices. This file is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # + +add_subdirectory(LookDevelopmentStudioPixar) +add_subdirectory(ReferenceMaterials) +add_subdirectory(Sponza) diff --git a/Gems/AtomContent/LookDevelopmentStudioPixar/CMakeLists.txt b/Gems/AtomContent/LookDevelopmentStudioPixar/CMakeLists.txt new file mode 100644 index 0000000000..1eef04a86d --- /dev/null +++ b/Gems/AtomContent/LookDevelopmentStudioPixar/CMakeLists.txt @@ -0,0 +1,15 @@ +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# + +# This will export its "SourcePaths" to the generated "cmake_dependencies..assetbuilder.setreg" +if(PAL_TRAIT_BUILD_HOST_TOOLS) + ly_create_alias(NAME AtomContent_LookDevelopmentStudioPixar.Builders NAMESPACE Gem) +endif() diff --git a/Gems/AtomContent/ReferenceMaterials/CMakeLists.txt b/Gems/AtomContent/ReferenceMaterials/CMakeLists.txt new file mode 100644 index 0000000000..9afc5af5a7 --- /dev/null +++ b/Gems/AtomContent/ReferenceMaterials/CMakeLists.txt @@ -0,0 +1,15 @@ +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# + +# This will export its "SourcePaths" to the generated "cmake_dependencies..assetbuilder.setreg" +if(PAL_TRAIT_BUILD_HOST_TOOLS) + ly_create_alias(NAME AtomContent_ReferenceMaterials.Builders NAMESPACE Gem) +endif() diff --git a/Gems/AtomContent/Sponza/CMakeLists.txt b/Gems/AtomContent/Sponza/CMakeLists.txt new file mode 100644 index 0000000000..df672f31f3 --- /dev/null +++ b/Gems/AtomContent/Sponza/CMakeLists.txt @@ -0,0 +1,15 @@ +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# + +# This will export its "SourcePaths" to the generated "cmake_dependencies..assetbuilder.setreg" +if(PAL_TRAIT_BUILD_HOST_TOOLS) + ly_create_alias(NAME AtomContent_Sponza.Builders NAMESPACE Gem) +endif() diff --git a/Gems/DevTextures/CMakeLists.txt b/Gems/DevTextures/CMakeLists.txt index 4d5680a30d..6ec5ba947c 100644 --- a/Gems/DevTextures/CMakeLists.txt +++ b/Gems/DevTextures/CMakeLists.txt @@ -8,3 +8,8 @@ # remove or modify any license notices. This file is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # + +# This will export its "SourcePaths" to the generated "cmake_dependencies..assetbuilder.setreg" +if(PAL_TRAIT_BUILD_HOST_TOOLS) + ly_create_alias(NAME DevTextures.Builders NAMESPACE Gem) +endif() diff --git a/Gems/PBSreferenceMaterials/CMakeLists.txt b/Gems/PBSreferenceMaterials/CMakeLists.txt index 4d5680a30d..ae5b2229e5 100644 --- a/Gems/PBSreferenceMaterials/CMakeLists.txt +++ b/Gems/PBSreferenceMaterials/CMakeLists.txt @@ -8,3 +8,8 @@ # remove or modify any license notices. This file is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # + +# This will export its "SourcePaths" to the generated "cmake_dependencies..assetbuilder.setreg" +if(PAL_TRAIT_BUILD_HOST_TOOLS) + ly_create_alias(NAME PBSreferenceMaterials.Builders NAMESPACE Gem) +endif() diff --git a/Gems/PhysXSamples/CMakeLists.txt b/Gems/PhysXSamples/CMakeLists.txt index 4d5680a30d..7ace40940b 100644 --- a/Gems/PhysXSamples/CMakeLists.txt +++ b/Gems/PhysXSamples/CMakeLists.txt @@ -8,3 +8,8 @@ # remove or modify any license notices. This file is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # + +# This will export its "SourcePaths" to the generated "cmake_dependencies..assetbuilder.setreg" +if(PAL_TRAIT_BUILD_HOST_TOOLS) + ly_create_alias(NAME PhysXSamples.Builders NAMESPACE Gem) +endif() diff --git a/Gems/PhysicsEntities/CMakeLists.txt b/Gems/PhysicsEntities/CMakeLists.txt index 4d5680a30d..6ec2f6f374 100644 --- a/Gems/PhysicsEntities/CMakeLists.txt +++ b/Gems/PhysicsEntities/CMakeLists.txt @@ -8,3 +8,8 @@ # remove or modify any license notices. This file is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # + +# This will export its "SourcePaths" to the generated "cmake_dependencies..assetbuilder.setreg" +if(PAL_TRAIT_BUILD_HOST_TOOLS) + ly_create_alias(NAME PhysicsEntities.Builders NAMESPACE Gem) +endif() diff --git a/Gems/PrimitiveAssets/CMakeLists.txt b/Gems/PrimitiveAssets/CMakeLists.txt index 4d5680a30d..72d532ec9b 100644 --- a/Gems/PrimitiveAssets/CMakeLists.txt +++ b/Gems/PrimitiveAssets/CMakeLists.txt @@ -8,3 +8,9 @@ # remove or modify any license notices. This file is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # + +# Add the PrimitiveAssets Asset-only gem as a Builder variant +# This will export its "SourcePaths" to the generated "cmake_dependencies..assetbuilder.setreg" +if(PAL_TRAIT_BUILD_HOST_TOOLS) + ly_create_alias(NAME PrimitiveAssets.Builders NAMESPACE Gem) +endif() diff --git a/Gems/UiBasics/CMakeLists.txt b/Gems/UiBasics/CMakeLists.txt index 4d5680a30d..91b24308b0 100644 --- a/Gems/UiBasics/CMakeLists.txt +++ b/Gems/UiBasics/CMakeLists.txt @@ -8,3 +8,8 @@ # remove or modify any license notices. This file is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # + +# This will export its "SourcePaths" to the generated "cmake_dependencies..assetbuilder.setreg" +if(PAL_TRAIT_BUILD_HOST_TOOLS) + ly_create_alias(NAME UiBasics.Builders NAMESPACE Gem) +endif() diff --git a/Gems/Vegetation_Gem_Assets/CMakeLists.txt b/Gems/Vegetation_Gem_Assets/CMakeLists.txt index 4d5680a30d..a410a242c7 100644 --- a/Gems/Vegetation_Gem_Assets/CMakeLists.txt +++ b/Gems/Vegetation_Gem_Assets/CMakeLists.txt @@ -8,3 +8,8 @@ # remove or modify any license notices. This file is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # + +# This will export its "SourcePaths" to the generated "cmake_dependencies..assetbuilder.setreg" +if(PAL_TRAIT_BUILD_HOST_TOOLS) + ly_create_alias(NAME Vegetation_Gem_Assets.Builders NAMESPACE Gem) +endif() diff --git a/Templates/AssetGem/Template/CMakeLists.txt b/Templates/AssetGem/Template/CMakeLists.txt new file mode 100644 index 0000000000..a220cce911 --- /dev/null +++ b/Templates/AssetGem/Template/CMakeLists.txt @@ -0,0 +1,18 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + +# This will export the path to the directory containing the gem.json +# to the "SourcePaths" entry within the "cmake_dependencies..assetbuilder.setreg" +# which is generated when cmake is run +# This path is the gem root directory +if(PAL_TRAIT_BUILD_HOST_TOOLS) + ly_create_alias(NAME ${Name}.Builders NAMESPACE Gem) +endif() diff --git a/Templates/AssetGem/Template/gem.json b/Templates/AssetGem/Template/gem.json new file mode 100644 index 0000000000..5b8fb3fde0 --- /dev/null +++ b/Templates/AssetGem/Template/gem.json @@ -0,0 +1,14 @@ +{ + "gem_name": "${Name}", + "origin": "The primary repo for ${Name} goes here: i.e. http://www.mydomain.com", + "license": "What license ${Name} uses goes here: i.e. https://opensource.org/licenses/MIT", + "display_name": "${Name}", + "summary": "A short description of ${Name}.", + "canonical_tags": [ + "Gem" + ], + "user_tags": [ + "${Name}" + ], + "icon_path": "preview.png" +} diff --git a/Templates/AssetGem/Template/preview.png b/Templates/AssetGem/Template/preview.png new file mode 100644 index 0000000000..2f1ed47754 --- /dev/null +++ b/Templates/AssetGem/Template/preview.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa +size 41127 diff --git a/Templates/AssetGem/template.json b/Templates/AssetGem/template.json new file mode 100644 index 0000000000..e858dc526d --- /dev/null +++ b/Templates/AssetGem/template.json @@ -0,0 +1,38 @@ +{ + "template_name": "AssetGem", + "origin": "The primary repo for AssetGem goes here: i.e. http://www.mydomain.com", + "license": "What license AssetGem uses goes here: i.e. https://opensource.org/licenses/MIT", + "display_name": "AssetGem", + "summary": "A short description of AssetGem template.", + "canonical_tags": [], + "user_tags": [ + "AssetGem" + ], + "icon_path": "preview.png", + "copyFiles": [ + { + "file": "CMakeLists.txt", + "origin": "CMakeLists.txt", + "isTemplated": true, + "isOptional": false + }, + { + "file": "gem.json", + "origin": "gem.json", + "isTemplated": true, + "isOptional": false + }, + { + "file": "preview.png", + "origin": "preview.png", + "isTemplated": false, + "isOptional": false + } + ], + "createDirectories": [ + { + "dir": "Assets", + "origin": "Assets" + } + ] +} diff --git a/Templates/DefaultProject/Template/EngineFinder.cmake b/Templates/DefaultProject/Template/EngineFinder.cmake index fbbe3d8cfe..cac0f6215c 100644 --- a/Templates/DefaultProject/Template/EngineFinder.cmake +++ b/Templates/DefaultProject/Template/EngineFinder.cmake @@ -1,3 +1,4 @@ +# {BEGIN_LICENSE} # # All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or # its licensors. @@ -8,6 +9,7 @@ # remove or modify any license notices. This file is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# {END_LICENSE} # This file is copied during engine registration. Edits to this file will be lost next # time a registration happens. diff --git a/Templates/DefaultProject/Template/Registry/assets_scan_folders.setreg b/Templates/DefaultProject/Template/Registry/assets_scan_folders.setreg index 3da517eb83..a42f65efb4 100644 --- a/Templates/DefaultProject/Template/Registry/assets_scan_folders.setreg +++ b/Templates/DefaultProject/Template/Registry/assets_scan_folders.setreg @@ -7,8 +7,7 @@ [ "Assets", "ShaderLib", - "Shaders", - "Registry" + "Shaders" ] } } diff --git a/Templates/DefaultProject/Template/game.cfg b/Templates/DefaultProject/Template/game.cfg index 49fc0346e4..1da374a93b 100644 --- a/Templates/DefaultProject/Template/game.cfg +++ b/Templates/DefaultProject/Template/game.cfg @@ -1,7 +1,3 @@ -sys_game_name = "${Name}" -sys_localization_folder = Localization -ca_useIMG_CAF = 0 - -- Enable warnings when asset loads take longer than the given millisecond threshold cl_assetLoadWarningEnable=true cl_assetLoadWarningMsThreshold=100 diff --git a/Templates/DefaultProject/template.json b/Templates/DefaultProject/template.json index 6f74fb6b26..67df3cccf7 100644 --- a/Templates/DefaultProject/template.json +++ b/Templates/DefaultProject/template.json @@ -25,12 +25,6 @@ "isTemplated": true, "isOptional": false }, - { - "file": "EngineFinder.cmake", - "origin": "EngineFinder.cmake", - "isTemplated": false, - "isOptional": false - }, { "file": "Code/${NameLower}_files.cmake", "origin": "Code/${NameLower}_files.cmake", @@ -49,12 +43,6 @@ "isTemplated": true, "isOptional": false }, - { - "file": "Code/gem.json", - "origin": "Code/gem.json", - "isTemplated": true, - "isOptional": true - }, { "file": "Code/Include/${Name}/${Name}Bus.h", "origin": "Code/Include/${Name}/${Name}Bus.h", @@ -175,12 +163,24 @@ "isTemplated": true, "isOptional": false }, + { + "file": "Code/gem.json", + "origin": "Code/gem.json", + "isTemplated": true, + "isOptional": true + }, { "file": "Config/shader_global_build_options.json", "origin": "Config/shader_global_build_options.json", "isTemplated": false, "isOptional": false }, + { + "file": "EngineFinder.cmake", + "origin": "EngineFinder.cmake", + "isTemplated": false, + "isOptional": false + }, { "file": "Platform/Android/android_project.cmake", "origin": "Platform/Android/android_project.cmake", @@ -478,7 +478,7 @@ { "file": "ShaderLib/README.md", "origin": "ShaderLib/README.md", - "isTemplated": true, + "isTemplated": false, "isOptional": true }, { @@ -514,7 +514,7 @@ { "file": "game.cfg", "origin": "game.cfg", - "isTemplated": true, + "isTemplated": false, "isOptional": false }, { @@ -650,6 +650,10 @@ { "dir": "Shaders", "origin": "Shaders" + }, + { + "dir": "Shaders/ShaderResourceGroups", + "origin": "Shaders/ShaderResourceGroups" } ] } diff --git a/Templates/MinimalProject/Template/.gitignore b/Templates/MinimalProject/Template/.gitignore new file mode 100644 index 0000000000..9a6d119b1b --- /dev/null +++ b/Templates/MinimalProject/Template/.gitignore @@ -0,0 +1,3 @@ +[Bb]uild/ +[Cc]ache/ +[Uu]ser/ \ No newline at end of file diff --git a/Templates/MinimalProject/Template/CMakeLists.txt b/Templates/MinimalProject/Template/CMakeLists.txt new file mode 100644 index 0000000000..4dcfc5325b --- /dev/null +++ b/Templates/MinimalProject/Template/CMakeLists.txt @@ -0,0 +1,35 @@ +# {BEGIN_LICENSE} +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# +# {END_LICENSE} + +if(NOT PROJECT_NAME) + cmake_minimum_required(VERSION 3.20) + project(${Name} + LANGUAGES C CXX + VERSION 1.0.0.0 + ) + include(EngineFinder.cmake OPTIONAL) + find_package(o3de REQUIRED) + o3de_initialize() +else() + # Add the project_name to global LY_PROJECTS_TARGET_NAME property + file(READ "${CMAKE_CURRENT_LIST_DIR}/project.json" project_json) + + string(JSON project_target_name ERROR_VARIABLE json_error GET ${project_json} "project_name") + if(json_error) + message(FATAL_ERROR "Unable to read key 'project_name' from 'project.json'") + endif() + + set_property(GLOBAL APPEND PROPERTY LY_PROJECTS_TARGET_NAME ${project_target_name}) + + add_subdirectory(Code) +endif() diff --git a/Templates/MinimalProject/Template/Code/${NameLower}_files.cmake b/Templates/MinimalProject/Template/Code/${NameLower}_files.cmake new file mode 100644 index 0000000000..f77348395b --- /dev/null +++ b/Templates/MinimalProject/Template/Code/${NameLower}_files.cmake @@ -0,0 +1,17 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + +set(FILES + Include/${Name}/${Name}Bus.h + Source/${Name}SystemComponent.cpp + Source/${Name}SystemComponent.h + enabled_gems.cmake +) diff --git a/Templates/MinimalProject/Template/Code/${NameLower}_shared_files.cmake b/Templates/MinimalProject/Template/Code/${NameLower}_shared_files.cmake new file mode 100644 index 0000000000..6b9ddc02aa --- /dev/null +++ b/Templates/MinimalProject/Template/Code/${NameLower}_shared_files.cmake @@ -0,0 +1,14 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + +set(FILES + Source/${Name}Module.cpp +) diff --git a/Templates/MinimalProject/Template/Code/CMakeLists.txt b/Templates/MinimalProject/Template/Code/CMakeLists.txt new file mode 100644 index 0000000000..43459b1606 --- /dev/null +++ b/Templates/MinimalProject/Template/Code/CMakeLists.txt @@ -0,0 +1,116 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + +# Currently we are in the ${Name}/Code folder: ${CMAKE_CURRENT_LIST_DIR} +# Get the platform specific folder ${pal_dir} for the current folder: ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} +# Note: ly_get_list_relative_pal_filename will take care of the details for us, as this may be a restricted platform +# in which case it will see if that platform is present here or in the restricted folder. +# i.e. It could here : ${Name}/Code/Platform/ or +# //${Name}/Code +ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} ${o3de_project_restricted_path} ${o3de_project_path} ${o3de_project_name}) + +# Now that we have the platform abstraction layer (PAL) folder for this folder, thats where we will find the +# traits for this platform. Traits for a platform are defines for things like whether or not something in this project +# is supported by this platform. +include(${pal_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake) + +# Now that we have loaded our project traits for this platform, see if this project is even supported on this platform. +# If its not supported we just return after including the unsupported. +if(NOT PAL_TRAIT_${NameUpper}_SUPPORTED) + return() +endif() + +# We are on a supported platform, so add the ${Name} target +# Note: We include the common files and the platform specific files which are set in ${NameLower}_files.cmake and +# in ${pal_dir}/${NameLower}_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake +ly_add_target( + NAME ${Name}.Static STATIC + NAMESPACE Gem + FILES_CMAKE + ${NameLower}_files.cmake + ${pal_dir}/${NameLower}_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake + INCLUDE_DIRECTORIES + PUBLIC + Include + BUILD_DEPENDENCIES + PRIVATE + AZ::AzGameFramework + Gem::Atom_AtomBridge.Static +) + +ly_add_target( + NAME ${Name} ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE} + NAMESPACE Gem + FILES_CMAKE + ${NameLower}_shared_files.cmake + ${pal_dir}/${NameLower}_shared_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake + INCLUDE_DIRECTORIES + PUBLIC + Include + BUILD_DEPENDENCIES + PRIVATE + Gem::${Name}.Static + AZ::AzCore +) + +# if enabled, ${Name} is used by all kinds of applications +ly_create_alias(NAME ${Name}.Builders NAMESPACE Gem TARGETS Gem::${Name}) +ly_create_alias(NAME ${Name}.Tools NAMESPACE Gem TARGETS Gem::${Name}) +ly_create_alias(NAME ${Name}.Clients NAMESPACE Gem TARGETS Gem::${Name}) +ly_create_alias(NAME ${Name}.Servers NAMESPACE Gem TARGETS Gem::${Name}) + +################################################################################ +# Gem dependencies +################################################################################ + +# The GameLauncher uses "Clients" gem variants: +ly_enable_gems( + PROJECT_NAME ${Name} GEM_FILE enabled_gems.cmake + TARGETS + ${Name}.GameLauncher + VARIANTS + Clients) + +if(PAL_TRAIT_BUILD_HOST_TOOLS) + + # the builder type applications use the "Builders" variants of the enabled gems. + ly_enable_gems( + PROJECT_NAME ${Name} GEM_FILE enabled_gems.cmake + TARGETS + AssetBuilder + AssetProcessor + AssetProcessorBatch + VARIANTS + Builders) + + # the Editor applications use the "Tools" variants of the enabled gems. + ly_enable_gems( + PROJECT_NAME ${Name} GEM_FILE enabled_gems.cmake + TARGETS + Editor + VARIANTS + Tools) +endif() + +if(PAL_TRAIT_BUILD_SERVER_SUPPORTED) + # this property causes it to actually make a ServerLauncher. + # if you don't want a Server application, you can remove this and the + # following ly_enable_gems lines. + set_property(GLOBAL APPEND PROPERTY LY_LAUNCHER_SERVER_PROJECTS ${Name}) + + # The ServerLauncher uses the "Servers" variants of enabled gems: + ly_enable_gems( + PROJECT_NAME ${Name} GEM_FILE enabled_gems.cmake + TARGETS + ${Name}.ServerLauncher + VARIANTS + Servers) +endif() diff --git a/Templates/MinimalProject/Template/Code/Include/${Name}/${Name}Bus.h b/Templates/MinimalProject/Template/Code/Include/${Name}/${Name}Bus.h new file mode 100644 index 0000000000..05e434ec03 --- /dev/null +++ b/Templates/MinimalProject/Template/Code/Include/${Name}/${Name}Bus.h @@ -0,0 +1,44 @@ +// {BEGIN_LICENSE} +/* + * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or + * its licensors. + * + * For complete copyright and license terms please see the LICENSE at the root of this + * distribution (the "License"). All use of this software is governed by the License, + * or, if provided, by the license below or the license accompanying this file. Do not + * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + */ + // {END_LICENSE} + +#pragma once + +#include +#include + +namespace ${SanitizedCppName} +{ + class ${SanitizedCppName}Requests + { + public: + AZ_RTTI(${SanitizedCppName}Requests, "${Random_Uuid}"); + virtual ~${SanitizedCppName}Requests() = default; + // Put your public methods here + }; + + class ${SanitizedCppName}BusTraits + : public AZ::EBusTraits + { + public: + ////////////////////////////////////////////////////////////////////////// + // EBusTraits overrides + static constexpr AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single; + static constexpr AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single; + ////////////////////////////////////////////////////////////////////////// + }; + + using ${SanitizedCppName}RequestBus = AZ::EBus<${SanitizedCppName}Requests, ${SanitizedCppName}BusTraits>; + using ${SanitizedCppName}Interface = AZ::Interface<${SanitizedCppName}Requests>; + +} // namespace ${SanitizedCppName} diff --git a/Templates/MinimalProject/Template/Code/Platform/Android/${NameLower}_android_files.cmake b/Templates/MinimalProject/Template/Code/Platform/Android/${NameLower}_android_files.cmake new file mode 100644 index 0000000000..78fd98ba6c --- /dev/null +++ b/Templates/MinimalProject/Template/Code/Platform/Android/${NameLower}_android_files.cmake @@ -0,0 +1,14 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + +set(FILES + PAL_android.cmake +) diff --git a/Templates/MinimalProject/Template/Code/Platform/Android/${NameLower}_shared_android_files.cmake b/Templates/MinimalProject/Template/Code/Platform/Android/${NameLower}_shared_android_files.cmake new file mode 100644 index 0000000000..d7112106d2 --- /dev/null +++ b/Templates/MinimalProject/Template/Code/Platform/Android/${NameLower}_shared_android_files.cmake @@ -0,0 +1,13 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + +set(FILES +) diff --git a/Templates/MinimalProject/Template/Code/Platform/Android/PAL_android.cmake b/Templates/MinimalProject/Template/Code/Platform/Android/PAL_android.cmake new file mode 100644 index 0000000000..8218d1c700 --- /dev/null +++ b/Templates/MinimalProject/Template/Code/Platform/Android/PAL_android.cmake @@ -0,0 +1,12 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + +set(PAL_TRAIT_${NameUpper}_SUPPORTED TRUE) diff --git a/Templates/MinimalProject/Template/Code/Platform/Linux/${NameLower}_linux_files.cmake b/Templates/MinimalProject/Template/Code/Platform/Linux/${NameLower}_linux_files.cmake new file mode 100644 index 0000000000..ee0b06efc4 --- /dev/null +++ b/Templates/MinimalProject/Template/Code/Platform/Linux/${NameLower}_linux_files.cmake @@ -0,0 +1,14 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + +set(FILES + PAL_linux.cmake +) diff --git a/Templates/MinimalProject/Template/Code/Platform/Linux/${NameLower}_shared_linux_files.cmake b/Templates/MinimalProject/Template/Code/Platform/Linux/${NameLower}_shared_linux_files.cmake new file mode 100644 index 0000000000..d7112106d2 --- /dev/null +++ b/Templates/MinimalProject/Template/Code/Platform/Linux/${NameLower}_shared_linux_files.cmake @@ -0,0 +1,13 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + +set(FILES +) diff --git a/Templates/MinimalProject/Template/Code/Platform/Linux/PAL_linux.cmake b/Templates/MinimalProject/Template/Code/Platform/Linux/PAL_linux.cmake new file mode 100644 index 0000000000..8218d1c700 --- /dev/null +++ b/Templates/MinimalProject/Template/Code/Platform/Linux/PAL_linux.cmake @@ -0,0 +1,12 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + +set(PAL_TRAIT_${NameUpper}_SUPPORTED TRUE) diff --git a/Templates/MinimalProject/Template/Code/Platform/Mac/${NameLower}_mac_files.cmake b/Templates/MinimalProject/Template/Code/Platform/Mac/${NameLower}_mac_files.cmake new file mode 100644 index 0000000000..e14e028c88 --- /dev/null +++ b/Templates/MinimalProject/Template/Code/Platform/Mac/${NameLower}_mac_files.cmake @@ -0,0 +1,15 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + +set(FILES + ../../../Resources/Platform/Mac/Info.plist + PAL_mac.cmake +) diff --git a/Templates/MinimalProject/Template/Code/Platform/Mac/${NameLower}_shared_mac_files.cmake b/Templates/MinimalProject/Template/Code/Platform/Mac/${NameLower}_shared_mac_files.cmake new file mode 100644 index 0000000000..d9f2e6ec6b --- /dev/null +++ b/Templates/MinimalProject/Template/Code/Platform/Mac/${NameLower}_shared_mac_files.cmake @@ -0,0 +1,14 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + +set(FILES + ../../../Resources/Platform/Mac/Info.plist +) diff --git a/Templates/MinimalProject/Template/Code/Platform/Mac/PAL_mac.cmake b/Templates/MinimalProject/Template/Code/Platform/Mac/PAL_mac.cmake new file mode 100644 index 0000000000..8218d1c700 --- /dev/null +++ b/Templates/MinimalProject/Template/Code/Platform/Mac/PAL_mac.cmake @@ -0,0 +1,12 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + +set(PAL_TRAIT_${NameUpper}_SUPPORTED TRUE) diff --git a/Templates/MinimalProject/Template/Code/Platform/Windows/${NameLower}_shared_windows_files.cmake b/Templates/MinimalProject/Template/Code/Platform/Windows/${NameLower}_shared_windows_files.cmake new file mode 100644 index 0000000000..d7112106d2 --- /dev/null +++ b/Templates/MinimalProject/Template/Code/Platform/Windows/${NameLower}_shared_windows_files.cmake @@ -0,0 +1,13 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + +set(FILES +) diff --git a/Templates/MinimalProject/Template/Code/Platform/Windows/${NameLower}_windows_files.cmake b/Templates/MinimalProject/Template/Code/Platform/Windows/${NameLower}_windows_files.cmake new file mode 100644 index 0000000000..b6eb718a05 --- /dev/null +++ b/Templates/MinimalProject/Template/Code/Platform/Windows/${NameLower}_windows_files.cmake @@ -0,0 +1,14 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + +set(FILES + PAL_windows.cmake +) diff --git a/Templates/MinimalProject/Template/Code/Platform/Windows/PAL_windows.cmake b/Templates/MinimalProject/Template/Code/Platform/Windows/PAL_windows.cmake new file mode 100644 index 0000000000..8218d1c700 --- /dev/null +++ b/Templates/MinimalProject/Template/Code/Platform/Windows/PAL_windows.cmake @@ -0,0 +1,12 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + +set(PAL_TRAIT_${NameUpper}_SUPPORTED TRUE) diff --git a/Templates/MinimalProject/Template/Code/Platform/iOS/${NameLower}_ios_files.cmake b/Templates/MinimalProject/Template/Code/Platform/iOS/${NameLower}_ios_files.cmake new file mode 100644 index 0000000000..44f15538c8 --- /dev/null +++ b/Templates/MinimalProject/Template/Code/Platform/iOS/${NameLower}_ios_files.cmake @@ -0,0 +1,15 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + +set(FILES + ../Resources/Platform/iOS/Info.plist + PAL_ios.cmake +) diff --git a/Templates/MinimalProject/Template/Code/Platform/iOS/${NameLower}_shared_ios_files.cmake b/Templates/MinimalProject/Template/Code/Platform/iOS/${NameLower}_shared_ios_files.cmake new file mode 100644 index 0000000000..d7112106d2 --- /dev/null +++ b/Templates/MinimalProject/Template/Code/Platform/iOS/${NameLower}_shared_ios_files.cmake @@ -0,0 +1,13 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + +set(FILES +) diff --git a/Templates/MinimalProject/Template/Code/Platform/iOS/PAL_ios.cmake b/Templates/MinimalProject/Template/Code/Platform/iOS/PAL_ios.cmake new file mode 100644 index 0000000000..8218d1c700 --- /dev/null +++ b/Templates/MinimalProject/Template/Code/Platform/iOS/PAL_ios.cmake @@ -0,0 +1,12 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + +set(PAL_TRAIT_${NameUpper}_SUPPORTED TRUE) diff --git a/Templates/MinimalProject/Template/Code/Source/${Name}Module.cpp b/Templates/MinimalProject/Template/Code/Source/${Name}Module.cpp new file mode 100644 index 0000000000..57b473b317 --- /dev/null +++ b/Templates/MinimalProject/Template/Code/Source/${Name}Module.cpp @@ -0,0 +1,50 @@ +// {BEGIN_LICENSE} +/* + * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or + * its licensors. + * + * For complete copyright and license terms please see the LICENSE at the root of this + * distribution (the "License"). All use of this software is governed by the License, + * or, if provided, by the license below or the license accompanying this file. Do not + * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + */ + // {END_LICENSE} + +#include +#include + +#include "${Name}SystemComponent.h" + +namespace ${SanitizedCppName} +{ + class ${SanitizedCppName}Module + : public AZ::Module + { + public: + AZ_RTTI(${SanitizedCppName}Module, "${ModuleClassId}", AZ::Module); + AZ_CLASS_ALLOCATOR(${SanitizedCppName}Module, AZ::SystemAllocator, 0); + + ${SanitizedCppName}Module() + : AZ::Module() + { + // Push results of [MyComponent]::CreateDescriptor() into m_descriptors here. + m_descriptors.insert(m_descriptors.end(), { + ${SanitizedCppName}SystemComponent::CreateDescriptor(), + }); + } + + /** + * Add required SystemComponents to the SystemEntity. + */ + AZ::ComponentTypeList GetRequiredSystemComponents() const override + { + return AZ::ComponentTypeList{ + azrtti_typeid<${SanitizedCppName}SystemComponent>(), + }; + } + }; +}// namespace ${SanitizedCppName} + +AZ_DECLARE_MODULE_CLASS(Gem_${SanitizedCppName}, ${SanitizedCppName}::${SanitizedCppName}Module) diff --git a/Templates/MinimalProject/Template/Code/Source/${Name}SystemComponent.cpp b/Templates/MinimalProject/Template/Code/Source/${Name}SystemComponent.cpp new file mode 100644 index 0000000000..ed0a47d6db --- /dev/null +++ b/Templates/MinimalProject/Template/Code/Source/${Name}SystemComponent.cpp @@ -0,0 +1,91 @@ +// {BEGIN_LICENSE} +/* + * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or + * its licensors. + * + * For complete copyright and license terms please see the LICENSE at the root of this + * distribution (the "License"). All use of this software is governed by the License, + * or, if provided, by the license below or the license accompanying this file. Do not + * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + */ + // {END_LICENSE} + +#include +#include +#include + +#include "${Name}SystemComponent.h" + +namespace ${SanitizedCppName} +{ + void ${SanitizedCppName}SystemComponent::Reflect(AZ::ReflectContext* context) + { + if (AZ::SerializeContext* serialize = azrtti_cast(context)) + { + serialize->Class<${SanitizedCppName}SystemComponent, AZ::Component>() + ->Version(0) + ; + + if (AZ::EditContext* ec = serialize->GetEditContext()) + { + ec->Class<${SanitizedCppName}SystemComponent>("${SanitizedCppName}", "[Description of functionality provided by this System Component]") + ->ClassElement(AZ::Edit::ClassElements::EditorData, "") + ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System")) + ->Attribute(AZ::Edit::Attributes::AutoExpand, true) + ; + } + } + } + + void ${SanitizedCppName}SystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided) + { + provided.push_back(AZ_CRC("${SanitizedCppName}Service")); + } + + void ${SanitizedCppName}SystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible) + { + incompatible.push_back(AZ_CRC("${SanitizedCppName}Service")); + } + + void ${SanitizedCppName}SystemComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required) + { + AZ_UNUSED(required); + } + + void ${SanitizedCppName}SystemComponent::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent) + { + AZ_UNUSED(dependent); + } + + ${SanitizedCppName}SystemComponent::${SanitizedCppName}SystemComponent() + { + if (${SanitizedCppName}Interface::Get() == nullptr) + { + ${SanitizedCppName}Interface::Register(this); + } + } + + ${SanitizedCppName}SystemComponent::~${SanitizedCppName}SystemComponent() + { + if (${SanitizedCppName}Interface::Get() == this) + { + ${SanitizedCppName}Interface::Unregister(this); + } + } + + void ${SanitizedCppName}SystemComponent::Init() + { + } + + void ${SanitizedCppName}SystemComponent::Activate() + { + ${SanitizedCppName}RequestBus::Handler::BusConnect(); + } + + void ${SanitizedCppName}SystemComponent::Deactivate() + { + ${SanitizedCppName}RequestBus::Handler::BusDisconnect(); + } +} diff --git a/Templates/MinimalProject/Template/Code/Source/${Name}SystemComponent.h b/Templates/MinimalProject/Template/Code/Source/${Name}SystemComponent.h new file mode 100644 index 0000000000..10a500aba2 --- /dev/null +++ b/Templates/MinimalProject/Template/Code/Source/${Name}SystemComponent.h @@ -0,0 +1,53 @@ +// {BEGIN_LICENSE} +/* + * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or + * its licensors. + * + * For complete copyright and license terms please see the LICENSE at the root of this + * distribution (the "License"). All use of this software is governed by the License, + * or, if provided, by the license below or the license accompanying this file. Do not + * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + */ + // {END_LICENSE} + +#pragma once + +#include + +#include <${Name}/${Name}Bus.h> + +namespace ${SanitizedCppName} +{ + class ${SanitizedCppName}SystemComponent + : public AZ::Component + , protected ${SanitizedCppName}RequestBus::Handler + { + public: + AZ_COMPONENT(${SanitizedCppName}SystemComponent, "${SysCompClassId}"); + + static void Reflect(AZ::ReflectContext* context); + + static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided); + static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible); + static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required); + static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent); + + ${SanitizedCppName}SystemComponent(); + ~${SanitizedCppName}SystemComponent(); + + protected: + //////////////////////////////////////////////////////////////////////// + // ${SanitizedCppName}RequestBus interface implementation + + //////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////// + // AZ::Component interface implementation + void Init() override; + void Activate() override; + void Deactivate() override; + //////////////////////////////////////////////////////////////////////// + }; +} diff --git a/Templates/MinimalProject/Template/Code/enabled_gems.cmake b/Templates/MinimalProject/Template/Code/enabled_gems.cmake new file mode 100644 index 0000000000..72500a8ada --- /dev/null +++ b/Templates/MinimalProject/Template/Code/enabled_gems.cmake @@ -0,0 +1,17 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + +set(ENABLED_GEMS + ${Name} + Atom_AtomBridge + CameraFramework + ImGui +) diff --git a/Templates/MinimalProject/Template/Code/gem.json b/Templates/MinimalProject/Template/Code/gem.json new file mode 100644 index 0000000000..5b8fb3fde0 --- /dev/null +++ b/Templates/MinimalProject/Template/Code/gem.json @@ -0,0 +1,14 @@ +{ + "gem_name": "${Name}", + "origin": "The primary repo for ${Name} goes here: i.e. http://www.mydomain.com", + "license": "What license ${Name} uses goes here: i.e. https://opensource.org/licenses/MIT", + "display_name": "${Name}", + "summary": "A short description of ${Name}.", + "canonical_tags": [ + "Gem" + ], + "user_tags": [ + "${Name}" + ], + "icon_path": "preview.png" +} diff --git a/Templates/MinimalProject/Template/Config/shader_global_build_options.json b/Templates/MinimalProject/Template/Config/shader_global_build_options.json new file mode 100644 index 0000000000..08e4d7f502 --- /dev/null +++ b/Templates/MinimalProject/Template/Config/shader_global_build_options.json @@ -0,0 +1,11 @@ +{ + "Type": "JsonSerialization", + "Version": 1, + "ClassName": "GlobalBuildOptions", + "ClassData": { + "ShaderCompilerArguments" : { + "DefaultMatrixOrder" : "Row", + "AzslcAdditionalFreeArguments" : "--strip-unused-srgs" + } + } +} \ No newline at end of file diff --git a/Templates/MinimalProject/Template/EngineFinder.cmake b/Templates/MinimalProject/Template/EngineFinder.cmake new file mode 100644 index 0000000000..cac0f6215c --- /dev/null +++ b/Templates/MinimalProject/Template/EngineFinder.cmake @@ -0,0 +1,70 @@ +# {BEGIN_LICENSE} +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# +# {END_LICENSE} +# This file is copied during engine registration. Edits to this file will be lost next +# time a registration happens. + +include_guard() + +# Read the engine name from the project_json file +file(READ ${CMAKE_CURRENT_LIST_DIR}/project.json project_json) +string(JSON LY_ENGINE_NAME_TO_USE ERROR_VARIABLE json_error GET ${project_json} engine) +if(json_error) + message(FATAL_ERROR "Unable to read key 'engine' from 'project.json', error: ${json_error}") +endif() + +if(DEFINED ENV{USERPROFILE} AND EXISTS $ENV{USERPROFILE}) + set(manifest_path $ENV{USERPROFILE}/.o3de/o3de_manifest.json) # Windows +else() + set(manifest_path $ENV{HOME}/.o3de/o3de_manifest.json) # Unix +endif() + +# Read the ~/.o3de/o3de_manifest.json file and look through the 'engines_path' object. +# Find a key that matches LY_ENGINE_NAME_TO_USE and use that as the engine path. +if(EXISTS ${manifest_path}) + file(READ ${manifest_path} manifest_json) + + string(JSON engines_path_count ERROR_VARIABLE json_error LENGTH ${manifest_json} engines_path) + if(json_error) + message(FATAL_ERROR "Unable to read key 'engines_path' from '${manifest_path}', error: ${json_error}") + endif() + + string(JSON engines_path_type ERROR_VARIABLE json_error TYPE ${manifest_json} engines_path) + if(json_error OR NOT ${engines_path_type} STREQUAL "OBJECT") + message(FATAL_ERROR "Type of 'engines_path' in '${manifest_path}' is not a JSON Object, error: ${json_error}") + endif() + + math(EXPR engines_path_count "${engines_path_count}-1") + foreach(engine_path_index RANGE ${engines_path_count}) + string(JSON engine_name ERROR_VARIABLE json_error MEMBER ${manifest_json} engines_path ${engine_path_index}) + if(json_error) + message(FATAL_ERROR "Unable to read 'engines_path/${engine_path_index}' from '${manifest_path}', error: ${json_error}") + endif() + + if(LY_ENGINE_NAME_TO_USE STREQUAL engine_name) + string(JSON engine_path ERROR_VARIABLE json_error GET ${manifest_json} engines_path ${engine_name}) + if(json_error) + message(FATAL_ERROR "Unable to read value from 'engines_path/${engine_name}', error: ${json_error}") + endif() + + if(engine_path) + list(APPEND CMAKE_MODULE_PATH "${engine_path}/cmake") + break() + endif() + endif() + endforeach() +else() + # If the user is passing CMAKE_MODULE_PATH we assume thats where we will find the engine + if(NOT CMAKE_MODULE_PATH) + message(FATAL_ERROR "Engine registration is required before configuring a project. Please register an engine by running 'scripts/o3de register --this-engine'") + endif() +endif() diff --git a/Templates/MinimalProject/Template/Platform/Android/android_project.cmake b/Templates/MinimalProject/Template/Platform/Android/android_project.cmake new file mode 100644 index 0000000000..e102985372 --- /dev/null +++ b/Templates/MinimalProject/Template/Platform/Android/android_project.cmake @@ -0,0 +1,11 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + diff --git a/Templates/MinimalProject/Template/Platform/Android/android_project.json b/Templates/MinimalProject/Template/Platform/Android/android_project.json new file mode 100644 index 0000000000..99500f02ba --- /dev/null +++ b/Templates/MinimalProject/Template/Platform/Android/android_project.json @@ -0,0 +1,9 @@ +{ + "Tags": ["Android"], + "android_settings" : { + "package_name" : "com.lumberyard.${Name}", + "version_number" : 1, + "version_name" : "1.0.0.0", + "orientation" : "landscape" + } +} \ No newline at end of file diff --git a/Templates/MinimalProject/Template/Platform/Linux/linux_project.cmake b/Templates/MinimalProject/Template/Platform/Linux/linux_project.cmake new file mode 100644 index 0000000000..e102985372 --- /dev/null +++ b/Templates/MinimalProject/Template/Platform/Linux/linux_project.cmake @@ -0,0 +1,11 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + diff --git a/Templates/MinimalProject/Template/Platform/Linux/linux_project.json b/Templates/MinimalProject/Template/Platform/Linux/linux_project.json new file mode 100644 index 0000000000..d08fbf53ba --- /dev/null +++ b/Templates/MinimalProject/Template/Platform/Linux/linux_project.json @@ -0,0 +1,3 @@ +{ + "Tags": ["Linux"] +} \ No newline at end of file diff --git a/Templates/MinimalProject/Template/Platform/Mac/mac_project.cmake b/Templates/MinimalProject/Template/Platform/Mac/mac_project.cmake new file mode 100644 index 0000000000..e102985372 --- /dev/null +++ b/Templates/MinimalProject/Template/Platform/Mac/mac_project.cmake @@ -0,0 +1,11 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + diff --git a/Templates/MinimalProject/Template/Platform/Mac/mac_project.json b/Templates/MinimalProject/Template/Platform/Mac/mac_project.json new file mode 100644 index 0000000000..d42b6f8186 --- /dev/null +++ b/Templates/MinimalProject/Template/Platform/Mac/mac_project.json @@ -0,0 +1,3 @@ +{ + "Tags": ["Mac"] +} \ No newline at end of file diff --git a/Templates/MinimalProject/Template/Platform/Windows/windows_project.cmake b/Templates/MinimalProject/Template/Platform/Windows/windows_project.cmake new file mode 100644 index 0000000000..e102985372 --- /dev/null +++ b/Templates/MinimalProject/Template/Platform/Windows/windows_project.cmake @@ -0,0 +1,11 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + diff --git a/Templates/MinimalProject/Template/Platform/Windows/windows_project.json b/Templates/MinimalProject/Template/Platform/Windows/windows_project.json new file mode 100644 index 0000000000..a052f1e05a --- /dev/null +++ b/Templates/MinimalProject/Template/Platform/Windows/windows_project.json @@ -0,0 +1,3 @@ +{ + "Tags": ["Windows"] +} \ No newline at end of file diff --git a/Templates/MinimalProject/Template/Platform/iOS/ios_project.cmake b/Templates/MinimalProject/Template/Platform/iOS/ios_project.cmake new file mode 100644 index 0000000000..e102985372 --- /dev/null +++ b/Templates/MinimalProject/Template/Platform/iOS/ios_project.cmake @@ -0,0 +1,11 @@ +# {BEGIN_LICENSE} +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# {END_LICENSE} + diff --git a/Templates/MinimalProject/Template/Platform/iOS/ios_project.json b/Templates/MinimalProject/Template/Platform/iOS/ios_project.json new file mode 100644 index 0000000000..b2dab56d05 --- /dev/null +++ b/Templates/MinimalProject/Template/Platform/iOS/ios_project.json @@ -0,0 +1,3 @@ +{ + "Tags": ["iOS"] +} \ No newline at end of file diff --git a/Templates/MinimalProject/Template/Registry/assets_scan_folders.setreg b/Templates/MinimalProject/Template/Registry/assets_scan_folders.setreg new file mode 100644 index 0000000000..a42f65efb4 --- /dev/null +++ b/Templates/MinimalProject/Template/Registry/assets_scan_folders.setreg @@ -0,0 +1,14 @@ +{ + "Amazon": + { + "${Name}.Assets": + { + "SourcePaths": + [ + "Assets", + "ShaderLib", + "Shaders" + ] + } + } +} \ No newline at end of file diff --git a/Templates/MinimalProject/Template/Resources/CryEngineLogoLauncher.bmp b/Templates/MinimalProject/Template/Resources/CryEngineLogoLauncher.bmp new file mode 100644 index 0000000000..fe0adc54a4 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/CryEngineLogoLauncher.bmp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf6d56fe4c367d39bd78500dd34332fcad57ad41241768b52781dbdb60ddd972 +size 347568 diff --git a/Templates/MinimalProject/Template/Resources/GameSDK.ico b/Templates/MinimalProject/Template/Resources/GameSDK.ico new file mode 100644 index 0000000000..cb935cd926 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/GameSDK.ico @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61efd8df621780af995fc1250918df5e00364ff00f849bef67702cd4b0a152e1 +size 65537 diff --git a/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/Contents.json b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/Contents.json new file mode 100644 index 0000000000..da4a164c91 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/Contents.json b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/Contents.json new file mode 100644 index 0000000000..bfa8bcf478 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "icon_16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "icon_16_2x.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "icon_32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "icon_32_2x.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "icon_128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "icon_128 _2x.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "icon_256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "icon_256 _2x.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "icon_512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "icon_512_2x.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_128 _2x.png b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_128 _2x.png new file mode 100644 index 0000000000..5970ea34ba --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_128 _2x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e38257b6917cdf5d73e90e6009f10c8736d62b20c4e785085305075c7e6320e2 +size 32037 diff --git a/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_128.png b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_128.png new file mode 100644 index 0000000000..9e30e09547 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_128.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9f41a37d2347a617e93bd97adaf6d4c161c471ca3ef7e04b98c65ddda52396dc +size 27833 diff --git a/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_16.png b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_16.png new file mode 100644 index 0000000000..aeb29abd0a --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_16.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b07984494059bf827bc485cbea06d12e0283811face1a18799495f9ba7ae8af1 +size 20779 diff --git a/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_16_2x.png b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_16_2x.png new file mode 100644 index 0000000000..445a389d61 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_16_2x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e645142d284de40aafb7a4a858f3df92b6a5ba9b03fa5f1a2d3cb25211597926 +size 21857 diff --git a/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_256 _2x.png b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_256 _2x.png new file mode 100644 index 0000000000..0904cf7ce8 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_256 _2x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07631f41b8dea80713d2463f81a713a9a93798975b6fb50afbeeb13d26c57fa2 +size 48899 diff --git a/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_256.png b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_256.png new file mode 100644 index 0000000000..5970ea34ba --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_256.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e38257b6917cdf5d73e90e6009f10c8736d62b20c4e785085305075c7e6320e2 +size 32037 diff --git a/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_32.png b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_32.png new file mode 100644 index 0000000000..445a389d61 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_32.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e645142d284de40aafb7a4a858f3df92b6a5ba9b03fa5f1a2d3cb25211597926 +size 21857 diff --git a/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_32_2x.png b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_32_2x.png new file mode 100644 index 0000000000..1fad9bda96 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_32_2x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad83faf98b49f4e37112baedeae726f4f8d71bcdd1961d9cdad31f043f8ca666 +size 24003 diff --git a/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_512.png b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_512.png new file mode 100644 index 0000000000..e1517dddb6 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_512.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68529a6c11d5ffa7ecd9d5bbb11ceea28e6852bd45946b525af09602c9a1e1bf +size 48899 diff --git a/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_512_2x.png b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_512_2x.png new file mode 100644 index 0000000000..b425cb685f --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_512_2x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a70003840b418848b2ce6c18ed7cbbfcd6fcf76598a6601dca8b98d9b6c1a2f +size 114706 diff --git a/Templates/MinimalProject/Template/Resources/Platform/Mac/Info.plist b/Templates/MinimalProject/Template/Resources/Platform/Mac/Info.plist new file mode 100644 index 0000000000..6d056ba799 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/Mac/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleInfoDictionaryVersion + + CFBundleDisplayName + ${Name} + CFBundleExecutable + ${Name}.GameLauncher + CFBundleIdentifier + com.amazon.${Name} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0.0 + CFBundleSignature + 03DE + CFBundleVersion + 1.0.0 + LSApplicationCategoryType + public.app-category.puzzle-games + + diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/Contents.json b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/Contents.json new file mode 100644 index 0000000000..73c00596a7 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/Contents.json b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/Contents.json new file mode 100644 index 0000000000..f836f07ee7 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -0,0 +1,169 @@ +{ + "images" : [ + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "2436h", + "filename" : "iPhoneLaunchImage1125x2436.png", + "minimum-system-version" : "11.0", + "orientation" : "portrait", + "scale" : "3x" + }, + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "2436h", + "filename" : "iPhoneLaunchImage2436x1125.png", + "minimum-system-version" : "11.0", + "orientation" : "landscape", + "scale" : "3x" + }, + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "736h", + "filename" : "iPhoneLaunchImage1242x2208.png", + "minimum-system-version" : "8.0", + "orientation" : "portrait", + "scale" : "3x" + }, + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "736h", + "filename" : "iPhoneLaunchImage2208x1242.png", + "minimum-system-version" : "8.0", + "orientation" : "landscape", + "scale" : "3x" + }, + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "667h", + "filename" : "iPhoneLaunchImage750x1334.png", + "minimum-system-version" : "8.0", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "filename" : "iPhoneLaunchImage640x960.png", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "retina4", + "filename" : "iPhoneLaunchImage640x1136.png", + "minimum-system-version" : "7.0", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "filename" : "iPadLaunchImage768x1024.png", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "filename" : "iPadLaunchImage1024x768.png", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "filename" : "iPadLaunchImage1536x2048.png", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "filename" : "iPadLaunchImage2048x1536.png", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "extent" : "full-screen", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "extent" : "full-screen", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "extent" : "full-screen", + "subtype" : "retina4", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "to-status-bar", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "full-screen", + "scale" : "1x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "to-status-bar", + "scale" : "1x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "full-screen", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "to-status-bar", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "full-screen", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "to-status-bar", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "full-screen", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPadLaunchImage1024x768.png b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPadLaunchImage1024x768.png new file mode 100644 index 0000000000..1249ef3703 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPadLaunchImage1024x768.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:31afa7ed44c5d9844c8d6ce08beccac482c3f43590869a3d190d06e2df377ccc +size 137472 diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPadLaunchImage1536x2048.png b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPadLaunchImage1536x2048.png new file mode 100644 index 0000000000..cdb6d5a82a --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPadLaunchImage1536x2048.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0aac8ef9899442820bec0df8bf6434a46cc787d57c5d6d38a04727b8dc310048 +size 338281 diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPadLaunchImage2048x1536.png b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPadLaunchImage2048x1536.png new file mode 100644 index 0000000000..954d3084c8 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPadLaunchImage2048x1536.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c07495891f15b138ba09f142777b0f43217bf8be05cbb74ba938319f3425980c +size 321125 diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPadLaunchImage768x1024.png b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPadLaunchImage768x1024.png new file mode 100644 index 0000000000..021319fbc3 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPadLaunchImage768x1024.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d6bf6acb92421a453a36fc143ab6cefda14d631ea5e6dbf95c6e252a445fcbac +size 144797 diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPhoneLaunchImage640x1136.png b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPhoneLaunchImage640x1136.png new file mode 100644 index 0000000000..a15fd777fa --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPhoneLaunchImage640x1136.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e9ad650fda925b1c076a67d1ef70315fe4f14db888c9fd36ee4eba1d18c1e7d1 +size 166749 diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPhoneLaunchImage640x960.png b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPhoneLaunchImage640x960.png new file mode 100644 index 0000000000..2855f4069d --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPhoneLaunchImage640x960.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:16f6e9d7bd15fc528d934c252213de8792812e708b1810191c5f1767f7165852 +size 142331 diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/Contents.json b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/Contents.json new file mode 100644 index 0000000000..09621469c3 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/Contents.json @@ -0,0 +1,116 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "iPhoneNotificationIcon40x40.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "iPhoneNotificationIcon60x60.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "iPhoneSettingsIcon58x58.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "iPhoneSettingsIcon87x87.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "iPhoneSpotlightIcon80x80.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "iPhoneSpotlightIcon120x120.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "iPhoneAppIcon120x120.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "iPhoneAppIcon180x180.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "iPadNotificationIcon20x20.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "iPadNotificationIcon40x40.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "iPadSettingsIcon29x29.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "iPadSettingsIcon58x58.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "iPadSpotlightIcon40x40.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "iPadSpotlightIcon80x80.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "iPadAppIcon76x76.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "iPadAppIcon152x152.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "iPadProAppIcon167x167.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "iOSAppStoreIcon1024x1024.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadAppIcon152x152.png b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadAppIcon152x152.png new file mode 100644 index 0000000000..b0dd493c11 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadAppIcon152x152.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e4901093fa6190bf37291b0fb6de23fba1be8ebbd742775a8565a4106722fbb6 +size 31942 diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadAppIcon76x76.png b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadAppIcon76x76.png new file mode 100644 index 0000000000..21aa62e96b --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadAppIcon76x76.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e4ae97c4f44910121a61686862c8342ce598db4cdf9d46b29e96d3cb9e43bd06 +size 22158 diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadProAppIcon167x167.png b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadProAppIcon167x167.png new file mode 100644 index 0000000000..6b696a84b2 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadProAppIcon167x167.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:061e2d0ce8dc852dd298c80f2aed5fee8ea4b87511c00662aa2d00922c0ba3c2 +size 30162 diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadSettingsIcon29x29.png b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadSettingsIcon29x29.png new file mode 100644 index 0000000000..f3dfa05839 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadSettingsIcon29x29.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0fb4b4b77620d99dae7473b7bd8affe14630419835bd5719167ed200e657fa4f +size 17504 diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadSettingsIcon58x58.png b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadSettingsIcon58x58.png new file mode 100644 index 0000000000..5325b805fd --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadSettingsIcon58x58.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8aa9b1194f3244025578225a6a87cbc2dd12c70955ff615c8af640ea7f1334f1 +size 19619 diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadSpotlightIcon40x40.png b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadSpotlightIcon40x40.png new file mode 100644 index 0000000000..98d8455838 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadSpotlightIcon40x40.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c25ffb1af8160b3202977de8c32aaa235e22c643ffd8004e4546c96868ef3b9 +size 18317 diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadSpotlightIcon80x80.png b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadSpotlightIcon80x80.png new file mode 100644 index 0000000000..7482f6c892 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadSpotlightIcon80x80.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2db961b8f922a552d8ad374fdb56029efd4049a6cde10399b3d961242c82ce53 +size 22571 diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneAppIcon120x120.png b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneAppIcon120x120.png new file mode 100644 index 0000000000..da987b86f9 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneAppIcon120x120.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f39d897a57d4da0a70ede7c91339660b28e9d8c57b3e7d749807b13baa4b85f3 +size 28559 diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneAppIcon180x180.png b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneAppIcon180x180.png new file mode 100644 index 0000000000..205e025c36 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneAppIcon180x180.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:263b75d58328499eef1f8fa2e64c30706f546badcc0c4464a043b231da93cd0d +size 34969 diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneSettingsIcon58x58.png b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneSettingsIcon58x58.png new file mode 100644 index 0000000000..0deb4f4f35 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneSettingsIcon58x58.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:33522ad8a8e826b22dd9ad214f56e63e24bf55c00bd8c845925d848b855dfb48 +size 19619 diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneSettingsIcon87x87.png b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneSettingsIcon87x87.png new file mode 100644 index 0000000000..78591751d7 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneSettingsIcon87x87.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f405c9f3d908d038aea26049e533b0d10955adfac370c7b3b80209997ea706d0 +size 24407 diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneSpotlightIcon120x120.png b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneSpotlightIcon120x120.png new file mode 100644 index 0000000000..034dcb9fed --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneSpotlightIcon120x120.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d110f6e151799a2327bcdf5ef94d6fc82b114783a8cc973a8915896679ba4a80 +size 28559 diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneSpotlightIcon80x80.png b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneSpotlightIcon80x80.png new file mode 100644 index 0000000000..f0fa89149c --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneSpotlightIcon80x80.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:db8f00568fad4e49b05249aaa7a48c9fbf85c8b7a78489c83dc9b8161778bcef +size 22571 diff --git a/Templates/MinimalProject/Template/Resources/Platform/iOS/Info.plist b/Templates/MinimalProject/Template/Resources/Platform/iOS/Info.plist new file mode 100644 index 0000000000..2233733ad8 --- /dev/null +++ b/Templates/MinimalProject/Template/Resources/Platform/iOS/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${Name} + CFBundleExecutable + ${Name}.GameLauncher + CFBundleIdentifier + com.amazon.lumberyard.${Name} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${Name} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + UIRequiredDeviceCapabilities + + arm64 + metal + + UIRequiresFullScreen + + UIStatusBarHidden + + UISupportedInterfaceOrientations + + UIInterfaceOrientationLandscapeRight + UIInterfaceOrientationLandscapeLeft + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationLandscapeRight + UIInterfaceOrientationLandscapeLeft + + + diff --git a/Templates/MinimalProject/Template/ShaderLib/README.md b/Templates/MinimalProject/Template/ShaderLib/README.md new file mode 100644 index 0000000000..034550163d --- /dev/null +++ b/Templates/MinimalProject/Template/ShaderLib/README.md @@ -0,0 +1,5 @@ +# Customizing Shader Resource Groups + +Please read: +*\/Gems/Atom/Feature/Common/Assets/ShaderResourceGroups/README.md* +for details on how to customize scenesrg.srgi and viewsrg.srgi. diff --git a/Templates/MinimalProject/Template/ShaderLib/scenesrg.srgi b/Templates/MinimalProject/Template/ShaderLib/scenesrg.srgi new file mode 100644 index 0000000000..0a8cec5963 --- /dev/null +++ b/Templates/MinimalProject/Template/ShaderLib/scenesrg.srgi @@ -0,0 +1,31 @@ +// {BEGIN_LICENSE} +/* +* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +* its licensors. +* +* For complete copyright and license terms please see the LICENSE at the root of this +* distribution (the "License"). All use of this software is governed by the License, +* or, if provided, by the license below or the license accompanying this file. Do not +* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* +*/ +// {END_LICENSE} + +#pragma once + +// Please read README.md for an explanation on why scenesrg.srgi and viewsrg.srgi are +// located in this folder (And how you can optionally customize your own scenesrg.srgi +// and viewsrg.srgi in your game project). + +#include + +partial ShaderResourceGroup SceneSrg : SRG_PerScene +{ +/* Intentionally Empty. Helps define the SrgSemantic for SceneSrg once.*/ +}; + +#define AZ_COLLECTING_PARTIAL_SRGS +#include +#include +#undef AZ_COLLECTING_PARTIAL_SRGS diff --git a/Templates/MinimalProject/Template/ShaderLib/viewsrg.srgi b/Templates/MinimalProject/Template/ShaderLib/viewsrg.srgi new file mode 100644 index 0000000000..bc566590ff --- /dev/null +++ b/Templates/MinimalProject/Template/ShaderLib/viewsrg.srgi @@ -0,0 +1,30 @@ +// {BEGIN_LICENSE} +/* +* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +* its licensors. +* +* For complete copyright and license terms please see the LICENSE at the root of this +* distribution (the "License"). All use of this software is governed by the License, +* or, if provided, by the license below or the license accompanying this file. Do not +* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* +*/ +// {END_LICENSE} + +#pragma once + +// Please read README.md for an explanation on why scenesrg.srgi and viewsrg.srgi are +// located in this folder (And how you can optionally customize your own scenesrg.srgi +// and viewsrg.srgi in your game project). + +#include + +partial ShaderResourceGroup ViewSrg : SRG_PerView +{ +/* Intentionally Empty. Helps define the SrgSemantic for ViewSrg once.*/ +}; + +#define AZ_COLLECTING_PARTIAL_SRGS +#include +#undef AZ_COLLECTING_PARTIAL_SRGS diff --git a/Templates/MinimalProject/Template/Shaders/CommonVS.azsli b/Templates/MinimalProject/Template/Shaders/CommonVS.azsli new file mode 100644 index 0000000000..fc557b9b06 --- /dev/null +++ b/Templates/MinimalProject/Template/Shaders/CommonVS.azsli @@ -0,0 +1,56 @@ +// {BEGIN_LICENSE} +/* +* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +* its licensors. +* +* For complete copyright and license terms please see the LICENSE at the root of this +* distribution (the "License"). All use of this software is governed by the License, +* or, if provided, by the license below or the license accompanying this file. Do not +* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* +*/ +// {END_LICENSE} + +#pragma once + +#include +#include +#include + +struct VertexInput +{ + float3 m_position : POSITION; + float3 m_normal : NORMAL; + float4 m_tangent : TANGENT; + float3 m_bitangent : BITANGENT; + float2 m_uv : UV0; +}; + +struct VertexOutput +{ + float4 m_position : SV_Position; + float3 m_normal : NORMAL; + float3 m_tangent : TANGENT; + float3 m_bitangent : BITANGENT; + float2 m_uv : UV0; + float3 m_view : VIEW; +}; + +VertexOutput CommonVS(VertexInput input) +{ + float4x4 objectToWorld = ObjectSrg::GetWorldMatrix(); + float3x3 objectToWorldIT = ObjectSrg::GetWorldMatrixInverseTranspose(); + + VertexOutput output; + float3 worldPosition = mul(objectToWorld, float4(input.m_position, 1)).xyz; + output.m_position = mul(ViewSrg::m_viewProjectionMatrix, float4(worldPosition, 1.0)); + + output.m_uv = input.m_uv; + + output.m_view = worldPosition - ViewSrg::m_worldPosition; + + ConstructTBN(input.m_normal, input.m_tangent, input.m_bitangent, objectToWorld, objectToWorldIT, output.m_normal, output.m_tangent, output.m_bitangent); + + return output; +} diff --git a/Templates/MinimalProject/Template/Shaders/ShaderResourceGroups/SceneSrg.azsli b/Templates/MinimalProject/Template/Shaders/ShaderResourceGroups/SceneSrg.azsli new file mode 100644 index 0000000000..4c962fbbcd --- /dev/null +++ b/Templates/MinimalProject/Template/Shaders/ShaderResourceGroups/SceneSrg.azsli @@ -0,0 +1,24 @@ +// {BEGIN_LICENSE} +/* +* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +* its licensors. +* +* For complete copyright and license terms please see the LICENSE at the root of this +* distribution (the "License"). All use of this software is governed by the License, +* or, if provided, by the license below or the license accompanying this file. Do not +* remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* +*/ +// {END_LICENSE} + +#ifndef AZ_COLLECTING_PARTIAL_SRGS +#error Do not include this file directly. Include the main .srgi file instead. +#endif + +partial ShaderResourceGroup SceneSrg +{ + float m_time; + float m_deltaTime; +} + diff --git a/Templates/MinimalProject/Template/autoexec.cfg b/Templates/MinimalProject/Template/autoexec.cfg new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Templates/MinimalProject/Template/game.cfg b/Templates/MinimalProject/Template/game.cfg new file mode 100644 index 0000000000..1da374a93b --- /dev/null +++ b/Templates/MinimalProject/Template/game.cfg @@ -0,0 +1,3 @@ +-- Enable warnings when asset loads take longer than the given millisecond threshold +cl_assetLoadWarningEnable=true +cl_assetLoadWarningMsThreshold=100 diff --git a/Templates/MinimalProject/Template/preview.png b/Templates/MinimalProject/Template/preview.png new file mode 100644 index 0000000000..a3e13481c9 --- /dev/null +++ b/Templates/MinimalProject/Template/preview.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a5881b8d6cfbc4ceefb14ab96844484fe19407ee030824768f9fcce2f729d35 +size 2949 diff --git a/Templates/MinimalProject/Template/project.json b/Templates/MinimalProject/Template/project.json new file mode 100644 index 0000000000..7f6b5d3b78 --- /dev/null +++ b/Templates/MinimalProject/Template/project.json @@ -0,0 +1,15 @@ +{ + "project_name": "${Name}", + "origin": "The primary repo for ${Name} goes here: i.e. http://www.mydomain.com", + "license": "What license ${Name} uses goes here: i.e. https://opensource.org/licenses/MIT", + "display_name": "${Name}", + "summary": "A short description of ${Name}.", + "canonical_tags": [ + "Project" + ], + "user_tags": [ + "${Name}" + ], + "icon_path": "preview.png", + "engine": "o3de" +} diff --git a/Templates/MinimalProject/template.json b/Templates/MinimalProject/template.json new file mode 100644 index 0000000000..88214b26fa --- /dev/null +++ b/Templates/MinimalProject/template.json @@ -0,0 +1,656 @@ +{ + "template_name": "MinimalProject", + "origin": "The primary repo for MinimalProject goes here: i.e. http://www.mydomain.com", + "license": "What license MinimalProject uses goes here: i.e. https://opensource.org/licenses/MIT", + "display_name": "MinimalProject", + "summary": "A short description of MinimalProject.", + "canonical_tags": [], + "user_tags": [ + "MinimalProject" + ], + "icon_path": "preview.png", + "copyFiles": [ + { + "file": ".gitignore", + "origin": ".gitignore", + "isTemplated": false, + "isOptional": false + }, + { + "file": "CMakeLists.txt", + "origin": "CMakeLists.txt", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/${NameLower}_files.cmake", + "origin": "Code/${NameLower}_files.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/${NameLower}_shared_files.cmake", + "origin": "Code/${NameLower}_shared_files.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/CMakeLists.txt", + "origin": "Code/CMakeLists.txt", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/Include/${Name}/${Name}Bus.h", + "origin": "Code/Include/${Name}/${Name}Bus.h", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/Platform/Android/${NameLower}_android_files.cmake", + "origin": "Code/Platform/Android/${NameLower}_android_files.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/Platform/Android/${NameLower}_shared_android_files.cmake", + "origin": "Code/Platform/Android/${NameLower}_shared_android_files.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/Platform/Android/PAL_android.cmake", + "origin": "Code/Platform/Android/PAL_android.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/Platform/Linux/${NameLower}_linux_files.cmake", + "origin": "Code/Platform/Linux/${NameLower}_linux_files.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/Platform/Linux/${NameLower}_shared_linux_files.cmake", + "origin": "Code/Platform/Linux/${NameLower}_shared_linux_files.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/Platform/Linux/PAL_linux.cmake", + "origin": "Code/Platform/Linux/PAL_linux.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/Platform/Mac/${NameLower}_mac_files.cmake", + "origin": "Code/Platform/Mac/${NameLower}_mac_files.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/Platform/Mac/${NameLower}_shared_mac_files.cmake", + "origin": "Code/Platform/Mac/${NameLower}_shared_mac_files.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/Platform/Mac/PAL_mac.cmake", + "origin": "Code/Platform/Mac/PAL_mac.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/Platform/Windows/${NameLower}_shared_windows_files.cmake", + "origin": "Code/Platform/Windows/${NameLower}_shared_windows_files.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/Platform/Windows/${NameLower}_windows_files.cmake", + "origin": "Code/Platform/Windows/${NameLower}_windows_files.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/Platform/Windows/PAL_windows.cmake", + "origin": "Code/Platform/Windows/PAL_windows.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/Platform/iOS/${NameLower}_ios_files.cmake", + "origin": "Code/Platform/iOS/${NameLower}_ios_files.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/Platform/iOS/${NameLower}_shared_ios_files.cmake", + "origin": "Code/Platform/iOS/${NameLower}_shared_ios_files.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/Platform/iOS/PAL_ios.cmake", + "origin": "Code/Platform/iOS/PAL_ios.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/Source/${Name}Module.cpp", + "origin": "Code/Source/${Name}Module.cpp", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/Source/${Name}SystemComponent.cpp", + "origin": "Code/Source/${Name}SystemComponent.cpp", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/Source/${Name}SystemComponent.h", + "origin": "Code/Source/${Name}SystemComponent.h", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/enabled_gems.cmake", + "origin": "Code/enabled_gems.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Code/gem.json", + "origin": "Code/gem.json", + "isTemplated": true, + "isOptional": true + }, + { + "file": "Config/shader_global_build_options.json", + "origin": "Config/shader_global_build_options.json", + "isTemplated": false, + "isOptional": false + }, + { + "file": "EngineFinder.cmake", + "origin": "EngineFinder.cmake", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Platform/Android/android_project.cmake", + "origin": "Platform/Android/android_project.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Platform/Android/android_project.json", + "origin": "Platform/Android/android_project.json", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Platform/Linux/linux_project.cmake", + "origin": "Platform/Linux/linux_project.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Platform/Linux/linux_project.json", + "origin": "Platform/Linux/linux_project.json", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Platform/Mac/mac_project.cmake", + "origin": "Platform/Mac/mac_project.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Platform/Mac/mac_project.json", + "origin": "Platform/Mac/mac_project.json", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Platform/Windows/windows_project.cmake", + "origin": "Platform/Windows/windows_project.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Platform/Windows/windows_project.json", + "origin": "Platform/Windows/windows_project.json", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Platform/iOS/ios_project.cmake", + "origin": "Platform/iOS/ios_project.cmake", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Platform/iOS/ios_project.json", + "origin": "Platform/iOS/ios_project.json", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Registry/assets_scan_folders.setreg", + "origin": "Registry/assets_scan_folders.setreg", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Resources/CryEngineLogoLauncher.bmp", + "origin": "Resources/CryEngineLogoLauncher.bmp", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/GameSDK.ico", + "origin": "Resources/GameSDK.ico", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/Mac/Images.xcassets/Contents.json", + "origin": "Resources/Platform/Mac/Images.xcassets/Contents.json", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/Contents.json", + "origin": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/Contents.json", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_128 _2x.png", + "origin": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_128 _2x.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_128.png", + "origin": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_128.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_16.png", + "origin": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_16.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_16_2x.png", + "origin": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_16_2x.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_256 _2x.png", + "origin": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_256 _2x.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_256.png", + "origin": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_256.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_32.png", + "origin": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_32.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_32_2x.png", + "origin": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_32_2x.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_512.png", + "origin": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_512.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_512_2x.png", + "origin": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset/icon_512_2x.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/Mac/Info.plist", + "origin": "Resources/Platform/Mac/Info.plist", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Images.xcassets/Contents.json", + "origin": "Resources/Platform/iOS/Images.xcassets/Contents.json", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/Contents.json", + "origin": "Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/Contents.json", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPadLaunchImage1024x768.png", + "origin": "Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPadLaunchImage1024x768.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPadLaunchImage1536x2048.png", + "origin": "Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPadLaunchImage1536x2048.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPadLaunchImage2048x1536.png", + "origin": "Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPadLaunchImage2048x1536.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPadLaunchImage768x1024.png", + "origin": "Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPadLaunchImage768x1024.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPhoneLaunchImage640x1136.png", + "origin": "Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPhoneLaunchImage640x1136.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPhoneLaunchImage640x960.png", + "origin": "Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage/iPhoneLaunchImage640x960.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/Contents.json", + "origin": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/Contents.json", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadAppIcon152x152.png", + "origin": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadAppIcon152x152.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadAppIcon76x76.png", + "origin": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadAppIcon76x76.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadProAppIcon167x167.png", + "origin": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadProAppIcon167x167.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadSettingsIcon29x29.png", + "origin": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadSettingsIcon29x29.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadSettingsIcon58x58.png", + "origin": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadSettingsIcon58x58.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadSpotlightIcon40x40.png", + "origin": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadSpotlightIcon40x40.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadSpotlightIcon80x80.png", + "origin": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPadSpotlightIcon80x80.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneAppIcon120x120.png", + "origin": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneAppIcon120x120.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneAppIcon180x180.png", + "origin": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneAppIcon180x180.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneSettingsIcon58x58.png", + "origin": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneSettingsIcon58x58.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneSettingsIcon87x87.png", + "origin": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneSettingsIcon87x87.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneSpotlightIcon120x120.png", + "origin": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneSpotlightIcon120x120.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneSpotlightIcon80x80.png", + "origin": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset/iPhoneSpotlightIcon80x80.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "Resources/Platform/iOS/Info.plist", + "origin": "Resources/Platform/iOS/Info.plist", + "isTemplated": true, + "isOptional": false + }, + { + "file": "ShaderLib/README.md", + "origin": "ShaderLib/README.md", + "isTemplated": false, + "isOptional": true + }, + { + "file": "ShaderLib/scenesrg.srgi", + "origin": "ShaderLib/scenesrg.srgi", + "isTemplated": true, + "isOptional": false + }, + { + "file": "ShaderLib/viewsrg.srgi", + "origin": "ShaderLib/viewsrg.srgi", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Shaders/CommonVS.azsli", + "origin": "Shaders/CommonVS.azsli", + "isTemplated": true, + "isOptional": false + }, + { + "file": "Shaders/ShaderResourceGroups/SceneSrg.azsli", + "origin": "Shaders/ShaderResourceGroups/SceneSrg.azsli", + "isTemplated": true, + "isOptional": false + }, + { + "file": "autoexec.cfg", + "origin": "autoexec.cfg", + "isTemplated": false, + "isOptional": false + }, + { + "file": "game.cfg", + "origin": "game.cfg", + "isTemplated": false, + "isOptional": false + }, + { + "file": "preview.png", + "origin": "preview.png", + "isTemplated": false, + "isOptional": false + }, + { + "file": "project.json", + "origin": "project.json", + "isTemplated": true, + "isOptional": false + } + ], + "createDirectories": [ + { + "dir": "Assets", + "origin": "Assets" + }, + { + "dir": "Code", + "origin": "Code" + }, + { + "dir": "Code/Include", + "origin": "Code/Include" + }, + { + "dir": "Code/Include/${Name}", + "origin": "Code/Include/${Name}" + }, + { + "dir": "Code/Platform", + "origin": "Code/Platform" + }, + { + "dir": "Code/Platform/Android", + "origin": "Code/Platform/Android" + }, + { + "dir": "Code/Platform/Linux", + "origin": "Code/Platform/Linux" + }, + { + "dir": "Code/Platform/Mac", + "origin": "Code/Platform/Mac" + }, + { + "dir": "Code/Platform/Windows", + "origin": "Code/Platform/Windows" + }, + { + "dir": "Code/Platform/iOS", + "origin": "Code/Platform/iOS" + }, + { + "dir": "Code/Source", + "origin": "Code/Source" + }, + { + "dir": "Config", + "origin": "Config" + }, + { + "dir": "Platform", + "origin": "Platform" + }, + { + "dir": "Platform/Android", + "origin": "Platform/Android" + }, + { + "dir": "Platform/Linux", + "origin": "Platform/Linux" + }, + { + "dir": "Platform/Mac", + "origin": "Platform/Mac" + }, + { + "dir": "Platform/Windows", + "origin": "Platform/Windows" + }, + { + "dir": "Platform/iOS", + "origin": "Platform/iOS" + }, + { + "dir": "Registry", + "origin": "Registry" + }, + { + "dir": "Resources", + "origin": "Resources" + }, + { + "dir": "Resources/Platform", + "origin": "Resources/Platform" + }, + { + "dir": "Resources/Platform/Mac", + "origin": "Resources/Platform/Mac" + }, + { + "dir": "Resources/Platform/Mac/Images.xcassets", + "origin": "Resources/Platform/Mac/Images.xcassets" + }, + { + "dir": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset", + "origin": "Resources/Platform/Mac/Images.xcassets/TestDPAppIcon.appiconset" + }, + { + "dir": "Resources/Platform/iOS", + "origin": "Resources/Platform/iOS" + }, + { + "dir": "Resources/Platform/iOS/Images.xcassets", + "origin": "Resources/Platform/iOS/Images.xcassets" + }, + { + "dir": "Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage", + "origin": "Resources/Platform/iOS/Images.xcassets/LaunchImage.launchimage" + }, + { + "dir": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset", + "origin": "Resources/Platform/iOS/Images.xcassets/TestDPAppIcon.appiconset" + }, + { + "dir": "ShaderLib", + "origin": "ShaderLib" + }, + { + "dir": "Shaders", + "origin": "Shaders" + }, + { + "dir": "Shaders/ShaderResourceGroups", + "origin": "Shaders/ShaderResourceGroups" + } + ] +} diff --git a/engine.json b/engine.json index 09bb3f5ff6..21ed239c1c 100644 --- a/engine.json +++ b/engine.json @@ -92,7 +92,9 @@ "AutomatedTesting" ], "templates": [ + "Templates/AssetGem", "Templates/DefaultGem", - "Templates/DefaultProject" + "Templates/DefaultProject", + "Templates/MinimalProject" ] } diff --git a/scripts/o3de/o3de/engine_template.py b/scripts/o3de/o3de/engine_template.py index 06e34cc449..384b8a3c0f 100755 --- a/scripts/o3de/o3de/engine_template.py +++ b/scripts/o3de/o3de/engine_template.py @@ -14,6 +14,7 @@ This file contains all the code that has to do with creating and instantiate eng import argparse import logging import os +import pathlib import shutil import sys import json @@ -79,7 +80,22 @@ restricted_platforms = { } template_file_name = 'template.json' -this_script_parent = os.path.dirname(os.path.realpath(__file__)) +this_script_parent = pathlib.Path(os.path.dirname(os.path.realpath(__file__))) + +def _replace_license_text(source_data: str): + while '{BEGIN_LICENSE}' in source_data: + start = source_data.find('{BEGIN_LICENSE}') + if start != -1: + line_start = source_data.rfind('\n', 0, start) + if line_start == -1: + line_start = 0 + end = source_data.find('{END_LICENSE}') + if end != -1: + end = source_data.find('\n', end) + if end != -1: + source_data = source_data[:line_start] + source_data[end + 1:] + return source_data + def _transform(s_data: str, replacements: list, @@ -92,7 +108,7 @@ def _transform(s_data: str, :return: the potentially transformed data """ # copy the s_data into t_data, then apply all transformations only on t_data - t_data = s_data + t_data = str(s_data) for replacement in replacements: t_data = t_data.replace(replacement[0], replacement[1]) @@ -100,30 +116,13 @@ def _transform(s_data: str, while '${Random_Uuid}' in t_data: t_data = t_data.replace('${Random_Uuid}', str(uuid.uuid4()), 1) - ################################################################## - # For some reason the re.sub call here gets into some kind of infinite - # loop and never returns on some files consistently. - # Until I figure out why we can use the string replacement method - # if not keep_license_text: - # t_data = re.sub(r"^(//|'''|#)\s*{BEGIN_LICENSE}((.|\n)*){END_LICENSE}\n", "", t_data, flags=re.DOTALL) - if not keep_license_text: - while '{BEGIN_LICENSE}' in t_data: - start = t_data.find('{BEGIN_LICENSE}') - if start != -1: - line_start = t_data.rfind('\n', 0, start) - if line_start == -1: - line_start = 0 - end = t_data.find('{END_LICENSE}') - end = t_data.find('\n', end) - if end != -1: - t_data = t_data[:line_start] + t_data[end + 1:] - ################################################################### + t_data = _replace_license_text(t_data) return t_data -def _transform_copy(source_file: str, - destination_file: str, +def _transform_copy(source_file: pathlib.Path, + destination_file: pathlib.Path, replacements: list, keep_license_text: bool = False) -> None: """ @@ -158,18 +157,18 @@ def _transform_copy(source_file: str, def _execute_template_json(json_data: dict, - destination_path: str, - template_path: str, + destination_path: pathlib.Path, + template_path: pathlib.Path, replacements: list, keep_license_text: bool = False) -> None: # create dirs first # for each createDirectory entry, transform the folder name for create_directory in json_data['createDirectories']: # construct the new folder name - new_dir = f"{destination_path}/{create_directory['dir']}" + new_dir = destination_path / create_directory['dir'] # transform the folder name - new_dir = _transform(new_dir, replacements, keep_license_text) + new_dir = _transform(new_dir.as_posix(), replacements, keep_license_text) # create the folder os.makedirs(new_dir, exist_ok=True) @@ -178,7 +177,7 @@ def _execute_template_json(json_data: dict, # regular copy if not templated for copy_file in json_data['copyFiles']: # construct the input file name - in_file = f"{template_path}/Template/{copy_file['file']}" + in_file = template_path / 'Template' /copy_file['file'] # the file can be marked as optional, if it is and it does not exist skip if copy_file['isOptional'] and copy_file['isOptional'] == 'true': @@ -186,10 +185,10 @@ def _execute_template_json(json_data: dict, continue # construct the output file name - out_file = f"{destination_path}/{copy_file['file']}" + out_file = destination_path / copy_file['file'] # transform the output file name - out_file = _transform(out_file, replacements, keep_license_text) + out_file = _transform(out_file.as_posix(), replacements, keep_license_text) # if for some reason the output folder for this file was not created above do it now os.makedirs(os.path.dirname(out_file), exist_ok=True) @@ -205,35 +204,35 @@ def _execute_restricted_template_json(json_data: dict, restricted_platform: str, destination_name, template_name, - destination_path: str, - destination_restricted_path: str, - template_restricted_path: str, - destination_restricted_platform_relative_path: str, - template_restricted_platform_relative_path: str, + destination_path: pathlib.Path, + destination_restricted_path: pathlib.Path, + template_restricted_path: pathlib.Path, + destination_restricted_platform_relative_path: pathlib.Path, + template_restricted_platform_relative_path: pathlib.Path, replacements: list, keep_restricted_in_instance: bool = False, keep_license_text: bool = False) -> None: # if we are not keeping restricted in instance make restricted.json if not present if not keep_restricted_in_instance: - restricted_json = f"{destination_restricted_path}/restricted.json".replace('//', '/') + restricted_json = destination_restricted_path / 'restricted.json' os.makedirs(os.path.dirname(restricted_json), exist_ok=True) if not os.path.isfile(restricted_json): with open(restricted_json, 'w') as s: restricted_json_data = {} restricted_json_data.update({"restricted_name": destination_name}) - s.write(json.dumps(restricted_json_data, indent=4)) + s.write(json.dumps(restricted_json_data, indent=4) + '\n') # create dirs first # for each createDirectory entry, transform the folder name for create_directory in json_data['createDirectories']: # construct the new folder name - new_dir = f"{destination_restricted_path}/{restricted_platform}/{destination_restricted_platform_relative_path}/{destination_name}/{create_directory['dir']}".replace( - '//', '/') + new_dir = destination_restricted_path / restricted_platform / destination_restricted_platform_relative_path\ + / destination_name / create_directory['dir'] if keep_restricted_in_instance: - new_dir = f"{destination_path}/{create_directory['origin']}".replace('//', '/') + new_dir = destination_path / create_directory['origin'] # transform the folder name - new_dir = _transform(new_dir, replacements, keep_license_text) + new_dir = _transform(new_dir.as_posix(), replacements, keep_license_text) # create the folder os.makedirs(new_dir, exist_ok=True) @@ -242,8 +241,8 @@ def _execute_restricted_template_json(json_data: dict, # regular copy if not templated for copy_file in json_data['copyFiles']: # construct the input file name - in_file = f"{template_restricted_path}/{restricted_platform}/{template_restricted_platform_relative_path}/{template_name}/Template/{copy_file['file']}".replace( - '//', '/') + in_file = template_restricted_path / restricted_platform / template_restricted_platform_relative_path\ + / template_name / 'Template'/ copy_file['file'] # the file can be marked as optional, if it is and it does not exist skip if copy_file['isOptional'] and copy_file['isOptional'] == 'true': @@ -251,13 +250,13 @@ def _execute_restricted_template_json(json_data: dict, continue # construct the output file name - out_file = f"{destination_restricted_path}/{restricted_platform}/{destination_restricted_platform_relative_path}/{destination_name}/{copy_file['file']}".replace( - '//', '/') + out_file = destination_restricted_path / restricted_platform / destination_restricted_platform_relative_path\ + / destination_name / copy_file['file'] if keep_restricted_in_instance: - out_file = f"{destination_path}/{copy_file['origin']}".replace('//', '/') + out_file = destination_path / copy_file['origin'] # transform the output file name - out_file = _transform(out_file, replacements, keep_license_text) + out_file = _transform(out_file.as_posix(), replacements, keep_license_text) # if for some reason the output folder for this file was not created above do it now os.makedirs(os.path.dirname(out_file), exist_ok=True) @@ -272,12 +271,12 @@ def _execute_restricted_template_json(json_data: dict, def _instantiate_template(template_json_data: dict, destination_name: str, template_name: str, - destination_path: str, - template_path: str, - destination_restricted_path: str, - template_restricted_path: str, - destination_restricted_platform_relative_path: str, - template_restricted_platform_relative_path: str, + destination_path: pathlib.Path, + template_path: pathlib.Path, + destination_restricted_path: pathlib.Path, + template_restricted_path: pathlib.Path, + destination_restricted_platform_relative_path: pathlib.Path, + template_restricted_platform_relative_path: pathlib.Path, replacements: list, keep_restricted_in_instance: bool = False, keep_license_text: bool = False) -> int: @@ -316,9 +315,9 @@ def _instantiate_template(template_json_data: dict, for restricted_platform in os.listdir(template_restricted_path): if os.path.isfile(restricted_platform): continue - template_restricted_platform = f'{template_restricted_path}/{restricted_platform}' - template_restricted_platform_path_rel = f'{template_restricted_platform}/{template_restricted_platform_relative_path}/{template_name}' - platform_json = f'{template_restricted_platform_path_rel}/{template_file_name}'.replace('//', '/') + template_restricted_platform = template_restricted_path / restricted_platform + template_restricted_platform_path_rel = template_restricted_platform / template_restricted_platform_relative_path / template_name + platform_json = template_restricted_platform_path_rel / template_file_name if os.path.isfile(platform_json): if not validation.valid_o3de_template_json(platform_json): @@ -349,17 +348,18 @@ def _instantiate_template(template_json_data: dict, return 0 -def create_template(source_path: str, - template_path: str, - source_restricted_path: str = None, +def create_template(source_path: pathlib.Path, + template_path: pathlib.Path, + source_restricted_path: pathlib.Path = None, source_restricted_name: str = None, - template_restricted_path: str = None, + template_restricted_path: pathlib.Path = None, template_restricted_name: str = None, - source_restricted_platform_relative_path: str = None, - template_restricted_platform_relative_path: str = None, + source_restricted_platform_relative_path: pathlib.Path = None, + template_restricted_platform_relative_path: pathlib.Path = None, keep_restricted_in_template: bool = False, keep_license_text: bool = False, - replace: list = None) -> int: + replace: list = None, + force: bool = False) -> int: """ Create a template from a source directory using replacement @@ -382,6 +382,7 @@ def create_template(source_path: str, Templated files can have license blocks starting with {BEGIN_LICENSE} and ending with {END_LICENSE}, this controls if you want to keep the license text from the template in the new instance. It is false by default because most people will not want license text in their instances. + :param force Overrides existing files even if they exist :return: 0 for success or non 0 failure code """ @@ -389,24 +390,23 @@ def create_template(source_path: str, if not source_path: logger.error('Src path cannot be empty.') return 1 - source_path = source_path.replace('\\', '/') if not os.path.isdir(source_path): logger.error(f'Src path {source_path} is not a folder.') return 1 # source_name is now the last component of the source_path source_name = os.path.basename(source_path) + sanitized_source_name = utils.sanitize_identifier_for_cpp(source_name) # if no template path, error if not template_path: logger.info(f'Template path empty. Using source name {source_name}') template_path = source_name - template_path = template_path.replace('\\', '/') if not os.path.isabs(template_path): default_templates_folder = manifest.get_registered(default_folder='templates') - template_path = f'{default_templates_folder}/{template_path}' + template_path = default_templates_folder/ template_path logger.info(f'Template path not a full path. Using default templates folder {template_path}') - if os.path.isdir(template_path): + if not force and os.path.isdir(template_path): logger.error(f'Template path {template_path} already exists.') return 1 @@ -423,9 +423,8 @@ def create_template(source_path: str, # source_restricted_path if source_restricted_path: - source_restricted_path = source_restricted_path.replace('\\', '/') if not os.path.isabs(source_restricted_path): - engine_json = f'{manifest.get_this_engine_path()}/engine.json' + engine_json = manifest.get_this_engine_path() / 'engine.json' if not validation.valid_o3de_engine_json(engine_json): logger.error(f"Engine json {engine_json} is not valid.") return 1 @@ -441,7 +440,7 @@ def create_template(source_path: str, logger.error(f"Engine json {engine_json} restricted not found.") return 1 engine_restricted_folder = manifest.get_registered(restricted_name=engine_restricted) - new_source_restricted_path = f'{engine_restricted_folder}/{source_restricted_path}' + new_source_restricted_path = engine_restricted_folder / source_restricted_path logger.info(f'Source restricted path {source_restricted_path} not a full path. We must assume this engines' f' restricted folder {new_source_restricted_path}') if not os.path.isdir(source_restricted_path): @@ -456,10 +455,9 @@ def create_template(source_path: str, # template_restricted_path if template_restricted_path: - template_restricted_path = template_restricted_path.replace('\\', '/') if not os.path.isabs(template_restricted_path): default_templates_restricted_folder = manifest.get_registered(restricted_name='templates') - new_template_restricted_path = f'{default_templates_restricted_folder}/{template_restricted_path}' + new_template_restricted_path = default_templates_restricted_folder / template_restricted_path logger.info(f'Template restricted path {template_restricted_path} not a full path. We must assume the' f' default templates restricted folder {new_template_restricted_path}') template_restricted_path = new_template_restricted_path @@ -467,7 +465,7 @@ def create_template(source_path: str, if os.path.isdir(template_restricted_path): # see if this is already a restricted path, if it is get the "restricted_name" from the restricted json # so we can set "restricted_name" to it for this template - restricted_json = f'{template_restricted_path}/restricted.json' + restricted_json = template_restricted_path / 'restricted.json' if os.path.isfile(restricted_json): if not validation.valid_o3de_restricted_json(restricted_json): logger.error(f'{restricted_json} is not valid.') @@ -484,18 +482,14 @@ def create_template(source_path: str, logger.error(f'Failed to read restricted_name from {restricted_json}') return 1 else: - os.makedirs(template_restricted_path) + os.makedirs(template_restricted_path, exist_ok=True) # source restricted relative - if source_restricted_platform_relative_path: - source_restricted_platform_relative_path = source_restricted_platform_relative_path.replace('\\', '/') - else: + if not source_restricted_platform_relative_path: source_restricted_platform_relative_path = '' # template restricted relative - if template_restricted_platform_relative_path: - template_restricted_platform_relative_path = template_restricted_platform_relative_path.replace('\\', '/') - else: + if not template_restricted_platform_relative_path: template_restricted_platform_relative_path = '' logger.info(f'Processing Src: {source_path}') @@ -513,8 +507,9 @@ def create_template(source_path: str, replacements.append((source_name.lower(), '${NameLower}')) replacements.append((source_name.upper(), '${NameUpper}')) replacements.append((source_name, '${Name}')) + replacements.append((sanitized_source_name, '${SanitizedCppName}')) - def _transform_into_template(s_data: object) -> (bool, object): + def _transform_into_template(s_data: object) -> (bool, str): """ Internal function to transform any data into templated data :param s_data: the input data, this could be file data or file name data @@ -522,18 +517,18 @@ def create_template(source_path: str, t_data: potentially transformed data 0 for success or non 0 failure code """ # copy the src data to the transformed data, then operate only on transformed data - t_data = s_data + t_data = str(s_data) # run all the replacements for replacement in replacements: t_data = t_data.replace(replacement[0], replacement[1]) if not keep_license_text: - t_data = re.sub(r"(//|'''|#)\s*{BEGIN_LICENSE}((.|\n)*){END_LICENSE}\n", "", t_data, flags=re.DOTALL) + t_data = _replace_license_text(t_data) # See if this file has the ModuleClassId try: - pattern = r'.*AZ_RTTI\(\$\{Name\}Module, \"(?P\{.*-.*-.*-.*-.*\})\", AZ::Module' + pattern = r'.*AZ_RTTI\(\$\{SanitizedCppName\}Module, \"(?P\{.*-.*-.*-.*-.*\})\",' module_class_id = re.search(pattern, t_data).group('ModuleClassId') replacements.append((module_class_id, '${ModuleClassId}')) t_data = t_data.replace(module_class_id, '${ModuleClassId}') @@ -542,7 +537,7 @@ def create_template(source_path: str, # See if this file has the SysCompClassId try: - pattern = r'.*AZ_COMPONENT\(\$\{Name\}SystemComponent, \"(?P\{.*-.*-.*-.*-.*\})\"' + pattern = r'.*AZ_COMPONENT\(\$\{SanitizedCppName\}SystemComponent, \"(?P\{.*-.*-.*-.*-.*\})\"' sys_comp_class_id = re.search(pattern, t_data).group('SysCompClassId') replacements.append((sys_comp_class_id, '${SysCompClassId}')) t_data = t_data.replace(sys_comp_class_id, '${SysCompClassId}') @@ -551,7 +546,7 @@ def create_template(source_path: str, # See if this file has the EditorSysCompClassId try: - pattern = r'.*AZ_COMPONENT\(\$\{Name\}EditorSystemComponent, \"(?P\{.*-.*-.*-.*-.*\})\"' + pattern = r'.*AZ_COMPONENT\(\$\{SanitizedCppName\}EditorSystemComponent, \"(?P\{.*-.*-.*-.*-.*\})\"' editor_sys_comp_class_id = re.search(pattern, t_data).group('EditorSysCompClassId') replacements.append((editor_sys_comp_class_id, '${EditorSysCompClassId}')) t_data = t_data.replace(editor_sys_comp_class_id, '${EditorSysCompClassId}') @@ -595,10 +590,10 @@ def create_template(source_path: str, else: return False, t_data - def _transform_restricted_into_copyfiles_and_createdirs(source_path: str, + def _transform_restricted_into_copyfiles_and_createdirs(source_path: pathlib.Path, restricted_platform: str, - root_abs: str, - path_abs: str = None) -> None: + root_abs: pathlib.Path, + path_abs: pathlib.Path = None) -> None: """ Internal function recursively called to transform any paths files into copyfiles and create dirs relative to the root. This will transform and copy the files, and save the copyfiles and createdirs data, no not save it @@ -613,10 +608,13 @@ def create_template(source_path: str, for entry in entries: # create the absolute entry by joining the path_abs and the entry - entry_abs = f'{path_abs}/{entry}' + entry_abs = path_abs / entry # create the relative entry by removing the root_abs - entry_rel = entry_abs.replace(root_abs + '/', '') + try: + entry_rel = entry_abs.relative_to(root_abs) + except ValueError as err: + logger.warning(f'Unable to create relative path: {str(err)}') # report what file we are processing so we have a good idea if it breaks on what file it broke on logger.info(f'Processing file: {entry_abs}') @@ -628,8 +626,8 @@ def create_template(source_path: str, # C:/repo/Lumberyard/restricted/Jasper/TestDP/CMakeLists.txt -> # C:/repo/Lumberyard/TestDP/Platform/Jasper/CMakeLists.txt # - _, origin_entry_rel = _transform_into_template(entry_rel) - components = origin_entry_rel.split('/') + _, origin_entry_rel = _transform_into_template(entry_rel.as_posix()) + components = list(origin_entry_rel.parts) num_components = len(components) # see how far along the source path the restricted folder matches @@ -656,29 +654,24 @@ def create_template(source_path: str, after.append(components[num_components - 1]) before.append("Platform") - warn_if_not_platform = f'{source_path}/{"/".join(before)}' + warn_if_not_platform = source_path / pathlib.Path(*before) before.append(restricted_platform) before.extend(after) - origin_entry_rel = '/'.join(before) + origin_entry_rel = pathlib.Path(*before) if not os.path.isdir(warn_if_not_platform): logger.warning( f'{entry_abs} -> {origin_entry_rel}: Other Platforms not found in {warn_if_not_platform}') destination_entry_rel = origin_entry_rel - destination_entry_abs = f'{template_path}/Template/{origin_entry_rel}' - - # clean up any collapsed folders - origin_entry_rel = origin_entry_rel.replace('//', '/') - destination_entry_abs = destination_entry_abs.replace('//', '/') - destination_entry_rel = destination_entry_rel.replace('//', '/') + destination_entry_abs = template_path / 'Template' / origin_entry_rel # clean up any relative leading slashes - while origin_entry_rel.startswith('/'): - origin_entry_rel = origin_entry_rel[1:] - while destination_entry_rel.startswith('/'): - destination_entry_rel = destination_entry_rel[1:] + if origin_entry_rel.as_posix().startswith('/'): + origin_entry_rel = pathlib.Path(origin_entry_rel.as_posix().lstrip('/')) + if destination_entry_rel.as_posix().startswith('/'): + destination_entry_rel = pathlib.Path(destination_entry_rel.as_posix().lstrip('/')) # make sure the dst folder may or may not exist yet, make sure it does exist before we transform # data into it @@ -735,8 +728,8 @@ def create_template(source_path: str, _transform_restricted_into_copyfiles_and_createdirs(source_path, restricted_platform, root_abs, entry_abs) - def _transform_dir_into_copyfiles_and_createdirs(root_abs: str, - path_abs: str = None) -> None: + def _transform_dir_into_copyfiles_and_createdirs(root_abs: pathlib.Path, + path_abs: pathlib.Path = None) -> None: """ Internal function recursively called to transform any paths files into copyfiles and create dirs relative to the root. This will transform and copy the files, and save the copyfiles and createdirs data, no not save it @@ -751,10 +744,14 @@ def create_template(source_path: str, for entry in entries: # create the absolute entry by joining the path_abs and the entry - entry_abs = f'{path_abs}/{entry}' + entry_abs = path_abs / entry # create the relative entry by removing the root_abs - entry_rel = entry_abs.replace(root_abs + '/', '') + entry_rel = entry_abs + try: + entry_rel = entry_abs.relative_to(root_abs) + except ValueError as err: + logger.warning(f'Unable to create relative path: {str(err)}') # report what file we are processing so we have a good idea if it breaks on what file it broke on logger.info(f'Processing file: {entry_abs}') @@ -763,7 +760,7 @@ def create_template(source_path: str, # then at the end we can save the restricted ones separately found_platform = '' platform = False - if not keep_restricted_in_template and '/Platform' in entry_abs: + if not keep_restricted_in_template and 'Platform' in entry_abs.parts: platform = True try: # the name of the Platform should follow the '/Platform/' @@ -787,7 +784,7 @@ def create_template(source_path: str, # Now if we found a platform and still have a found_platform which is a restricted platform # then transform the entry relative name into a dst relative entry name and dst abs entry. # if not then create a normal relative and abs dst entry name - _, origin_entry_rel = _transform_into_template(entry_rel) + _, origin_entry_rel = _transform_into_template(entry_rel.as_posix()) if platform and found_platform in restricted_platforms: # if we don't have a template restricted path and we found restricted files... warn and skip # the file/dir @@ -795,21 +792,22 @@ def create_template(source_path: str, logger.warning("Restricted platform files found!!! {entry_rel}, {found_platform}") continue _, destination_entry_rel = _transform_into_template_restricted_filename(entry_rel, found_platform) - destination_entry_abs = f'{template_restricted_path}/{found_platform}/{template_restricted_platform_relative_path}/{template_name}/Template/{destination_entry_rel}' + destination_entry_abs = template_restricted_path / found_platform\ + / template_restricted_platform_relative_path / template_name / 'Template'\ + / destination_entry_rel else: destination_entry_rel = origin_entry_rel - destination_entry_abs = f'{template_path}/Template/{destination_entry_rel}' - - # clean up any collapsed folders - origin_entry_rel = origin_entry_rel.replace('//', '/') - destination_entry_abs = destination_entry_abs.replace('//', '/') - destination_entry_rel = destination_entry_rel.replace('//', '/') + destination_entry_abs = template_path / 'Template' / destination_entry_rel # clean up any relative leading slashes - while origin_entry_rel.startswith('/'): - origin_entry_rel = origin_entry_rel[1:] - while destination_entry_rel.startswith('/'): - destination_entry_rel = destination_entry_rel[1:] + if isinstance(origin_entry_rel, pathlib.Path): + origin_entry_rel = origin_entry_rel.as_posix() + if origin_entry_rel.startswith('/'): + origin_entry_rel = pathlib.Path(origin_entry_rel.lstrip('/')) + if isinstance(destination_entry_rel, pathlib.Path): + destination_entry_rel = destination_entry_rel.as_posix() + if destination_entry_rel.startswith('/'): + destination_entry_rel = pathlib.Path(destination_entry_rel.lstrip('/')) # make sure the dst folder may or may not exist yet, make sure it does exist before we transform # data into it @@ -905,8 +903,8 @@ def create_template(source_path: str, # run the transformation on each src restricted folder if source_restricted_path: for restricted_platform in os.listdir(source_restricted_path): - restricted_platform_src_path_abs = f'{source_restricted_path}/{restricted_platform}/{source_restricted_platform_relative_path}/{source_name}'.replace( - '//', '/') + restricted_platform_src_path_abs = source_restricted_path / restricted_platform\ + / source_restricted_platform_relative_path / source_name if os.path.isdir(restricted_platform_src_path_abs): _transform_restricted_into_copyfiles_and_createdirs(source_path, restricted_platform, restricted_platform_src_path_abs) @@ -934,17 +932,14 @@ def create_template(source_path: str, json_data.update({'copyFiles': copy_files}) json_data.update({'createDirectories': create_dirs}) - json_name = f'{template_path}/{template_file_name}' + json_name = template_path / template_file_name - # if the json file we are about to write already exists for some reason, delete it - if os.path.isfile(json_name): - os.unlink(json_name) - with open(json_name, 'w') as s: - s.write(json.dumps(json_data, indent=4)) + with json_name.open('w') as s: + s.write(json.dumps(json_data, indent=4) + '\n') # copy the default preview.png - preview_png_src = f'{this_script_parent}/resources/preview.png' - preview_png_dst = f'{template_path}/Template/preview.png' + preview_png_src = this_script_parent / 'resources' /' preview.png' + preview_png_dst = template_path / 'Template' / 'preview.png' if not os.path.isfile(preview_png_dst): shutil.copy(preview_png_src, preview_png_dst) @@ -955,8 +950,8 @@ def create_template(source_path: str, if template_restricted_path: # now write out each restricted platform template json separately for restricted_platform in restricted_platform_entries: - restricted_template_path = f'{template_restricted_path}/{restricted_platform}/{template_restricted_platform_relative_path}/{template_name}'.replace( - '//', '/') + restricted_template_path = template_restricted_path / restricted_platform\ + / template_restricted_platform_relative_path / template_name # sort restricted_platform_entries[restricted_platform]['copyFiles'].sort(key=lambda x: x['file']) @@ -976,34 +971,32 @@ def create_template(source_path: str, json_data.update({'copyFiles': restricted_platform_entries[restricted_platform]['copyFiles']}) json_data.update({'createDirectories': restricted_platform_entries[restricted_platform]['createDirs']}) - json_name = f'{restricted_template_path}/{template_file_name}' + json_name = restricted_template_path / template_file_name os.makedirs(os.path.dirname(json_name), exist_ok=True) - # if the json file we are about to write already exists for some reason, delete it - if os.path.isfile(json_name): - os.unlink(json_name) - with open(json_name, 'w') as s: - s.write(json.dumps(json_data, indent=4)) + with json_name.open('w') as s: + s.write(json.dumps(json_data, indent=4) + '\n') - preview_png_dst = f'{restricted_template_path}/Template/preview.png' + preview_png_dst = restricted_template_path / 'Template' /' preview.png' if not os.path.isfile(preview_png_dst): shutil.copy(preview_png_src, preview_png_dst) return 0 -def create_from_template(destination_path: str, - template_path: str = None, +def create_from_template(destination_path: pathlib.Path, + template_path: pathlib.Path = None, template_name: str = None, - destination_restricted_path: str = None, + destination_restricted_path: pathlib.Path = None, destination_restricted_name: str = None, - template_restricted_path: str = None, + template_restricted_path: pathlib.Path = None, template_restricted_name: str = None, - destination_restricted_platform_relative_path: str = None, - template_restricted_platform_relative_path: str = None, + destination_restricted_platform_relative_path: pathlib.Path = None, + template_restricted_platform_relative_path: pathlib.Path = None, keep_restricted_in_instance: bool = False, keep_license_text: bool = False, - replace: list = None) -> int: + replace: list = None, + force: bool = False) -> int: """ Generic template instantiation for non o3de object templates. This function makes NO assumptions! Assumptions are made only for specializations like create_project or create_gem etc... So this function @@ -1026,6 +1019,7 @@ def create_from_template(destination_path: str, :param replace: optional list of strings uses to make concrete names out of templated parameters. X->Y pairs Ex. ${Name},TestGem,${Player},TestGemPlayer This will cause all references to ${Name} be replaced by TestGem, and all ${Player} replaced by 'TestGemPlayer' + :param force Overrides existing files even if they exist :return: 0 for success or non 0 failure code """ if template_name and template_path: @@ -1057,7 +1051,7 @@ def create_from_template(destination_path: str, template_folder_name = os.path.basename(template_path) # the template.json should be in the template_path, make sure it's there a nd valid - template_json = f'{template_path}/template.json' + template_json = template_path / 'template.json' if not validation.valid_o3de_template_json(template_json): logger.error(f'Template json {template_path} is invalid.') return 1 @@ -1116,7 +1110,6 @@ def create_from_template(destination_path: str, # The user has supplied the --template-restricted-path, see if that matches the template specifies. # If it does then we do not have a problem. If it doesn't match then error out. If not specified # in the template then warn and use the --template-restricted-path - template_restricted_path = template_restricted_path.replace('\\', '/') try: template_json_restricted_name = template_json_data['restricted_name'] except KeyError as e: @@ -1148,11 +1141,9 @@ def create_from_template(destination_path: str, # If not supplied and not in the template set empty string. if template_restricted_platform_relative_path: # The user specified a --template-restricted-platform-relative-path - template_restricted_platform_relative_path = template_restricted_platform_relative_path.replace( - '\\', '/') try: - template_json_restricted_platform_relative_path = template_json_data[ - 'restricted_platform_relative_path'] + template_json_restricted_platform_relative_path = pathlib.Path( + template_json_data['restricted_platform_relative_path']) except KeyError as e: # the template json doesn't have a 'restricted_platform_relative_path' element warn and use it logger.info(f'The template does not specify a "restricted_platform_relative_path".' @@ -1161,19 +1152,20 @@ def create_from_template(destination_path: str, # the template has a 'restricted_platform_relative_path', if it matches we are fine, if not # something is wrong with either the --template-restricted-platform-relative or the template is. if template_restricted_platform_relative_path != template_json_restricted_platform_relative_path: - logger.error(f'The supplied --template-restricted-platform-relative-path does not match the' - f' templates "restricted_platform_relative_path". Either' - f' --template-restricted-platform-relative-path is incorrect or the templates' - f' "restricted_platform_relative_path" is wrong. Note that since this template' - f' specifies "restricted_platform_relative_path" it need not be supplied and' - f' {template_json_restricted_platform_relative_path} will be used.') + logger.error(f'The supplied --template-restricted-platform-relative-path' + f' "{template_restricted_platform_relative_path}" does not match the' + f' templates.json "restricted_platform_relative_path". Either' + f' --template-restricted-platform-relative-path is incorrect or the templates' + f' "restricted_platform_relative_path" is wrong. Note that since this template' + f' specifies "restricted_platform_relative_path" it need not be supplied and' + f' "{template_json_restricted_platform_relative_path}" will be used.') return 1 else: # The user has not supplied --template-restricted-platform-relative-path, try to read it from # the template json. try: - template_restricted_platform_relative_path = template_json_data[ - 'restricted_platform_relative_path'] + template_restricted_platform_relative_path = pathlib.Path( + template_json_data['restricted_platform_relative_path']) except KeyError as e: # The template json doesn't have a 'restricted_platform_relative_path' element, set empty string. template_restricted_platform_relative_path = '' @@ -1185,12 +1177,11 @@ def create_from_template(destination_path: str, if not destination_path: logger.error('Destination path cannot be empty.') return 1 - destination_path = destination_path.replace('\\', '/') - if os.path.isdir(destination_path): + if not force and os.path.isdir(destination_path): logger.error(f'Destination path {destination_path} already exists.') return 1 else: - os.makedirs(destination_path) + os.makedirs(destination_path, exist_ok=force) # destination name is now the last component of the destination_path destination_name = os.path.basename(destination_path) @@ -1206,23 +1197,20 @@ def create_from_template(destination_path: str, # destination restricted path elif destination_restricted_path: - destination_restricted_path = destination_restricted_path.replace('\\', '/') if os.path.isabs(destination_restricted_path): restricted_default_path = manifest.get_registered(default='restricted') - new_destination_restricted_path = f'{restricted_default_path}/{destination_restricted_path}' + new_destination_restricted_path = restricted_default_path / destination_restricted_path logger.info(f'{destination_restricted_path} is not a full path, making it relative' f' to default restricted path = {new_destination_restricted_path}') destination_restricted_path = new_destination_restricted_path elif template_restricted_path: - restricted_default_path = manifest.get_registered(default='restricted') + restricted_default_path = manifest.get_registered(restricted_name='restricted') logger.info(f'--destination-restricted-path is not specified, using default restricted path / destination name' f' = {restricted_default_path}') destination_restricted_path = restricted_default_path # destination restricted relative - if destination_restricted_platform_relative_path: - destination_restricted_platform_relative_path = destination_restricted_platform_relative_path.replace('\\', '/') - else: + if not destination_restricted_platform_relative_path: destination_restricted_platform_relative_path = '' # any user supplied replacements @@ -1265,34 +1253,35 @@ def create_from_template(destination_path: str, os.makedirs(destination_restricted_path, exist_ok=True) # read the restricted_name from the destination restricted.json - restricted_json = f"{destination_restricted_path}/restricted.json".replace('//', '/') + restricted_json = destination_restricted_path / restricted.json if not os.path.isfile(restricted_json): with open(restricted_json, 'w') as s: restricted_json_data = {} restricted_json_data.update({'restricted_name': destination_name}) - s.write(json.dumps(restricted_json_data, indent=4)) + s.write(json.dumps(restricted_json_data, indent=4) + '\n') logger.warning(f'Instantiation successful. NOTE: This is a generic instantiation of the template. If this' - f' was a template of an o3de object like a project, gem, template, etc. then you should have used' - f' specialization that knows how to link that object type via its project.json or gem.json, etc.' + f' was a template of an o3de object like a project, gem, template, etc. then the create-project' + f' or create-gem command can be used to register the object type via its project.json or gem.json, etc.' f' Create from template is meant only to instance a template of a non o3de object.') return 0 -def create_project(project_path: str, +def create_project(project_path: pathlib.Path, project_name: str = None, - template_path: str = None, + template_path: pathlib.Path = None, template_name: str = None, - project_restricted_path: str = None, + project_restricted_path: pathlib.Path = None, project_restricted_name: str = None, - template_restricted_path: str = None, + template_restricted_path: pathlib.Path = None, template_restricted_name: str = None, - project_restricted_platform_relative_path: str = None, - template_restricted_platform_relative_path: str = None, + project_restricted_platform_relative_path: pathlib.Path = None, + template_restricted_platform_relative_path: pathlib.Path = None, keep_restricted_in_project: bool = False, keep_license_text: bool = False, replace: list = None, + force: bool = False, system_component_class_id: str = None, editor_system_component_class_id: str = None, module_id: str = None) -> int: @@ -1318,6 +1307,7 @@ def create_project(project_path: str, :param replace: optional list of strings uses to make concrete names out of templated parameters. X->Y pairs Ex. ${Name},TestGem,${Player},TestGemPlayer This will cause all references to ${Name} be replaced by TestGem, and all ${Player} replaced by 'TestGemPlayer' + :param force Overrides existing files even if they exist :param system_component_class_id: optionally specify a uuid for the system component class, default is random uuid :param editor_system_component_class_id: optionally specify a uuid for the editor system component class, default is random uuid @@ -1354,7 +1344,7 @@ def create_project(project_path: str, template_folder_name = os.path.basename(template_path) # the template.json should be in the template_path, make sure it's there and valid - template_json = f'{template_path}/template.json' + template_json = template_path / 'template.json' if not validation.valid_o3de_template_json(template_json): logger.error(f'Template json {template_path} is not valid.') return 1 @@ -1413,7 +1403,6 @@ def create_project(project_path: str, # The user has supplied the --template-restricted-path, see if that matches the template specifies. # If it does then we do not have a problem. If it doesn't match then error out. If not specified # in the template then warn and use the --template-restricted-path - template_restricted_path = template_restricted_path.replace('\\', '/') try: template_json_restricted_name = template_json_data['restricted_name'] except KeyError as e: @@ -1445,10 +1434,9 @@ def create_project(project_path: str, # If not supplied and not in the template set empty string. if template_restricted_platform_relative_path: # The user specified a --template-restricted-platform-relative-path - template_restricted_platform_relative_path = template_restricted_platform_relative_path.replace('\\', '/') try: - template_json_restricted_platform_relative_path = template_json_data[ - 'restricted_platform_relative_path'] + template_json_restricted_platform_relative_path = pathlib.Path( + template_json_data['restricted_platform_relative_path']) except KeyError as e: # the template json doesn't have a 'restricted_platform_relative_path' element warn and use it logger.info(f'The template does not specify a "restricted_platform_relative_path".' @@ -1457,19 +1445,20 @@ def create_project(project_path: str, # the template has a 'restricted_platform_relative_path', if it matches we are fine, if not # something is wrong with either the --template-restricted-platform-relative or the template is. if template_restricted_platform_relative_path != template_json_restricted_platform_relative_path: - logger.error(f'The supplied --template-restricted-platform-relative-path does not match the' - f' templates "restricted_platform_relative_path". Either' + logger.error(f'The supplied --template-restricted-platform-relative-path' + f' "{template_restricted_platform_relative_path}" does not match the' + f' templates.json "restricted_platform_relative_path". Either' f' --template-restricted-platform-relative-path is incorrect or the templates' f' "restricted_platform_relative_path" is wrong. Note that since this template' f' specifies "restricted_platform_relative_path" it need not be supplied and' - f' {template_json_restricted_platform_relative_path} will be used.') + f' "{template_json_restricted_platform_relative_path}" will be used.') return 1 else: # The user has not supplied --template-restricted-platform-relative-path, try to read it from # the template json. try: - template_restricted_platform_relative_path = template_json_data[ - 'restricted_platform_relative_path'] + template_restricted_platform_relative_path = pathlib.Path( + template_json_data['restricted_platform_relative_path']) except KeyError as e: # The template json doesn't have a 'restricted_platform_relative_path' element, set empty string. template_restricted_platform_relative_path = '' @@ -1480,18 +1469,17 @@ def create_project(project_path: str, if not project_path: logger.error('Project path cannot be empty.') return 1 - project_path = project_path.replace('\\', '/') if not os.path.isabs(project_path): default_projects_folder = manifest.get_registered(default_folder='projects') - new_project_path = f'{default_projects_folder}/{project_path}' + new_project_path = default_projects_folder / project_path logger.info(f'Project Path {project_path} is not a full path, we must assume its relative' f' to default projects path = {new_project_path}') project_path = new_project_path - if os.path.isdir(project_path) and len(os.listdir(project_path)) > 0: + if not force and os.path.isdir(project_path) and len(os.listdir(project_path)) > 0: logger.error(f'Project path {project_path} already exists and is not empty.') return 1 elif not os.path.isdir(project_path): - os.makedirs(project_path) + os.makedirs(project_path, exist_ok=force) if not project_name: # project name is now the last component of the project_path @@ -1512,10 +1500,9 @@ def create_project(project_path: str, # project restricted path elif project_restricted_path: - project_restricted_path = project_restricted_path.replace('\\', '/') if not os.path.isabs(project_restricted_path): default_projects_restricted_folder = manifest.get_registered(restricted_name='projects') - new_project_restricted_path = f'{default_projects_restricted_folder}/{project_restricted_path}' + new_project_restricted_path = default_projects_restricted_folder/ project_restricted_path logger.info(f'Project restricted path {project_restricted_path} is not a full path, we must assume its' f' relative to default projects restricted path = {new_project_restricted_path}') project_restricted_path = new_project_restricted_path @@ -1526,9 +1513,7 @@ def create_project(project_path: str, project_restricted_path = project_restricted_default_path # project restricted relative path - if project_restricted_platform_relative_path: - project_restricted_platform_relative_path = project_restricted_platform_relative_path.replace('\\', '/') - else: + if not project_restricted_platform_relative_path: project_restricted_platform_relative_path = '' # any user supplied replacements @@ -1597,7 +1582,7 @@ def create_project(project_path: str, os.makedirs(project_restricted_path, exist_ok=True) # read the restricted_name from the projects restricted.json - restricted_json = f"{project_restricted_path}/restricted.json".replace('//', '/') + restricted_json = project_restricted_path / 'restricted.json' if os.path.isfile(restricted_json): if not validation.valid_o3de_restricted_json(restricted_json): logger.error(f'Restricted json {restricted_json} is not valid.') @@ -1606,7 +1591,7 @@ def create_project(project_path: str, with open(restricted_json, 'w') as s: restricted_json_data = {} restricted_json_data.update({'restricted_name': project_name}) - s.write(json.dumps(restricted_json_data, indent=4)) + s.write(json.dumps(restricted_json_data, indent=4) + '\n') with open(restricted_json, 'r') as s: try: @@ -1622,7 +1607,7 @@ def create_project(project_path: str, return 1 # set the "restricted_name": "restricted_name" element of the project.json - project_json = f"{project_path}/project.json".replace('//', '/') + project_json = project_path / 'project.json' if not validation.valid_o3de_project_json(project_json): logger.error(f'Project json {project_json} is not valid.') return 1 @@ -1638,15 +1623,15 @@ def create_project(project_path: str, os.unlink(project_json) with open(project_json, 'w') as s: try: - s.write(json.dumps(project_json_data, indent=4)) + s.write(json.dumps(project_json_data, indent=4) + '\n') except OSError as e: logger.error(f'Failed to write project json {project_json}.') return 1 for restricted_platform in restricted_platforms: - restricted_project = f'{project_restricted_path}/{restricted_platform}/{project_name}' + restricted_project = project_restricted_path / restricted_platform / project_name os.makedirs(restricted_project, exist_ok=True) - cmakelists_file_name = f'{restricted_project}/CMakeLists.txt' + cmakelists_file_name = restricted_project/ 'CMakeLists.txt' if not os.path.isfile(cmakelists_file_name): with open(cmakelists_file_name, 'w') as d: if keep_license_text: @@ -1675,10 +1660,14 @@ def create_project(project_path: str, return 1 project_json_data = manifest.get_project_json_data(project_path=project_path) + if not project_json_data: + # get_project_json_data already logs an error if the project.json is mising + return 1 + project_json_data.update({"engine": engine_name}) with open(project_json, 'w') as s: try: - s.write(json.dumps(project_json_data, indent=4)) + s.write(json.dumps(project_json_data, indent=4) + '\n') except OSError as e: logger.error(f'Failed to write project json at {project_path}.') return 1 @@ -1686,18 +1675,19 @@ def create_project(project_path: str, return 0 -def create_gem(gem_path: str, - template_path: str = None, +def create_gem(gem_path: pathlib.Path, + template_path: pathlib.Path = None, template_name: str = None, - gem_restricted_path: str = None, + gem_restricted_path: pathlib.Path = None, gem_restricted_name: str = None, - template_restricted_path: str = None, + template_restricted_path: pathlib.Path = None, template_restricted_name: str = None, - gem_restricted_platform_relative_path: str = None, - template_restricted_platform_relative_path: str = None, + gem_restricted_platform_relative_path: pathlib.Path = None, + template_restricted_platform_relative_path: pathlib.Path = None, keep_restricted_in_gem: bool = False, keep_license_text: bool = False, replace: list = None, + force: bool = False, system_component_class_id: str = None, editor_system_component_class_id: str = None, module_id: str = None) -> int: @@ -1722,6 +1712,7 @@ def create_gem(gem_path: str, :param replace: optional list of strings uses to make concrete names out of templated parameters. X->Y pairs Ex. ${Name},TestGem,${Player},TestGemPlayer This will cause all references to ${Name} be replaced by TestGem, and all ${Player} replaced by 'TestGemPlayer' + :param force Overrides existing files even if they exist :param system_component_class_id: optionally specify a uuid for the system component class, default is random uuid :param editor_system_component_class_id: optionally specify a uuid for the editor system component class, default is random uuid @@ -1754,7 +1745,7 @@ def create_gem(gem_path: str, template_folder_name = os.path.basename(template_path) # the template.json should be in the template_path, make sure it's there and valid - template_json = f'{template_path}/template.json' + template_json = template_path / 'template.json' if not validation.valid_o3de_template_json(template_json): logger.error(f'Template json {template_path} is not valid.') return 1 @@ -1812,7 +1803,6 @@ def create_gem(gem_path: str, # The user has supplied the --template-restricted-path, see if that matches the template specifies. # If it does then we do not have a problem. If it doesn't match then error out. If not specified # in the template then warn and use the --template-restricted-path - template_restricted_path = template_restricted_path.replace('\\', '/') try: template_json_restricted_name = template_json_data['restricted_name'] except KeyError as e: @@ -1843,10 +1833,9 @@ def create_gem(gem_path: str, # If not supplied and not in the template set empty string. if template_restricted_platform_relative_path: # The user specified a --template-restricted-platform-relative-path - template_restricted_platform_relative_path = template_restricted_platform_relative_path.replace('\\', '/') try: - template_json_restricted_platform_relative_path = template_json_data[ - 'restricted_platform_relative_path'] + template_json_restricted_platform_relative_path = pathlib.Path( + template_json_data['restricted_platform_relative_path']) except KeyError as e: # the template json doesn't have a 'restricted_platform_relative_path' element warn and use it logger.info(f'The template does not specify a "restricted_platform_relative_path".' @@ -1855,12 +1844,13 @@ def create_gem(gem_path: str, # the template has a 'restricted_platform_relative_path', if it matches we are fine, if not something is # wrong with either the --template-restricted-platform-relative or the template is if template_restricted_platform_relative_path != template_json_restricted_platform_relative_path: - logger.error(f'The supplied --template-restricted-platform-relative-path does not match the' - f' templates "restricted_platform_relative_path". Either' + logger.error(f'The supplied --template-restricted-platform-relative-path' + f' "{template_restricted_platform_relative_path}" does not match the' + f' templates.json "restricted_platform_relative_path". Either' f' --template-restricted-platform-relative-path is incorrect or the templates' f' "restricted_platform_relative_path" is wrong. Note that since this template' f' specifies "restricted_platform_relative_path" it need not be supplied and' - f' {template_json_restricted_platform_relative_path} will be used.') + f' "{template_json_restricted_platform_relative_path}" will be used.') return 1 else: # The user has not supplied --template-restricted-platform-relative-path, try to read it from @@ -1878,20 +1868,21 @@ def create_gem(gem_path: str, if not gem_path: logger.error('Gem path cannot be empty.') return 1 - gem_path = gem_path.replace('\\', '/') if not os.path.isabs(gem_path): default_gems_folder = manifest.get_registered(default_folder='gems') - new_gem_path = f'{default_gems_folder}/{gem_path}' + new_gem_path = default_gems_folder / gem_path logger.info(f'Gem Path {gem_path} is not a full path, we must assume its relative' f' to default gems path = {new_gem_path}') gem_path = new_gem_path - if os.path.isdir(gem_path): + if not force and os.path.isdir(gem_path): logger.error(f'Gem path {gem_path} already exists.') return 1 else: - os.makedirs(gem_path) + os.makedirs(gem_path, exist_ok=force) - # gem name is now the last component of the gem_path + # gem nam + # + # e is now the last component of the gem_path gem_name = os.path.basename(gem_path) if not utils.validate_identifier(gem_name): @@ -1909,10 +1900,9 @@ def create_gem(gem_path: str, # gem restricted path elif gem_restricted_path: - gem_restricted_path = gem_restricted_path.replace('\\', '/') if not os.path.isabs(gem_restricted_path): default_gems_restricted_folder = manifest.get_registered(restricted_name='gems') - new_gem_restricted_path = f'{default_gems_restricted_folder}/{gem_restricted_path}' + new_gem_restricted_path = default_gems_restricted_folder /gem_restricted_path logger.info(f'Gem restricted path {gem_restricted_path} is not a full path, we must assume its' f' relative to default gems restricted path = {new_gem_restricted_path}') gem_restricted_path = new_gem_restricted_path @@ -1923,9 +1913,7 @@ def create_gem(gem_path: str, gem_restricted_path = gem_restricted_default_path # gem restricted relative - if gem_restricted_platform_relative_path: - gem_restricted_platform_relative_path = gem_restricted_platform_relative_path.replace('\\', '/') - else: + if not gem_restricted_platform_relative_path: gem_restricted_platform_relative_path = '' # any user supplied replacements @@ -1995,7 +1983,7 @@ def create_gem(gem_path: str, os.makedirs(gem_restricted_path, exist_ok=True) # read the restricted_name from the gems restricted.json - restricted_json = f"{gem_restricted_path}/restricted.json".replace('//', '/') + restricted_json = gem_restricted_path / 'restricted.json' if os.path.isfile(restricted_json): if not validation.valid_o3de_restricted_json(restricted_json): logger.error(f'Restricted json {restricted_json} is not valid.') @@ -2004,7 +1992,7 @@ def create_gem(gem_path: str, with open(restricted_json, 'w') as s: restricted_json_data = {} restricted_json_data.update({'restricted_name': gem_name}) - s.write(json.dumps(restricted_json_data, indent=4)) + s.write(json.dumps(restricted_json_data, indent=4) + '\n') with open(restricted_json, 'r') as s: try: @@ -2020,7 +2008,7 @@ def create_gem(gem_path: str, return 1 # set the "restricted_name": "restricted_name" element of the gem.json - gem_json = f"{gem_path}/gem.json".replace('//', '/') + gem_json = gem_path / 'gem.json' if not validation.valid_o3de_gem_json(gem_json): logger.error(f'Gem json {gem_json} is not valid.') return 1 @@ -2036,15 +2024,15 @@ def create_gem(gem_path: str, os.unlink(gem_json) with open(gem_json, 'w') as s: try: - s.write(json.dumps(gem_json_data, indent=4)) + s.write(json.dumps(gem_json_data, indent=4) + '\n') except OSError as e: logger.error(f'Failed to write project json {gem_json}.') return 1 for restricted_platform in restricted_platforms: - restricted_gem = f'{gem_restricted_path}/{restricted_platform}/{gem_name}' + restricted_gem = gem_restricted_path / restricted_platform/ gem_name os.makedirs(restricted_gem, exist_ok=True) - cmakelists_file_name = f'{restricted_gem}/CMakeLists.txt' + cmakelists_file_name = restricted_gem / 'CMakeLists.txt' if not os.path.isfile(cmakelists_file_name): with open(cmakelists_file_name, 'w') as d: if keep_license_text: @@ -2077,7 +2065,8 @@ def _run_create_template(args: argparse) -> int: args.template_restricted_platform_relative_path, args.keep_restricted_in_template, args.keep_license_text, - args.replace) + args.replace, + args.force) def _run_create_from_template(args: argparse) -> int: @@ -2092,7 +2081,8 @@ def _run_create_from_template(args: argparse) -> int: args.template_restricted_platform_relative_path, args.keep_restricted_in_instance, args.keep_license_text, - args.replace) + args.replace, + args.force) def _run_create_project(args: argparse) -> int: @@ -2109,6 +2099,7 @@ def _run_create_project(args: argparse) -> int: args.keep_restricted_in_project, args.keep_license_text, args.replace, + args.force, args.system_component_class_id, args.editor_system_component_class_id, args.module_id) @@ -2127,6 +2118,7 @@ def _run_create_gem(args: argparse) -> int: args.keep_restricted_in_gem, args.keep_license_text, args.replace, + args.force, args.system_component_class_id, args.editor_system_component_class_id, args.module_id) @@ -2144,13 +2136,13 @@ def add_args(subparsers) -> None: """ # turn a directory into a template create_template_subparser = subparsers.add_parser('create-template') - create_template_subparser.add_argument('-sp', '--source-path', type=str, required=True, + create_template_subparser.add_argument('-sp', '--source-path', type=pathlib.Path, required=True, help='The path to the source that you want to make into a template') - create_template_subparser.add_argument('-tp', '--template-path', type=str, required=False, + create_template_subparser.add_argument('-tp', '--template-path', type=pathlib.Path, required=False, help='The path to the template to create, can be absolute or relative' ' to default templates path') group = create_template_subparser.add_mutually_exclusive_group(required=False) - group.add_argument('-srp', '--source-restricted-path', type=str, required=False, + group.add_argument('-srp', '--source-restricted-path', type=pathlib.Path, required=False, default=None, help='The path to the source restricted folder.') group.add_argument('-srn', '--source-restricted-name', type=str, required=False, @@ -2159,7 +2151,7 @@ def add_args(subparsers) -> None: ' the --source-restricted-path.') group = create_template_subparser.add_mutually_exclusive_group(required=False) - group.add_argument('-trp', '--template-restricted-path', type=str, required=False, + group.add_argument('-trp', '--template-restricted-path', type=pathlib.Path, required=False, default=None, help='The path to the templates restricted folder.') group.add_argument('-trn', '--template-restricted-name', type=str, required=False, @@ -2167,7 +2159,7 @@ def add_args(subparsers) -> None: help='The name of the templates restricted folder. If supplied this will resolve' ' the --template-restricted-path.') - create_template_subparser.add_argument('-srprp', '--source-restricted-platform-relative-path', type=str, + create_template_subparser.add_argument('-srprp', '--source-restricted-platform-relative-path', type=pathlib.Path, required=False, default=None, help='Any path to append to the --source-restricted-path/' @@ -2175,7 +2167,7 @@ def add_args(subparsers) -> None: ' --source-restricted-path C:/restricted' ' --source-restricted-platform-relative-path some/folder' ' => C:/restricted//some/folder/') - create_template_subparser.add_argument('-trprp', '--template-restricted-platform-relative-path', type=str, + create_template_subparser.add_argument('-trprp', '--template-restricted-platform-relative-path', type=pathlib.Path, required=False, default=None, help='Any path to append to the --template-restricted-path/' @@ -2202,18 +2194,20 @@ def add_args(subparsers) -> None: ' Note: is automatically ${Name}' ' Note: is automatically ${NameLower}' ' Note: is automatically ${NameUpper}') + create_template_subparser.add_argument('-f', '--force', action='store_true', default=False, + help='Copies to new template directory even if it exist.') create_template_subparser.set_defaults(func=_run_create_template) # create from template create_from_template_subparser = subparsers.add_parser('create-from-template') - create_from_template_subparser.add_argument('-dp', '--destination-path', type=str, required=True, + create_from_template_subparser.add_argument('-dp', '--destination-path', type=pathlib.Path, required=True, help='The path to where you want the template instantiated,' ' can be absolute or dev root relative.' 'Ex. C:/o3de/Test' 'Test = ') group = create_from_template_subparser.add_mutually_exclusive_group(required=True) - group.add_argument('-tp', '--template-path', type=str, required=False, + group.add_argument('-tp', '--template-path', type=pathlib.Path, required=False, help='The path to the template you want to instantiate, can be absolute' ' or dev root/Templates relative.' 'Ex. C:/o3de/Template/TestTemplate' @@ -2222,8 +2216,8 @@ def add_args(subparsers) -> None: help='The name to the registered template you want to instantiate. If supplied this will' ' resolve the --template-path.') - group = create_from_template_subparser.add_mutually_exclusive_group(required=True) - group.add_argument('-drp', '--destination-restricted-path', type=str, required=False, + group = create_from_template_subparser.add_mutually_exclusive_group(required=False) + group.add_argument('-drp', '--destination-restricted-path', type=pathlib.Path, required=False, default=None, help='The destination restricted path is where the restricted files' ' will be written to.') @@ -2233,7 +2227,7 @@ def add_args(subparsers) -> None: ' will be written to. If supplied this will resolve the --destination-restricted-path.') group = create_from_template_subparser.add_mutually_exclusive_group(required=False) - group.add_argument('-trp', '--template-restricted-path', type=str, required=False, + group.add_argument('-trp', '--template-restricted-path', type=pathlib.Path, required=False, default=None, help='The template restricted path to read from if any') group.add_argument('-trn', '--template-restricted-name', type=str, required=False, @@ -2241,17 +2235,17 @@ def add_args(subparsers) -> None: help='The name of the registered restricted path to read from if any. If supplied this will' ' resolve the --template-restricted-path.') - create_from_template_subparser.add_argument('-drprp', '--destination-restricted-platform-relative-path', type=str, + create_from_template_subparser.add_argument('-drprp', '--destination-restricted-platform-relative-path', type=pathlib.Path, required=False, - default='', + default=None, help='Any path to append to the --destination-restricted-path/' ' to where the restricted destination is.' ' --destination-restricted-path C:/instance' ' --destination-restricted-platform-relative-path some/folder' ' => C:/instance//some/folder/') - create_from_template_subparser.add_argument('-trprp', '--template-restricted-platform-relative-path', type=str, + create_from_template_subparser.add_argument('-trprp', '--template-restricted-platform-relative-path', type=pathlib.Path, required=False, - default='Templates', + default=None, help='Any path to append to the --template-restricted-path/' ' to where the restricted template is.' ' --template-restricted-path C:/restricted' @@ -2276,11 +2270,13 @@ def add_args(subparsers) -> None: ' Note: ${Name} is automatically ' ' Note: ${NameLower} is automatically ' ' Note: ${NameUpper} is automatically ') + create_from_template_subparser.add_argument('-f', '--force', action='store_true', default=False, + help='Copies over instantiated template directory even if it exist.') create_from_template_subparser.set_defaults(func=_run_create_from_template) # creation of a project from a template (like create from template but makes project assumptions) create_project_subparser = subparsers.add_parser('create-project') - create_project_subparser.add_argument('-pp', '--project-path', type=str, required=True, + create_project_subparser.add_argument('-pp', '--project-path', type=pathlib.Path, required=True, help='The location of the project you wish to create from the template,' ' can be an absolute path or dev root relative.' ' Ex. C:/o3de/TestProject' @@ -2292,7 +2288,7 @@ def add_args(subparsers) -> None: ' Ex. New_Project-123') group = create_project_subparser.add_mutually_exclusive_group(required=False) - group.add_argument('-tp', '--template-path', type=str, required=False, + group.add_argument('-tp', '--template-path', type=pathlib.Path, required=False, default=None, help='the path to the template you want to instance, can be absolute or' ' relative to default templates path') @@ -2302,7 +2298,7 @@ def add_args(subparsers) -> None: ' to DefaultProject. If supplied this will resolve the --template-path.') group = create_project_subparser.add_mutually_exclusive_group(required=False) - group.add_argument('-prp', '--project-restricted-path', type=str, required=False, + group.add_argument('-prp', '--project-restricted-path', type=pathlib.Path, required=False, default=None, help='path to the projects restricted folder, can be absolute or relative' ' to the restricted="projects"') @@ -2312,7 +2308,7 @@ def add_args(subparsers) -> None: ' the --project-restricted-path.') group = create_project_subparser.add_mutually_exclusive_group(required=False) - group.add_argument('-trp', '--template-restricted-path', type=str, required=False, + group.add_argument('-trp', '--template-restricted-path', type=pathlib.Path, required=False, default=None, help='The templates restricted path can be absolute or relative to' ' restricted="templates"') @@ -2321,7 +2317,7 @@ def add_args(subparsers) -> None: help='The name of the registered templates restricted path. If supplied this will resolve' ' the --template-restricted-path.') - create_project_subparser.add_argument('-prprp', '--project-restricted-platform-relative-path', type=str, + create_project_subparser.add_argument('-prprp', '--project-restricted-platform-relative-path', type=pathlib.Path, required=False, default=None, help='Any path to append to the --project-restricted-path/' @@ -2329,7 +2325,7 @@ def add_args(subparsers) -> None: ' --project-restricted-path C:/restricted' ' --project-restricted-platform-relative-path some/folder' ' => C:/restricted//some/folder/') - create_project_subparser.add_argument('-trprp', '--template-restricted-platform-relative-path', type=str, + create_project_subparser.add_argument('-trprp', '--template-restricted-platform-relative-path', type=pathlib.Path, required=False, default=None, help='Any path to append to the --template-restricted-path/' @@ -2358,25 +2354,27 @@ def add_args(subparsers) -> None: ' Note: ${Name} is automatically ' ' Note: ${NameLower} is automatically ' ' Note: ${NameUpper} is automatically ') - create_project_subparser.add_argument('--system-component-class-id', type=utils.validate_uuid4, required=False, + create_project_subparser.add_argument('--system-component-class-id', type=uuid.UUID, required=False, help='The uuid you want to associate with the system class component, default' ' is a random uuid Ex. {b60c92eb-3139-454b-a917-a9d3c5819594}') - create_project_subparser.add_argument('--editor-system-component-class-id', type=utils.validate_uuid4, + create_project_subparser.add_argument('--editor-system-component-class-id', type=uuid.UUID, required=False, help='The uuid you want to associate with the editor system class component,' ' default is a random uuid Ex. {b60c92eb-3139-454b-a917-a9d3c5819594}') - create_project_subparser.add_argument('--module-id', type=utils.validate_uuid4, required=False, + create_project_subparser.add_argument('--module-id', type=uuid.UUID, required=False, help='The uuid you want to associate with the module, default is a random' ' uuid Ex. {b60c92eb-3139-454b-a917-a9d3c5819594}') + create_project_subparser.add_argument('-f', '--force', action='store_true', default=False, + help='Copies over instantiated template directory even if it exist.') create_project_subparser.set_defaults(func=_run_create_project) # creation of a gem from a template (like create from template but makes gem assumptions) create_gem_subparser = subparsers.add_parser('create-gem') - create_gem_subparser.add_argument('-gp', '--gem-path', type=str, required=True, + create_gem_subparser.add_argument('-gp', '--gem-path', type=pathlib.Path, required=True, help='The gem path, can be absolute or relative to default gems path') group = create_gem_subparser.add_mutually_exclusive_group(required=False) - group.add_argument('-tp', '--template-path', type=str, required=False, + group.add_argument('-tp', '--template-path', type=pathlib.Path, required=False, default=None, help='The template path you want to instance, can be absolute or relative' ' to default templates path') @@ -2386,7 +2384,7 @@ def add_args(subparsers) -> None: ' to DefaultGem. If supplied this will resolve the --template-path.') group = create_gem_subparser.add_mutually_exclusive_group(required=False) - group.add_argument('-grp', '--gem-restricted-path', type=str, required=False, + group.add_argument('-grp', '--gem-restricted-path', type=pathlib.Path, required=False, default=None, help='The path to the gem restricted to write to folder if any, can be' 'absolute or dev root relative, default is dev root/restricted.') @@ -2397,7 +2395,7 @@ def add_args(subparsers) -> None: ' this will resolve the --gem-restricted-path.') group = create_gem_subparser.add_mutually_exclusive_group(required=False) - group.add_argument('-trp', '--template-restricted-path', type=str, required=False, + group.add_argument('-trp', '--template-restricted-path', type=pathlib.Path, required=False, default=None, help='The templates restricted path, can be absolute or relative to' ' the restricted="templates"') @@ -2406,7 +2404,7 @@ def add_args(subparsers) -> None: help='The name of the registered templates restricted path. If supplied' ' this will resolve the --template-restricted-path.') - create_gem_subparser.add_argument('-grprp', '--gem-restricted-platform-relative-path', type=str, + create_gem_subparser.add_argument('-grprp', '--gem-restricted-platform-relative-path', type=pathlib.Path, required=False, default=None, help='Any path to append to the --gem-restricted-path/' @@ -2414,7 +2412,7 @@ def add_args(subparsers) -> None: ' --gem-restricted-path C:/restricted' ' --gem-restricted-platform-relative-path some/folder' ' => C:/restricted//some/folder/') - create_gem_subparser.add_argument('-trprp', '--template-restricted-platform-relative-path', type=str, + create_gem_subparser.add_argument('-trprp', '--template-restricted-platform-relative-path', type=pathlib.Path, required=False, default=None, help='Any path to append to the --template-restricted-path/' @@ -2443,16 +2441,18 @@ def add_args(subparsers) -> None: ' default is False, so will not keep license text by default.' ' License text is defined as all lines of text starting on a line' ' with {BEGIN_LICENSE} and ending line {END_LICENSE}.') - create_gem_subparser.add_argument('--system-component-class-id', type=utils.validate_uuid4, required=False, + create_gem_subparser.add_argument('--system-component-class-id', type=uuid.UUID, required=False, help='The uuid you want to associate with the system class component, default' ' is a random uuid Ex. {b60c92eb-3139-454b-a917-a9d3c5819594}') - create_gem_subparser.add_argument('--editor-system-component-class-id', type=utils.validate_uuid4, + create_gem_subparser.add_argument('--editor-system-component-class-id', type=uuid.UUID, required=False, help='The uuid you want to associate with the editor system class component,' ' default is a random uuid Ex. {b60c92eb-3139-454b-a917-a9d3c5819594}') - create_gem_subparser.add_argument('--module-id', type=utils.validate_uuid4, required=False, + create_gem_subparser.add_argument('--module-id', type=uuid.UUID, required=False, help='The uuid you want to associate with the gem module,' ' default is a random uuid Ex. {b60c92eb-3139-454b-a917-a9d3c5819594}') + create_gem_subparser.add_argument('-f', '--force', action='store_true', default=False, + help='Copies over instantiated template directory even if it exist.') create_gem_subparser.set_defaults(func=_run_create_gem)