Compare commits

..

10 commits

Author SHA1 Message Date
Celtic Minstrel
231a908601 [LuaDoc] WIP Partially validate unit WML when creating units from Lua 2024-08-13 08:53:02 -04:00
Celtic Minstrel
1089884c07 [LuaDoc] Mark filesystem.asset_type as an enumerator 2024-08-13 08:53:02 -04:00
Celtic Minstrel
b060f06a12 [Lua] Read campaign ID from scenario settings instead of mp_settings. 2024-08-13 08:53:01 -04:00
Celtic Minstrel
fd97d37c41 [Lua] Add some TODO notes on things to come back to later. 2024-08-13 08:53:01 -04:00
Celtic Minstrel
d9073e01fb [Lua] Remove some internal implementation functions from the external ai_helper interface.
There are no callers in mainline. The functions are not meant to be called directly at all – for each, there are wrapper functions that are intended to be called instead, which are still exposed.
2024-08-13 08:53:01 -04:00
Celtic Minstrel
6dd8622ab8 [Lua] Avoid missing field warning by reversing the order of the check 2024-08-13 08:53:01 -04:00
Celtic Minstrel
f082ce89f7 [Lua] Fix some accidental global warnings 2024-08-13 08:53:01 -04:00
Celtic Minstrel
d1bab92d4f [Lua] Mark location_set.values as private 2024-08-13 08:53:00 -04:00
Celtic Minstrel
a5537dba4f [Lua] Avoid variable reuse as a different type 2024-08-13 08:53:00 -04:00
Celtic Minstrel
310c43a4c4 [Lua] Suppress some diagnostics and also recommend suppressing certain diagnostics globally 2024-08-13 08:53:00 -04:00
21179 changed files with 341394 additions and 421344 deletions

View file

@ -1,4 +0,0 @@
---
Checks: '-*,modernize-use-nullptr,performance-unnecessary-value-param'
WarningsAsErrors: true
...

View file

@ -41,12 +41,12 @@ jobs:
if: success() || failure()
run: doxygen doc/doxygen/Doxyfile
copyright: # check takes a bit longer and does not need to run in docker (sound/music only)
copyright: # check takes a bit longer and does not need to run in docker
runs-on: ubuntu-latest
steps:
- { uses: actions/checkout@v4, with: { fetch-depth: 50 } }
- name: Sound/Music copyright check
- name: Copyright check
run: ./update_copyrights
ubuntu:
@ -54,10 +54,8 @@ jobs:
fail-fast: false
matrix:
include:
# the check for WML tests below may need to be adjusted if configurations are changed
- { cfg: debug, tool: scons, cc: gcc, cxx: g++, std: 17, lto: false, sys_lua: false }
- { cfg: release, tool: cmake, cc: gcc, cxx: g++, std: 20, lto: true, sys_lua: false }
- { cfg: release, tool: cmake, cc: clang, cxx: clang++, std: 17, lto: true, sys_lua: true }
- { tool: scons, cc: gcc, cxx: g++, cfg: debug, lto: false, sys_lua: false }
- { tool: cmake, cc: clang, cxx: clang++, cfg: release, lto: true, sys_lua: true }
runs-on: ubuntu-latest
container:
image: wesnoth/wesnoth:2404-master
@ -67,7 +65,7 @@ jobs:
CFG: ${{ matrix.cfg }}
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
CXX_STD: ${{ matrix.std }}
CXX_STD: 17
LTO: ${{ matrix.lto }}
SYS_LUA: ${{ matrix.sys_lua }}
CLICOLOR_FORCE: 1
@ -90,15 +88,10 @@ jobs:
scons "$@" build="$CFG" ctool="$CC" cxxtool="$CXX" cxx_std="$CXX_STD" \
extra_flags_config="-pipe" forum_user_handler=true \
nls=false enable_lto="$LTO" system_lua="$SYS_LUA" force_color=true \
jobs=2 --debug=time glibcxx_debug=true glibcxx_assertions=true compile_db=true
jobs=2 --debug=time glibcxx_debug=true glibcxx_assertions=true
}
build strict=true wesnoth boost_unit_tests
build cdb
# disable all warnings since we have coverage on them in a standard build, and clang-tidy
# triggers false positive compiler warnings that clang itself won't
run-clang-tidy -quiet -use-color -j 2 -extra-arg="-w" -warnings-as-errors='*' '^(?!.*src/modules/|.*build/)'
apt remove -y -qq libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev
build strict=false wesnothd campaignd
@ -109,7 +102,7 @@ jobs:
cmake "$@" -DCMAKE_BUILD_TYPE="$CFG" -DCXX_STD="$CXX_STD" \
-DEXTRA_FLAGS_CONFIG="-pipe" -DENABLE_MYSQL=true \
-DENABLE_NLS=false -DENABLE_LTO="$LTO" -DFORCE_COLOR_OUTPUT=true -DLTO_JOBS=2 \
-DENABLE_SYSTEM_LUA="$SYS_LUA -DCLANG_TIDY=true" .
-DENABLE_SYSTEM_LUA="$SYS_LUA" .
}
rm -R /usr/local/lib/cmake
rm /usr/local/lib/libboost*
@ -128,27 +121,20 @@ jobs:
if: success() || steps.build.outcome == 'success'
run: |
./wesnoth --version
for opt in data userdata usercache
for opt in data userdata
do
output=$(./wesnoth --nobanner --"$opt"-path)
if [ "$output" = "" ]; then printf 'option --%s-path prints nothing to stdout!\n' "$opt" >&2; exit 1; fi
printf '%s-path: %s\n' "$opt" "$output"
done
- name: WML validation
# only run on release builds (takes ~10 times as long on debug); since there are multiple release builds
# but running the following tests multiple times doesn't make much sense use cc==clang as the check
if: matrix.cc == 'clang' && (success() || steps.build.outcome == 'success')
# only run on release builds (takes ~10 times as long on debug)
if: matrix.cfg == 'release' && (success() || steps.build.outcome == 'success')
run: ./utils/CI/schema_validation.sh
- name: Run WML tests
# only run on release builds (takes ~6 times as long on debug)
if: matrix.cc == 'clang' && (success() || steps.build.outcome == 'success')
run: ./run_wml_tests -v -v -g -c -t 20 -bt 1000 -a=--userdata-dir=ud
- name: Upload userdata files from WML unit tests (logs, replays)
if: matrix.cc == 'clang' && (success() || failure())
uses: actions/upload-artifact@v4
with:
name: WMLTest-userdata-Linux
path: ud
if: matrix.cfg == 'release' && (success() || steps.build.outcome == 'success')
run: ./run_wml_tests -g -c -t 20 -bt 1000
- name: Run play tests
if: success() || steps.build.outcome == 'success'
run: ./utils/CI/play_test_executor.sh
@ -263,8 +249,8 @@ jobs:
strategy:
fail-fast: false
matrix:
cfg: [ Release ]
runs-on: macos-13
cfg: [ Debug, Release ]
runs-on: macos-12
env:
CFG: ${{ matrix.cfg }}
@ -288,7 +274,6 @@ jobs:
[ -x "build/$CFG/unit_tests" ] || { printf 'Failed to build unit test executable!\n' >&2; exit 1; }
- name: Create disk image
working-directory: projectfiles/Xcode
continue-on-error: true # allow failures since this is not essential and it does fail spuriously (hdiutil: create failed - Resource busy)
run: hdiutil create -volname "Wesnoth_$CFG" -fs 'HFS+' -srcfolder "build/$CFG" -ov -format UDBZ "Wesnoth_${CFG}.dmg"
- name: Upload disk image
uses: actions/upload-artifact@v4
@ -297,13 +282,7 @@ jobs:
path: projectfiles/Xcode/Wesnoth_${{ matrix.cfg }}.dmg
- name: Run WML tests
if: matrix.cfg == 'Release'
run: ./run_wml_tests -g -c -t 30 -bt 350 -p "projectfiles/Xcode/build/$CFG/The Battle for Wesnoth.app/Contents/MacOS/The Battle for Wesnoth" -a=--userdata-dir="$PWD/ud"
- name: Upload userdata files from WML unit tests (logs, replays)
if: matrix.cfg == 'Release' && (success() || failure())
uses: actions/upload-artifact@v4
with:
name: WMLTest-userdata-MacOS
path: ud
run: ./run_wml_tests -g -c -t 30 -p "projectfiles/Xcode/build/$CFG/The Battle for Wesnoth.app/Contents/MacOS/The Battle for Wesnoth"
- name: Run unit tests
run: ./run_boost_tests --path=projectfiles/Xcode/build/"$CFG" --executable=unit_tests
@ -311,7 +290,7 @@ jobs:
strategy:
fail-fast: false
matrix:
cfg: [Release]
cfg: [Debug, Release]
env:
CFG: ${{ matrix.cfg }}
VCPKG_FEATURE_FLAGS: dependencygraph
@ -320,7 +299,7 @@ jobs:
defaults:
run:
shell: cmd
runs-on: windows-latest
runs-on: windows-2019
steps:
- { uses: actions/checkout@v4, with: { submodules: "recursive" } }
@ -343,21 +322,14 @@ jobs:
run: cmake -DCMAKE_BUILD_TYPE=%CFG% -DENABLE_GAME=true -DENABLE_SERVER=true -DENABLE_CAMPAIGN_SERVER=true
-DENABLE_TESTS=true -DENABLE_MYSQL=false -DENABLE_NLS=false
-DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake -DVCPKG_INSTALL_OPTIONS=--debug
-DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_GENERATOR_PLATFORM=x64 -G "Visual Studio 17 2022" .
-DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_GENERATOR_PLATFORM=x64 -G "Visual Studio 16 2019" .
- name: Build wesnoth, wesnothd, campaignd and unit tests
run: MSBuild.exe wesnoth.sln -p:Configuration=%CFG%
- name: Run WML unit tests
if: matrix.cfg == 'Release'
run: python run_wml_tests -v -g -c -t 20 -p %CFG%/wesnoth.exe -a=--userdata-dir=ud
- name: Upload userdata files from WML unit tests (logs, replays)
if: matrix.cfg == 'Release' && (success() || failure())
uses: actions/upload-artifact@v4
with:
name: WMLTest-userdata-Windows
path: ud
run: python run_wml_tests -v -g -c -t 20 -p %CFG%/wesnoth.exe
# run after all other jobs have completed to check overall build status
notification:

View file

@ -16,7 +16,7 @@ jobs:
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
timeout-minutes: 360
permissions:
actions: read
@ -50,12 +50,11 @@ jobs:
- name: Install dependencies
if: matrix.language == 'cpp'
run: |
utils/autorevision.sh -t h > src/revision.h
sudo apt update
sudo apt install scons libboost-system1.83-dev libboost-filesystem1.83-dev libboost-iostreams1.83-dev \
libboost-serialization1.83-dev libboost-locale1.83-dev libboost-regex1.83-dev libboost-random1.83-dev \
libboost-program-options1.83-dev libboost-thread1.83-dev libboost-context1.83-dev libboost-test-dev \
libboost-coroutine1.83-dev libboost-graph1.83-dev libasio-dev libsdl2-dev libsdl2-image-dev \
sudo apt install scons libboost-system1.74-dev libboost-filesystem1.74-dev libboost-iostreams1.74-dev \
libboost-serialization1.74-dev libboost-locale1.74-dev libboost-regex1.74-dev libboost-random1.74-dev \
libboost-program-options1.74-dev libboost-thread1.74-dev libboost-context1.74-dev libboost-test-dev \
libboost-coroutine1.74-dev libboost-graph1.74-dev libasio-dev libsdl2-dev libsdl2-image-dev \
libsdl2-mixer-dev libvorbis-dev libpango1.0-dev libssl-dev libcurl4-openssl-dev liblua5.4-dev
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
- name: Autobuild

View file

@ -1,88 +0,0 @@
name: Image metadata check CI
on:
push:
branches: [ master ]
paths: [ '**.webp', '**.png', '**.jpg', '**.jpeg' ]
pull_request:
paths: [ '**.webp', '**.png', '**.jpg', '**.jpeg' ]
permissions:
contents: read
jobs:
build:
name: Image Metadata
runs-on: ubuntu-latest
env:
BASE_SHA: ${{ github.event_name == 'push' && github.event.before || github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event_name == 'push' && github.event.after || github.event.pull_request.head.sha }}
steps:
- name: exiftool installation
run: |
sudo apt-get install --assume-yes exiftool
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: check image EXIF metadata
run: |
mapfile -t image_files < <(git diff --name-only --diff-filter=d "$BASE_SHA" "$HEAD_SHA" | grep -E '\.(webp|je?pg)$')
# cycle through the changed image files, make sure they have the right fields
for file in "${image_files[@]}"; do
# check Artist tag, fail if missing
artist="$(exiftool -p '$Artist' "$file")"
if [ "$artist" ]; then
printf 'Artist tag in %s is %s\n' "$file" "$artist"
else
printf 'no Artist EXIF tag in %s\n' "$file"
exit 1
fi
# check Copyright tag, fail if missing or wrong type
copyright="$(exiftool -p '$Copyright' "$file")"
case $copyright in
'GNU GPL v2+'|'CC BY-SA 4.0'|CC0)
printf 'Copyright tag in %s is %s\n' "$file" "$copyright"
;;
'')
printf 'no Copyright EXIF tag in %s\n' "$file"
exit 1
;;
*)
printf 'Copyright tag %s in file %s is not an accepted license! Must be one of: "GNU GPL v2+", "CC BY-SA 4.0", "CC0"\n' "$copyright" "$file"
exit 1
;;
esac
done
- name: check png XMP metadata
run: |
mapfile -t image_files < <(git diff --name-only --diff-filter=d "$BASE_SHA" "$HEAD_SHA" | grep -E '\.png$')
# cycle through the changed image files, make sure they have the right fields
for file in "${image_files[@]}"; do
# check Creator tag, fail if missing
artist="$(exiftool -p '$XMP:Creator' "$file")"
if [ "$artist" ]; then
printf 'Creator tag in %s is %s\n' "$file" "$artist"
else
printf 'no Creator XMP tag in %s\n' "$file"
exit 1
fi
# check Rights tag, fail if missing or wrong type
copyright="$(exiftool -p '$XMP:Rights' "$file")"
case $copyright in
'GNU GPL v2+'|'CC BY-SA 4.0'|CC0)
printf 'Rights tag in %s is %s\n' "$file" "$copyright"
;;
'')
printf 'no Rights XMP tag in %s\n' "$file"
exit 1
;;
*)
printf 'Rights tag %s in file %s is not an accepted license! Must be one of: "GNU GPL v2+", "CC BY-SA 4.0", "CC0"\n' "$copyright" "$file"
exit 1
;;
esac
done

1
.gitignore vendored
View file

@ -127,7 +127,6 @@ wesnoth.plg
*.exe
*.dll
*.so
compile_commands.json
# library files
.libs

View file

@ -1,4 +1,4 @@
# set minimum version
# set minimum version
cmake_minimum_required(VERSION 3.14)
project(wesnoth)
@ -171,7 +171,6 @@ option(GLIBCXX_ASSERTIONS "Whether to define _GLIBCXX_ASSERTIONS" OFF)
option(GLIBCXX_DEBUG "Whether to define _GLIBCXX_DEBUG and _GLIBCXX_DEBUG_PEDANTIC. Requires a version of Boost's program_options that's compiled with __GLIBCXX_DEBUG too." OFF)
option(ENABLE_POT_UPDATE_TARGET "Enables the tools to update the pot files and manuals. This target has extra dependencies." OFF)
option(FORCE_COLOR_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." FALSE)
option(CLANG_TIDY "Enable clang-tidy linter checks." OFF)
if(UNIX AND NOT APPLE AND NOT CYGWIN)
option(ENABLE_NOTIFICATIONS "Enable Window manager notification messages" ON)
@ -256,11 +255,6 @@ if(NOT MSVC)
endif()
endif()
### Enable clang-tidy linting
if (CLANG_TIDY)
set(CMAKE_CXX_CLANG_TIDY "clang-tidy -Wno-unknown-warning-option")
endif()
### Set the final compiler flags.
set(COMPILER_FLAGS "${COMPILER_FLAGS} ${CXX_FLAGS_USER}")
@ -480,7 +474,7 @@ if(NOT MSVC)
else()
set(CMAKE_CXX_FLAGS "/W3 /WX /wd4503 /wd4351 /wd4250 /wd4244 /wd4267 /we4239 /wd4275 /EHsc /utf-8 /Zc:__cplusplus" CACHE STRING "Global flags used by the CXX compiler during all builds." FORCE)
set(CMAKE_C_FLAGS "/WX" CACHE STRING "Global flags used by the C compiler during all builds." FORCE)
add_definitions(-D_WIN32_WINNT=0x0A00 -D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS -DNOMINMAX)
add_definitions(-D_WIN32_WINNT=0x0601 -D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS -DNOMINMAX)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG_LUA")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO")

View file

@ -2,7 +2,7 @@
## Prerequisites
Wesnoth requires a compiler with sufficient C++17 support such as GCC 11 and
Wesnoth requires a compiler with sufficient C++17 support such as GCC 8 and
later, or a version of Clang with equivalent support.
You'll need to have these libraries and their development headers installed in
@ -19,7 +19,6 @@ order to build Wesnoth:
* System
* Coroutine
* Graph
* Charconv (This requires boost 1.85 or higher and is optional but reccomended especially for clang builds)
* SDL2 libraries:
* SDL2 >= 2.0.18 (macOS: 2.0.22 due to needing https://github.com/libsdl-org/SDL/commit/3bebdaccb7bff8c40438856081d404a7ce3def30)
* SDL2_image >= 2.0.2 (with PNG, JPEG, and WEBP support)

View file

@ -120,7 +120,6 @@ opts.AddVariables(
BoolVariable("OS_ENV", "Forward the entire OS environment to scons", False),
BoolVariable("history", "Clear to disable GNU history support in lua console", True),
BoolVariable('force_color', 'Always produce ANSI-colored output (GNU/Clang only).', False),
BoolVariable('compile_db', 'Produce a compile_commands.json file.', False),
)
#
@ -190,11 +189,6 @@ if env['distcc']:
if env['ccache']: env.Tool('ccache')
if env['compile_db']:
env.Tool('compilation_db')
cdb = env.CompilationDatabase()
Alias('cdb', cdb)
boost_version = "1.67"
def SortHelpText(a, b):
@ -385,7 +379,6 @@ if env["prereqs"]:
conf.CheckBoost("program_options", require_version = boost_version) & \
conf.CheckBoost("random", require_version = boost_version) & \
conf.CheckBoost("smart_ptr", header_only = True) & \
conf.CheckBoostCharconv() & \
CheckAsio(conf) & \
conf.CheckBoost("thread") & \
conf.CheckBoost("locale") & \
@ -672,7 +665,7 @@ for env in [test_env, client_env, env]:
env[d] = os.path.join(env["prefix"], env[d])
if env["PLATFORM"] == 'win32':
env.Append(LIBS = ["wsock32", "crypt32", "iconv", "z", "shlwapi", "winmm", "ole32", "uuid"], CCFLAGS = ["-mthreads"], LINKFLAGS = ["-mthreads"], CPPDEFINES = ["_WIN32_WINNT=0x0A00"])
env.Append(LIBS = ["wsock32", "crypt32", "iconv", "z", "shlwapi", "winmm", "ole32", "uuid"], CCFLAGS = ["-mthreads"], LINKFLAGS = ["-mthreads"], CPPDEFINES = ["_WIN32_WINNT=0x0601"])
if env["PLATFORM"] == 'darwin': # Mac OS X
env.Append(FRAMEWORKS = "Cocoa") # Cocoa GUI

View file

@ -81,7 +81,7 @@ code_blocks_target_translations = {
# XCode #
#=======#
def modify_xcode(filename, targets, remove):
def add_to_xcode(filename, targets):
"""Add the given file to the specified targets.
"""
projectfile = rootdir.joinpath(
@ -121,29 +121,24 @@ def modify_xcode(filename, targets, remove):
raise Exception(f"problem finding '{d}' group in '{groupname}'")
parent_group = found_groups[0]
if remove :
# Remove from all targets if we want to remove
for file in project.get_files_by_name(filename.name, parent=parent_group):
project.remove_file_by_id(file.get_id())
else:
# if the group already has an entry with the same filename, loudly skip.
# note: this doesn't allow adding to targets one at a time.
# a new file should be added to all targets at once...
# or maybe targets could be checked somehow,
# or maybe the file could simply be completely removed and readded.
if project.get_files_by_name(filename.name, parent=parent_group):
print(" '"+filename.name+"' already found in Xcode project '"+",".join(translated_targets)+"', skipping")
return
# if the group already has an entry with the same filename, loudly skip.
# note: this doesn't allow adding to targets one at a time.
# a new file should be added to all targets at once...
# or maybe targets could be checked somehow,
# or maybe the file could simply be completely removed and readded.
if project.get_files_by_name(filename.name, parent=parent_group):
print(" '"+filename.name+"' already found in Xcode project '"+",".join(translated_targets)+"', skipping")
return
# force is True here because otherwise a duplicate filename in
# a different place will block addition of the new file.
# the rest is just to match existing project file structure.
project.add_file(filename.name,
force=True,
tree="<group>",
parent=parent_group,
target_name=translated_targets,
)
# force is True here because otherwise a duplicate filename in
# a different place will block addition of the new file.
# the rest is just to match existing project file structure.
project.add_file(filename.name,
force=True,
tree="<group>",
parent=parent_group,
target_name=translated_targets,
)
# that's done, save the file
project.save()
@ -153,7 +148,7 @@ def modify_xcode(filename, targets, remove):
# source_lists #
#==============#
def modify_source_list(filename, source_list, remove):
def add_to_source_list(filename, source_list):
source_list_file = rootdir.joinpath("source_lists", source_list)
sl_lines = open(source_list_file).readlines()
file_line = filename.as_posix() + '\n'
@ -162,16 +157,12 @@ def modify_source_list(filename, source_list, remove):
if filename.suffix != ".cpp":
return
if remove:
if file_line in sl_lines: sl_lines.remove(file_line)
else:
# if the target already has an entry with the same filename, loudly skip
if file_line in sl_lines:
print(f" '{filename}' already found in '{source_list}', skipping")
return
sl_lines.append(file_line)
# if the target already has an entry with the same filename, loudly skip
if file_line in sl_lines:
print(f" '{filename}' already found in '{source_list}', skipping")
return
sl_lines.append(file_line)
sl_lines.sort()
open(source_list_file, 'w').writelines(sl_lines)
@ -179,18 +170,13 @@ def add_to_source_lists(filename, targets):
translated_targets = [source_list_target_translations[t] for t in targets]
print(" source_list targets:", translated_targets)
for t in translated_targets:
modify_source_list(filename, t, False)
def remove_from_source_lists(filename):
# remove from all tagerts if -r was specified.
for t in source_list_target_translations.values():
modify_source_list(filename, t, True)
add_to_source_list(filename, t)
#==============#
# Code::Blocks #
#==============#
def modify_code_blocks_target(filename, target, remove):
def add_to_code_blocks_target(filename, target):
cbp_file = rootdir.joinpath(
"projectfiles",
"CodeBlocks",
@ -204,33 +190,30 @@ def modify_code_blocks_target(filename, target, remove):
elem = f"\t\t<Unit filename=\"{filename_for_cbp}\" />\n"
if remove:
if elem in cbp_lines: cbp_lines.remove(elem)
else:
# if the target already has an entry with the same filename, loudly skip
if elem in cbp_lines:
print(f" '{filename}' already found in '{target}.cbp', skipping")
return
# if the target already has an entry with the same filename, loudly skip
if elem in cbp_lines:
print(f" '{filename}' already found in '{target}.cbp', skipping")
return
# find an appropriate line to add before/after
index = 0
for line in cbp_lines:
if line.startswith("\t\t<Unit "):
if elem < line:
break
elif line.startswith("\t\t<Extensions>"):
# we must be the last entry, as this comes after the Unit section
# find an appropriate line to add before/after
index = 0
for line in cbp_lines:
if line.startswith("\t\t<Unit "):
if elem < line:
break
index += 1
cbp_lines.insert(index, elem)
elif line.startswith("\t\t<Extensions>"):
# we must be the last entry, as this comes after the Unit section
break
index += 1
cbp_lines.insert(index, elem)
open(cbp_file, 'w').writelines(cbp_lines)
def modify_code_blocks(filename, targets, remove):
translated_targets = code_blocks_target_translations.values() if remove else [code_blocks_target_translations[t] for t in targets]
def add_to_code_blocks(filename, targets):
translated_targets = [code_blocks_target_translations[t] for t in targets]
print(" code::blocks targets:", translated_targets)
for t in translated_targets:
modify_code_blocks_target(filename, t, remove)
add_to_code_blocks_target(filename, t)
def sanity_check_existing_cpp_hpp(filenames):
"""
@ -302,8 +285,6 @@ if __name__ == "__main__":
help="which build targets to add the file to")
ap.add_argument("--no-checks", action="store_true",
help="do not check whether the files exist, etc")
ap.add_argument("-r", "--remove", action="store_true",
help="remove the specified files from projectfiles instead of adding them, --target is then ignored")
# By default, recognise --help too
options = ap.parse_args()
@ -320,13 +301,7 @@ if __name__ == "__main__":
sanity_check_existing_cpp_hpp(filenames)
for filename in filenames:
if options.remove:
print(f"removing '{filename}' from all targets")
modify_xcode(filename, options.target, True)
remove_from_source_lists(filename)
modify_code_blocks(filename, options.target, True)
else:
print(f"adding '{filename}' to targets: {options.target}")
modify_xcode(filename, options.target, False)
add_to_source_lists(filename, options.target)
modify_code_blocks(filename, options.target, False)
print(f"adding '{filename}' to targets: {options.target}")
add_to_xcode(filename, options.target)
add_to_source_lists(filename, options.target)
add_to_code_blocks(filename, options.target)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 428 B

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 799 B

After

Width:  |  Height:  |  Size: 678 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 KiB

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 KiB

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 KiB

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 815 B

After

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1,014 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 815 B

After

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 646 B

After

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 914 B

After

Width:  |  Height:  |  Size: 776 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 953 B

After

Width:  |  Height:  |  Size: 815 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 464 B

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 973 B

After

Width:  |  Height:  |  Size: 835 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 544 B

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 953 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 388 B

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 673 B

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 882 B

After

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 882 B

After

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 890 B

After

Width:  |  Height:  |  Size: 752 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 587 B

After

Width:  |  Height:  |  Size: 449 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 584 B

After

Width:  |  Height:  |  Size: 446 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 990 B

After

Width:  |  Height:  |  Size: 852 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 901 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 B

After

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 B

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 256 B

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 293 B

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 291 B

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 B

After

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 B

After

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 B

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 B

After

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

After

Width:  |  Height:  |  Size: 115 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 229 B

After

Width:  |  Height:  |  Size: 91 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 B

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 B

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 331 B

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 335 B

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 B

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 B

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 312 B

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 B

After

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 B

After

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 B

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

After

Width:  |  Height:  |  Size: 108 B

Some files were not shown because too many files have changed in this diff Show more