Forráskód Böngészése

Merge pull request #76251 from bruvzg/docs_platf

[Export docs] Move docs to platform folders.
Rémi Verschelde 2 éve
szülő
commit
2b20a707cb

+ 2 - 2
.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: |

+ 11 - 1
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"]:

+ 1 - 1
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"

+ 1 - 1
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")

+ 10 - 0
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)

+ 0 - 0
doc/classes/EditorExportPlatformAndroid.xml → platform/android/doc_classes/EditorExportPlatformAndroid.xml


+ 10 - 0
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.

+ 0 - 0
doc/classes/EditorExportPlatformIOS.xml → platform/ios/doc_classes/EditorExportPlatformIOS.xml


+ 10 - 0
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()),

+ 0 - 0
doc/classes/EditorExportPlatformLinuxBSD.xml → platform/linuxbsd/doc_classes/EditorExportPlatformLinuxBSD.xml


+ 10 - 0
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()),

+ 0 - 0
doc/classes/EditorExportPlatformMacOS.xml → platform/macos/doc_classes/EditorExportPlatformMacOS.xml


+ 10 - 0
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"),

+ 0 - 0
doc/classes/EditorExportPlatformWeb.xml → platform/web/doc_classes/EditorExportPlatformWeb.xml


+ 10 - 0
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()
 

+ 0 - 0
doc/classes/EditorExportPlatformWindows.xml → platform/windows/doc_classes/EditorExportPlatformWindows.xml