chromium/remoting/host/installer/mac/BUILD.gn

# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/zip.gni")
import("//remoting/build/config/remoting_build.gni")

action("remoting_me2me_host_archive") {
  _installer_mac_files = [
    "app-entitlements.plist",
    "do_signing.sh",
    "do_signing.props",
    "ChromotingHost.pkgproj",
    "ChromotingHostService.pkgproj",
    "ChromotingHostUninstaller.pkgproj",
    "LaunchAgents/org.chromium.chromoting.plist",
    "Scripts/keystone_install.sh",
    "Scripts/remoting_postflight.sh",
    "Scripts/remoting_preflight.sh",
    "Keystone/GoogleSoftwareUpdate.pkg",
    "//chrome/installer/mac/pkg-dmg",
  ]

  inputs = _installer_mac_files

  zip_path = "$root_build_dir/remoting-me2me-host-mac.zip"

  outputs = [ "$root_build_dir/remoting-me2me-host-mac.zip" ]

  script = "//remoting/host/installer/build-installer-archive.py"

  sources = [
    # Used by build-installer-archive.py.
    "//build/zip_helpers.py",
  ]

  args = [
           rebase_path("$target_gen_dir/remoting_installation", root_build_dir),
           rebase_path(zip_path, root_build_dir),
           "--source-file-roots",
           rebase_path("//remoting/host/installer/mac/", root_build_dir),
           rebase_path("//chrome/installer/mac", root_build_dir),
           "--source-files",
         ] + rebase_path(_installer_mac_files, root_build_dir) + [
           "--generated-files",
           "remoting_me2me_host.app",
           "native_messaging_host.app",
           "remote_assistance_host.app",
           "remoting_host_uninstaller.app",
           "remoting/com.google.chrome.remote_desktop.json",
           "remoting/com.google.chrome.remote_assistance.json",
           "remoting/com.google.chrome.remote_desktop-firefox.json",
           "remoting/com.google.chrome.remote_assistance-firefox.json",
           "--generated-files-dst",
           "PrivilegedHelperTools/$me2me_host_bundle_name",
           "PrivilegedHelperTools/$me2me_host_bundle_name/Contents/MacOS/$native_messaging_host_bundle_name",
           "PrivilegedHelperTools/$me2me_host_bundle_name/Contents/MacOS/$remote_assistance_host_bundle_name",
           "Applications/$host_uninstaller_name.app",
           "Config/com.google.chrome.remote_desktop.json",
           "Config/com.google.chrome.remote_assistance.json",
           "Config/Firefox/com.google.chrome.remote_desktop.json",
           "Config/Firefox/com.google.chrome.remote_assistance.json",
           "--defs",
           "VERSION=$chrome_version_full",
           "VERSION_SHORT=$chrome_version_major.$chrome_version_minor.$chrome_version_build",
           "VERSION_MAJOR=$chrome_version_major",
           "VERSION_MINOR=$chrome_version_minor",
           "HOST_NAME=$host_name",
           "HOST_BUNDLE_NAME=$me2me_host_bundle_name",
           "HOST_LEGACY_BUNDLE_NAME=$me2me_host_legacy_bundle_name",
           "HOST_SERVICE_NAME=$host_service_name",
           "HOST_UNINSTALLER_NAME=$host_uninstaller_name",
           "HOST_PKG=$host_name",
           "HOST_SERVICE_PKG=$host_service_name_nospace",
           "HOST_UNINSTALLER_PKG=$host_uninstaller_name_nospace",
           "BUNDLE_ID_HOST=$bundle_prefix.$host_name_nospace",
           "BUNDLE_ID_HOST_SERVICE=$bundle_prefix.$host_service_name_nospace",
           "BUNDLE_ID_HOST_UNINSTALLER=$bundle_prefix.$host_uninstaller_name_nospace",
           "DMG_VOLUME_NAME=$host_name $chrome_version_full",
           "DMG_FILE_NAME=$host_name_nospace-$chrome_version_full",
           "NATIVE_MESSAGING_HOST_BUNDLE_NAME=$native_messaging_host_bundle_name",
           "REMOTE_ASSISTANCE_HOST_BUNDLE_NAME=$remote_assistance_host_bundle_name",
         ]

  deps = [
    ":remoting_host_uninstaller",
    "//remoting/host:remoting_me2me_host",
    "//remoting/host:remoting_native_messaging_host",
    "//remoting/host:remoting_native_messaging_manifests",
    "//remoting/host/it2me:remote_assistance_host",
  ]
}

_uninstaller_plist = "uninstaller/remoting_uninstaller-Info.plist"

# remoting_uninstaller-InfoPlist.strings
foreach(locale, remoting_locales_with_underscores) {
  bundle_data("remoting_uninstaller_strings_${locale}_bundle_data") {
    sources = [ "$root_gen_dir/remoting/host/remoting_uninstaller-InfoPlist.strings/$locale.lproj/InfoPlist.strings" ]
    outputs = [ "{{bundle_resources_dir}}/$locale.lproj/{{source_file_part}}" ]
    deps = [ "//remoting/host:remoting_infoplist_strings" ]
  }
}

mac_app_bundle("remoting_host_uninstaller") {
  info_plist = _uninstaller_plist
  extra_substitutions = [
    "BUNDLE_ID=$uninstaller_bundle_id",
    "VERSION_FULL=$remoting_version_full",
    "VERSION_SHORT=$remoting_version_short",
    "MACOSX_DEPLOYMENT_TARGET=10.15",
  ]

  sources = [
    "uninstaller/remoting_uninstaller.h",
    "uninstaller/remoting_uninstaller.mm",
    "uninstaller/remoting_uninstaller_app.h",
    "uninstaller/remoting_uninstaller_app.mm",
  ]

  frameworks = [
    "Cocoa.framework",
    "CoreFoundation.framework",
    "Security.framework",
  ]

  deps = [
    ":remoting_host_uninstaller_resources",
    "//base",
    "//remoting/host:remoting_infoplist_strings",
    "//remoting/host/mac:constants",
    "//remoting/resources:strings",
    "//ui/base:base",
  ]
  foreach(locale, remoting_locales_with_underscores) {
    deps += [ ":remoting_uninstaller_strings_${locale}_bundle_data" ]
  }
}

bundle_data("remoting_host_uninstaller_resources") {
  sources = [ "uninstaller/remoting_uninstaller.icns" ]

  outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
}