From 90c854f3bf0e409f905ba29d4f813e10d9dceaf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Majcherski?= <43614029+majcherm-da@users.noreply.github.com> Date: Thu, 6 Jun 2019 16:19:39 +0200 Subject: [PATCH] windows: language-support java codegen tests (#1542) --- build.ps1 | 2 ++ language-support/java/codegen/BUILD.bazel | 1 + language-support/java/codegen/codegen.bzl | 4 ++-- .../scala/com/digitalasset/CodegenLedgerTest.scala | 6 ++++-- .../digitalasset/daml/lf/codegen/CodeGenRunnerTests.scala | 5 +++-- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/build.ps1 b/build.ps1 index f4160f10bf3b..805a7cbbc511 100644 --- a/build.ps1 +++ b/build.ps1 @@ -47,6 +47,7 @@ bazel build `-`-experimental_execution_log_file ${ARTIFACT_DIRS}/build_execution //language-support/java/testkit:testkit ` //language-support/java/bindings/... ` //language-support/java/bindings-rxjava/... ` + //language-support/java/codegen/... ` //ledger/... ` //ledger-api/... ` //navigator/backend/... ` @@ -64,6 +65,7 @@ bazel test `-`-experimental_execution_log_file ${ARTIFACT_DIRS}/test_execution_w //daml-lf/... ` //language-support/java/bindings/... ` //language-support/java/bindings-rxjava/... ` + //language-support/java/codegen/... ` //ledger/ledger-api-client/... ` //ledger/ledger-api-common/... ` //ledger-api/... ` diff --git a/language-support/java/codegen/BUILD.bazel b/language-support/java/codegen/BUILD.bazel index 97ccfeb17b04..13db73787fd0 100644 --- a/language-support/java/codegen/BUILD.bazel +++ b/language-support/java/codegen/BUILD.bazel @@ -64,6 +64,7 @@ test_deps = [ "//3rdparty/jvm/org/scalatest", "//3rdparty/jvm/org/scalaz:scalaz_core", "//3rdparty/jvm/com/google/protobuf:protobuf_java", + "//bazel_tools/runfiles:scala_runfiles", "//daml-lf/archive:daml_lf_java_proto", "//daml-lf/data", "//daml-lf/interface", diff --git a/language-support/java/codegen/codegen.bzl b/language-support/java/codegen/codegen.bzl index c5d310442d58..07c774788285 100644 --- a/language-support/java/codegen/codegen.bzl +++ b/language-support/java/codegen/codegen.bzl @@ -24,14 +24,14 @@ def dar_to_java(**kwargs): outs = [mangle(src_jar)], cmd = """ $(execpath //language-support/java/codegen:codegen) -o {gen_out} -d com.daml.ledger.javaapi.TestDecoder {gen_in} - $(execpath @local_jdk//:bin/jar) -cf $@ -C {gen_out} . + $(execpath @bazel_tools//tools/jdk:jar) -cf $@ -C {gen_out} . """.format( gen_in = "$(location %s)=%s" % (dar, package_prefix), gen_out = src_out, ), tools = [ "//language-support/java/codegen:codegen", - "@local_jdk//:bin/jar", + "@bazel_tools//tools/jdk:jar", ], ) diff --git a/language-support/java/codegen/src/ledger-tests/scala/com/digitalasset/CodegenLedgerTest.scala b/language-support/java/codegen/src/ledger-tests/scala/com/digitalasset/CodegenLedgerTest.scala index 721698d4c508..70ec84d9155e 100644 --- a/language-support/java/codegen/src/ledger-tests/scala/com/digitalasset/CodegenLedgerTest.scala +++ b/language-support/java/codegen/src/ledger-tests/scala/com/digitalasset/CodegenLedgerTest.scala @@ -25,6 +25,7 @@ import com.daml.ledger.javaapi.data.{ Transaction, Unit => DamlUnit } +import com.digitalasset.daml.bazeltools.BazelRunfiles import com.digitalasset.ledger.api.v1.CommandServiceOuterClass.SubmitAndWaitRequest import com.digitalasset.ledger.api.v1.TransactionServiceOuterClass.{ GetLedgerEndRequest, @@ -44,10 +45,11 @@ import tests.wolpertinger.{Color, Wolpertinger} import scala.collection.JavaConverters._ import scala.language.implicitConversions import com.digitalasset.ledger.api.domain.LedgerId + @SuppressWarnings(Array("org.wartremover.warts.Any")) -class CodegenLedgerTest extends FlatSpec with Matchers { +class CodegenLedgerTest extends FlatSpec with Matchers with BazelRunfiles { - def testDalf = new File("language-support/java/codegen/ledger-tests-model.dar") + def testDalf = new File(rlocation("language-support/java/codegen/ledger-tests-model.dar")) val LedgerID = "ledger-test" def withClient(testCode: Channel => Assertion): Assertion = { diff --git a/language-support/java/codegen/src/test/scala/com/digitalasset/daml/lf/codegen/CodeGenRunnerTests.scala b/language-support/java/codegen/src/test/scala/com/digitalasset/daml/lf/codegen/CodeGenRunnerTests.scala index 6988ca620a00..3b4bade8cdd9 100644 --- a/language-support/java/codegen/src/test/scala/com/digitalasset/daml/lf/codegen/CodeGenRunnerTests.scala +++ b/language-support/java/codegen/src/test/scala/com/digitalasset/daml/lf/codegen/CodeGenRunnerTests.scala @@ -6,18 +6,19 @@ package com.digitalasset.daml.lf.codegen import java.io.File import java.nio.file.Files +import com.digitalasset.daml.bazeltools.BazelRunfiles import com.digitalasset.daml.lf.codegen.backend.java.JavaBackend import com.digitalasset.daml.lf.codegen.conf.Conf import org.scalatest.{FlatSpec, Matchers} @SuppressWarnings(Array("org.wartremover.warts.Any")) -class CodeGenRunnerTests extends FlatSpec with Matchers { +class CodeGenRunnerTests extends FlatSpec with Matchers with BazelRunfiles { behavior of "collectDamlLfInterfaces" def path(p: String) = new File(p).getAbsoluteFile.toPath - val testDar = path("language-support/java/codegen/test-daml.dar") + val testDar = path(rlocation("language-support/java/codegen/test-daml.dar")) val dummyOutputDir = Files.createTempDirectory("codegen")