reordered the libs
This commit is contained in:
25
lib/godot-cpp/misc/scripts/black_format.sh
Normal file
25
lib/godot-cpp/misc/scripts/black_format.sh
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script runs black on all Python files in the repo.
|
||||
|
||||
set -uo pipefail
|
||||
|
||||
# Apply black.
|
||||
echo -e "Formatting Python files..."
|
||||
PY_FILES=$(git ls-files -- '*SConstruct' '*SCsub' '*.py' ':!:.git/*' ':!:thirdparty/*')
|
||||
black -l 120 $PY_FILES
|
||||
|
||||
diff=$(git diff --color)
|
||||
|
||||
# If no patch has been generated all is OK, clean up, and exit.
|
||||
if [ -z "$diff" ] ; then
|
||||
printf "Files in this commit comply with the black style rules.\n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# A patch has been created, notify the user, clean up, and exit.
|
||||
printf "\n*** The following differences were found between the code "
|
||||
printf "and the formatting rules:\n\n"
|
||||
echo "$diff"
|
||||
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
|
||||
exit 1
|
65
lib/godot-cpp/misc/scripts/check_ci_log.py
Normal file
65
lib/godot-cpp/misc/scripts/check_ci_log.py
Normal file
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print("ERROR: You must run program with file name as argument.")
|
||||
sys.exit(50)
|
||||
|
||||
fname = sys.argv[1]
|
||||
|
||||
fileread = open(fname.strip(), "r")
|
||||
file_contents = fileread.read()
|
||||
|
||||
# If find "ERROR: AddressSanitizer:", then happens invalid read or write
|
||||
# This is critical bug, so we need to fix this as fast as possible
|
||||
|
||||
if file_contents.find("ERROR: AddressSanitizer:") != -1:
|
||||
print("FATAL ERROR: An incorrectly used memory was found.")
|
||||
sys.exit(51)
|
||||
|
||||
# There is also possible, that program crashed with or without backtrace.
|
||||
|
||||
if (
|
||||
file_contents.find("Program crashed with signal") != -1
|
||||
or file_contents.find("Dumping the backtrace") != -1
|
||||
or file_contents.find("Segmentation fault (core dumped)") != -1
|
||||
):
|
||||
print("FATAL ERROR: Godot has been crashed.")
|
||||
sys.exit(52)
|
||||
|
||||
# Finding memory leaks in Godot is quite difficult, because we need to take into
|
||||
# account leaks also in external libraries. They are usually provided without
|
||||
# debugging symbols, so the leak report from it usually has only 2/3 lines,
|
||||
# so searching for 5 element - "#4 0x" - should correctly detect the vast
|
||||
# majority of memory leaks
|
||||
|
||||
if file_contents.find("ERROR: LeakSanitizer:") != -1:
|
||||
if file_contents.find("#4 0x") != -1:
|
||||
print("ERROR: Memory leak was found")
|
||||
sys.exit(53)
|
||||
|
||||
# It may happen that Godot detects leaking nodes/resources and removes them, so
|
||||
# this possibility should also be handled as a potential error, even if
|
||||
# LeakSanitizer doesn't report anything
|
||||
|
||||
if file_contents.find("ObjectDB instances leaked at exit") != -1:
|
||||
print("ERROR: Memory leak was found")
|
||||
sys.exit(54)
|
||||
|
||||
# In test project may be put several assert functions which will control if
|
||||
# project is executed with right parameters etc. which normally will not stop
|
||||
# execution of project
|
||||
|
||||
if file_contents.find("Assertion failed") != -1:
|
||||
print("ERROR: Assertion failed in project, check execution log for more info")
|
||||
sys.exit(55)
|
||||
|
||||
# For now Godot leaks a lot of rendering stuff so for now we just show info
|
||||
# about it and this needs to be re-enabled after fixing this memory leaks.
|
||||
|
||||
if file_contents.find("were leaked") != -1 or file_contents.find("were never freed") != -1:
|
||||
print("WARNING: Memory leak was found")
|
||||
|
||||
sys.exit(0)
|
31
lib/godot-cpp/misc/scripts/check_get_file_list.py
Normal file
31
lib/godot-cpp/misc/scripts/check_get_file_list.py
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os, sys
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", ".."))
|
||||
|
||||
from binding_generator import get_file_list, generate_bindings
|
||||
|
||||
api_filepath = "gdextension/extension_api.json"
|
||||
bits = "64"
|
||||
precision = "single"
|
||||
output_dir = "self_test"
|
||||
|
||||
generate_bindings(api_filepath, use_template_get_node=False, bits=bits, precision=precision, output_dir=output_dir)
|
||||
flist = get_file_list(api_filepath, output_dir, headers=True, sources=True)
|
||||
|
||||
p = Path(output_dir) / "gen"
|
||||
allfiles = [str(f.as_posix()) for f in p.glob("**/*.*")]
|
||||
missing = list(filter((lambda f: f not in flist), allfiles))
|
||||
extras = list(filter((lambda f: f not in allfiles), flist))
|
||||
if len(missing) > 0 or len(extras) > 0:
|
||||
print("Error!")
|
||||
for f in missing:
|
||||
print("MISSING: " + str(f))
|
||||
for f in extras:
|
||||
print("EXTRA: " + str(f))
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("OK!")
|
38
lib/godot-cpp/misc/scripts/clang_format.sh
Normal file
38
lib/godot-cpp/misc/scripts/clang_format.sh
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script runs clang-format and fixes copyright headers on all relevant files in the repo.
|
||||
# This is the primary script responsible for fixing style violations.
|
||||
|
||||
set -uo pipefail
|
||||
|
||||
# Loops through all code files tracked by Git.
|
||||
git ls-files -- '*.c' '*.h' '*.cpp' '*.hpp' '*.cc' '*.hh' '*.cxx' '*.m' '*.mm' '*.inc' |
|
||||
while read -r f; do
|
||||
# Run clang-format.
|
||||
clang-format --Wno-error=unknown -i "$f"
|
||||
|
||||
# Fix copyright headers, but not all files get them.
|
||||
if [[ "$f" == *"inc" ]]; then
|
||||
continue
|
||||
elif [[ "$f" == *"glsl" ]]; then
|
||||
continue
|
||||
elif [[ "$f" == "test/"* ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
python misc/scripts/copyright_headers.py "$f"
|
||||
done
|
||||
|
||||
diff=$(git diff --color)
|
||||
|
||||
# If no patch has been generated all is OK, clean up, and exit.
|
||||
if [ -z "$diff" ] ; then
|
||||
printf "Files in this commit comply with the clang-tidy style rules.\n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# A patch has been created, notify the user, clean up, and exit.
|
||||
printf "\n*** The following changes have been made to comply with the formatting rules:\n\n"
|
||||
echo "$diff"
|
||||
printf "\n*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
|
||||
exit 1
|
5
lib/godot-cpp/misc/scripts/codespell.sh
Normal file
5
lib/godot-cpp/misc/scripts/codespell.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
SKIP_LIST="./thirdparty,*.gen.*,*.po,*.pot,package-lock.json,./core/string/locales.h,./DONORS.md,./misc/scripts/codespell.sh"
|
||||
IGNORE_LIST="ba,childs,curvelinear,expct,fave,findn,gird,inout,lod,nd,numer,ois,ro,statics,te,varn"
|
||||
|
||||
codespell -w -q 3 -S "${SKIP_LIST}" -L "${IGNORE_LIST}"
|
95
lib/godot-cpp/misc/scripts/copyright_headers.py
Normal file
95
lib/godot-cpp/misc/scripts/copyright_headers.py
Normal file
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
|
||||
header = """\
|
||||
/**************************************************************************/
|
||||
/* $filename */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
"""
|
||||
|
||||
fname = sys.argv[1]
|
||||
|
||||
# Handle replacing $filename with actual filename and keep alignment
|
||||
fsingle = fname.strip()
|
||||
if fsingle.find("/") != -1:
|
||||
fsingle = fsingle[fsingle.rfind("/") + 1 :]
|
||||
rep_fl = "$filename"
|
||||
rep_fi = fsingle
|
||||
len_fl = len(rep_fl)
|
||||
len_fi = len(rep_fi)
|
||||
# Pad with spaces to keep alignment
|
||||
if len_fi < len_fl:
|
||||
for x in range(len_fl - len_fi):
|
||||
rep_fi += " "
|
||||
elif len_fl < len_fi:
|
||||
for x in range(len_fi - len_fl):
|
||||
rep_fl += " "
|
||||
if header.find(rep_fl) != -1:
|
||||
text = header.replace(rep_fl, rep_fi)
|
||||
else:
|
||||
text = header.replace("$filename", fsingle)
|
||||
text += "\n"
|
||||
|
||||
# We now have the proper header, so we want to ignore the one in the original file
|
||||
# and potentially empty lines and badly formatted lines, while keeping comments that
|
||||
# come after the header, and then keep everything non-header unchanged.
|
||||
# To do so, we skip empty lines that may be at the top in a first pass.
|
||||
# In a second pass, we skip all consecutive comment lines starting with "/*",
|
||||
# then we can append the rest (step 2).
|
||||
|
||||
fileread = open(fname.strip(), "r")
|
||||
line = fileread.readline()
|
||||
header_done = False
|
||||
|
||||
while line.strip() == "": # Skip empty lines at the top
|
||||
line = fileread.readline()
|
||||
|
||||
if line.find("/**********") == -1: # Godot header starts this way
|
||||
# Maybe starting with a non-Godot comment, abort header magic
|
||||
header_done = True
|
||||
|
||||
while not header_done: # Handle header now
|
||||
if line.find("/*") != 0: # No more starting with a comment
|
||||
header_done = True
|
||||
if line.strip() != "":
|
||||
text += line
|
||||
line = fileread.readline()
|
||||
|
||||
while line != "": # Dump everything until EOF
|
||||
text += line
|
||||
line = fileread.readline()
|
||||
|
||||
fileread.close()
|
||||
|
||||
# Write
|
||||
filewrite = open(fname.strip(), "w")
|
||||
filewrite.write(text)
|
||||
filewrite.close()
|
41
lib/godot-cpp/misc/scripts/file_format.sh
Normal file
41
lib/godot-cpp/misc/scripts/file_format.sh
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script ensures proper POSIX text file formatting and a few other things.
|
||||
# This is supplementary to clang_format.sh and black_format.sh, but should be
|
||||
# run before them.
|
||||
|
||||
# We need dos2unix and recode.
|
||||
if [ ! -x "$(command -v dos2unix)" -o ! -x "$(command -v recode)" ]; then
|
||||
printf "Install 'dos2unix' and 'recode' to use this script.\n"
|
||||
fi
|
||||
|
||||
set -uo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
# Loops through all text files tracked by Git.
|
||||
git grep -zIl '' |
|
||||
while IFS= read -rd '' f; do
|
||||
# Ensure that files are UTF-8 formatted.
|
||||
recode UTF-8 "$f" 2> /dev/null
|
||||
# Ensure that files have LF line endings and do not contain a BOM.
|
||||
dos2unix "$f" 2> /dev/null
|
||||
# Remove trailing space characters and ensures that files end
|
||||
# with newline characters. -l option handles newlines conveniently.
|
||||
perl -i -ple 's/\s*$//g' "$f"
|
||||
done
|
||||
|
||||
diff=$(git diff --color)
|
||||
|
||||
# If no patch has been generated all is OK, clean up, and exit.
|
||||
if [ -z "$diff" ] ; then
|
||||
printf "Files in this commit comply with the formatting rules.\n"
|
||||
rm -f patch.patch
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# A patch has been created, notify the user, clean up, and exit.
|
||||
printf "\n*** The following differences were found between the code "
|
||||
printf "and the formatting rules:\n\n"
|
||||
echo "$diff"
|
||||
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
|
||||
exit 1
|
60
lib/godot-cpp/misc/scripts/header_guards.sh
Normal file
60
lib/godot-cpp/misc/scripts/header_guards.sh
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -f "SConstruct" ]; then
|
||||
echo "Warning: This script is intended to be run from the root of the Godot repository."
|
||||
echo "Some of the paths checks may not work as intended from a different folder."
|
||||
fi
|
||||
|
||||
files_invalid_guard=""
|
||||
|
||||
for file in $(find . -name "*.hpp" -print); do
|
||||
# Skip generated files.
|
||||
if [[ "$file" == "./gen/"* || "$file" == "./include/gen/"* ]]; then continue; fi
|
||||
# Skip the test project.
|
||||
if [[ "$file" == "./test/"* ]]; then continue; fi
|
||||
|
||||
bname=$(basename $file .hpp)
|
||||
|
||||
# NOTE: The "GODOT_CPP_" prefix is already used by the generated
|
||||
# bindings, so we can't use that. We'll use "GODOT_" instead.
|
||||
prefix="GODOT_"
|
||||
|
||||
# ^^ is bash builtin for UPPERCASE.
|
||||
guard="${prefix}${bname^^}_HPP"
|
||||
|
||||
# Replaces guards to use computed name.
|
||||
# We also add some \n to make sure there's a proper separation.
|
||||
sed -i $file -e "0,/ifndef/s/#ifndef.*/\n#ifndef $guard/"
|
||||
sed -i $file -e "0,/define/s/#define.*/#define $guard\n/"
|
||||
sed -i $file -e "$ s/#endif.*/\n#endif \/\/ $guard/"
|
||||
# Removes redundant \n added before, if they weren't needed.
|
||||
sed -i $file -e "/^$/N;/^\n$/D"
|
||||
|
||||
# Check that first ifndef (should be header guard) is at the expected position.
|
||||
# If not it can mean we have some code before the guard that should be after.
|
||||
# "31" is the expected line with the copyright header.
|
||||
first_ifndef=$(grep -n -m 1 "ifndef" $file | sed 's/\([0-9]*\).*/\1/')
|
||||
if [[ "$first_ifndef" != "31" ]]; then
|
||||
files_invalid_guard+="$file\n"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ! -z "$files_invalid_guard" ]]; then
|
||||
echo -e "The following files were found to have potentially invalid header guard:\n"
|
||||
echo -e "$files_invalid_guard"
|
||||
fi
|
||||
|
||||
diff=$(git diff --color)
|
||||
|
||||
# If no diff has been generated all is OK, clean up, and exit.
|
||||
if [ -z "$diff" ] ; then
|
||||
printf "Files in this commit comply with the header guards formatting rules.\n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# A diff has been created, notify the user, clean up, and exit.
|
||||
printf "\n*** The following differences were found between the code "
|
||||
printf "and the header guards formatting rules:\n\n"
|
||||
echo "$diff"
|
||||
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
|
||||
exit 1
|
66
lib/godot-cpp/misc/scripts/make_tarball.sh
Normal file
66
lib/godot-cpp/misc/scripts/make_tarball.sh
Normal file
@@ -0,0 +1,66 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -e "version.py" ]; then
|
||||
echo "This script should be ran from the root folder of the Godot repository."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while getopts "h?sv:g:" opt; do
|
||||
case "$opt" in
|
||||
h|\?)
|
||||
echo "Usage: $0 [OPTIONS...]"
|
||||
echo
|
||||
echo " -s script friendly file name (godot.tar.gz)"
|
||||
echo " -v godot version for file name (e.g. 4.0-stable)"
|
||||
echo " -g git treeish to archive (e.g. master)"
|
||||
echo
|
||||
exit 1
|
||||
;;
|
||||
s)
|
||||
script_friendly_name=1
|
||||
;;
|
||||
v)
|
||||
godot_version=$OPTARG
|
||||
;;
|
||||
g)
|
||||
git_treeish=$OPTARG
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ! -z "$git_treeish" ]; then
|
||||
HEAD=$(git rev-parse $git_treeish)
|
||||
else
|
||||
HEAD=$(git rev-parse HEAD)
|
||||
fi
|
||||
|
||||
if [ ! -z "$script_friendly_name" ]; then
|
||||
NAME=godot
|
||||
else
|
||||
if [ ! -z "$godot_version" ]; then
|
||||
NAME=godot-$godot_version
|
||||
else
|
||||
NAME=godot-$HEAD
|
||||
fi
|
||||
fi
|
||||
|
||||
CURDIR=$(pwd)
|
||||
TMPDIR=$(mktemp -d -t godot-XXXXXX)
|
||||
|
||||
echo "Generating tarball for revision $HEAD with folder name '$NAME'."
|
||||
echo
|
||||
echo "The tarball will be written to the parent folder:"
|
||||
echo " $(dirname $CURDIR)/$NAME.tar.gz"
|
||||
|
||||
git archive $HEAD --prefix=$NAME/ -o $TMPDIR/$NAME.tar
|
||||
|
||||
# Adding custom .git/HEAD to tarball so that we can generate VERSION_HASH.
|
||||
cd $TMPDIR
|
||||
mkdir -p $NAME/.git
|
||||
echo $HEAD > $NAME/.git/HEAD
|
||||
tar -uf $NAME.tar $NAME
|
||||
|
||||
cd $CURDIR
|
||||
gzip -c $TMPDIR/$NAME.tar > ../$NAME.tar.gz
|
||||
|
||||
rm -rf $TMPDIR
|
11
lib/godot-cpp/misc/scripts/mypy.ini
Normal file
11
lib/godot-cpp/misc/scripts/mypy.ini
Normal file
@@ -0,0 +1,11 @@
|
||||
[mypy]
|
||||
ignore_missing_imports = true
|
||||
disallow_any_generics = True
|
||||
pretty = True
|
||||
show_column_numbers = True
|
||||
warn_redundant_casts = True
|
||||
warn_return_any = True
|
||||
warn_unreachable = True
|
||||
|
||||
namespace_packages = True
|
||||
explicit_package_bases = True
|
6
lib/godot-cpp/misc/scripts/mypy_check.sh
Normal file
6
lib/godot-cpp/misc/scripts/mypy_check.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -uo pipefail
|
||||
|
||||
echo -e "Python: mypy static analysis..."
|
||||
mypy --config-file=./misc/scripts/mypy.ini .
|
Reference in New Issue
Block a user