Skip to content

Commit

Permalink
Merge pull request #81112 from akien-mga/3.x-cherrypicks
Browse files Browse the repository at this point in the history
Cherry-picks for the 3.x branch (future 3.6) - 14th batch
  • Loading branch information
akien-mga authored Aug 29, 2023
2 parents 3c7114e + b19469a commit 98fe7f4
Show file tree
Hide file tree
Showing 171 changed files with 17,055 additions and 10,293 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/android_builds.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: 🤖 Android Builds
on: [push, pull_request]
on:
workflow_call:

# Global Settings
env:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ios_builds.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: 🍏 iOS Builds
on: [push, pull_request]
on:
workflow_call:

# Global Settings
env:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/javascript_builds.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: 🌐 JavaScript Builds
on: [push, pull_request]
on:
workflow_call:

# Global Settings
env:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/linux_builds.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: 🐧 Linux Builds
on: [push, pull_request]
on:
workflow_call:

# Global Settings
env:
Expand Down Expand Up @@ -63,6 +64,12 @@ jobs:
libdbus-1-dev libudev-dev libxi-dev libxrandr-dev yasm xvfb wget unzip \
libspeechd-dev speech-dispatcher
- name: Free disk space on runner
run: |
echo "Disk usage before:" && df -h
sudo rm -rf /usr/local/lib/android
echo "Disk usage after:" && df -h
- name: Setup Godot build cache
uses: ./.github/actions/godot-cache
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/macos_builds.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: 🍎 macOS Builds
on: [push, pull_request]
on:
workflow_call:

# Global Settings
env:
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: 🔗 GHA
on: [push, pull_request]

concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-runner
cancel-in-progress: true

jobs:
static-checks:
name: 📊 Static
uses: ./.github/workflows/static_checks.yml

android-build:
name: 🤖 Android
needs: static-checks
uses: ./.github/workflows/android_builds.yml

ios-build:
name: 🍏 iOS
needs: static-checks
uses: ./.github/workflows/ios_builds.yml

javascript-build:
name: 🌐 JavaScript
needs: static-checks
uses: ./.github/workflows/javascript_builds.yml

linux-build:
name: 🐧 Linux
needs: static-checks
uses: ./.github/workflows/linux_builds.yml

macos-build:
name: 🍎 macOS
needs: static-checks
uses: ./.github/workflows/macos_builds.yml

server-build:
name: ☁ Server
needs: static-checks
uses: ./.github/workflows/server_builds.yml

windows-build:
name: 🏁 Windows
needs: static-checks
uses: ./.github/workflows/windows_builds.yml
3 changes: 2 additions & 1 deletion .github/workflows/server_builds.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: ☁ Server Builds
on: [push, pull_request]
on:
workflow_call:

# Global Settings
env:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/static_checks.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: 📊 Static Checks
on: [push, pull_request]
on:
workflow_call:

concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-static
Expand Down Expand Up @@ -29,6 +30,11 @@ jobs:
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-15 100
sudo pip3 install black==22.3.0 pygments
# This needs to happen before Python and npm execution; it must happen before any extra files are written.
- name: .gitignore checks (gitignore_check.sh)
run: |
bash ./misc/scripts/gitignore_check.sh
- name: File formatting checks (file_format.sh)
run: |
bash ./misc/scripts/file_format.sh
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/windows_builds.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: 🏁 Windows Builds
on: [push, pull_request]
on:
workflow_call:

# Global Settings
# SCONS_CACHE for windows must be set in the build environment
Expand Down
27 changes: 8 additions & 19 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,23 +131,9 @@ cppcheck-cppcheck-build-dir/
*.pydevproject
*.launch

# Gcov and Lcov code coverage
*.gcno
# GCOV code coverage
*.gcda
*.gcov.html
*.func.html
*.func-sort-c.html
*index-sort-f.html
*index-sort-l.html
*index.html
godot.info
amber.png
emerald.png
glass.png
ruby.png
snow.png
updown.png
gcov.css
*.gcno

# Geany
*.geany
Expand Down Expand Up @@ -246,9 +232,6 @@ xcuserdata/
x64/
x86/

# Do not ignore x86 folders anywhere under thirdparty libraries
!thirdparty/**/x86/

[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
Expand All @@ -258,6 +241,12 @@ bld/
[Ll]og/
[Ll]ogs/

# Do not ignore arch-specific folders anywhere under thirdparty libraries
!thirdparty/**/x64/
!thirdparty/**/x86/
!thirdparty/**/arm/
!thirdparty/**/arm64/

# Visual Studio 2015/2017 cache/options directory
.vs/

Expand Down
4 changes: 2 additions & 2 deletions COPYRIGHT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ License: CC0-1.0

Files: ./thirdparty/miniupnpc/
Comment: MiniUPnP Project
Copyright: 2005-2022, Thomas Bernard
Copyright: 2005-2023, Thomas Bernard
License: BSD-3-clause

Files: ./thirdparty/minizip/
Expand Down Expand Up @@ -413,7 +413,7 @@ License: Zlib

Files: ./thirdparty/zstd/
Comment: Zstandard
Copyright: 2016-2021, Facebook, Inc.
Copyright: Meta Platforms, Inc. and affiliates.
License: BSD-3-clause


Expand Down
1 change: 1 addition & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ if selected_platform in platform_list:

if env["werror"]:
env.Append(CCFLAGS=["/WX"])
env.Append(LINKFLAGS=["/WX"])
else: # GCC, Clang
version = methods.get_compiler_version(env) or [-1, -1]

Expand Down
6 changes: 6 additions & 0 deletions core/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2477,6 +2477,9 @@ void Image::_repeat_pixel_over_subsequent_memory(uint8_t *p_pixel, int p_pixel_s
}

void Image::fill(const Color &p_color) {
if (data.size() == 0) {
return;
}
ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot fill in compressed or custom image formats.");

lock();
Expand All @@ -2495,6 +2498,9 @@ void Image::fill(const Color &p_color) {
}

void Image::fill_rect(const Rect2 &p_rect, const Color &p_color) {
if (data.size() == 0) {
return;
}
ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot fill rect in compressed or custom image formats.");

Rect2i r = Rect2i(0, 0, width, height).clip(p_rect.abs());
Expand Down
26 changes: 26 additions & 0 deletions misc/scripts/gitignore_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
set -uo pipefail
shopt -s globstar

echo -e ".gitignore validation..."

# Get a list of files that exist in the repo but are ignored.

# The --verbose flag also includes files un-ignored via ! prefixes.
# We filter those out with a somewhat awkward `awk` directive.
# (Explanation: Split each line by : delimiters,
# see if the actual gitignore line shown in the third field starts with !,
# if it doesn't, print it.)

# ignorecase for the sake of Windows users.

output=$(git -c core.ignorecase=true check-ignore --verbose --no-index **/* | \
awk -F ':' '{ if ($3 !~ /^!/) print $0 }')

# Then we take this result and return success if it's empty.
if [ -z "$output" ]; then
exit 0
else
# And print the result if it isn't.
echo "$output"
exit 1
fi
2 changes: 1 addition & 1 deletion modules/regex/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def can_build(env, platform):
return not env["arch"].startswith("rv")
return True


def configure(env):
Expand Down
4 changes: 3 additions & 1 deletion modules/regex/regex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ static void *_regex_malloc(PCRE2_SIZE size, void *user) {
}

static void _regex_free(void *ptr, void *user) {
memfree(ptr);
if (ptr) {
memfree(ptr);
}
}

int RegExMatch::_find(const Variant &p_name) const {
Expand Down
1 change: 1 addition & 0 deletions platform/android/java/editor/src/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!/debug
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ internal class AssetsDirectoryAccess(context: Context) : DirectoryAccessHandler.
override fun hasDirId(dirId: Int) = dirs.indexOfKey(dirId) >= 0

override fun dirOpen(path: String): Int {
val assetsPath = getAssetsPath(path) ?: return INVALID_DIR_ID
val assetsPath = getAssetsPath(path)
try {
val files = assetManager.list(assetsPath) ?: return INVALID_DIR_ID
// Empty directories don't get added to the 'assets' directory, so
Expand Down Expand Up @@ -99,7 +99,7 @@ internal class AssetsDirectoryAccess(context: Context) : DirectoryAccessHandler.
}

override fun fileExists(path: String): Boolean {
val assetsPath = getAssetsPath(path) ?: return false
val assetsPath = getAssetsPath(path)
try {
val files = assetManager.list(assetsPath) ?: return false
// Empty directories don't get added to the 'assets' directory, so
Expand Down
8 changes: 4 additions & 4 deletions platform/osx/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ def configure(env):
env.Append(CCFLAGS=["-arch", "arm64", "-mmacosx-version-min=10.15"])
env.Append(LINKFLAGS=["-arch", "arm64", "-mmacosx-version-min=10.15"])
else:
print("Building for macOS 10.12+, platform x86-64.")
env.Append(ASFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.12"])
env.Append(CCFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.12"])
env.Append(LINKFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.12"])
print("Building for macOS 10.13+, platform x86-64.")
env.Append(ASFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.13"])
env.Append(CCFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.13"])
env.Append(LINKFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.13"])

if not "osxcross" in env: # regular native build
if env["macports_clang"] != "no":
Expand Down
15 changes: 0 additions & 15 deletions platform/osx/os_osx.mm
Original file line number Diff line number Diff line change
Expand Up @@ -510,11 +510,7 @@ - (id)init {
trackingArea = nil;
imeInputEventInProgress = false;
[self updateTrackingAreas];
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
[self registerForDraggedTypes:[NSArray arrayWithObject:NSPasteboardTypeFileURL]];
#else
[self registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];
#endif
markedText = [[NSMutableAttributedString alloc] init];
return self;
}
Expand Down Expand Up @@ -660,7 +656,6 @@ - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender {
Vector<String> files;
NSPasteboard *pboard = [sender draggingPasteboard];

#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
NSArray *items = pboard.pasteboardItems;
for (NSPasteboardItem *item in items) {
NSString *path = [item stringForType:NSPasteboardTypeFileURL];
Expand All @@ -671,16 +666,6 @@ - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender {
free(utfs);
files.push_back(ret);
}
#else
NSArray *filenames = [pboard propertyListForType:NSFilenamesPboardType];
for (NSString *ns in filenames) {
char *utfs = strdup([ns UTF8String]);
String ret;
ret.parse_utf8(utfs);
free(utfs);
files.push_back(ret);
}
#endif

if (files.size()) {
OS_OSX::singleton->main_loop->drop_files(files, 0);
Expand Down
6 changes: 5 additions & 1 deletion platform/server/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def get_flags():


def configure(env):

## Build type

if env["target"] == "release":
Expand All @@ -76,6 +75,11 @@ def configure(env):
env.Prepend(CCFLAGS=["-g3"])
env.Append(LINKFLAGS=["-rdynamic"])

if env["debug_symbols"]:
# Adding dwarf-4 explicitly makes stacktraces work with clang builds,
# otherwise addr2line doesn't understand them
env.Append(CCFLAGS=["-gdwarf-4"])

## Architecture

is64 = sys.maxsize > 2**32
Expand Down
Loading

0 comments on commit 98fe7f4

Please sign in to comment.