From a5128e71bbcc57166412a222d65dbb05ed939d1b Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Wed, 19 Apr 2023 12:23:22 +0300 Subject: [PATCH] [Export docs] Move docs to platform folders. --- .github/workflows/static_checks.yml | 4 ++-- SConstruct | 12 +++++++++++- doc/Makefile | 2 +- doc/tools/make_rst.py | 2 +- platform/android/detect.py | 10 ++++++++++ .../doc_classes}/EditorExportPlatformAndroid.xml | 0 platform/ios/detect.py | 10 ++++++++++ .../ios/doc_classes}/EditorExportPlatformIOS.xml | 0 platform/linuxbsd/detect.py | 10 ++++++++++ .../doc_classes}/EditorExportPlatformLinuxBSD.xml | 0 platform/macos/detect.py | 10 ++++++++++ .../macos/doc_classes}/EditorExportPlatformMacOS.xml | 0 platform/web/detect.py | 10 ++++++++++ .../web/doc_classes}/EditorExportPlatformWeb.xml | 0 platform/windows/detect.py | 10 ++++++++++ .../doc_classes}/EditorExportPlatformWindows.xml | 0 16 files changed, 75 insertions(+), 5 deletions(-) rename {doc/classes => platform/android/doc_classes}/EditorExportPlatformAndroid.xml (100%) rename {doc/classes => platform/ios/doc_classes}/EditorExportPlatformIOS.xml (100%) rename {doc/classes => platform/linuxbsd/doc_classes}/EditorExportPlatformLinuxBSD.xml (100%) rename {doc/classes => platform/macos/doc_classes}/EditorExportPlatformMacOS.xml (100%) rename {doc/classes => platform/web/doc_classes}/EditorExportPlatformWeb.xml (100%) rename {doc/classes => platform/windows/doc_classes}/EditorExportPlatformWindows.xml (100%) diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml index b2ab9132347..81c6831a755 100644 --- a/.github/workflows/static_checks.yml +++ b/.github/workflows/static_checks.yml @@ -54,11 +54,11 @@ jobs: - name: Class reference schema checks run: | - xmllint --noout --schema doc/class.xsd doc/classes/*.xml modules/*/doc_classes/*.xml + xmllint --noout --schema doc/class.xsd doc/classes/*.xml modules/*/doc_classes/*.xml platform/*/doc_classes/*.xml - name: Documentation checks run: | - doc/tools/make_rst.py --dry-run --color doc/classes modules + doc/tools/make_rst.py --dry-run --color doc/classes modules platforms - name: Style checks via clang-format (clang_format.sh) run: | diff --git a/SConstruct b/SConstruct index 8b39f120b4b..518dcaa05d8 100644 --- a/SConstruct +++ b/SConstruct @@ -66,6 +66,7 @@ if ARGUMENTS.get("target", "editor") == "editor": platform_list = [] # list of platforms platform_opts = {} # options for each platform platform_flags = {} # flags for each platform +platform_doc_class_path = {} active_platforms = [] active_platform_ids = [] @@ -82,6 +83,15 @@ for x in sorted(glob.glob("platform/*")): sys.path.insert(0, tmppath) import detect + # Get doc classes paths (if present) + try: + doc_classes = detect.get_doc_classes() + doc_path = detect.get_doc_path() + for c in doc_classes: + platform_doc_class_path[c] = x.replace("\\", "/") + "/" + doc_path + except Exception: + pass + if os.path.exists(x + "/export/export.cpp"): platform_exporters.append(x[9:]) if os.path.exists(x + "/api/api.cpp"): @@ -782,7 +792,7 @@ if selected_platform in platform_list: modules_enabled = OrderedDict() env.module_dependencies = {} env.module_icons_paths = [] - env.doc_class_path = {} + env.doc_class_path = platform_doc_class_path for name, path in modules_detected.items(): if not env["module_" + name + "_enabled"]: diff --git a/doc/Makefile b/doc/Makefile index cc2ebf98818..53c5c7dcb05 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,5 +1,5 @@ BASEDIR = . -CLASSES = "$(BASEDIR)/classes/" "$(BASEDIR)/../modules/" +CLASSES = "$(BASEDIR)/classes/" "$(BASEDIR)/../modules/" "$(BASEDIR)/../platform/" OUTPUTDIR = $(BASEDIR)/_build TOOLSDIR = $(BASEDIR)/tools JSDIR = "$(BASEDIR)/../platform/web" diff --git a/doc/tools/make_rst.py b/doc/tools/make_rst.py index 1f71b77cbda..3655a60c35f 100755 --- a/doc/tools/make_rst.py +++ b/doc/tools/make_rst.py @@ -567,7 +567,7 @@ def main() -> None: if path.endswith("/") or path.endswith("\\"): path = path[:-1] - if os.path.basename(path) == "modules": + if os.path.basename(path) in ["modules", "platform"]: for subdir, dirs, _ in os.walk(path): if "doc_classes" in dirs: doc_dir = os.path.join(subdir, "doc_classes") diff --git a/platform/android/detect.py b/platform/android/detect.py index ec36a409411..7515d0020dc 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -32,6 +32,16 @@ def get_opts(): ] +def get_doc_classes(): + return [ + "EditorExportPlatformAndroid", + ] + + +def get_doc_path(): + return "doc_classes" + + # Return the ANDROID_SDK_ROOT environment variable. def get_env_android_sdk_root(): return os.environ.get("ANDROID_SDK_ROOT", -1) diff --git a/doc/classes/EditorExportPlatformAndroid.xml b/platform/android/doc_classes/EditorExportPlatformAndroid.xml similarity index 100% rename from doc/classes/EditorExportPlatformAndroid.xml rename to platform/android/doc_classes/EditorExportPlatformAndroid.xml diff --git a/platform/ios/detect.py b/platform/ios/detect.py index 71612cf1fa0..bab055dbd59 100644 --- a/platform/ios/detect.py +++ b/platform/ios/detect.py @@ -39,6 +39,16 @@ def get_opts(): ] +def get_doc_classes(): + return [ + "EditorExportPlatformIOS", + ] + + +def get_doc_path(): + return "doc_classes" + + def get_flags(): return [ ("arch", "arm64"), # Default for convenience. diff --git a/doc/classes/EditorExportPlatformIOS.xml b/platform/ios/doc_classes/EditorExportPlatformIOS.xml similarity index 100% rename from doc/classes/EditorExportPlatformIOS.xml rename to platform/ios/doc_classes/EditorExportPlatformIOS.xml diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py index 54351757cdf..0bebd29f897 100644 --- a/platform/linuxbsd/detect.py +++ b/platform/linuxbsd/detect.py @@ -56,6 +56,16 @@ def get_opts(): ] +def get_doc_classes(): + return [ + "EditorExportPlatformLinuxBSD", + ] + + +def get_doc_path(): + return "doc_classes" + + def get_flags(): return [ ("arch", detect_arch()), diff --git a/doc/classes/EditorExportPlatformLinuxBSD.xml b/platform/linuxbsd/doc_classes/EditorExportPlatformLinuxBSD.xml similarity index 100% rename from doc/classes/EditorExportPlatformLinuxBSD.xml rename to platform/linuxbsd/doc_classes/EditorExportPlatformLinuxBSD.xml diff --git a/platform/macos/detect.py b/platform/macos/detect.py index ae8749354e9..7c63fe9211a 100644 --- a/platform/macos/detect.py +++ b/platform/macos/detect.py @@ -39,6 +39,16 @@ def get_opts(): ] +def get_doc_classes(): + return [ + "EditorExportPlatformMacOS", + ] + + +def get_doc_path(): + return "doc_classes" + + def get_flags(): return [ ("arch", detect_arch()), diff --git a/doc/classes/EditorExportPlatformMacOS.xml b/platform/macos/doc_classes/EditorExportPlatformMacOS.xml similarity index 100% rename from doc/classes/EditorExportPlatformMacOS.xml rename to platform/macos/doc_classes/EditorExportPlatformMacOS.xml diff --git a/platform/web/detect.py b/platform/web/detect.py index 08c1ff7b4ab..419d8918f28 100644 --- a/platform/web/detect.py +++ b/platform/web/detect.py @@ -48,6 +48,16 @@ def get_opts(): ] +def get_doc_classes(): + return [ + "EditorExportPlatformWeb", + ] + + +def get_doc_path(): + return "doc_classes" + + def get_flags(): return [ ("arch", "wasm32"), diff --git a/doc/classes/EditorExportPlatformWeb.xml b/platform/web/doc_classes/EditorExportPlatformWeb.xml similarity index 100% rename from doc/classes/EditorExportPlatformWeb.xml rename to platform/web/doc_classes/EditorExportPlatformWeb.xml diff --git a/platform/windows/detect.py b/platform/windows/detect.py index ba8d27bba57..cd6d461a938 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -192,6 +192,16 @@ def get_opts(): ] +def get_doc_classes(): + return [ + "EditorExportPlatformWindows", + ] + + +def get_doc_path(): + return "doc_classes" + + def get_flags(): arch = detect_build_env_arch() or detect_arch() diff --git a/doc/classes/EditorExportPlatformWindows.xml b/platform/windows/doc_classes/EditorExportPlatformWindows.xml similarity index 100% rename from doc/classes/EditorExportPlatformWindows.xml rename to platform/windows/doc_classes/EditorExportPlatformWindows.xml