Skip to content

Commit

Permalink
Merge pull request #1 from V-Sekai/next
Browse files Browse the repository at this point in the history
Update godot engine
  • Loading branch information
fire authored Nov 20, 2024
2 parents 4d145e5 + 9c38417 commit f9db49e
Show file tree
Hide file tree
Showing 180 changed files with 2,025 additions and 1,345 deletions.
10 changes: 4 additions & 6 deletions godot/.github/actions/godot-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ inputs:
required: false
scons-cache:
description: The SCons cache path.
default: ${{ github.workspace }}/.scons-cache/
default: ${{ github.workspace }}/.scons_cache/
scons-cache-limit:
description: The SCons cache size limit.
# actions/cache has 10 GiB limit, and GitHub runners have a 14 GiB disk.
# Limit to 7 GiB to avoid having the extracted cache fill the disk.
default: 7168
default: 7

runs:
using: composite
Expand All @@ -32,10 +32,8 @@ runs:
shell: sh
env:
SCONSFLAGS: ${{ inputs.sconsflags }}
SCONS_CACHE: ${{ inputs.scons-cache }}
SCONS_CACHE_LIMIT: ${{ inputs.scons-cache-limit }}
run: |
echo "Building with flags:" platform=${{ inputs.platform }} target=${{ inputs.target }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }}
echo "Building with flags:" platform=${{ inputs.platform }} target=${{ inputs.target }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }} "cache_path=${{ inputs.scons-cache }}" cache_limit=${{ inputs.scons-cache-limit }}
if [ "${{ inputs.target }}" != "editor" ]; then
# Ensure we don't include editor code in export template builds.
Expand All @@ -49,5 +47,5 @@ runs:
export BUILD_NAME="gh"
fi
scons platform=${{ inputs.platform }} target=${{ inputs.target }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }}
scons platform=${{ inputs.platform }} target=${{ inputs.target }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }} "cache_path=${{ inputs.scons-cache }}" cache_limit=${{ inputs.scons-cache-limit }}
ls -l bin/
3 changes: 1 addition & 2 deletions godot/.github/actions/godot-cache-restore/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ inputs:
default: ${{ github.job }}
scons-cache:
description: The SCons cache path.
default: ${{ github.workspace }}/.scons-cache/
default: ${{ github.workspace }}/.scons_cache/

runs:
using: composite
Expand All @@ -29,7 +29,6 @@ runs:
# 4. A partial match for the same base branch only (not ideal, matches any PR with the same base branch).

restore-keys: |
${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }}
${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}
${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-refs/heads/${{ env.GODOT_BASE_BRANCH }}
${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}
2 changes: 1 addition & 1 deletion godot/.github/actions/godot-cache-save/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ inputs:
default: ${{ github.job }}
scons-cache:
description: The SCons cache path.
default: ${{ github.workspace }}/.scons-cache/
default: ${{ github.workspace }}/.scons_cache/

runs:
using: composite
Expand Down
3 changes: 0 additions & 3 deletions godot/.github/workflows/godot_cpp_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ jobs:
# continue-on-error: true

- name: Build godot-cpp test extension
env: # Keep synced with godot-build.
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
SCONS_CACHE_LIMIT: 7168
run: scons --directory=./godot-cpp/test target=template_debug dev_build=yes verbose=yes

# - name: Save Godot build cache
Expand Down
10 changes: 5 additions & 5 deletions godot/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ compile_commands.json
platform/windows/godot_res.res

# Ninja build files
build.ninja
.ninja
*.ninja
.ninja/
run_ninja_env.bat

# Generated by Godot binary
Expand Down Expand Up @@ -77,6 +77,9 @@ venv
__pycache__/
*.pyc

# Python modules
.*_cache/

# Documentation
doc/_build/

Expand Down Expand Up @@ -164,9 +167,6 @@ gmon.out
# Kdevelop
*.kdev4

# Mypy
.mypy_cache

# Qt Creator
*.config
*.creator
Expand Down
8 changes: 4 additions & 4 deletions godot/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
;
[subrepo]
remote = https://github.com/V-Sekai/godot.git
branch = groups-4.4
commit = 225836f900a4cfb3dea0532879e863d5b61634da
parent = 5b44b614dca4273121773800dd6497de38dbcefb
branch = groups-4.3
commit = ab2078a324260f94b60016413df31d61635a97e9
parent = 4d145e55f2dc3b83f58d780c4844ba363cc5f567
method = merge
cmdver = 0.4.6
cmdver = 0.4.9
58 changes: 25 additions & 33 deletions godot/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ opts.Add(BoolVariable("scu_build", "Use single compilation unit build", False))
opts.Add("scu_limit", "Max includes per SCU file when using scu_build (determines RAM use)", "0")
opts.Add(BoolVariable("engine_update_check", "Enable engine update checks in the Project Manager", True))
opts.Add(BoolVariable("steamapi", "Enable minimal SteamAPI integration for usage time tracking (editor only)", False))
opts.Add("cache_path", "Path to a directory where SCons cache files will be stored. No value disables the cache.", "")
opts.Add("cache_limit", "Max size (in GiB) for the SCons cache. 0 means no limit.", "0")

# Thirdparty libraries
opts.Add(BoolVariable("builtin_brotli", "Use the built-in Brotli library", True))
Expand Down Expand Up @@ -323,6 +325,9 @@ opts.Add("rcflags", "Custom flags for Windows resource compiler")
# in following code (especially platform and custom_modules).
opts.Update(env)

# Setup caching logic early to catch everything.
methods.prepare_cache(env)

# Copy custom environment variables if set.
if env["import_env_vars"]:
for env_var in str(env["import_env_vars"]).split(","):
Expand Down Expand Up @@ -356,7 +361,9 @@ if env["platform"] == "":
if env["platform"] in compatibility_platform_aliases:
alias = env["platform"]
platform = compatibility_platform_aliases[alias]
print_warning(f'Platform "{alias}" has been renamed to "{platform}" in Godot 4. Building for platform "{platform}".')
print_warning(
f'Platform "{alias}" has been renamed to "{platform}" in Godot 4. Building for platform "{platform}".'
)
env["platform"] = platform

# Alias for convenience.
Expand Down Expand Up @@ -658,40 +665,32 @@ elif methods.using_gcc(env):
"to switch to posix threads."
)
Exit(255)
if env["debug_paths_relative"] and cc_version_major < 8:
print_warning("GCC < 8 doesn't support -ffile-prefix-map, disabling `debug_paths_relative` option.")
env["debug_paths_relative"] = False
elif methods.using_clang(env):
# Apple LLVM versions differ from upstream LLVM version \o/, compare
# in https://en.wikipedia.org/wiki/Xcode#Toolchain_versions
if env["platform"] == "macos" or env["platform"] == "ios":
vanilla = methods.is_vanilla_clang(env)
if vanilla and cc_version_major < 6:
print_error(
"Detected Clang version older than 6, which does not fully support "
"C++17. Supported versions are Clang 6 and later."
)
Exit(255)
elif not vanilla and cc_version_major < 10:
if methods.is_apple_clang(env):
if cc_version_major < 10:
print_error(
"Detected Apple Clang version older than 10, which does not fully "
"support C++17. Supported versions are Apple Clang 10 and later."
)
Exit(255)
if env["debug_paths_relative"] and not vanilla and cc_version_major < 12:
elif env["debug_paths_relative"] and cc_version_major < 12:
print_warning(
"Apple Clang < 12 doesn't support -ffile-prefix-map, disabling `debug_paths_relative` option."
)
env["debug_paths_relative"] = False
elif cc_version_major < 6:
print_error(
"Detected Clang version older than 6, which does not fully support "
"C++17. Supported versions are Clang 6 and later."
)
Exit(255)
if env["debug_paths_relative"] and cc_version_major < 10:
print_warning("Clang < 10 doesn't support -ffile-prefix-map, disabling `debug_paths_relative` option.")
env["debug_paths_relative"] = False
else:
if cc_version_major < 6:
print_error(
"Detected Clang version older than 6, which does not fully support "
"C++17. Supported versions are Clang 6 and later."
)
Exit(255)
elif env["debug_paths_relative"] and cc_version_major < 10:
print_warning("Clang < 10 doesn't support -ffile-prefix-map, disabling `debug_paths_relative` option.")
env["debug_paths_relative"] = False

elif env.msvc:
# Ensure latest minor builds of Visual Studio 2017/2019.
# https://github.com/godotengine/godot/pull/94995#issuecomment-2336464574
Expand Down Expand Up @@ -758,7 +757,7 @@ else:
env.Append(LINKFLAGS=["-Wl,-pdb="])
env.Append(CCFLAGS=["-gcodeview"])
else:
if methods.using_clang(env) and not methods.is_vanilla_clang(env):
if methods.is_apple_clang(env):
# Apple Clang, its linker doesn't like -s.
env.Append(LINKFLAGS=["-Wl,-S", "-Wl,-x", "-Wl,-dead_strip"])
else:
Expand Down Expand Up @@ -1044,11 +1043,6 @@ GLSL_BUILDERS = {
}
env.Append(BUILDERS=GLSL_BUILDERS)

scons_cache_path = os.environ.get("SCONS_CACHE")
if scons_cache_path is not None:
CacheDir(scons_cache_path)
print("Scons cache enabled... (path: '" + scons_cache_path + "')")

if env["compiledb"]:
env.Tool("compilation_db")
env.Alias("compiledb", env.CompilationDatabase())
Expand All @@ -1061,7 +1055,7 @@ if env["ninja"]:
SetOption("experimental", "ninja")
env["NINJA_FILE_NAME"] = env["ninja_file"]
env["NINJA_DISABLE_AUTO_RUN"] = not env["ninja_auto_run"]
env.Tool("ninja", "build.ninja")
env.Tool("ninja", env["ninja_file"])

# Threads
if env["threads"]:
Expand Down Expand Up @@ -1123,13 +1117,11 @@ atexit.register(print_elapsed_time)


def purge_flaky_files():
paths_to_keep = ["build.ninja"]
paths_to_keep = [env["ninja_file"]]
for build_failure in GetBuildFailures():
path = build_failure.node.path
if os.path.isfile(path) and path not in paths_to_keep:
os.remove(path)


atexit.register(purge_flaky_files)

methods.clean_cache(env)
14 changes: 10 additions & 4 deletions godot/core/config/project_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ String ProjectSettings::localize_path(const String &p_path) const {

return cwd.replace_first(res_path, "res://");
} else {
int sep = path.rfind("/");
int sep = path.rfind_char('/');
if (sep == -1) {
return "res://" + path;
}
Expand Down Expand Up @@ -262,6 +262,12 @@ String ProjectSettings::globalize_path(const String &p_path) const {
return p_path.replace("res:/", resource_path);
}
return p_path.replace("res://", "");
} else if (p_path.begins_with("uid://")) {
const String path = ResourceUID::uid_to_path(p_path);
if (!resource_path.is_empty()) {
return path.replace("res:/", resource_path);
}
return path.replace("res://", "");
} else if (p_path.begins_with("user://")) {
String data_dir = OS::get_singleton()->get_user_data_dir();
if (!data_dir.is_empty()) {
Expand Down Expand Up @@ -300,7 +306,7 @@ bool ProjectSettings::_set(const StringName &p_name, const Variant &p_value) {
}

{ // Feature overrides.
int dot = p_name.operator String().find(".");
int dot = p_name.operator String().find_char('.');
if (dot != -1) {
Vector<String> s = p_name.operator String().split(".");

Expand Down Expand Up @@ -435,7 +441,7 @@ void ProjectSettings::_get_property_list(List<PropertyInfo> *p_list) const {

for (const _VCSort &E : vclist) {
String prop_info_name = E.name;
int dot = prop_info_name.find(".");
int dot = prop_info_name.find_char('.');
if (dot != -1 && !custom_prop_info.has(prop_info_name)) {
prop_info_name = prop_info_name.substr(0, dot);
}
Expand Down Expand Up @@ -1092,7 +1098,7 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
String category = E.name;
String name = E.name;

int div = category.find("/");
int div = category.find_char('/');

if (div < 0) {
category = "";
Expand Down
2 changes: 1 addition & 1 deletion godot/core/debugger/engine_debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void EngineDebugger::initialize(const String &p_uri, bool p_skip_breakpoints, co

for (int i = 0; i < p_breakpoints.size(); i++) {
const String &bp = p_breakpoints[i];
int sp = bp.rfind(":");
int sp = bp.rfind_char(':');
ERR_CONTINUE_MSG(sp == -1, vformat("Invalid breakpoint: '%s', expected file:line format.", bp));

singleton_script_debugger->insert_breakpoint(bp.substr(sp + 1, bp.length()).to_int(), bp.substr(0, sp));
Expand Down
4 changes: 2 additions & 2 deletions godot/core/debugger/local_debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void LocalDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {

} else {
String key_value = line.get_slicec(' ', 1);
int value_pos = key_value.find("=");
int value_pos = key_value.find_char('=');

if (value_pos < 0) {
print_line("Error: Invalid set format. Use: set key=value");
Expand Down Expand Up @@ -344,7 +344,7 @@ Pair<String, int> LocalDebugger::to_breakpoint(const String &p_line) {
String breakpoint_part = p_line.get_slicec(' ', 1);
Pair<String, int> breakpoint;

int last_colon = breakpoint_part.rfind(":");
int last_colon = breakpoint_part.rfind_char(':');
if (last_colon < 0) {
print_line("Error: Invalid breakpoint format. Expected [source:line]");
return breakpoint;
Expand Down
4 changes: 2 additions & 2 deletions godot/core/debugger/remote_debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ void RemoteDebugger::_send_stack_vars(List<String> &p_names, List<Variant> &p_va
}

Error RemoteDebugger::_try_capture(const String &p_msg, const Array &p_data, bool &r_captured) {
const int idx = p_msg.find(":");
const int idx = p_msg.find_char(':');
r_captured = false;
if (idx < 0) { // No prefix, unknown message.
return OK;
Expand Down Expand Up @@ -610,7 +610,7 @@ void RemoteDebugger::poll_events(bool p_is_idle) {
ERR_CONTINUE(arr[1].get_type() != Variant::ARRAY);

const String cmd = arr[0];
const int idx = cmd.find(":");
const int idx = cmd.find_char(':');
bool parsed = false;
if (idx < 0) { // Not prefix, use scripts capture.
capture_parse("core", cmd, arr[1], parsed);
Expand Down
2 changes: 1 addition & 1 deletion godot/core/debugger/remote_debugger_peer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ RemoteDebuggerPeer *RemoteDebuggerPeerTCP::create(const String &p_uri) {
uint16_t debug_port = 6007;

if (debug_host.contains(":")) {
int sep_pos = debug_host.rfind(":");
int sep_pos = debug_host.rfind_char(':');
debug_port = debug_host.substr(sep_pos + 1).to_int();
debug_host = debug_host.substr(0, sep_pos);
}
Expand Down
Loading

0 comments on commit f9db49e

Please sign in to comment.