trigger runner: added hidden dev-mode-unsafe flag (#11205)

This adds a hidden `dev-mode-unsafe` flag to the trigger runner to allow
running against a daml-lf 1.dev version dar.

CHANGELOG_BEGIN
CHANGELOG_END
This commit is contained in:
Robin Krom 2021-10-12 12:54:23 +02:00 committed by GitHub
parent ae41aa2c14
commit 9835ccb1ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View File

@ -717,9 +717,10 @@ object Runner extends StrictLogging {
timeProviderType: TimeProviderType,
applicationId: ApplicationId,
party: String,
config: Compiler.Config,
)(implicit materializer: Materializer, executionContext: ExecutionContext): Future[SValue] = {
val darMap = dar.all.toMap
val compiledPackages = PureCompiledPackages.build(darMap) match {
val compiledPackages = PureCompiledPackages.build(darMap, config) match {
case Left(err) => throw new RuntimeException(s"Failed to compile packages: $err")
case Right(pkgs) => pkgs
}

View File

@ -10,6 +10,7 @@ import com.daml.ledger.api.refinements.ApiTypes.ApplicationId
import com.daml.ledger.api.tls.TlsConfiguration
import com.daml.ledger.api.tls.TlsConfigurationCli
import com.daml.platform.services.time.TimeProviderType
import com.daml.lf.speedy.Compiler
case class RunnerConfig(
darPath: Path,
@ -26,6 +27,7 @@ case class RunnerConfig(
accessTokenFile: Option[Path],
applicationId: ApplicationId,
tlsConfig: TlsConfiguration,
compilerConfig: Compiler.Config,
)
object RunnerConfig {
@ -33,6 +35,7 @@ object RunnerConfig {
private[trigger] val DefaultTimeProviderType: TimeProviderType = TimeProviderType.WallClock
private[trigger] val DefaultApplicationId: ApplicationId =
ApplicationId("daml-trigger")
private[trigger] val DefaultCompilerConfig: Compiler.Config = Compiler.Config.Default
@SuppressWarnings(Array("org.wartremover.warts.NonUnitStatements")) // scopt builders
private val parser = new scopt.OptionParser[RunnerConfig]("trigger-runner") {
@ -98,6 +101,14 @@ object RunnerConfig {
}
.text(s"Application ID used to submit commands. Defaults to ${DefaultApplicationId}")
opt[Unit]("dev-mode-unsafe")
.action((_, c) => c.copy(compilerConfig = Compiler.Config.Dev))
.optional()
.text(
"Turns on development mode. Development mode allows development versions of Daml-LF language."
)
.hidden()
TlsConfigurationCli.parse(this, colSpacer = " ")((f, c) =>
c.copy(tlsConfig = f(c.tlsConfig))
)
@ -158,6 +169,7 @@ object RunnerConfig {
accessTokenFile = None,
tlsConfig = TlsConfiguration(false, None, None, None),
applicationId = DefaultApplicationId,
compilerConfig = DefaultCompilerConfig,
),
)
}

View File

@ -96,6 +96,7 @@ object RunnerMain {
config.timeProviderType.getOrElse(RunnerConfig.DefaultTimeProviderType),
config.applicationId,
config.ledgerParty,
config.compilerConfig,
)
} yield ()