Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup dependencies #4221

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repos:
- id: clang-format
name: clang-format
description: This hook automatically checks and reformats changed files using clang-format formatter.
entry: './.dependencies/clang-format-16-83817c2f/clang-format'
entry: './.dependencies/clang-format-18.1.8/clang-format'
language: script
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
args: ['-i', '-style=file']
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"cmake.configureOnOpen": true,
"cmake.copyCompileCommands": "${workspaceFolder}/compile_commands.json",
"cmake.cmakePath": "${workspaceFolder}/.dependencies/cmake-3.28.3/bin/cmake",
"cmake.cmakePath": "${workspaceFolder}/.dependencies/cmake-3.30.3/bin/cmake",
"cmake.generator": "Ninja",
"files.insertFinalNewline": true,
"files.associations": {
Expand Down
160 changes: 80 additions & 80 deletions CMakePresets.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/Prusa-Firmware-MMU/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repos:
- id: clang-format
name: clang-format
description: This hook automatically checks and reformats changed files using clang-format formatter.
entry: './.dependencies/clang-format-9.0.0-noext/clang-format'
entry: './.dependencies/clang-format-18.1.8/clang-format'
language: script
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
args: ['-i', '-style=file']
Expand Down
2 changes: 1 addition & 1 deletion lib/Prusa-Firmware-MMU/.vscode/cmake-kits.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "avr-gcc",
"toolchainFile": "${workspaceFolder}/cmake/AvrGcc.cmake",
"cmakeSettings": {
"CMAKE_MAKE_PROGRAM": "${workspaceFolder}/.dependencies/ninja-1.10.2/ninja",
"CMAKE_MAKE_PROGRAM": "${workspaceFolder}/.dependencies/ninja-1.12.1/ninja",
"CMAKE_BUILD_TYPE": "Release"
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Prusa-Firmware-MMU/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"-isystem${workspaceFolder}/.dependencies/avr-gcc-7.3.0/avr/include/util",
],
"cmake.buildDirectory": "${workspaceFolder}/build-vscode/${buildKit}",
"cmake.cmakePath": "${workspaceFolder}/.dependencies/cmake-3.22.5/bin/cmake",
"cmake.cmakePath": "${workspaceFolder}/.dependencies/cmake-3.30.3/bin/cmake",
"cmake.generator": "Ninja",
"files.insertFinalNewline": true,
}
6 changes: 3 additions & 3 deletions lib/Prusa-Firmware-MMU/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ Run `git clone https://github.com/prusa3d/Prusa-Firmware-MMU.git`.
Run `./utils/bootstrap.py`

`bootstrap.py` will now download all the "missing" dependencies into the `.dependencies` folder:
- clang-format-9.0.0-noext
- cmake-3.22.5
- ninja-1.10.2
- clang-format-18.1.8
- cmake-3.30.3
- ninja-1.12.1
- avr-gcc-7.3.0

### How to build the preliminary project so far:
Expand Down
61 changes: 41 additions & 20 deletions lib/Prusa-Firmware-MMU/utils/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,23 @@
# yapf: disable
dependencies = {
'ninja': {
'version': '1.10.2',
'version': '1.12.1',
'url': {
'Linux': 'https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-linux.zip',
'Windows': 'https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-win.zip',
'Darwin': 'https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-mac.zip',
'Linux': 'https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-linux.zip',
'Linux-aarch64': 'https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-linux-aarch64.zip',
'Windows': 'https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-win.zip',
'Windows-arm64': 'https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-winarm64.zip',
'Darwin': 'https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-mac.zip',
},
},
'cmake': {
'version': '3.22.5',
'version': '3.30.3',
'url': {
'Linux': 'https://github.com/Kitware/CMake/releases/download/v3.22.5/cmake-3.22.5-linux-x86_64.tar.gz',
'Windows': 'https://github.com/Kitware/CMake/releases/download/v3.22.5/cmake-3.22.5-windows-x86_64.zip',
'Darwin': 'https://github.com/Kitware/CMake/releases/download/v3.22.5/cmake-3.22.5-macos-universal.tar.gz',
'Linux': 'https://github.com/Kitware/CMake/releases/download/v3.30.3/cmake-3.30.3-linux-x86_64.tar.gz',
'Linux-aarch64': 'https://github.com/Kitware/CMake/releases/download/v3.30.3/cmake-3.30.3-linux-aarch64.tar.gz',
'Windows': 'https://github.com/Kitware/CMake/releases/download/v3.30.3/cmake-3.30.3-windows-x86_64.zip',
'Windows-arm64': 'https://github.com/Kitware/CMake/releases/download/v3.30.3/cmake-3.30.3-windows-arm64.zip',
'Darwin': 'https://github.com/Kitware/CMake/releases/download/v3.30.3/cmake-3.30.3-macos-universal.tar.gz',
},
},
'avr-gcc': {
Expand All @@ -52,11 +56,12 @@
},
},
'clang-format': {
'version': '9.0.0-noext',
'version': '18.1.8',
'url': {
'Linux': 'https://prusa-buddy-firmware-dependencies.s3.eu-central-1.amazonaws.com/clang-format-9.0.0-linux.zip',
'Windows': 'https://prusa-buddy-firmware-dependencies.s3.eu-central-1.amazonaws.com/clang-format-9.0.0-noext-win.zip',
'Darwin': 'https://prusa-buddy-firmware-dependencies.s3.eu-central-1.amazonaws.com/clang-format-9.0.0-darwin.zip',
'Linux': 'https://github.com/ysmilda/clang-llvm/releases/download/llvmorg-18.1.8/clang-format-18.1.8-x86_64-linux-gnu-ubuntu-18.04',
'Linux-aarch64': 'https://github.com/ysmilda/clang-llvm/releases/download/llvmorg-18.1.8/clang-format-18.1.8-aarch64-linux-gnu',
'Windows': 'https://github.com/ysmilda/clang-llvm/releases/download/llvmorg-18.1.8/clang-format-18.1.8-x86_64-pc-windows-msvc.exe',
'Darwin': 'https://github.com/ysmilda/clang-llvm/releases/download/llvmorg-18.1.8/clang-format-18.1.8-arm64-apple-macos11',
}
},
'prusa3dboards': {
Expand Down Expand Up @@ -86,20 +91,34 @@ def find_single_subdir(path: Path):
raise RuntimeError


def download_and_unzip(url: str, directory: Path):
def download_and_unzip(url: str, directory: Path, dependency: str):
"""Download a compressed file and extract it at `directory`."""
extract_dir = directory.with_suffix('.temp')
shutil.rmtree(directory, ignore_errors=True)
shutil.rmtree(extract_dir, ignore_errors=True)

print('Downloading ' + directory.name)
f, _ = urlretrieve(url, filename=None)
print('Extracting ' + directory.name)
if '.tar.bz2' in url or '.tar.gz' in url or '.tar.xz' in url:
obj = tarfile.open(f)

tarExtensions = (
'.tar.bz2',
'.tar.gz',
'.tar.xz',
)
zipExtensions = ('.zip')

if url.endswith(tarExtensions) or url.endswith(zipExtensions):
f, _ = urlretrieve(url, filename=None)
print('Extracting ' + directory.name)
if url.endswith(tarExtensions):
obj = tarfile.open(f)
obj.extractall(path=str(extract_dir), filter='fully_trusted')
else:
obj = zipfile.ZipFile(f, 'r')
obj.extractall(path=str(extract_dir))

else:
obj = zipfile.ZipFile(f, 'r')
obj.extractall(path=str(extract_dir))
os.mkdir(extract_dir)
f, _ = urlretrieve(url, filename=os.path.join(extract_dir, dependency))

subdir = find_single_subdir(extract_dir)
shutil.move(str(subdir), str(directory))
Expand Down Expand Up @@ -144,7 +163,9 @@ def install_dependency(dependency):
url = specs['url']
if isinstance(url, dict):
url = url[platform.system()]
download_and_unzip(url=url, directory=installation_directory)
download_and_unzip(url=url,
directory=installation_directory,
dependency=dependency)
fix_executable_permissions(dependency, installation_directory)


Expand Down
6 changes: 3 additions & 3 deletions lib/Prusa-Firmware-MMU/utils/holly/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ pipeline {
steps {
sh """
python3 utils/bootstrap.py
export PATH=\$PWD/.dependencies/cmake-3.22.5/bin:\$PWD/.dependencies/ninja-1.10.2:\$PATH
export PATH=\$PWD/.dependencies/cmake-3.30.3/bin:\$PWD/.dependencies/ninja-1.12.1:\$PATH
export CTEST_OUTPUT_ON_FAILURE=1
mkdir -p build-test
LD_LIBRARY_PATH=/usr/local/lib32 \$PWD/.dependencies/cmake-3.22.5/bin/ctest --build-and-test . build-test \
-DCMAKE_MAKE_PROGRAM=\$PWD/.dependencies/ninja-1.10.2/ninja \
LD_LIBRARY_PATH=/usr/local/lib32 \$PWD/.dependencies/cmake-3.30.3/bin/ctest --build-and-test . build-test \
-DCMAKE_MAKE_PROGRAM=\$PWD/.dependencies/ninja-1.12.1/ninja \
--build-generator Ninja \
--build-target tests \
--test-command ctest
Expand Down
2 changes: 1 addition & 1 deletion src/gui/res/png2cc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ else
stripFileType | png2indexed
stripFileType | convertToCC

../../../.dependencies/clang-format-9.0.0-noext/clang-format $CC_DIR/* -i
../../../.dependencies/clang-format-18.1.8/clang-format $CC_DIR/* -i

rm -rf $PAL_DIR

Expand Down
66 changes: 42 additions & 24 deletions utils/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import tarfile
import venv
import zipfile
import stat
from argparse import ArgumentParser
from pathlib import Path
from urllib.request import urlretrieve
Expand All @@ -36,21 +35,23 @@
# yapf: disable
dependencies = {
'ninja': {
'version': '1.10.2',
'version': '1.12.1',
'url': {
'Linux': 'https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-linux.zip',
'Linux-aarch64': 'https://prusa-buddy-firmware-dependencies.s3.eu-central-1.amazonaws.com/ninja-v1.10.2-linux-aarch64.zip',
'Windows': 'https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-win.zip',
'Darwin': 'https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-mac.zip',
'Linux': 'https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-linux.zip',
'Linux-aarch64': 'https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-linux-aarch64.zip',
'Windows': 'https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-win.zip',
'Windows-arm64': 'https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-winarm64.zip',
'Darwin': 'https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-mac.zip',
},
},
'cmake': {
'version': '3.28.3',
'version': '3.30.3',
'url': {
'Linux': 'https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3-linux-x86_64.tar.gz',
'Linux-aarch64': 'https://prusa-buddy-firmware-dependencies.s3.eu-central-1.amazonaws.com/cmake-3.28.3-Linux-aarch64.tar.gz',
'Windows': 'https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3-windows-x86_64.zip',
'Darwin': 'https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3-macos-universal.tar.gz',
'Linux': 'https://github.com/Kitware/CMake/releases/download/v3.30.3/cmake-3.30.3-linux-x86_64.tar.gz',
'Linux-aarch64': 'https://github.com/Kitware/CMake/releases/download/v3.30.3/cmake-3.30.3-linux-aarch64.tar.gz',
'Windows': 'https://github.com/Kitware/CMake/releases/download/v3.30.3/cmake-3.30.3-windows-x86_64.zip',
'Windows-arm64': 'https://github.com/Kitware/CMake/releases/download/v3.30.3/cmake-3.30.3-windows-arm64.zip',
'Darwin': 'https://github.com/Kitware/CMake/releases/download/v3.30.3/cmake-3.30.3-macos-universal.tar.gz',
},
},
'gcc-arm-none-eabi': {
Expand All @@ -59,15 +60,16 @@
'Linux': 'https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz',
'Linux-aarch64': 'https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-aarch64-arm-none-eabi.tar.xz',
'Windows': 'https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-mingw-w64-i686-arm-none-eabi.zip',
'Darwin': 'https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-darwin-x86_64-arm-none-eabi.tar.xzg',
'Darwin': 'https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-darwin-x86_64-arm-none-eabi.tar.xz',
}
},
'clang-format': {
'version': '16-83817c2f',
'version': '18.1.8',
'url': {
'Linux': 'https://prusa-buddy-firmware-dependencies.s3.eu-central-1.amazonaws.com/clang-format-16-83817c2f-linux.zip',
'Windows': 'https://prusa-buddy-firmware-dependencies.s3.eu-central-1.amazonaws.com/clang-format-16-83817c2f-windows.zip',
'Darwin': 'https://prusa-buddy-firmware-dependencies.s3.eu-central-1.amazonaws.com/clang-format-16-83817c2f-macosx.zip',
'Linux': 'https://github.com/ysmilda/clang-llvm/releases/download/llvmorg-18.1.8/clang-format-18.1.8-x86_64-linux-gnu-ubuntu-18.04',
'Linux-aarch64': 'https://github.com/ysmilda/clang-llvm/releases/download/llvmorg-18.1.8/clang-format-18.1.8-aarch64-linux-gnu',
'Windows': 'https://github.com/ysmilda/clang-llvm/releases/download/llvmorg-18.1.8/clang-format-18.1.8-x86_64-pc-windows-msvc.exe',
'Darwin': 'https://github.com/ysmilda/clang-llvm/releases/download/llvmorg-18.1.8/clang-format-18.1.8-arm64-apple-macos11',
}
},
'bootloader-mini': {
Expand Down Expand Up @@ -135,20 +137,34 @@ def find_single_subdir(path: Path):
raise RuntimeError


def download_and_unzip(url: str, directory: Path):
def download_and_unzip(url: str, directory: Path, dependency: str):
"""Download a compressed file and extract it at `directory`."""
extract_dir = directory.with_suffix('.temp')
shutil.rmtree(directory, ignore_errors=True)
shutil.rmtree(extract_dir, ignore_errors=True)

print('Downloading ' + directory.name)
f, _ = urlretrieve(url, filename=None)
print('Extracting ' + directory.name)
if '.tar.bz2' in url or '.tar.gz' in url or '.tar.xz' in url:
obj = tarfile.open(f)

tarExtensions = (
'.tar.bz2',
'.tar.gz',
'.tar.xz',
)
zipExtensions = ('.zip')

if url.endswith(tarExtensions) or url.endswith(zipExtensions):
f, _ = urlretrieve(url, filename=None)
print('Extracting ' + directory.name)
if url.endswith(tarExtensions):
obj = tarfile.open(f)
obj.extractall(path=str(extract_dir), filter='fully_trusted')
else:
obj = zipfile.ZipFile(f, 'r')
obj.extractall(path=str(extract_dir))

else:
obj = zipfile.ZipFile(f, 'r')
obj.extractall(path=str(extract_dir))
os.mkdir(extract_dir)
f, _ = urlretrieve(url, filename=os.path.join(extract_dir, dependency))

subdir = find_single_subdir(extract_dir)
shutil.move(str(subdir), str(directory))
Expand Down Expand Up @@ -199,7 +215,9 @@ def install_dependency(dependency):
url = url[platform.system()]
else:
url = url[full_description]
download_and_unzip(url=url, directory=installation_directory)
download_and_unzip(url=url,
directory=installation_directory,
dependency=dependency)
elif files is not None:
os.mkdir(installation_directory)
for file in files:
Expand Down
6 changes: 3 additions & 3 deletions utils/holly/build-pr.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,13 @@ pipeline {
}
steps {
sh """
export PATH=/work/.dependencies/cmake-3.28.3/bin:/work/.dependencies/ninja-1.10.2:\$PATH
export PATH=/work/.dependencies/cmake-3.30.3/bin:/work/.dependencies/ninja-1.12.1:\$PATH
ln -fs /work/.dependencies
ln -fs /work/.venv
. .venv/bin/activate
mkdir -p build-test
LD_LIBRARY_PATH=/usr/local/lib32 /work/.dependencies/cmake-3.28.3/bin/ctest --build-and-test . build-test \
-DCMAKE_MAKE_PROGRAM=/work/.dependencies/ninja-1.10.2/ninja \
LD_LIBRARY_PATH=/usr/local/lib32 /work/.dependencies/cmake-3.30.3/bin/ctest --build-and-test . build-test \
-DCMAKE_MAKE_PROGRAM=/work/.dependencies/ninja-1.12.1/ninja \
--build-generator Ninja \
--build-target tests \
--build-options -DBOARD=BUDDY \
Expand Down
4 changes: 2 additions & 2 deletions utils/translations_and_fonts/README_TRANSLATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ cd build_tests
# If it says, that -std=c++20 does not exist, your compilator is too old. Install g++-10 and run this command before cmake:
# export CXX=/bin/g++-10

../.dependencies/cmake-3.28.3/bin/cmake -D CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=YES -D CMAKE_C_FLAGS="-O0 -ggdb3" -D CMAKE_CXX_FLAGS="-O0 -ggdb3 -std=c++20" -D CMAKE_BUILD_TYPE=Debug ..
../.dependencies/cmake-3.30.3/bin/cmake -D CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=YES -D CMAKE_C_FLAGS="-O0 -ggdb3" -D CMAKE_CXX_FLAGS="-O0 -ggdb3 -std=c++20" -D CMAKE_BUILD_TYPE=Debug ..
make -j$(nproc) tests VERBOSE=1 # This will build unit tests
../.dependencies/cmake-3.28.3/bin/ctest --output-on-failure . # This will run unit tests
../.dependencies/cmake-3.30.3/bin/ctest --output-on-failure . # This will run unit tests
```
2 changes: 1 addition & 1 deletion utils/translations_and_fonts/generate_single_font.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ rm -rf full-chars.txt standard-chars.txt digits-chars.txt
# Build png2font binary
mkdir -p build_tests
cd build_tests
../.dependencies/cmake-3.28.3/bin/cmake -D CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=YES -D CMAKE_C_FLAGS="-O0 -ggdb3" -D CMAKE_CXX_FLAGS="-O0 -ggdb3 -std=c++20" -D CMAKE_BUILD_TYPE=Debug .. -G Ninja
../.dependencies/cmake-3.30.3/bin/cmake -D CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=YES -D CMAKE_C_FLAGS="-O0 -ggdb3" -D CMAKE_CXX_FLAGS="-O0 -ggdb3 -std=c++20" -D CMAKE_BUILD_TYPE=Debug .. -G Ninja
ninja utils/translations_and_fonts/png2font/png2font
cd ../

Expand Down
2 changes: 1 addition & 1 deletion utils/translations_and_fonts/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rm -rf non-ascii-chars.txt non-ascii-chars.raw

mkdir -p build_tests
cd build_tests
../.dependencies/cmake-3.28.3/bin/cmake -D CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=YES -D CMAKE_C_FLAGS="-O0 -ggdb3" -D CMAKE_CXX_FLAGS="-O0 -ggdb3 -std=c++20" -D CMAKE_BUILD_TYPE=Debug .. -G Ninja -D BOARD=XBUDDY
../.dependencies/cmake-3.30.3/bin/cmake -D CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=YES -D CMAKE_C_FLAGS="-O0 -ggdb3" -D CMAKE_CXX_FLAGS="-O0 -ggdb3 -std=c++20" -D CMAKE_BUILD_TYPE=Debug .. -G Ninja -D BOARD=XBUDDY
ninja utils/translations_and_fonts/png2font/png2font
cd ../

Expand Down