From e90def4181a51b9c4aaba54b2ebdd994d29fdf01 Mon Sep 17 00:00:00 2001 From: Rd Date: Tue, 4 Jun 2024 12:53:26 +0530 Subject: [PATCH] Introduce RunCoverageForTestTarget script --- scripts/BUILD.bazel | 9 +++++++++ .../org/oppia/android/scripts/coverage/BUILD.bazel | 14 ++++++++++++++ .../scripts/coverage/RunCoverageForTestTarget.kt | 5 +++++ 3 files changed, 28 insertions(+) create mode 100644 scripts/src/java/org/oppia/android/scripts/coverage/BUILD.bazel create mode 100644 scripts/src/java/org/oppia/android/scripts/coverage/RunCoverageForTestTarget.kt diff --git a/scripts/BUILD.bazel b/scripts/BUILD.bazel index 689cf6e53d2..23587533fa0 100644 --- a/scripts/BUILD.bazel +++ b/scripts/BUILD.bazel @@ -237,6 +237,15 @@ kt_jvm_binary( ], ) +kt_jvm_binary( + name = "run_coverage_for_test_target", + testonly = True, + main_class = "org.oppia.android.scripts.coverage.RunCoverageForTestTargetKt", + runtime_deps = [ + "//scripts/src/java/org/oppia/android/scripts/coverage:run_coverage_for_test_target_lib", + ], +) + # Note that this is intentionally not test-only since it's used by the app build pipeline. Also, # this apparently needs to be a java_binary to set up runfiles correctly when executed within a # Starlark rule as a tool. diff --git a/scripts/src/java/org/oppia/android/scripts/coverage/BUILD.bazel b/scripts/src/java/org/oppia/android/scripts/coverage/BUILD.bazel new file mode 100644 index 00000000000..3b0c0f9d886 --- /dev/null +++ b/scripts/src/java/org/oppia/android/scripts/coverage/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_library") + +kt_jvm_library( + name = "run_coverage_for_test_target_lib", + testonly = True, + srcs = [ + "RunCoverageForTestTarget.kt", + ], + visibility = ["//scripts:oppia_script_binary_visibility"], + deps = [ + "//scripts/src/java/org/oppia/android/scripts/common:bazel_client", + "//scripts/src/java/org/oppia/android/scripts/common:git_client", + ], +) \ No newline at end of file diff --git a/scripts/src/java/org/oppia/android/scripts/coverage/RunCoverageForTestTarget.kt b/scripts/src/java/org/oppia/android/scripts/coverage/RunCoverageForTestTarget.kt new file mode 100644 index 00000000000..f5850688ab7 --- /dev/null +++ b/scripts/src/java/org/oppia/android/scripts/coverage/RunCoverageForTestTarget.kt @@ -0,0 +1,5 @@ +package org.oppia.android.scripts.coverage + +fun main(vararg args: String) { + println("Running coverage for test target: ${args[0]}") +} \ No newline at end of file