name: HTPortalVPN
options:
  bundleIdPrefix: net.hivetechnology
  developmentLanguage: en
  deploymentTarget:
    iOS: "16.0"
  xcodeVersion: "26.0"
configs:
  Debug: debug
  Release: release
settings:
  base:
    SWIFT_VERSION: "5.0"
    MARKETING_VERSION: "0.1.0"
    CURRENT_PROJECT_VERSION: 42
    DEVELOPMENT_TEAM: 8A45MXKLQK
    CODE_SIGN_STYLE: Automatic
    HT_IOS_DISTRIBUTION_CHANNEL: app-store
    IOS_PUBLIC_RELEASE_ALLOWED: YES
    HTP_GPL_SOURCE_URL: "https://portal.hivetechnology.net/open-source/ht-portal-vpn/$(MARKETING_VERSION)-build$(CURRENT_PROJECT_VERSION)-source.tar.gz"
    SUPPORTS_MACCATALYST: NO
    TARGETED_DEVICE_FAMILY: "1"
targets:
  HTPortalVPN:
    type: application
    platform: iOS
    sources:
      - path: ios/HTPortalVPN
      - path: ios/Shared
      - path: LICENSES/GPL-3.0-only.txt
        buildPhase: resources
      - path: LICENSES/LGPL-2.1-only.txt
        buildPhase: resources
      - path: THIRD_PARTY_NOTICES.md
        buildPhase: resources
    settings:
      base:
        PRODUCT_BUNDLE_IDENTIFIER: net.hivetechnology.o20010.06
        TARGETED_DEVICE_FAMILY: "1"
        INFOPLIST_FILE: ios/HTPortalVPN/Info.plist
        CODE_SIGN_ENTITLEMENTS: ios/HTPortalVPN/HTPortalVPN.entitlements
        ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon
    dependencies:
      - target: PacketTunnel
        embed: true
    postBuildScripts:
      - name: Enforce iOS public release gate
        basedOnDependencyAnalysis: false
        script: scripts/check-ios-release-gate.sh
  PacketTunnel:
    type: app-extension
    platform: iOS
    sources:
      - path: ios/PacketTunnel
      - path: ios/Shared
      - path: ios/HTPortalVPN/Model/MobileVpnModels.swift
      - path: core/src
      - third_party/n3n/src/aes.c
      - third_party/n3n/src/auth.c
      - third_party/n3n/src/base64.c
      - third_party/n3n/src/benchmark.c
      - third_party/n3n/src/benchmark_pdu.c
      - third_party/n3n/src/cc20.c
      - third_party/n3n/src/conffile.c
      - third_party/n3n/src/conffile_defs.c
      - third_party/n3n/src/curve25519.c
      - third_party/n3n/src/edge_utils.c
      - third_party/n3n/src/header_encryption.c
      - third_party/n3n/src/hexdump.c
      - third_party/n3n/src/initfuncs.c
      - third_party/n3n/src/json.c
      - third_party/n3n/src/logging.c
      - third_party/n3n/src/mainloop.c
      - third_party/n3n/src/management.c
      - third_party/n3n/src/metrics.c
      - third_party/n3n/src/minilzo.c
      - third_party/n3n/src/n2n.c
      - third_party/n3n/src/n2n_port_mapping.c
      - third_party/n3n/src/n2n_regex.c
      - third_party/n3n/src/network_traffic_filter.c
      - third_party/n3n/src/pearson.c
      - third_party/n3n/src/peer_info.c
      - third_party/n3n/src/pktbuf.c
      - third_party/n3n/src/random_numbers.c
      - third_party/n3n/src/resolve.c
      - third_party/n3n/src/sn_selection.c
      - third_party/n3n/src/sn_utils.c
      - third_party/n3n/src/speck.c
      - third_party/n3n/src/tf.c
      - third_party/n3n/src/transform.c
      - third_party/n3n/src/transform_aes.c
      - third_party/n3n/src/transform_cc20.c
      - third_party/n3n/src/transform_lzo.c
      - third_party/n3n/src/transform_none.c
      - third_party/n3n/src/transform_null.c
      - third_party/n3n/src/transform_speck.c
      - third_party/n3n/src/transform_tf.c
      - third_party/n3n/src/transform_zstd.c
      - third_party/n3n/src/wire.c
      - third_party/n3n/libs/connslot/connslot.c
      - third_party/n3n/libs/connslot/jsonrpc.c
      - third_party/n3n/libs/connslot/strbuf.c
    settings:
      base:
        PRODUCT_BUNDLE_IDENTIFIER: net.hivetechnology.o20010.06.packet-tunnel
        TARGETED_DEVICE_FAMILY: "1"
        INFOPLIST_FILE: ios/PacketTunnel/Info.plist
        CODE_SIGN_ENTITLEMENTS: ios/PacketTunnel/PacketTunnel.entitlements
        SKIP_INSTALL: YES
        APPLICATION_EXTENSION_API_ONLY: YES
        HEADER_SEARCH_PATHS:
          - "$(SRCROOT)/core/include"
          - "$(SRCROOT)/core/cmake"
          - "$(SRCROOT)/third_party/n3n/include"
          - "$(SRCROOT)/third_party/n3n/src"
          - "$(SRCROOT)/third_party/n3n/libs"
          - "$(DERIVED_FILE_DIR)"
        SWIFT_INCLUDE_PATHS: "$(SRCROOT)/core/include"
        GCC_PREPROCESSOR_DEFINITIONS:
          - "$(inherited)"
          - 'VERSION=\"3.4.6\"'
          - 'BUILDDATE=\"HT-Portal-mobile\"'
          - 'CONFIG_RUNDIR=\"/tmp\"'
          - HAVE_BRIDGING_SUPPORT=1
          - METRICS=1
          - N3N_EMBEDDED_MANAGED_LIFECYCLE=1
          - SKIP_MULTICAST_PEERS_DISCOVERY=1
    preBuildScripts:
      - name: Generate n3n management resources
        outputFiles:
          - "$(DERIVED_FILE_DIR)/management_index.html.h"
          - "$(DERIVED_FILE_DIR)/management_script.js.h"
        script: |
          set -eu
          perl "$SRCROOT/third_party/n3n/libs/connslot/file2strbufc" "$SRCROOT/third_party/n3n/src/management_index.html" management_index > "$DERIVED_FILE_DIR/management_index.html.h"
          perl "$SRCROOT/third_party/n3n/libs/connslot/file2strbufc" "$SRCROOT/third_party/n3n/src/management_script.js" management_script > "$DERIVED_FILE_DIR/management_script.js.h"
schemes:
  HTPortalVPN:
    build:
      targets:
        HTPortalVPN: all
        PacketTunnel: all
    run:
      config: Debug
    archive:
      config: Release
