chromium/ui/file_manager/integration_tests/BUILD.gn

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

import("//tools/typescript/ts_library.gni")

preprocess_folder = "$target_gen_dir/preprocessed"
tsc_folder = "$target_gen_dir/tsc"

ts_files = [
  "remote_call.ts",
  "test_util.ts",
  "testcase.ts",

  # File Manager.
  "file_manager/android_photos.ts",
  "file_manager/background.ts",
  "file_manager/breadcrumbs.ts",
  "file_manager/choose_entry.ts",
  "file_manager/choose_entry_const.ts",
  "file_manager/context_menu.ts",
  "file_manager/copy_between_windows.ts",
  "file_manager/create_new_folder.ts",
  "file_manager/crostini.ts",
  "file_manager/directory_tree.ts",
  "file_manager/directory_tree_context_menu.ts",
  "file_manager/dlp.ts",
  "file_manager/dlp_enterprise_connectors.ts",
  "file_manager/drive_specific.ts",
  "file_manager/file_dialog.ts",
  "file_manager/file_display.ts",
  "file_manager/file_list.ts",
  "file_manager/file_transfer_connector.ts",
  "file_manager/files_tooltip.ts",
  "file_manager/folder_shortcuts.ts",
  "file_manager/format_dialog.ts",
  "file_manager/gear_menu.ts",
  "file_manager/grid_view.ts",
  "file_manager/guest_os.ts",
  "file_manager/holding_space.ts",
  "file_manager/install_linux_package_dialog.ts",
  "file_manager/keyboard_operations.ts",
  "file_manager/manage_dialog.ts",
  "file_manager/metadata.ts",
  "file_manager/metrics.ts",
  "file_manager/materialized_views.ts",
  "file_manager/my_files.ts",
  "file_manager/navigation.ts",
  "file_manager/office.ts",
  "file_manager/open_audio_media_app.ts",
  "file_manager/open_files_in_web_drive.ts",
  "file_manager/open_image_media_app.ts",
  "file_manager/open_media_app.ts",
  "file_manager/open_sniffed_files.ts",
  "file_manager/open_video_media_app.ts",
  "file_manager/providers.ts",
  "file_manager/quick_view.ts",
  "file_manager/recents.ts",
  "file_manager/restore_prefs.ts",
  "file_manager/search.ts",
  "file_manager/share.ts",
  "file_manager/sort_columns.ts",
  "file_manager/tab_index.ts",
  "file_manager/tasks.ts",
  "file_manager/test_data.ts",
  "file_manager/toolbar.ts",
  "file_manager/transfer.ts",
  "file_manager/trash.ts",
  "file_manager/traverse.ts",
  "file_manager/zip_files.ts",

  # Page Objects.
  "file_manager/page_objects/directory_tree.ts",
]

# TS/JS files.
copy("copy_src") {
  sources = ts_files
  outputs = [ "$preprocess_folder/{{source_target_relative}}" ]
}

copy("from_files_app") {
  sources = [ "../file_manager/common/js/shared_types.ts" ]
  outputs = [ "$preprocess_folder/prod/file_manager/{{source_file_part}}" ]
  deps = [ "//ui/file_manager:generate_definitions" ]
}

# All non JS/TS files.
copy("copy_app") {
  sources = [
    "file_manager/background.html",
    "file_manager/choose_entry.html",
    "file_manager_test_manifest.json",
  ]
  outputs = [ "$tsc_folder/{{source_target_relative}}" ]
}

ts_library("build_ts") {
  root_dir = preprocess_folder
  out_dir = tsc_folder
  tsconfig_base = "tsconfig_base.json"
  composite = true

  definitions = [
    "//tools/typescript/definitions/chrome_event.d.ts",
    "//tools/typescript/definitions/chrome_test.d.ts",
    "//tools/typescript/definitions/runtime.d.ts",
    "//tools/typescript/definitions/file_system.d.ts",
    "//tools/typescript/definitions/windows.d.ts",
    "//ui/file_manager/file_manager/definitions/file_manager_private.d.ts",
    "//ui/file_manager/file_manager/definitions/navigator_connection.d.ts",
    "definitions.d.ts",
  ]

  extra_deps = [
    ":copy_src",
    ":from_files_app",
  ]

  in_files = ts_files + [
               # Copied from the Files app production to avoid duplication.
               "prod/file_manager/shared_types.ts",
             ]
}

group("build") {
  deps = [
    ":build_ts",
    ":copy_app",
  ]

  # Also as data_deps to make the files available at runtime to the
  # browser_tests binary, see `gn help runtime_deps` for more info.
  data_deps = [
    ":build_ts",
    ":copy_app",
  ]
}