mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-19 00:37:23 +03:00
More Scala 2.13 cleanup (#8855)
This fixes Scaladoc and our pom file generation. It also clears up the confusing error around gatling and removes a redundant dependency on sbt (no idea why we had that in the first place) both of which resulted in Scala 2.12 dependencies in our 2.13 lockfile which is obviously bad. With this, we should now be ready to publish Scala 2.13 artifacts once the ledger API test tool PR lands. changelog_begin changelog_end
This commit is contained in:
parent
f02b62a5e8
commit
7ae28beff9
@ -587,10 +587,12 @@ dev_env_tool(
|
||||
win_tool = "nsis-3.04",
|
||||
) if is_windows else None
|
||||
|
||||
load("@scala_version//:index.bzl", "scala_major_version_suffix")
|
||||
|
||||
# Scaladoc
|
||||
nixpkgs_package(
|
||||
name = "scala_nix",
|
||||
attribute_path = "scala",
|
||||
attribute_path = "scala_{}".format(scala_major_version_suffix),
|
||||
nix_file = "//nix:bazel.nix",
|
||||
nix_file_deps = common_nix_file_deps,
|
||||
# Remove once we upgrade to Bazel >=3.0. Until then `nix-build` output
|
||||
|
@ -12,6 +12,17 @@ load("@scala_version//:index.bzl", "scala_major_version", "scala_version")
|
||||
version_specific = {
|
||||
"2.12": [
|
||||
"ai.x:diff_2.12:2.0.1",
|
||||
# Gatling does not cross-build so this is limited to Scala 2.12. Newer
|
||||
# versions of Gatling still don’t cross-build but they build against Scala 2.13
|
||||
# instead so we’ll have to switch over at that point.
|
||||
"io.gatling:gatling-app:3.3.1",
|
||||
"io.gatling:gatling-core:3.3.1",
|
||||
"io.gatling:gatling-commons:3.3.1",
|
||||
"io.gatling:gatling-recorder:3.3.1",
|
||||
"io.gatling:gatling-charts:3.3.1",
|
||||
"io.gatling.highcharts:gatling-highcharts:3.3.1",
|
||||
"io.gatling:gatling-http:3.3.1",
|
||||
"io.gatling:gatling-http-client:3.3.1",
|
||||
],
|
||||
"2.13": [
|
||||
"org.scala-lang.modules:scala-parallel-collections_2.13:1.0.0",
|
||||
@ -144,7 +155,6 @@ def install_java_deps():
|
||||
"org.scalacheck:scalacheck_{}:1.14.0".format(scala_major_version),
|
||||
"org.scala-lang.modules:scala-collection-compat_{}:2.3.2".format(scala_major_version),
|
||||
"org.scala-lang.modules:scala-java8-compat_{}:0.9.0".format(scala_major_version),
|
||||
"org.scala-sbt:sbt:1.1.4",
|
||||
"org.scalactic:scalactic_{}:3.1.2".format(scala_major_version),
|
||||
"org.scalatest:scalatest_{}:3.1.2".format(scala_major_version),
|
||||
"org.scalatestplus:scalacheck-1-14_{}:3.1.4.0".format(scala_major_version),
|
||||
@ -162,15 +172,6 @@ def install_java_deps():
|
||||
"org.typelevel:paiges-core_{}:0.3.2".format(scala_major_version),
|
||||
"org.wartremover:wartremover_{}:2.4.10".format(scala_version),
|
||||
"org.xerial:sqlite-jdbc:3.30.1",
|
||||
# gatling dependencies
|
||||
"io.gatling:gatling-app:3.3.1",
|
||||
"io.gatling:gatling-core:3.3.1",
|
||||
"io.gatling:gatling-commons:3.3.1",
|
||||
"io.gatling:gatling-recorder:3.3.1",
|
||||
"io.gatling:gatling-charts:3.3.1",
|
||||
"io.gatling.highcharts:gatling-highcharts:3.3.1",
|
||||
"io.gatling:gatling-http:3.3.1",
|
||||
"io.gatling:gatling-http-client:3.3.1",
|
||||
"com.fasterxml.jackson.core:jackson-core:2.12.0",
|
||||
"com.fasterxml.jackson.core:jackson-databind:2.12.0",
|
||||
],
|
||||
|
@ -8,6 +8,8 @@
|
||||
# 3. We produce full pom files instead of only the dependency section.
|
||||
# 4. We have some special options to deal with our specific setup.
|
||||
|
||||
load("@scala_version//:index.bzl", "scala_major_version")
|
||||
|
||||
MavenInfo = provider(
|
||||
fields = {
|
||||
"maven_coordinates": """
|
||||
@ -26,8 +28,6 @@ _EMPTY_MAVEN_INFO = MavenInfo(
|
||||
|
||||
_MAVEN_COORDINATES_PREFIX = "maven_coordinates="
|
||||
|
||||
_SCALA_VERSION = "2.12"
|
||||
|
||||
# Map from a dependency to the exclusions for that dependency.
|
||||
# The exclusions will be automatically inserted in every pom file that
|
||||
# depends on the target.
|
||||
@ -77,7 +77,7 @@ def _collect_maven_info_impl(_target, ctx):
|
||||
}
|
||||
if jar.label.workspace_name in replacements:
|
||||
return [MavenInfo(
|
||||
maven_coordinates = "{}_{}:{}".format(replacements[jar.label.workspace_name], _SCALA_VERSION, jar_version(jar.label.name)),
|
||||
maven_coordinates = "{}_{}:{}".format(replacements[jar.label.workspace_name], scala_major_version, jar_version(jar.label.name)),
|
||||
maven_dependencies = [],
|
||||
)]
|
||||
if MavenInfo not in jar:
|
||||
@ -101,7 +101,7 @@ def _collect_maven_info_impl(_target, ctx):
|
||||
artifact_id = tag_val[1]
|
||||
version = tag_val[2]
|
||||
if has_scala_version_suffix(ctx.rule.kind, version, tags):
|
||||
artifact_id += "_{}".format(_SCALA_VERSION)
|
||||
artifact_id += "_{}".format(scala_major_version)
|
||||
maven_coordinates = "{}:{}:{}".format(group_id, artifact_id, version)
|
||||
if tag == "only_external_deps":
|
||||
only_external_deps = True
|
||||
|
@ -533,9 +533,7 @@ def da_scala_library(name, **kwargs):
|
||||
_wrap_rule(scala_library, name, **arguments)
|
||||
_create_scala_source_jar(name = name, **arguments)
|
||||
|
||||
# We get scaladoc from nix in version 2.12 atm.
|
||||
if scala_major_version == "2.12":
|
||||
_create_scaladoc_jar(name = name, **arguments)
|
||||
_create_scaladoc_jar(name = name, **arguments)
|
||||
|
||||
if "tags" in arguments:
|
||||
for tag in arguments["tags"]:
|
||||
|
@ -179,12 +179,10 @@ jobs:
|
||||
//... \
|
||||
-//ledger/ledger-api-test-tool/... \
|
||||
-//runtime-components/non-repudiation-postgresql:test
|
||||
# gatling-utils tests fail with a ClassNotFoundException for scala.collection.SeqLike
|
||||
bazel test --config scala_2_13 -- \
|
||||
//... \
|
||||
-//ledger/ledger-api-test-tool/... \
|
||||
-//runtime-components/non-repudiation-postgresql:test \
|
||||
-//libs-scala/gatling-utils/...
|
||||
-//runtime-components/non-repudiation-postgresql:test
|
||||
displayName: 'Build'
|
||||
- template: tell-slack-failed.yml
|
||||
parameters:
|
||||
|
@ -7,7 +7,7 @@ load(
|
||||
"da_scala_library",
|
||||
"lf_scalacopts",
|
||||
)
|
||||
load("@scala_version//:index.bzl", "scala_version_suffix")
|
||||
load("@scala_version//:index.bzl", "scala_major_version", "scala_version_suffix")
|
||||
|
||||
scalacopts = lf_scalacopts + [
|
||||
"-P:wartremover:traverser:org.wartremover.warts.NonUnitStatements",
|
||||
@ -55,7 +55,7 @@ da_scala_library(
|
||||
"@maven//:io_gatling_gatling_http_client",
|
||||
"@maven//:org_slf4j_slf4j_api",
|
||||
],
|
||||
)
|
||||
) if scala_major_version == "2.12" else None
|
||||
|
||||
da_scala_binary(
|
||||
name = "http-json-perf-binary",
|
||||
@ -103,6 +103,6 @@ da_scala_binary(
|
||||
"@maven//:io_gatling_gatling_http_client",
|
||||
"@maven//:org_slf4j_slf4j_api",
|
||||
],
|
||||
)
|
||||
) if scala_major_version == "2.12" else None
|
||||
|
||||
exports_files(["release/json-api-perf-logback.xml"])
|
||||
|
@ -291,7 +291,10 @@ scaladoc_jar(
|
||||
silencer_plugin,
|
||||
],
|
||||
root_content = "rootdoc.txt",
|
||||
scalacopts = ["-P:silencer:checkUnused"],
|
||||
scalacopts = [
|
||||
"-P:silencer:checkUnused",
|
||||
"-P:silencer:lineContentFilters=import scala.collection.compat",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
@ -301,7 +304,7 @@ scaladoc_jar(
|
||||
"{}_{}".format(d, scala_major_version_suffix)
|
||||
for d in scala_compile_deps + ["@maven//:org_scala_lang_modules_scala_collection_compat"]
|
||||
],
|
||||
) if (not is_windows and scala_major_version_suffix == "2_12") else None
|
||||
) if not is_windows else None
|
||||
|
||||
filegroup(
|
||||
name = "sources",
|
||||
|
@ -7,7 +7,7 @@ load(
|
||||
"da_scala_test",
|
||||
"lf_scalacopts",
|
||||
)
|
||||
load("@scala_version//:index.bzl", "scala_version_suffix")
|
||||
load("@scala_version//:index.bzl", "scala_major_version", "scala_version_suffix")
|
||||
load("//bazel_tools:scala.bzl", "silencer_plugin")
|
||||
|
||||
scalacopts = lf_scalacopts + [
|
||||
@ -41,7 +41,7 @@ da_scala_library(
|
||||
"@maven//:io_gatling_gatling_core",
|
||||
"@maven//:org_slf4j_slf4j_api",
|
||||
],
|
||||
)
|
||||
) if scala_major_version == "2.12" else None
|
||||
|
||||
filegroup(
|
||||
name = "test-simulation-logs",
|
||||
@ -71,4 +71,4 @@ da_scala_test(
|
||||
"//bazel_tools/runfiles:scala_runfiles",
|
||||
"//libs-scala/scalatest-utils",
|
||||
],
|
||||
)
|
||||
) if scala_major_version == "2.12" else None
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -29,7 +29,22 @@ let shared = rec {
|
||||
zip
|
||||
;
|
||||
|
||||
scala = (pkgs.scala_2_12.override { }).overrideAttrs (attrs: {
|
||||
scala_2_12 = (pkgs.scala_2_12.override { }).overrideAttrs (attrs: {
|
||||
# Something appears to be broken in nixpkgs' fixpoint which results in the
|
||||
# test not having the version number we overwrite so it fails
|
||||
# with a mismatch between the version in nixpkgs and the one we
|
||||
# overwrite.
|
||||
installCheckPhase = "";
|
||||
buildInputs = attrs.buildInputs ++ [ pkgs.makeWrapper ];
|
||||
installPhase = attrs.installPhase + ''
|
||||
wrapProgram $out/bin/scala --add-flags "-nobootcp"
|
||||
wrapProgram $out/bin/scalac --add-flags "-nobootcp"
|
||||
wrapProgram $out/bin/scaladoc --add-flags "-nobootcp"
|
||||
wrapProgram $out/bin/scalap --add-flags "-nobootcp"
|
||||
'';
|
||||
});
|
||||
|
||||
scala_2_13 = (pkgs.scala_2_13.override { }).overrideAttrs (attrs: {
|
||||
# Something appears to be broken in nixpkgs' fixpoint which results in the
|
||||
# test not having the version number we overwrite so it fails
|
||||
# with a mismatch between the version in nixpkgs and the one we
|
||||
|
@ -68,7 +68,7 @@ in rec {
|
||||
|
||||
javafmt = pkgs.callPackage ./tools/google-java-format {};
|
||||
|
||||
scala = bazel_dependencies.scala;
|
||||
scala = bazel_dependencies.scala_2_12;
|
||||
fsc = scala;
|
||||
scalac = scala;
|
||||
scaladoc = scala;
|
||||
|
@ -38,6 +38,14 @@ let
|
||||
sha256 = "3520cd1f3c9efff62baee75f32e52d1e5dc120be2ccf340649e470e48f527e2b";
|
||||
};
|
||||
});
|
||||
scala_2_13 = pkgs.scala_2_13.overrideAttrs (oldAttrs: rec {
|
||||
version = "2.13.3";
|
||||
name = "scala-2.13.3";
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://www.scala-lang.org/files/archive/${name}.tgz";
|
||||
sha256 = "0zv9w9f6g2cfydsvp8mqcfgv2v3487xp4ca1qndg6v7jrhdp7wy9";
|
||||
};
|
||||
});
|
||||
haskell = pkgs.haskell // {
|
||||
packages = pkgs.haskell.packages // {
|
||||
integer-simple = pkgs.haskell.packages.integer-simple // {
|
||||
|
Loading…
Reference in New Issue
Block a user