From c8ace8b1cf3acf43a88c42462ac2f0b1e540af46 Mon Sep 17 00:00:00 2001 From: Moritz Kiefer Date: Thu, 18 Nov 2021 09:51:43 +0100 Subject: [PATCH] Factor kind projector target into a variable (#11759) Seems nicer than trying to format a string everywhere changelog_begin changelog_end --- bazel_tools/scala.bzl | 1 + daml-lf/data-scalacheck/BUILD.bazel | 4 ++-- daml-lf/data/BUILD.bazel | 5 +++-- daml-lf/transaction-test-lib/BUILD.bazel | 4 ++-- language-support/scala/bindings-akka/BUILD.bazel | 4 ++-- language-support/scala/bindings/BUILD.bazel | 7 ++++--- .../scala/codegen-sample-app/BUILD.bazel | 4 ++-- language-support/scala/codegen-testing/BUILD.bazel | 9 ++++----- language-support/scala/codegen/BUILD.bazel | 5 ++--- ledger-service/fetch-contracts/BUILD.bazel | 6 +++--- ledger-service/http-json-oracle/BUILD.bazel | 6 +++--- ledger-service/http-json-perf/BUILD.bazel | 5 +++-- ledger-service/http-json-testing/BUILD.bazel | 4 ++-- ledger-service/http-json/BUILD.bazel | 13 +++++++------ ledger/ledger-api-common/BUILD.bazel | 5 +++-- libs-scala/concurrent/BUILD.bazel | 4 ++-- libs-scala/gatling-utils/BUILD.bazel | 7 ++++--- libs-scala/scala-utils/BUILD.bazel | 7 ++++--- libs-scala/scalatest-utils/BUILD.bazel | 4 ++-- 19 files changed, 55 insertions(+), 49 deletions(-) diff --git a/bazel_tools/scala.bzl b/bazel_tools/scala.bzl index ac546de4bcd4..c1daf7e118e2 100644 --- a/bazel_tools/scala.bzl +++ b/bazel_tools/scala.bzl @@ -177,6 +177,7 @@ default_compile_arguments = { } silencer_plugin = "@maven//:com_github_ghik_silencer_plugin_{}".format(scala_version_suffix) +kind_projector_plugin = "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix) default_initial_heap_size = "128m" default_max_heap_size = "1g" diff --git a/daml-lf/data-scalacheck/BUILD.bazel b/daml-lf/data-scalacheck/BUILD.bazel index 92e64018a450..6efe5406c5dd 100644 --- a/daml-lf/data-scalacheck/BUILD.bazel +++ b/daml-lf/data-scalacheck/BUILD.bazel @@ -4,15 +4,15 @@ load( "//bazel_tools:scala.bzl", "da_scala_library", + "kind_projector_plugin", "lf_scalacopts_stricter", ) -load("@scala_version//:index.bzl", "scala_version_suffix") da_scala_library( name = "data-scalacheck", srcs = glob(["src/main/**/*.scala"]), plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, ], scala_deps = [ "@maven//:org_scalacheck_scalacheck", diff --git a/daml-lf/data/BUILD.bazel b/daml-lf/data/BUILD.bazel index 2608d74bf618..6526c7c1fce6 100644 --- a/daml-lf/data/BUILD.bazel +++ b/daml-lf/data/BUILD.bazel @@ -5,11 +5,12 @@ load( "//bazel_tools:scala.bzl", "da_scala_library", "da_scala_test", + "kind_projector_plugin", "lf_scalacopts", "lf_scalacopts_stricter", "silencer_plugin", ) -load("@scala_version//:index.bzl", "scala_major_version", "scala_version_suffix") +load("@scala_version//:index.bzl", "scala_major_version") da_scala_library( name = "data", @@ -18,7 +19,7 @@ da_scala_library( "src/main/{}/**/*.scala".format(scala_major_version), ]), plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, silencer_plugin, ], scala_deps = [ diff --git a/daml-lf/transaction-test-lib/BUILD.bazel b/daml-lf/transaction-test-lib/BUILD.bazel index c9f466395356..a2467b46c434 100644 --- a/daml-lf/transaction-test-lib/BUILD.bazel +++ b/daml-lf/transaction-test-lib/BUILD.bazel @@ -4,16 +4,16 @@ load( "//bazel_tools:scala.bzl", "da_scala_library", + "kind_projector_plugin", "lf_scalacopts_stricter", "silencer_plugin", ) -load("@scala_version//:index.bzl", "scala_version_suffix") da_scala_library( name = "transaction-test-lib", srcs = glob(["src/main/**/*.scala"]), plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, silencer_plugin, ], scala_deps = [ diff --git a/language-support/scala/bindings-akka/BUILD.bazel b/language-support/scala/bindings-akka/BUILD.bazel index e3230c191a36..cb85a503803b 100644 --- a/language-support/scala/bindings-akka/BUILD.bazel +++ b/language-support/scala/bindings-akka/BUILD.bazel @@ -5,15 +5,15 @@ load( "//bazel_tools:scala.bzl", "da_scala_library", "da_scala_test_suite", + "kind_projector_plugin", "silencer_plugin", ) -load("@scala_version//:index.bzl", "scala_version_suffix") da_scala_library( name = "bindings-akka", srcs = glob(["src/main/**/*.scala"]), plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, silencer_plugin, ], resources = glob(["src/main/resources/**/*"]), diff --git a/language-support/scala/bindings/BUILD.bazel b/language-support/scala/bindings/BUILD.bazel index 3e1e05add24c..13ce1c3da077 100644 --- a/language-support/scala/bindings/BUILD.bazel +++ b/language-support/scala/bindings/BUILD.bazel @@ -5,8 +5,9 @@ load( "//bazel_tools:scala.bzl", "da_scala_library", "da_scala_test_suite", + "kind_projector_plugin", ) -load("@scala_version//:index.bzl", "scala_major_version", "scala_version_suffix") +load("@scala_version//:index.bzl", "scala_major_version") da_scala_library( name = "bindings", @@ -15,7 +16,7 @@ da_scala_library( "src/main/{}/**/*.scala".format(scala_major_version), ]), plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, ], scala_deps = [ "@maven//:org_scalaz_scalaz_core", @@ -46,7 +47,7 @@ da_scala_test_suite( size = "small", srcs = glob(["src/test/**/*.scala"]), plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, ], scala_deps = [ "@maven//:com_chuusai_shapeless", diff --git a/language-support/scala/codegen-sample-app/BUILD.bazel b/language-support/scala/codegen-sample-app/BUILD.bazel index 53954c322fa0..ea2f8b0873c6 100644 --- a/language-support/scala/codegen-sample-app/BUILD.bazel +++ b/language-support/scala/codegen-sample-app/BUILD.bazel @@ -5,6 +5,7 @@ load( "//bazel_tools:scala.bzl", "da_scala_library", "da_scala_test", + "kind_projector_plugin", "silencer_plugin", ) load( @@ -16,7 +17,6 @@ load( "//daml-lf/language:daml-lf.bzl", "lf_version_configuration", ) -load("@scala_version//:index.bzl", "scala_version_suffix") daml_compile( name = "MyMain", @@ -45,7 +45,7 @@ da_scala_library( name = "daml-lf-codegen-sample-app", srcs = [":MyMain.srcjar"] + glob(["src/main/**/*.scala"]), plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, silencer_plugin, ], scala_deps = [ diff --git a/language-support/scala/codegen-testing/BUILD.bazel b/language-support/scala/codegen-testing/BUILD.bazel index f23d714f2be6..5a3fd6c2cb11 100644 --- a/language-support/scala/codegen-testing/BUILD.bazel +++ b/language-support/scala/codegen-testing/BUILD.bazel @@ -5,16 +5,16 @@ load( "//bazel_tools:scala.bzl", "da_scala_library", "da_scala_test_suite", + "kind_projector_plugin", "silencer_plugin", ) -load("@scala_version//:index.bzl", "scala_major_version", "scala_version_suffix") +load("@scala_version//:index.bzl", "scala_major_version") da_scala_library( name = "codegen-testing", srcs = glob(["src/main/**/*.scala"]), plugins = [ - # Plugins have to be specified as JARs. - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, silencer_plugin, ], scala_deps = [ @@ -53,8 +53,7 @@ da_scala_library( name = "codegen-testing-testing", srcs = testing_utils + glob(["src/test/{}/com/**/*.scala".format(scala_major_version)]), plugins = [ - # Plugins have to be specified as JARs. - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, ], scala_deps = [ "@maven//:org_scalacheck_scalacheck", diff --git a/language-support/scala/codegen/BUILD.bazel b/language-support/scala/codegen/BUILD.bazel index 6fb647451069..9483c89638fe 100644 --- a/language-support/scala/codegen/BUILD.bazel +++ b/language-support/scala/codegen/BUILD.bazel @@ -6,9 +6,9 @@ load( "da_scala_binary", "da_scala_library", "da_scala_test_suite", + "kind_projector_plugin", "silencer_plugin", ) -load("@scala_version//:index.bzl", "scala_version_suffix") common_scalacopts = [ "-Xelide-below", @@ -27,8 +27,7 @@ da_scala_library( ], ), plugins = [ - # Plugins have to be specified as JARs. - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, silencer_plugin, ], scala_deps = [ diff --git a/ledger-service/fetch-contracts/BUILD.bazel b/ledger-service/fetch-contracts/BUILD.bazel index 8fd94308a51c..273491f3f42c 100644 --- a/ledger-service/fetch-contracts/BUILD.bazel +++ b/ledger-service/fetch-contracts/BUILD.bazel @@ -5,10 +5,10 @@ load( "//bazel_tools:scala.bzl", "da_scala_library", "da_scala_test", + "kind_projector_plugin", "lf_scalacopts", "silencer_plugin", ) -load("@scala_version//:index.bzl", "scala_version_suffix") hj_scalacopts = lf_scalacopts + [ "-P:wartremover:traverser:org.wartremover.warts.NonUnitStatements", @@ -18,7 +18,7 @@ da_scala_library( name = "fetch-contracts", srcs = glob(["src/main/scala/**/*.scala"]), plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, silencer_plugin, ], scala_deps = [ @@ -51,7 +51,7 @@ da_scala_test( size = "medium", srcs = glob(["src/test/scala/**/*.scala"]), plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, silencer_plugin, ], scala_deps = [ diff --git a/ledger-service/http-json-oracle/BUILD.bazel b/ledger-service/http-json-oracle/BUILD.bazel index 3244137ca420..ae59a1067934 100644 --- a/ledger-service/http-json-oracle/BUILD.bazel +++ b/ledger-service/http-json-oracle/BUILD.bazel @@ -2,11 +2,11 @@ # SPDX-License-Identifier: Apache-2.0 load("@oracle//:index.bzl", "oracle_testing") -load("@scala_version//:index.bzl", "scala_version_suffix") load( "//bazel_tools:scala.bzl", "da_scala_library", "da_scala_test_suite", + "kind_projector_plugin", "lf_scalacopts", ) @@ -18,7 +18,7 @@ da_scala_library( name = "integration-tests-lib", srcs = glob(["src/itlib/scala/**/*.scala"]), plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, ], scala_deps = [ "@maven//:com_chuusai_shapeless", @@ -73,7 +73,7 @@ da_scala_test_suite( "//ledger/test-common/test-certificates", ], plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, ], resources = glob(["src/it/resources/**/*"]), scala_deps = [ diff --git a/ledger-service/http-json-perf/BUILD.bazel b/ledger-service/http-json-perf/BUILD.bazel index 8d6425a54600..7f7702f94665 100644 --- a/ledger-service/http-json-perf/BUILD.bazel +++ b/ledger-service/http-json-perf/BUILD.bazel @@ -5,13 +5,14 @@ load( "//bazel_tools:scala.bzl", "da_scala_binary", "da_scala_library", + "kind_projector_plugin", "lf_scalacopts", ) load( "//rules_daml:daml.bzl", "daml_compile", ) -load("@scala_version//:index.bzl", "scala_major_version", "scala_version_suffix") +load("@scala_version//:index.bzl", "scala_major_version") load( "//daml-lf/language:daml-lf.bzl", "lf_version_configuration", @@ -33,7 +34,7 @@ perf_runtime_deps = { name = "http-json-perf-{}".format(edition), srcs = glob(["src/main/scala/**/*.scala"]), plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, ], resources = glob(["src/main/resources/**/*"]), scala_deps = [ diff --git a/ledger-service/http-json-testing/BUILD.bazel b/ledger-service/http-json-testing/BUILD.bazel index cfbbb90b8542..308142293fa5 100644 --- a/ledger-service/http-json-testing/BUILD.bazel +++ b/ledger-service/http-json-testing/BUILD.bazel @@ -4,10 +4,10 @@ load( "//bazel_tools:scala.bzl", "da_scala_library", + "kind_projector_plugin", "lf_scalacopts", "silencer_plugin", ) -load("@scala_version//:index.bzl", "scala_version_suffix") hj_scalacopts = lf_scalacopts + [ "-P:wartremover:traverser:org.wartremover.warts.NonUnitStatements", @@ -18,7 +18,7 @@ hj_scalacopts = lf_scalacopts + [ name = "{}".format(edition), srcs = glob(["src/main/scala/**/*.scala"]), plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, silencer_plugin, ], scala_deps = [ diff --git a/ledger-service/http-json/BUILD.bazel b/ledger-service/http-json/BUILD.bazel index 4818d4b269f5..4e98990d7f37 100644 --- a/ledger-service/http-json/BUILD.bazel +++ b/ledger-service/http-json/BUILD.bazel @@ -8,12 +8,13 @@ load( "da_scala_library", "da_scala_test", "da_scala_test_suite", + "kind_projector_plugin", "lf_scalacopts", "silencer_plugin", ) load("//rules_daml:daml.bzl", "daml_compile") load("@os_info//:os_info.bzl", "is_windows") -load("@scala_version//:index.bzl", "scala_major_version", "scala_version_suffix") +load("@scala_version//:index.bzl", "scala_major_version") hj_scalacopts = lf_scalacopts + [ "-P:wartremover:traverser:org.wartremover.warts.NonUnitStatements", @@ -24,7 +25,7 @@ hj_scalacopts = lf_scalacopts + [ name = "http-json-{}".format(edition), srcs = glob(["src/main/scala/**/*.scala"]), plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, silencer_plugin, ], scala_deps = [ @@ -202,7 +203,7 @@ daml_compile( "//ledger/test-common/test-certificates", ], plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, silencer_plugin, ], scala_deps = [ @@ -348,7 +349,7 @@ alias( "src/itpostgres/scala/**/*.scala", ]), plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, silencer_plugin, ], scala_deps = [ @@ -419,7 +420,7 @@ alias( # TODO https://github.com/digital-asset/daml/issues/11585 flaky = True, plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, silencer_plugin, ], resources = glob(["src/it/resources/**/*"]), @@ -506,7 +507,7 @@ test_suite( # See https://github.com/digital-asset/daml/issues/9886 flaky = True, plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, ], resources = glob(["src/failure/resources/**/*"]), scala_deps = [ diff --git a/ledger/ledger-api-common/BUILD.bazel b/ledger/ledger-api-common/BUILD.bazel index 494ae2e66ba2..50932187d0b5 100644 --- a/ledger/ledger-api-common/BUILD.bazel +++ b/ledger/ledger-api-common/BUILD.bazel @@ -5,15 +5,16 @@ load( "//bazel_tools:scala.bzl", "da_scala_library", "da_scala_test_suite", + "kind_projector_plugin", "silencer_plugin", ) -load("@scala_version//:index.bzl", "scala_major_version", "scala_version_suffix") +load("@scala_version//:index.bzl", "scala_major_version") da_scala_library( name = "ledger-api-common", srcs = glob(["src/main/scala/**/*.scala"]), plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, ], scala_deps = [ "@maven//:com_typesafe_akka_akka_actor", diff --git a/libs-scala/concurrent/BUILD.bazel b/libs-scala/concurrent/BUILD.bazel index c0e872c11e58..0504aba0ed14 100644 --- a/libs-scala/concurrent/BUILD.bazel +++ b/libs-scala/concurrent/BUILD.bazel @@ -5,9 +5,9 @@ load( "//bazel_tools:scala.bzl", "da_scala_library", "da_scala_test", + "kind_projector_plugin", "lf_scalacopts", ) -load("@scala_version//:index.bzl", "scala_major_version", "scala_version_suffix") scalacopts = lf_scalacopts + [ "-P:wartremover:traverser:org.wartremover.warts.NonUnitStatements", @@ -17,7 +17,7 @@ da_scala_library( name = "concurrent", srcs = glob(["src/main/scala/**/*.scala"]), plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, ], scala_deps = [ "@maven//:org_scalaz_scalaz_core", diff --git a/libs-scala/gatling-utils/BUILD.bazel b/libs-scala/gatling-utils/BUILD.bazel index b708847d5215..735048ecbc96 100644 --- a/libs-scala/gatling-utils/BUILD.bazel +++ b/libs-scala/gatling-utils/BUILD.bazel @@ -5,10 +5,11 @@ load( "//bazel_tools:scala.bzl", "da_scala_library", "da_scala_test", + "kind_projector_plugin", "lf_scalacopts", "silencer_plugin", ) -load("@scala_version//:index.bzl", "scala_major_version", "scala_version_suffix") +load("@scala_version//:index.bzl", "scala_major_version") scalacopts = lf_scalacopts + [ "-P:wartremover:traverser:org.wartremover.warts.NonUnitStatements", @@ -18,7 +19,7 @@ da_scala_library( name = "gatling-utils", srcs = glob(["src/main/scala/**/*.scala"]), plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, silencer_plugin, ], scala_deps = [ @@ -57,7 +58,7 @@ da_scala_test( ":test-simulation-logs", ], plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, ], scala_deps = [ "@maven//:org_scalatest_scalatest_core", diff --git a/libs-scala/scala-utils/BUILD.bazel b/libs-scala/scala-utils/BUILD.bazel index 07e4bc368d5e..9ebaa29ae754 100644 --- a/libs-scala/scala-utils/BUILD.bazel +++ b/libs-scala/scala-utils/BUILD.bazel @@ -5,10 +5,11 @@ load( "//bazel_tools:scala.bzl", "da_scala_library", "da_scala_test", + "kind_projector_plugin", "lf_scalacopts", "silencer_plugin", ) -load("@scala_version//:index.bzl", "scala_major_version", "scala_version_suffix") +load("@scala_version//:index.bzl", "scala_major_version") scalacopts = lf_scalacopts + [ "-P:wartremover:traverser:org.wartremover.warts.NonUnitStatements", @@ -20,7 +21,7 @@ da_scala_library( "src/main/{}/**/*.scala".format(scala_major_version), ]), plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, silencer_plugin, ], scala_deps = [ @@ -40,7 +41,7 @@ da_scala_test( name = "test", srcs = glob(["src/test/scala/**/*.scala"]), plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, ], scala_deps = [ "@maven//:com_chuusai_shapeless", diff --git a/libs-scala/scalatest-utils/BUILD.bazel b/libs-scala/scalatest-utils/BUILD.bazel index 6f0a2a7f73d5..b27f3d0ec7ac 100644 --- a/libs-scala/scalatest-utils/BUILD.bazel +++ b/libs-scala/scalatest-utils/BUILD.bazel @@ -5,15 +5,15 @@ load( "//bazel_tools:scala.bzl", "da_scala_library", "da_scala_test", + "kind_projector_plugin", "lf_scalacopts", ) -load("@scala_version//:index.bzl", "scala_version_suffix") da_scala_library( name = "scalatest-utils", srcs = glob(["src/main/**/*.scala"]), plugins = [ - "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + kind_projector_plugin, ], scala_deps = [ "@maven//:org_scalacheck_scalacheck",