feat: updated engine version to 4.4-rc1
This commit is contained in:
parent
ee00efde1f
commit
21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions
44
engine/misc/utility/clang_format_glsl.yml
Normal file
44
engine/misc/utility/clang_format_glsl.yml
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# GLSL-specific rules.
|
||||
# The rules should be the same as .clang-format, except those explicitly mentioned.
|
||||
BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: DontAlign
|
||||
AlignOperands: DontAlign
|
||||
AlignTrailingComments:
|
||||
Kind: Never
|
||||
OverEmptyLines: 0
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
BreakConstructorInitializers: AfterColon
|
||||
ColumnLimit: 0
|
||||
ConstructorInitializerIndentWidth: 8
|
||||
ContinuationIndentWidth: 8
|
||||
Cpp11BracedListStyle: false
|
||||
IncludeCategories:
|
||||
- Regex: ^".*"$
|
||||
Priority: 1
|
||||
- Regex: ^<.*\.h>$
|
||||
Priority: 2
|
||||
- Regex: ^<.*>$
|
||||
Priority: 3
|
||||
IndentCaseLabels: true
|
||||
IndentWidth: 4
|
||||
InsertBraces: true
|
||||
JavaImportGroups:
|
||||
- org.godotengine
|
||||
- android
|
||||
- androidx
|
||||
- com.android
|
||||
- com.google
|
||||
- java
|
||||
- javax
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
ObjCBlockIndentWidth: 4
|
||||
PackConstructorInitializers: NextLine
|
||||
RemoveSemicolon: false # Differs from base .clang-format
|
||||
SpacesInLineCommentPrefix:
|
||||
Minimum: 0
|
||||
Maximum: -1
|
||||
Standard: c++20
|
||||
TabWidth: 4
|
||||
UseTab: Always
|
||||
130
engine/misc/utility/color.py
Normal file
130
engine/misc/utility/color.py
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
from enum import Enum
|
||||
from typing import Final
|
||||
|
||||
# Colors are disabled in non-TTY environments such as pipes. This means if output is redirected
|
||||
# to a file, it won't contain color codes. Colors are always enabled on continuous integration.
|
||||
|
||||
IS_CI: Final[bool] = bool(os.environ.get("CI"))
|
||||
STDOUT_TTY: Final[bool] = bool(sys.stdout.isatty())
|
||||
STDERR_TTY: Final[bool] = bool(sys.stderr.isatty())
|
||||
|
||||
|
||||
def _color_supported(stdout: bool) -> bool:
|
||||
"""
|
||||
Validates if the current environment supports colored output. Attempts to enable ANSI escape
|
||||
code support on Windows 10 and later.
|
||||
"""
|
||||
if IS_CI:
|
||||
return True
|
||||
|
||||
if sys.platform != "win32":
|
||||
return STDOUT_TTY if stdout else STDERR_TTY
|
||||
else:
|
||||
from ctypes import POINTER, WINFUNCTYPE, WinError, windll
|
||||
from ctypes.wintypes import BOOL, DWORD, HANDLE
|
||||
|
||||
STD_HANDLE = -11 if stdout else -12
|
||||
ENABLE_VIRTUAL_TERMINAL_PROCESSING = 4
|
||||
|
||||
def err_handler(result, func, args):
|
||||
if not result:
|
||||
raise WinError()
|
||||
return args
|
||||
|
||||
GetStdHandle = WINFUNCTYPE(HANDLE, DWORD)(("GetStdHandle", windll.kernel32), ((1, "nStdHandle"),))
|
||||
GetConsoleMode = WINFUNCTYPE(BOOL, HANDLE, POINTER(DWORD))(
|
||||
("GetConsoleMode", windll.kernel32),
|
||||
((1, "hConsoleHandle"), (2, "lpMode")),
|
||||
)
|
||||
GetConsoleMode.errcheck = err_handler
|
||||
SetConsoleMode = WINFUNCTYPE(BOOL, HANDLE, DWORD)(
|
||||
("SetConsoleMode", windll.kernel32),
|
||||
((1, "hConsoleHandle"), (1, "dwMode")),
|
||||
)
|
||||
SetConsoleMode.errcheck = err_handler
|
||||
|
||||
try:
|
||||
handle = GetStdHandle(STD_HANDLE)
|
||||
flags = GetConsoleMode(handle)
|
||||
SetConsoleMode(handle, flags | ENABLE_VIRTUAL_TERMINAL_PROCESSING)
|
||||
return True
|
||||
except OSError:
|
||||
return False
|
||||
|
||||
|
||||
STDOUT_COLOR: Final[bool] = _color_supported(True)
|
||||
STDERR_COLOR: Final[bool] = _color_supported(False)
|
||||
_stdout_override: bool = STDOUT_COLOR
|
||||
_stderr_override: bool = STDERR_COLOR
|
||||
|
||||
|
||||
def toggle_color(stdout: bool, value: bool | None = None) -> None:
|
||||
"""
|
||||
Explicitly toggle color codes, regardless of support.
|
||||
|
||||
- `stdout`: A boolean to choose the output stream. `True` for stdout, `False` for stderr.
|
||||
- `value`: An optional boolean to explicitly set the color state instead of toggling.
|
||||
"""
|
||||
if stdout:
|
||||
global _stdout_override
|
||||
_stdout_override = value if value is not None else not _stdout_override
|
||||
else:
|
||||
global _stderr_override
|
||||
_stderr_override = value if value is not None else not _stderr_override
|
||||
|
||||
|
||||
class Ansi(Enum):
|
||||
"""
|
||||
Enum class for adding ansi codepoints directly into strings. Automatically converts values to
|
||||
strings representing their internal value.
|
||||
"""
|
||||
|
||||
RESET = "\x1b[0m"
|
||||
|
||||
BOLD = "\x1b[1m"
|
||||
DIM = "\x1b[2m"
|
||||
ITALIC = "\x1b[3m"
|
||||
UNDERLINE = "\x1b[4m"
|
||||
STRIKETHROUGH = "\x1b[9m"
|
||||
REGULAR = "\x1b[22;23;24;29m"
|
||||
|
||||
BLACK = "\x1b[30m"
|
||||
RED = "\x1b[31m"
|
||||
GREEN = "\x1b[32m"
|
||||
YELLOW = "\x1b[33m"
|
||||
BLUE = "\x1b[34m"
|
||||
MAGENTA = "\x1b[35m"
|
||||
CYAN = "\x1b[36m"
|
||||
WHITE = "\x1b[37m"
|
||||
GRAY = "\x1b[90m"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self.value
|
||||
|
||||
|
||||
def print_info(*values: object) -> None:
|
||||
"""Prints a informational message with formatting."""
|
||||
if _stdout_override:
|
||||
print(f"{Ansi.GRAY}{Ansi.BOLD}INFO:{Ansi.REGULAR}", *values, Ansi.RESET)
|
||||
else:
|
||||
print("INFO:", *values)
|
||||
|
||||
|
||||
def print_warning(*values: object) -> None:
|
||||
"""Prints a warning message with formatting."""
|
||||
if _stderr_override:
|
||||
print(f"{Ansi.YELLOW}{Ansi.BOLD}WARNING:{Ansi.REGULAR}", *values, Ansi.RESET, file=sys.stderr)
|
||||
else:
|
||||
print("WARNING:", *values, file=sys.stderr)
|
||||
|
||||
|
||||
def print_error(*values: object) -> None:
|
||||
"""Prints an error message with formatting."""
|
||||
if _stderr_override:
|
||||
print(f"{Ansi.RED}{Ansi.BOLD}ERROR:{Ansi.REGULAR}", *values, Ansi.RESET, file=sys.stderr)
|
||||
else:
|
||||
print("ERROR:", *values, file=sys.stderr)
|
||||
32
engine/misc/utility/problem-matchers.json
Normal file
32
engine/misc/utility/problem-matchers.json
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "gcc",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^(?:\\[[\\s\\d]{3}%\\]\\s)?(?:\\s|\\x1b\\[[=\\?]?[;\\d]+[a-zA-Z])*(?:\\d+\\>)?(\\S.*?)[:\\(](\\d+)(?:[,:](\\d+))?(?::{\\d+:\\d+\\-\\d+:\\d+})?\\)?:(?:\\s|\\x1b\\[[=\\?]?[;\\d]+[a-zA-Z])*(?:fatal\\s)?(error|warning)(?:\\s|\\x1b\\[[=\\?]?[;\\d]+[a-zA-Z])*:(?:\\s|\\x1b\\[[=\\?]?[;\\d]+[a-zA-Z])*(.*?)(?:\\[(.*)\\])?(?:\\s|\\x1b\\[[=\\?]?[;\\d]+[a-zA-Z])*$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5,
|
||||
"code": 6
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"owner": "msvc",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^(?:\\[[\\s\\d]{3}%\\]\\s)?(?:\\s|\\x1b\\[[=\\?]?[;\\d]+[a-zA-Z])*(?:\\d+\\>)?(\\S.*?)\\((\\d+)(?:,(\\d+))?(?:,\\d+,\\d+)?\\)(?:\\s|\\x1b\\[[=\\?]?[;\\d]+[a-zA-Z])*:(?:\\s|\\x1b\\[[=\\?]?[;\\d]+[a-zA-Z])*(?:fatal\\s)?(error|warning)(?:\\s|\\x1b\\[[=\\?]?[;\\d]+[a-zA-Z])*(\\w{1,2}\\d+):(?:\\s|\\x1b\\[[=\\?]?[;\\d]+[a-zA-Z])*(.*?)(?:\\s|\\x1b\\[[=\\?]?[;\\d]+[a-zA-Z])*$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"code": 5,
|
||||
"message": 6
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
98
engine/misc/utility/scons_hints.py
Normal file
98
engine/misc/utility/scons_hints.py
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
"""
|
||||
Adds type hints to SCons scripts. Implemented via
|
||||
`from misc.utility.scons_hints import *`.
|
||||
|
||||
This is NOT a 1-1 representation of what the defines will represent in an
|
||||
SCons build, as proxies are almost always utilized instead. Rather, this is
|
||||
a means of tracing back what those proxies are calling to in the first place.
|
||||
"""
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# ruff: noqa: F401
|
||||
from SCons.Action import Action
|
||||
from SCons.Builder import Builder
|
||||
from SCons.Defaults import Chmod, Copy, CScan, DefaultEnvironment, Delete, DirScanner, Mkdir, Move, Touch
|
||||
from SCons.Environment import Base
|
||||
from SCons.Platform import Platform
|
||||
from SCons.Platform.virtualenv import Virtualenv
|
||||
from SCons.Scanner import FindPathDirs, ScannerBase
|
||||
from SCons.Script import ARGLIST, ARGUMENTS, BUILD_TARGETS, COMMAND_LINE_TARGETS, DEFAULT_TARGETS
|
||||
from SCons.Script.Main import (
|
||||
AddOption,
|
||||
BuildTask,
|
||||
CleanTask,
|
||||
DebugOptions,
|
||||
GetBuildFailures,
|
||||
GetOption,
|
||||
PrintHelp,
|
||||
Progress,
|
||||
QuestionTask,
|
||||
SetOption,
|
||||
ValidateOptions,
|
||||
)
|
||||
from SCons.Script.SConscript import Configure, Return, SConsEnvironment, call_stack
|
||||
from SCons.Script.SConscript import SConsEnvironment as Environment
|
||||
from SCons.Subst import SetAllowableExceptions as AllowSubstExceptions
|
||||
from SCons.Tool import CScanner, DScanner, ProgramScanner, SourceFileScanner, Tool
|
||||
from SCons.Util import AddMethod, WhereIs
|
||||
from SCons.Variables import BoolVariable, EnumVariable, ListVariable, PackageVariable, PathVariable, Variables
|
||||
|
||||
# Global functions
|
||||
GetSConsVersion = SConsEnvironment.GetSConsVersion
|
||||
EnsurePythonVersion = SConsEnvironment.EnsurePythonVersion
|
||||
EnsureSConsVersion = SConsEnvironment.EnsureSConsVersion
|
||||
Exit = SConsEnvironment.Exit
|
||||
GetLaunchDir = SConsEnvironment.GetLaunchDir
|
||||
SConscriptChdir = SConsEnvironment.SConscriptChdir
|
||||
|
||||
# SConsEnvironment functions
|
||||
Default = SConsEnvironment(DefaultEnvironment()).Default
|
||||
Export = SConsEnvironment(DefaultEnvironment()).Export
|
||||
Help = SConsEnvironment(DefaultEnvironment()).Help
|
||||
Import = SConsEnvironment(DefaultEnvironment()).Import
|
||||
SConscript = SConsEnvironment(DefaultEnvironment()).SConscript
|
||||
|
||||
# Environment functions
|
||||
AddPostAction = DefaultEnvironment().AddPostAction
|
||||
AddPreAction = DefaultEnvironment().AddPreAction
|
||||
Alias = DefaultEnvironment().Alias
|
||||
AlwaysBuild = DefaultEnvironment().AlwaysBuild
|
||||
CacheDir = DefaultEnvironment().CacheDir
|
||||
Clean = DefaultEnvironment().Clean
|
||||
Command = DefaultEnvironment().Command
|
||||
Decider = DefaultEnvironment().Decider
|
||||
Depends = DefaultEnvironment().Depends
|
||||
Dir = DefaultEnvironment().Dir
|
||||
Entry = DefaultEnvironment().Entry
|
||||
Execute = DefaultEnvironment().Execute
|
||||
File = DefaultEnvironment().File
|
||||
FindFile = DefaultEnvironment().FindFile
|
||||
FindInstalledFiles = DefaultEnvironment().FindInstalledFiles
|
||||
FindSourceFiles = DefaultEnvironment().FindSourceFiles
|
||||
Flatten = DefaultEnvironment().Flatten
|
||||
GetBuildPath = DefaultEnvironment().GetBuildPath
|
||||
Glob = DefaultEnvironment().Glob
|
||||
Ignore = DefaultEnvironment().Ignore
|
||||
Install = DefaultEnvironment().Install
|
||||
InstallAs = DefaultEnvironment().InstallAs
|
||||
InstallVersionedLib = DefaultEnvironment().InstallVersionedLib
|
||||
Literal = DefaultEnvironment().Literal
|
||||
Local = DefaultEnvironment().Local
|
||||
NoCache = DefaultEnvironment().NoCache
|
||||
NoClean = DefaultEnvironment().NoClean
|
||||
ParseDepends = DefaultEnvironment().ParseDepends
|
||||
Precious = DefaultEnvironment().Precious
|
||||
PyPackageDir = DefaultEnvironment().PyPackageDir
|
||||
Repository = DefaultEnvironment().Repository
|
||||
Requires = DefaultEnvironment().Requires
|
||||
SConsignFile = DefaultEnvironment().SConsignFile
|
||||
SideEffect = DefaultEnvironment().SideEffect
|
||||
Split = DefaultEnvironment().Split
|
||||
Tag = DefaultEnvironment().Tag
|
||||
Value = DefaultEnvironment().Value
|
||||
VariantDir = DefaultEnvironment().VariantDir
|
||||
|
||||
env: SConsEnvironment
|
||||
env_modules: SConsEnvironment
|
||||
Loading…
Add table
Add a link
Reference in a new issue