blob: d560d98d740850741eea01034714682b651fd873 [file] [log] [blame]
load("@rules_java//java:defs.bzl", "java_library")
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
load("//tools/bzl:junit.bzl", "junit_tests")
load("//tools/js:eslint.bzl", "eslint")
load(
"//tools/bzl:plugin.bzl",
"PLUGIN_DEPS",
"PLUGIN_TEST_DEPS",
"gerrit_plugin",
)
load("//tools/bzl:genrule2.bzl", "genrule2")
load("//tools/bzl:js.bzl", "polygerrit_plugin")
gerrit_plugin(
name = "delete-project",
srcs = glob(["src/main/java/**/*.java"]),
manifest_entries = [
"Gerrit-PluginName: delete-project",
"Gerrit-Module: com.googlesource.gerrit.plugins.deleteproject.Module",
"Gerrit-HttpModule: com.googlesource.gerrit.plugins.deleteproject.HttpModule",
"Gerrit-SshModule: com.googlesource.gerrit.plugins.deleteproject.SshModule",
],
resource_jars = [":gr-delete-repo-static"],
resources = glob(["src/main/resources/Documentation/*.md"]),
deps = ["@commons-io//jar"],
)
genrule2(
name = "gr-delete-repo-static",
srcs = [":gr-delete-repo"],
outs = ["gr-delete-repo-static.jar"],
cmd = " && ".join([
"mkdir $$TMP/static",
"cp $(locations :gr-delete-repo) $$TMP/static",
"cd $$TMP",
"zip -Drq $$ROOT/$@ -g .",
]),
)
polygerrit_plugin(
name = "gr-delete-repo",
app = "delete-project-bundle.js",
plugin_name = "delete-project",
)
rollup_bundle(
name = "delete-project-bundle",
srcs = glob(["gr-delete-repo/*.js"]),
entry_point = "gr-delete-repo/plugin.js",
format = "iife",
rollup_bin = "//tools/node_tools:rollup-bin",
sourcemap = "hidden",
deps = [
"@tools_npm//rollup-plugin-node-resolve",
],
)
junit_tests(
name = "delete-project_tests",
srcs = glob(["src/test/java/**/*.java"]),
tags = ["delete-project"],
deps = [
":delete-project__plugin_test_deps",
],
)
java_library(
name = "delete-project__plugin_test_deps",
testonly = 1,
visibility = ["//visibility:public"],
exports = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [
":delete-project__plugin",
"@commons-io//jar",
"@mockito//jar",
],
)
# Define the eslinter for the plugin
# The eslint macro creates 2 rules: lint_test and lint_bin
eslint(
name = "lint",
srcs = glob([
"gr-delete-repo/**/*.js",
]),
config = ".eslintrc.json",
data = [],
extensions = [
".js",
],
ignore = ".eslintignore",
plugins = [
"@npm//eslint-config-google",
"@npm//eslint-plugin-html",
"@npm//eslint-plugin-import",
"@npm//eslint-plugin-jsdoc",
],
)