chromium/chrome/updater/enterprise/win/google/BUILD.gn

# Copyright 2024 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("//chrome/updater/branding.gni")
import("//components/crx_file/crx3.gni")

if (is_win) {
  # generate the GoogleUpdate admx templates here
  action("GoogleUpdateAdmxGenerate") {
    output_dir = "$root_build_dir/GoogleUpdateAdmx/"
    script = "build_group_policy_template.py"
    generate_group_policy_template_admx =
        "generate_group_policy_template_admx.py"
    public_apps = "public_apps.py"
    googleupdate_admx_file = output_dir + "GoogleUpdate.admx"
    googleupdate_adml_file = output_dir + "en-US/GoogleUpdate.adml"

    inputs = [
      script,
      generate_group_policy_template_admx,
      public_apps,
    ]
    outputs = [
      googleupdate_admx_file,
      googleupdate_adml_file,
    ]

    args = [
      "--updater_admx_file",
      rebase_path(googleupdate_admx_file),
      "--updater_adml_file",
      rebase_path(googleupdate_adml_file),
    ]
  }

  # Copy the dependencies: our group policy files includes the shared
  # google.admx/google.adml.
  copy("GoogleUpdateAdmx") {
    sources = [ "google.admx" ]
    outputs = [ "$root_build_dir/GoogleUpdateAdmx/{{source_file_part}}" ]
  }
  copy("GoogleUpdateAdml") {
    sources = [ "google.adml" ]
    outputs = [ "$root_build_dir/GoogleUpdateAdmx/en-US/{{source_file_part}}" ]
  }

  # Copy the Google Cloud Management policy template files.
  copy("GoogleCloudManagementAdmx") {
    sources = [
      "GoogleCloudManagement.admx",
      "google.admx",
    ]
    outputs =
        [ "$root_build_dir/GoogleCloudManagementAdmx/{{source_file_part}}" ]
  }
  copy("GoogleCloudManagementAdml") {
    sources = [
      "GoogleCloudManagement.adml",
      "google.adml",
    ]
    outputs = [
      "$root_build_dir/GoogleCloudManagementAdmx/en-US/{{source_file_part}}",
    ]
  }

  zip("GoogleUpdateAdmxZip") {
    inputs = get_target_outputs(":GoogleUpdateAdmxGenerate") +
             get_target_outputs(":GoogleUpdateAdmx") +
             get_target_outputs(":GoogleUpdateAdml")
    output = "$root_build_dir/GoogleUpdateAdmx.zip"
    deps = [
      ":GoogleUpdateAdml",
      ":GoogleUpdateAdmx",
      ":GoogleUpdateAdmxGenerate",
    ]
  }

  zip("GoogleCloudManagementAdmxZip") {
    inputs = get_target_outputs(":GoogleCloudManagementAdmx") +
             get_target_outputs(":GoogleCloudManagementAdml")
    output = "$root_build_dir/GoogleCloudManagementAdmx.zip"
    deps = [
      ":GoogleCloudManagementAdml",
      ":GoogleCloudManagementAdmx",
    ]
  }
}