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

Quelle  build.sh   Sprache: Shell

 

#!/usr/bin/env bash

set -euo pipefail

LOG_TAG="build"
# shellcheck source=lib/colors.sh
source "$(cd "$(dirname "$0")/.." && pwd)/scripts/lib/colors.sh"

if [[ $# = 0 ]]; then
  echo "Usage: ./build.sh [--dependencies | --dependencies-force | --generate-protobuf | [--build & --work]] [<relative project path>]"
  echo ""
  echo "Options to build the app and its dependencies:
  --dependencies                Download WebRTC if not cached.

  --dependencies-force          Always download the most recent available version of WebRTC.

  --generate-protobuf           Parse Protobuf files and generate Swift source code.
                                (https://github.com/apple/swift-protobuf/#alternatively-install-via-homebrew)

  --build                       Build debug version of target 'Threema'.
  --build --work                Build debug version of target 'Threema Work'.

  Example: ./build.sh --dependencies --build .."
  exit 0
fi

# Initialize project directory
if [[ $# -gt 0 ]] && [[ ${!#} != '--dependencies' ]] && [[ ${!#} != '--dependencies-force' ]] && [[ ${!#} != '--generate-protobuf' ]] && [[ ${!#} != '--build' ]] && [[ ${!#} != '--work' ]]; then
  project_dir="$PWD/${!#}"
else
  project_dir="$PWD"
fi

if [[ -d "$project_dir/Threema.xcodeproj/project.xcworkspace" ]]; then
  info "Project $project_dir/Threema.xcodeproj/project.xcworkspace"
else
  error "Project $project_dir/Threema.xcodeproj/project.xcworkspace not found"
  exit 1
fi

# Initialize script arguments
dependencies_arg=0
dependencies_force_arg=0
generate_protobuf_arg=0
build_arg=0
work_arg=0

for arg in "$@"; do
  if [[ "$arg" = '--dependencies' ]]; then
    dependencies_arg=1
  elif [[ "$arg" = '--dependencies-force' ]]; then
    dependencies_force_arg=1
  elif [[ "$arg" = '--generate-protobuf' ]]; then
    generate_protobuf_arg=1
  elif [[ "$arg" = '--build' ]]; then
    build_arg=1
  elif [[ "$arg" = '--work' ]]; then
    work_arg=1
  fi
done

if [[ "$dependencies_arg" = 1 ]] || [[ "$dependencies_force_arg" = 1 ]]; then
  # Delete or reset download directories
  # $1: Local directory
  reset() {
    if [[ -d "$project_dir/$1" ]]; then
      if  [[ "$dependencies_force_arg" = 1 ]]; then
        rm -R "$project_dir/$1"
      fi
    fi
  }

  download() {
    download_dir="$project_dir/$1"
    download_url="https://oss.threema.ch/ios/$2/$3/$1.zip"

    info "$download_url -> $download_dir"

    mkdir "$download_dir"
    curl "$download_url" -o "$download_dir/$1.zip"
    unzip -q "$download_dir/$1.zip" -d "$download_dir"
    rm "$download_dir/$1.zip"
    touch "$download_dir"
  }

  # $1: Local directory
  # $2: Dependency name on oss
  # $3: Dependency version on oss
  check() {
    if [[ -d "$project_dir/$1" ]]; then
      if [[ "$dependencies_force_arg" = 1 ]]; then
        warn "Forcing dependency refresh, removing cache for $1"
        rm -R "$project_dir/$1"
      fi
    fi

    if [[ -d "$project_dir/$1" ]]; then
      success "Cache found for $1"
    else
      download $1 $2 $3
    fi
  }

  reset "WebRTC.xcframework"
  WEBRTC_VERSION=$(cat ${project_dir}/.webrtc-version)
  check "WebRTC.xcframework" "webrtc" ${WEBRTC_VERSION}

fi

if [[ "$generate_protobuf_arg" = 1 ]]; then
  protobuf_submodule_path="./protobuf"
  protobuf_source_path="./ThreemaFramework/Protobuf"

  protoc --version

  if [[ -d "$project_dir/$protobuf_submodule_path" ]]; then
    if [[ -d "$project_dir/$protobuf_source_path" ]]; then
      info "Protobuf source path $project_dir/$protobuf_source_path"
    else
      mkdir "$project_dir/$protobuf_source_path"
    fi

    for file in "$project_dir/$protobuf_submodule_path"/*.proto
    do
      protoc --swift_out="$protobuf_source_path" --proto_path="$protobuf_submodule_path" "$(basename -- "$file")"
    done
  fi
fi

if [[ "$build_arg" = 1 ]]; then
  if [[ "$work_arg" = 1 ]]; then
    scheme="Threema Work"
  else
    scheme="Threema"
  fi

  step "Build $scheme"
  xcodebuild build -workspace "$project_dir/Threema.xcodeproj/project.xcworkspace" -scheme "$scheme" -configuration Debug -destination "generic/platform=iOS"
fi

Messung
CHZG
859710094

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet am  2026-11-04) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover


Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.