Skip to content

Commit

Permalink
[Export docs] Move docs to platform folders.
Browse files Browse the repository at this point in the history
  • Loading branch information
bruvzg committed Apr 20, 2023
1 parent 27253f3 commit a5128e7
Show file tree
Hide file tree
Showing 16 changed files with 75 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/static_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
12 changes: 11 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -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"):
Expand Down Expand Up @@ -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"]:
Expand Down
2 changes: 1 addition & 1 deletion doc/Makefile
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion doc/tools/make_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
10 changes: 10 additions & 0 deletions platform/android/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletions platform/ios/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletions platform/linuxbsd/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down
10 changes: 10 additions & 0 deletions platform/macos/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletions platform/web/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletions platform/windows/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
File renamed without changes.

0 comments on commit a5128e7

Please sign in to comment.