# vim: filetype=yaml sw=2
version: '[% c("var/torbrowser_version") %]'
output_dir: '[% c("var/projectname", { output_dir => "." }) %]/release'
link_input_files: 1

var:
  signed_status: unsigned
  publish_dir: '[% c("var/signed_status") %]/[% c("version") %]-[% c("var/torbrowser_build") %]'
  containers_target: with_containers

  linux-packages: '[% ( c("var/browser_platforms/linux-i686") || c("var/browser_platforms/linux-x86_64") ) && ( c("var/mullvad-browser") || c("var/nightly") ) %]'
  linux-packages-aarch64: '[% c("var/browser_platforms/linux-aarch64") && (c("var/mullvad-browser") || c("var/nightly")) %]'

targets:
  browser-all:
    - browser-src
  browser-all-desktop:
    var:
      browser-src: '[% ! c("var/testbuild") %]'
      browser_platforms:
        is_android_release: 0
        is_desktop_release: 1
  browser-all-android:
    var:
      browser-src: '[% ! c("var/testbuild") %]'
      browser_platforms:
        is_android_release: 1
        is_desktop_release: 0
  browser-single-platform:
    var:
      browser_platforms:
        is_android_release: 0
        is_desktop_release: 0
  browser-android-armv7:
    var:
      browser_platforms:
        android-armv7: 1
  browser-android-x86:
    var:
      browser_platforms:
        android-x86: 1
  browser-android-x86_64:
    var:
      browser_platforms:
        android-x86_64: 1
  browser-android-aarch64:
    var:
      browser_platforms:
        android-aarch64: 1
  browser-linux-x86_64:
    var:
      browser_platforms:
        linux-x86_64: 1
  browser-linux-x86_64-asan:
    var:
      browser_platforms:
        linux-x86_64: 1
      asan-build: '-asan'
  browser-linux-i686:
    var:
      browser_platforms:
        linux-i686: 1
  browser-linux-aarch64:
    var:
      browser_platforms:
        linux-aarch64: 1
  browser-windows-i686:
    var:
      browser_platforms:
        windows-i686: '[% c("var/browser_type") != "mullvadbrowser" %]'
  browser-windows-x86_64:
    var:
      browser_platforms:
        windows-x86_64: 1
  browser-macos:
    var:
      browser_platforms:
        macos: 1
  browser-macos-x86_64:
    var:
      browser_platforms:
        macos-x86_64: 1
  browser-macos-aarch64:
    var:
      browser_platforms:
        macos-aarch64: 1
  browser-src:
    var:
      browser-src: '[% ! c("var/testbuild") %]'
  browser-src-testbuild:
    var:
      browser-src: 1

  notarget:
    - torbrowser
    - release
    - browser-all

  noversiondir:
    var:
      publish_dir: ''

  torbrowser:
    var:
      browser_type: torbrowser
      git_tag_prefix: tbb
  basebrowser:
    var:
      browser_type: basebrowser
  mullvadbrowser:
    var:
      browser_type: mullvadbrowser
      git_tag_prefix: mb

  release:
    var:
      build_target: release

  nightly:
    output_dir: '[% c("var/projectname", { output_dir => "." }) %]/nightly'
    var:
      build_target: nightly
      publish_dir: '[% c("version") %]'

  alpha:
    output_dir: '[% c("var/projectname", { output_dir => "." }) %]/alpha'
    var:
      build_target: alpha

  testbuild:
    output_dir: 'testbuild'
    var:
      testbuild: 1
      build_target: '[% c("var/browser_type") %]-testbuild'
      publish_dir: ''

  no_containers:
    var:
      containers_target: no_containers

  signed:
    var:
      signed_status: signed

  create_unsigned_incrementals:
    var:
      create_unsigned_incrementals: 1

  unsigned_releases_dir:
    var:
      unsigned_releases_dir: 1

input_files:

# Release
  - name: android-armv7
    project: browser
    enable: '[% c("var/browser_platforms/android-armv7") %]'
    target:
      - '[% c("var/containers_target") %]'
      - '[% c("var/build_target") %]'
      - '[% c("var/browser_type") %]-android-armv7'

  - name: android-x86
    project: browser
    enable: '[% c("var/browser_platforms/android-x86") %]'
    target:
      - '[% c("var/containers_target") %]'
      - '[% c("var/build_target") %]'
      - '[% c("var/browser_type") %]-android-x86'

  - name: android-x86_64
    project: browser
    enable: '[% c("var/browser_platforms/android-x86_64") %]'
    target:
      - '[% c("var/containers_target") %]'
      - '[% c("var/build_target") %]'
      - '[% c("var/browser_type") %]-android-x86_64'

  - name: android-aarch64
    project: browser
    enable: '[% c("var/browser_platforms/android-aarch64") %]'
    target:
      - '[% c("var/containers_target") %]'
      - '[% c("var/build_target") %]'
      - '[% c("var/browser_type") %]-android-aarch64'

  - name: linux-x86_64
    project: browser
    enable: '[% c("var/browser_platforms/linux-x86_64") %]'
    target:
      - '[% c("var/build_target") %]'
      - '[% c("var/browser_type") %]-linux-x86_64[% c("var/asan-build") %]'

  - name: linux-i686
    project: browser
    enable: '[% c("var/browser_platforms/linux-i686") %]'
    target:
      - '[% c("var/build_target") %]'
      - '[% c("var/browser_type") %]-linux-i686'

  - name: linux-aarch64
    project: browser
    enable: '[% c("var/browser_platforms/linux-aarch64") %]'
    target:
      - '[% c("var/build_target") %]'
      - '[% c("var/browser_type") %]-linux-aarch64'

  - name: deb-packages
    project: linux-packages
    enable: '[% c("var/linux-packages") %]'
    # Add $browser_type-linux-x86_64 target for container config
    target:
      - '[% IF c("var/testbuild") %]testbuild[% END %]'
      - '[% c("var/build_target") %]'
      - '[% IF c("var/browser_platforms/linux-i686") %]browser-linux-i686[% END %]'
      - '[% IF c("var/browser_platforms/linux-x86_64") %]browser-linux-x86_64[% END %]'
      - deb
      - '[% c("var/browser_type") %]-linux-x86_64'

  # linux-aarch64 requires a separate container because of multi-arch
  # conflicts between amd64 and arm64
  - name: deb-packages-aarch64
    project: linux-packages
    enable: '[% c("var/linux-packages-aarch64") %]'
    # Add $browser_type-linux-x86_64 target for container config
    target:
      - '[% IF c("var/testbuild") %]testbuild[% END %]'
      - '[% c("var/build_target") %]'
      - browser-linux-aarch64
      - deb-arm64
      - '[% c("var/browser_type") %]-linux-x86_64'

  - name: rpm-packages
    project: linux-packages
    enable: '[% c("var/linux-packages") || c("var/linux-packages-aarch64") %]'
    # Add $browser_type-linux-x86_64 target for container config
    target:
      - '[% IF c("var/testbuild") %]testbuild[% END %]'
      - '[% c("var/build_target") %]'
      - '[% IF c("var/browser_platforms/linux-i686") %]browser-linux-i686[% END %]'
      - '[% IF c("var/browser_platforms/linux-x86_64") %]browser-linux-x86_64[% END %]'
      - '[% IF c("var/linux-packages-aarch64") %]browser-linux-aarch64[% END %]'
      - rpm
      - '[% c("var/browser_type") %]-linux-x86_64'

  - name: windows-i686
    project: browser
    enable: '[% c("var/browser_platforms/windows-i686") %]'
    target:
      - '[% c("var/build_target") %]'
      - '[% c("var/browser_type") %]-windows-i686'

  - name: windows-x86_64
    project: browser
    enable: '[% c("var/browser_platforms/windows-x86_64") %]'
    target:
      - '[% c("var/build_target") %]'
      - '[% c("var/browser_type") %]-windows-x86_64'

  - name: macos
    project: browser
    enable: '[% c("var/browser_platforms/macos") %]'
    target:
      - '[% c("var/build_target") %]'
      - '[% c("var/browser_type") %]-macos'

 # non-universal macos build
  - name: macos-x86_64
    project: browser
    enable: '[% c("var/browser_platforms/macos-x86_64") %]'
    target:
      - '[% c("var/build_target") %]'
      - '[% c("var/browser_type") %]-macos-x86_64'

 # non-universal macos build
  - name: macos-aarch64
    project: browser
    enable: '[% c("var/browser_platforms/macos-aarch64") %]'
    target:
      - '[% c("var/build_target") %]'
      - '[% c("var/browser_type") %]-macos-aarch64'

  - name: src-firefox
    project: firefox
    enable: '[% c("var/browser-src") %]'
    pkg_type: src-tarballs
    target:
      - '[% c("var/build_target") %]'
      - '[% c("var/browser_type") %]-macos'

steps:
  signtag:
    build_log: '-'
    debug: 0
    input_files: []
    signtag: '[% INCLUDE signtag %]'
  update_responses_config:
    build_log: '-'
    debug: 0
    input_files: []
    update_responses_config: '[% INCLUDE update_responses_config %]'
  create_update_responses_tar:
    build_log: '-'
    debug: 0
    input_files: []
    create_update_responses_tar: '[% INCLUDE create_update_responses_tar %]'
  hash_incrementals:
    build_log: '-'
    debug: 0
    input_files: []
    hash_incrementals: '[% INCLUDE hash_incrementals %]'
  dmg2mar:
    build_log: '-'
    debug: 0
    input_files: []
    dmg2mar: '[% INCLUDE dmg2mar %]'
  upload_sha256sums:
    build_log: '-'
    debug: 0
    input_files: []
    upload_sha256sums: '[% INCLUDE upload_sha256sums %]'
  compare_windows_signed_unsigned_exe:
    build_log: '-'
    debug: 0
    input_files:
      - project: osslsigncode
        name: osslsigncode
        pkg_type: build
    compare_windows_signed_unsigned_exe: '[% INCLUDE compare_windows_signed_unsigned_exe %]'
  compare_mar_signed_unsigned:
    build_log: '-'
    debug: 0
    input_files:
      - project: mar-tools
        name: mar-tools
        pkg_type: fetch_martools
    compare_mar_signed_unsigned: '[% INCLUDE compare_mar_signed_unsigned %]'
  kick_devmole_build:
    build_log: '-'
    debug: 0
    input_files: []
    kick_devmole_build: '[% INCLUDE kick_devmole_build %]'
