diff --git a/daml-script/export/integration-tests/matches-docs/BUILD.bazel b/daml-script/export/integration-tests/matches-docs/BUILD.bazel index 7de448e60dd..71e7abcc578 100644 --- a/daml-script/export/integration-tests/matches-docs/BUILD.bazel +++ b/daml-script/export/integration-tests/matches-docs/BUILD.bazel @@ -50,12 +50,10 @@ client_server_build( client_files = ["//daml-script/test:script-test.dar"], data = ["//daml-script/test:script-test.dar"], output_env = "EXPORT_OUT", - server = "//ledger/sandbox-classic:sandbox-classic-ephemeral-postgresql", + server = "//ledger/sandbox-on-x:sandbox-on-x-ephemeral-postgresql", server_args = [ - "--port=0", - "--port-file=%PORT_FILE%", + " --participant=participant-id=example,port=0,port-file=%PORT_FILE%", ], - server_files = ["//daml-script/test:script-test.dar"], ) if not is_windows else None # Disabled on Windows since postgres gets unhappy in client_server_build. diff --git a/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/RunnerMain.scala b/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/RunnerMain.scala index fd7cd6504f1..ea390ce57a9 100644 --- a/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/RunnerMain.scala +++ b/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/RunnerMain.scala @@ -6,6 +6,7 @@ package com.daml.lf.engine.script import akka.actor.ActorSystem import akka.http.scaladsl.Http import akka.stream._ + import java.nio.file.Files import scala.jdk.CollectionConverters._ import scala.concurrent.{Await, ExecutionContext, Future} @@ -21,6 +22,14 @@ import com.daml.lf.iface.reader.InterfaceReader import com.daml.lf.language.Ast.Package import com.daml.grpc.adapter.{AkkaExecutionSequencerPool, ExecutionSequencerFactory} import com.daml.auth.TokenHolder +import com.daml.ledger.client.configuration.{ + CommandClientConfiguration, + LedgerClientChannelConfiguration, + LedgerClientConfiguration, + LedgerIdRequirement, +} +import com.daml.ledger.client.withoutledgerid.LedgerClient +import com.google.protobuf.ByteString object RunnerMain { @@ -46,6 +55,7 @@ object RunnerMain { fileContent.parseJson }) + val token = config.accessTokenFile.map(new TokenHolder(_)).flatMap(_.token) val participantParams = config.participantConfig match { case Some(file) => { // We allow specifying --access-token-file/--application-id together with @@ -59,7 +69,6 @@ object RunnerMain { source.close } val jsVal = fileContent.parseJson - val token = config.accessTokenFile.map(new TokenHolder(_)).flatMap(_.token) import ParticipantsJsonProtocol._ jsVal .convertTo[Participants[ApiParameters]] @@ -71,13 +80,12 @@ object RunnerMain { ) } case None => - val tokenHolder = config.accessTokenFile.map(new TokenHolder(_)) Participants( default_participant = Some( ApiParameters( config.ledgerHost.get, config.ledgerPort.get, - tokenHolder.flatMap(_.token), + token, config.applicationId, ) ), @@ -96,6 +104,20 @@ object RunnerMain { } else { Runner.connect(participantParams, config.tlsConfig, config.maxInboundMessageSize) } + adminClient = LedgerClient.singleHost( + hostIp = config.ledgerHost.get, + port = config.ledgerPort.get, + configuration = LedgerClientConfiguration( + applicationId = "admin-client", + ledgerIdRequirement = LedgerIdRequirement.none, + commandClient = CommandClientConfiguration.default, + token = token, + ), + channelConfig = LedgerClientChannelConfiguration(None), + ) + _ <- adminClient.packageManagementClient.uploadDarFile( + ByteString.copyFrom(Files.readAllBytes(config.darPath.toPath)) + ) result <- Runner.run(dar, scriptId, inputValue, clients, config.timeMode) _ <- Future { config.outputFile.foreach { outputFile =>