Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Threema/   (Social Medium ©)  Datei vom 26.9.2026 mit Größe 8 kB image not shown  

Quelle  mise.toml  Sprache: unbekannt

 
Spracherkennung für: .toml vermutete Sprache: Shell {Shell[40] SQL[40] VDM[35]} [Methode: maximale Elemente, drei Dimensionen]

#-- Tools --#

[tools."github:nicklockwood/SwiftFormat"]
version = "0.61.1"
rename_exe = "swiftformat"
no_app = true  # Skip SwiftFormat.for.Xcode.app.zip, use swiftformat.zip instead

[tools]
rust = "1.97"
# Registry short name rather than a hand-written `github:` spec: SwiftLint's release assets are not laid out
# like SwiftFormat's (`portable_swiftlint.zip`, plus a `.pkg`), and the registry knows which to take per
# platform. Pin whatever `mise ls-remote swiftlint` reports as current.
swiftlint = "0.65.0"

#-- Settings --#
[settings]
lockfile = true

#-- Variables --#

[vars]

#- Rust -#
# We only support Apple Silicon Macs
# Darwin target is needed to run tests on macOS
rust_targets = "aarch64-apple-darwin aarch64-apple-ios aarch64-apple-ios-sim"

#- libthreema -#
libthreema_path = "libthreema"
libthreema_swift_path = "libthreemaSwift"
libthreema_xcframework_file = "{{vars.libthreema_swift_path}}/libthreema.xcframework"
libthreema_generated_swift_file = "{{vars.libthreema_swift_path}}/Sources/libthreemaSwift/Generated/libthreema.swift"

#- SaltyRTC -#
saltyrtc_path = "saltyrtc-task-relayed-data-rs/ffi/"
saltyrtc_ffi_target = "saltyrtc-task-relayed-data-ffi"

#-- General tasks --#

[tasks.all]
description = "Build all dependencies"
depends = ["dependencies"]
run = "echo 'All dependencies built.'"

[tasks.clean]
description = "Clean all dependencies"
depends = ["dependencies-clean"]
run = "echo 'All dependencies cleaned.'"

[tasks.libthreema-hash]
description = "Write libthreema submodule hash to .libthreema-version"
run = "if [ -f libthreema/.git ]; then echo $(git submodule status libthreema) | sed 's/^+//g' | cut -d ' ' -f1 > .libthreema-version; fi"

[tasks.saltyrtc-hash]
description = "Write SaltyRTC submodule hash to .saltyrtc-version"
run = "if [ -f saltyrtc-task-relayed-data-rs/.git ]; then echo $(git submodule status saltyrtc-task-relayed-data-rs) | cut -d ' ' -f1 > .saltyrtc-version; fi"

#- Setup -#

[tasks.setup]
description = "Setup the project"
run = "./scripts/setup.sh"

[tasks.set-githooks]
description = "Install protobuf and upgrade rustup via brew"
run = "git config core.hooksPath .githooks"

#- Dependencies -#

[tasks.dependencies]
description = "Build all dependencies (submodules, WebRTC, SaltyRTC, libthreema)"
depends = ["update-submodules", "webrtc", "saltyrtc", "libthreema-all"]
run = "echo 'Dependencies ready.'"

[tasks.dependencies-clean]
description = "Clean all dependencies"
depends = ["webrtc-clean", "saltyrtc-clean", "libthreema-clean"]
run = "echo 'Dependencies cleaned.'"

#- Submodules -#

[tasks.update-submodules]
description = "Init and update git submodules"
run = "git submodule update --init --recursive || true"

#- Format -#

[tasks.format]
description = "Run SwiftFormat on project (pass --lint for check-only mode)"
usage = 'flag "--lint" help="Check formatting without modifying files"'
run = 'mise exec -- swiftformat . --config .swiftformat --swift-version $(cat .swift-version) ${usage_lint:+--lint}'

#- Lint -#

[tasks.lint]
description = "Run SwiftLint (audio session ownership only, see .swiftlint.yml)"
run = 'mise exec -- swiftlint lint --config .swiftlint.yml --strict --quiet'

#- Release notes -#

[tasks.release-notes]
description = "Print or update the TestFlight release notes of a build, asks for print or update, nightly or beta, app, version and build (or pass them: print|update nightly|beta <app> <version> <build>)"
run = "./scripts-internal/release-notes.sh"

[tasks.edit-release-notes]
description = "Open the release notes file of the current branch (pending/<ticket>.txt, created by make-branch)"
run = "./scripts-internal/edit-release-notes.sh"

#-- WebRTC --#

[tasks.webrtc]
description = "Build WebRTC dependencies"
run = "./scripts/build.sh --dependencies ."

[tasks.webrtc-clean]
description = "Clean WebRTC framework"
run = "rm -rf WebRTC.xcframework"

#-- Rust --#

[tasks.libthreema-all]
description = """
Setup Rust toolchain and build libthreema.
If you are offline this might not work. Use `libthreema` instead.
"""
usage = '''
flag "--no-update-of-submodules" help="No update of submodules, it is usfull when upgrading libthreema!"
'''
run = """
{% if usage.no_update_of_submodules %}
  echo 'No update of submodules'
  mise run libthreema-rust --no-update-of-submodules
  mise run libthreema --no-update-of-submodules
{% else %}
  echo 'Update of submodules'
  mise run update-submodules
  mise run libthreema-rust
  mise run libthreema
{% endif %}
echo 'libthreema ready.'
"""

# Notes:
# - If we would set a build folder inside a Swift Package used in Xcode it will reload multiple times during a build
# - The UniFFI generator formats the Swift file by default. Our scripts disables this because we also change the APIs
#   with our formattter (e.g. Id -> ID) and this might break our bindings in the future. If official support is added
#   to fix Swift capitalization conventions in the future we should consider to enable them
#   (https://github.com/mozilla/uniffi-rs/issues/2276)
[tasks.libthreema]
description = "Build libthreema xcframework and generate Swift bindings"
usage = '''
flag "--no-update-of-submodules" help="No update of submodules, it is usfull when upgrading libthreema!"
'''
run = """
{% if usage.no_update_of_submodules %}
  echo 'No update of submodules'
{% else %}
  echo 'Update of submodules'
  mise run update-submodules
{% endif %}

# Sync Rust version
VERSION=$(awk -F'"' '/channel/ {print $2}' libthreema/rust-toolchain.toml)
CURRENT=$(awk -F'"' '/^rust =/ {print $2}' mise.toml)
if [ "$VERSION" != "$CURRENT" ]; then
    sed -i '' -e 's/^rust = ".*"/rust = "'"$VERSION"'"/' mise.toml
    mise trust $PWD/mise.toml
    mise install rust
    mise use rust@$VERSION
    echo "Rust version updated to $VERSION"
else
    mise use rust@$VERSION
    echo "Rust version matches $VERSION"
fi

# Sync UniFFI version to script tests
UNIFFI_VERSION=$(awk -F'"' '/uniffi.*version/ {print $2; exit}' libthreema/tools/uniffi-bindgen/Cargo.toml)
if [ -n "$UNIFFI_VERSION" ]; then
    TEST_LIB_CARGO="scripts/BuildRustLibrary/Tests/BuildRustLibraryScriptTests/rust-library/lib/Cargo.toml"
    TEST_BINDGEN_CARGO="scripts/BuildRustLibrary/Tests/BuildRustLibraryScriptTests/rust-library/uniffi-bindgen/Cargo.toml"
    CURRENT_UNIFFI=$(awk -F'"' '/uniffi.*version/ {print $2; exit}' "$TEST_LIB_CARGO")
    if [ "$UNIFFI_VERSION" != "$CURRENT_UNIFFI" ]; then
        sed -i '' -e 's/uniffi = { version = "[^"]*"/uniffi = { version = "'"$UNIFFI_VERSION"'"/' "$TEST_LIB_CARGO"
        sed -i '' -e 's/uniffi = { version = "[^"]*"/uniffi = { version = "'"$UNIFFI_VERSION"'"/' "$TEST_BINDGEN_CARGO"
        echo "UniFFI version updated to $UNIFFI_VERSION"
    else
        echo "UniFFI version matches $UNIFFI_VERSION"
    fi
fi

xcrun --sdk macosx ./scripts/BuildRustLibrary/Sources/BuildRustLibraryScript/main.swift \
    libthreema \
    --library-path {{vars.libthreema_path}} \
    --framework-out-file-path {{vars.libthreema_xcframework_file}} \
    --swift-out-file-path {{vars.libthreema_generated_swift_file}} \
    --targets {{vars.rust_targets}}

mise run libthreema-hash
"""

[tasks.libthreema-rust]
description = """
Install Rust targets for libthreema.
The toolchain version is managed by mise (see [tools] above), sourced from libthreema/rust-toolchain.toml.
"""
usage = '''
flag "--no-update-of-submodules" help="No update of submodules, it is usfull when upgrading libthreema!"
'''
run = """
{% if usage.no_update_of_submodules %}
  echo 'No update of submodules'
{% else %}
  echo 'Update of submodules'
  mise run update-submodules
{% endif %}
cd {{vars.libthreema_path}} && mise exec -- rustup target add {{vars.rust_targets}}
"""

[tasks.libthreema-clean]
description = "Clean libthreema build artifacts"
run = [
    "cd {{vars.libthreema_path}} && mise exec -- cargo clean",
    "rm -rf {{vars.libthreema_path}}/build",
    "rm -rf {{vars.libthreema_xcframework_file}}",
    "rm -f {{vars.libthreema_generated_swift_file}}",
]

#- SaltyRTC -#

[tasks.saltyrtc]
description = "Build SaltyRTC FFI"
depends = ["update-submodules"]
run = """
./scripts/build-rust.sh {{vars.saltyrtc_path}} {{vars.saltyrtc_ffi_target}}
mise run saltyrtc-hash
"""

[tasks.saltyrtc-clean]
description = "Clean SaltyRTC build"
run = "cd {{vars.saltyrtc_path}} && mise exec -- cargo clean"

[Dauer der Verarbeitung: 0.3 Sekunden, vorverarbeitet 2026-11-02]