diff options
Diffstat (limited to 'misc/scripts')
-rwxr-xr-x | misc/scripts/black_format.sh | 2 | ||||
-rwxr-xr-x | misc/scripts/check_ci_log.py | 65 | ||||
-rwxr-xr-x | misc/scripts/clang_format.sh | 4 | ||||
-rwxr-xr-x | misc/scripts/copyright_headers.py | 4 | ||||
-rwxr-xr-x | misc/scripts/file_format.sh | 9 | ||||
-rwxr-xr-x | misc/scripts/make_icons.sh | 2 | ||||
-rwxr-xr-x | misc/scripts/make_tarball.sh | 66 |
7 files changed, 144 insertions, 8 deletions
diff --git a/misc/scripts/black_format.sh b/misc/scripts/black_format.sh index f93e8cbc2a..2ad9a23832 100755 --- a/misc/scripts/black_format.sh +++ b/misc/scripts/black_format.sh @@ -15,7 +15,7 @@ PY_FILES=$(find \( -path "./.git" \ \) -print) black -l 120 $PY_FILES -git diff > patch.patch +git diff --color > patch.patch # If no patch has been generated all is OK, clean up, and exit. if [ ! -s patch.patch ] ; then diff --git a/misc/scripts/check_ci_log.py b/misc/scripts/check_ci_log.py new file mode 100755 index 0000000000..2c75b83bd7 --- /dev/null +++ b/misc/scripts/check_ci_log.py @@ -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) diff --git a/misc/scripts/clang_format.sh b/misc/scripts/clang_format.sh index e686305dea..bcd63aa73b 100755 --- a/misc/scripts/clang_format.sh +++ b/misc/scripts/clang_format.sh @@ -16,6 +16,8 @@ while IFS= read -rd '' f; do continue elif [[ "$f" == "platform/android/java/lib/src/com/google"* ]]; then continue + elif [[ "$f" == *"-so_wrap."* ]]; then + continue fi for extension in ${CLANG_FORMAT_FILE_EXTS[@]}; do @@ -38,7 +40,7 @@ while IFS= read -rd '' f; do done done -git diff > patch.patch +git diff --color > patch.patch # If no patch has been generated all is OK, clean up, and exit. if [ ! -s patch.patch ] ; then diff --git a/misc/scripts/copyright_headers.py b/misc/scripts/copyright_headers.py index bf1e0d3f9c..2f3e4a1b6a 100755 --- a/misc/scripts/copyright_headers.py +++ b/misc/scripts/copyright_headers.py @@ -11,8 +11,8 @@ header = """\ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/misc/scripts/file_format.sh b/misc/scripts/file_format.sh index c570ec23a7..b241f3da70 100755 --- a/misc/scripts/file_format.sh +++ b/misc/scripts/file_format.sh @@ -20,6 +20,9 @@ while IFS= read -rd '' f; do continue elif [[ "$f" == *"sln" ]]; then continue + elif [[ "$f" == *".out" ]]; then + # GDScript integration testing files. + continue elif [[ "$f" == *"patch" ]]; then continue elif [[ "$f" == *"pot" ]]; then @@ -30,6 +33,8 @@ while IFS= read -rd '' f; do continue elif [[ "$f" == "platform/android/java/lib/src/com/google"* ]]; then continue + elif [[ "$f" == *"-so_wrap."* ]]; then + continue fi # Ensure that files are UTF-8 formatted. recode UTF-8 "$f" 2> /dev/null @@ -38,11 +43,9 @@ while IFS= read -rd '' f; do # Remove trailing space characters and ensures that files end # with newline characters. -l option handles newlines conveniently. perl -i -ple 's/\s*$//g' "$f" - # Remove the character sequence "== true" if it has a leading space. - perl -i -pe 's/\x20== true//g' "$f" done -git diff > patch.patch +git diff --color > patch.patch # If no patch has been generated all is OK, clean up, and exit. if [ ! -s patch.patch ] ; then diff --git a/misc/scripts/make_icons.sh b/misc/scripts/make_icons.sh index b590f03d38..cbb9266055 100755 --- a/misc/scripts/make_icons.sh +++ b/misc/scripts/make_icons.sh @@ -20,7 +20,7 @@ zip godot-icons.zip icon*.png icotool -c -o godot-icon.ico icon{16,24,32,48,64,128,256}.png # icns for macOS -# Only some sizes: http://iconhandbook.co.uk/reference/chart/osx/ +# Only some sizes: https://iconhandbook.co.uk/reference/chart/osx/ png2icns godot-icon.icns icon{16,32,128,256,512,1024}.png rm -f icon*.png diff --git a/misc/scripts/make_tarball.sh b/misc/scripts/make_tarball.sh new file mode 100755 index 0000000000..9e02b80af1 --- /dev/null +++ b/misc/scripts/make_tarball.sh @@ -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 |