# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//flutter/testing/rules/android.gni")

_android_sources = [
  "app/build.gradle",
  "app/src/main/AndroidManifest.xml",
  "app/src/main/java/dev/flutter/android_background_image/MainActivity.java",
  "build.gradle",
]

gradle_task("android_lint") {
  app_name = "android_background_image"
  task = "lint"
  gradle_project_dir = rebase_path(".")
  sources = _android_sources
  outputs =
      [ "$root_out_dir/android_background_image/reports/lint-results.xml" ]

  deps = [ "//flutter/testing/android_background_image:android_background_image_snapshot" ]
}

gradle_task("build_apk") {
  app_name = "android_background_image"
  task = "assembleDebug"
  gradle_project_dir = rebase_path(".")
  sources = _android_sources
  outputs = [ "$root_out_dir/android_background_image/app/outputs/apk/debug/app-debug.apk" ]

  deps = [
    ":android_lint",
    "//flutter/testing/android_background_image:android_background_image_snapshot",
  ]
}

copy("android") {
  sources = get_target_outputs(":build_apk")
  outputs = [ "$root_out_dir/firebase_apks/android_background_image.apk" ]
  deps = [ ":build_apk" ]
}
