diff --git a/ledger/daml-on-sql/src/main/scala/on/sql/Cli.scala b/ledger/daml-on-sql/src/main/scala/on/sql/Cli.scala index 567fc87b119c..03d5e8cbd6b4 100644 --- a/ledger/daml-on-sql/src/main/scala/on/sql/Cli.scala +++ b/ledger/daml-on-sql/src/main/scala/on/sql/Cli.scala @@ -20,6 +20,14 @@ private[sql] final class Cli( .withContractIdSeeding(defaultConfig, Some(Seeding.Strong), Some(Seeding.Weak)) .parser + parser + .opt[Unit]("eager-package-loading") + .optional() + .text( + "Whether to load all the packages in the .dar files provided eagerly, rather than when needed as the commands come." + ) + .action((_, config) => config.copy(eagerPackageLoading = true)) + parser .opt[String]("sql-backend-jdbcurl-env") .optional() diff --git a/ledger/daml-on-sql/src/test/suite/scala/on/sql/CliSpec.scala b/ledger/daml-on-sql/src/test/suite/scala/on/sql/CliSpec.scala index e1a13cbe223e..ae5af93c4e6c 100644 --- a/ledger/daml-on-sql/src/test/suite/scala/on/sql/CliSpec.scala +++ b/ledger/daml-on-sql/src/test/suite/scala/on/sql/CliSpec.scala @@ -54,6 +54,10 @@ class CliSpec config shouldEqual None } + "parse the eager package loading flag when given" in { + checkOption(Array("--eager-package-loading"), _.copy(eagerPackageLoading = true)) + } + "reject when sql-backend-jdbcurl-env points to a non-existing environment variable" in { val config = cli.parse(Array("--ledgerid", "test-ledger", "--sql-backend-jdbcurl-env", "JDBC_URL")) diff --git a/ledger/sandbox-classic/src/main/scala/platform/sandbox/Cli.scala b/ledger/sandbox-classic/src/main/scala/platform/sandbox/Cli.scala index ec6dfa0bd064..561b1cae101e 100644 --- a/ledger/sandbox-classic/src/main/scala/platform/sandbox/Cli.scala +++ b/ledger/sandbox-classic/src/main/scala/platform/sandbox/Cli.scala @@ -32,6 +32,13 @@ private[sandbox] object Cli extends SandboxCli { " Two identifier formats are supported: Module.Name:Entity.Name (preferred) and Module.Name.Entity.Name (deprecated, will print a warning when used)." + s" Also note that instructing $Name to load a scenario will have the side effect of loading _all_ the .dar files provided eagerly (see --eager-package-loading)." ) + parser + .opt[Unit]("eager-package-loading") + .optional() + .text( + "Whether to load all the packages in the .dar files provided eagerly, rather than when needed as the commands come." + ) + .action((_, config) => config.copy(eagerPackageLoading = true)) parser .opt[String]("sql-backend-jdbcurl") .optional() diff --git a/ledger/sandbox-classic/src/test/suite/scala/platform/sandbox/CliSpec.scala b/ledger/sandbox-classic/src/test/suite/scala/platform/sandbox/CliSpec.scala index ae3532015955..73a6ba1fe3d0 100644 --- a/ledger/sandbox-classic/src/test/suite/scala/platform/sandbox/CliSpec.scala +++ b/ledger/sandbox-classic/src/test/suite/scala/platform/sandbox/CliSpec.scala @@ -23,6 +23,10 @@ class CliSpec extends CommonCliSpecBase(Cli) { ) } + "parse the eager package loading flag when given" in { + checkOption(Array("--eager-package-loading"), _.copy(eagerPackageLoading = true)) + } + "parse the sql-backend-jdbcurl flag when given" in { val jdbcUrl = "jdbc:postgresql://localhost:5432/test?user=test" checkOption(Array("--sql-backend-jdbcurl", jdbcUrl), _.copy(jdbcUrl = Some(jdbcUrl))) diff --git a/ledger/sandbox-common/src/main/scala/platform/sandbox/cli/CommonCliBase.scala b/ledger/sandbox-common/src/main/scala/platform/sandbox/cli/CommonCliBase.scala index e96a6d8dff90..8b3f13a83707 100644 --- a/ledger/sandbox-common/src/main/scala/platform/sandbox/cli/CommonCliBase.scala +++ b/ledger/sandbox-common/src/main/scala/platform/sandbox/cli/CommonCliBase.scala @@ -237,13 +237,6 @@ class CommonCliBase(name: LedgerName) { com.daml.cliopts.Logging.logLevelParse(this)((f, c) => c.copy(logLevel = f(c.logLevel))) - opt[Unit]("eager-package-loading") - .optional() - .text( - "Whether to load all the packages in the .dar files provided eagerly, rather than when needed as the commands come." - ) - .action((_, config) => config.copy(eagerPackageLoading = true)) - JwtVerifierConfigurationCli.parse(this)((v, c) => c.copy(authService = Some(AuthServiceJWT(v))) ) diff --git a/ledger/sandbox-common/src/test/lib/scala/platform/sandbox/cli/CommonCliSpecBase.scala b/ledger/sandbox-common/src/test/lib/scala/platform/sandbox/cli/CommonCliSpecBase.scala index 8553dcf37fd3..f926e07e4ac4 100644 --- a/ledger/sandbox-common/src/test/lib/scala/platform/sandbox/cli/CommonCliSpecBase.scala +++ b/ledger/sandbox-common/src/test/lib/scala/platform/sandbox/cli/CommonCliSpecBase.scala @@ -207,10 +207,6 @@ abstract class CommonCliSpecBase( ) } - "parse the eager package loading flag when given" in { - checkOption(Array("--eager-package-loading"), _.copy(eagerPackageLoading = true)) - } - "parse a console metrics reporter when given" in { checkOption( Array("--metrics-reporter", "console"), diff --git a/ledger/sandbox/BUILD.bazel b/ledger/sandbox/BUILD.bazel index 2b4b3e793597..9fffa518c5b9 100644 --- a/ledger/sandbox/BUILD.bazel +++ b/ledger/sandbox/BUILD.bazel @@ -263,7 +263,6 @@ NEXT_SERVERS = { "server_args": [ "--contract-id-seeding=testing-weak", "--port=6865", - "--eager-package-loading", ], }, "postgresql": { @@ -271,7 +270,6 @@ NEXT_SERVERS = { "server_args": [ "--contract-id-seeding=testing-weak", "--port=6865", - "--eager-package-loading", ], }, } diff --git a/ledger/sandbox/src/main/scala/platform/sandboxnext/Cli.scala b/ledger/sandbox/src/main/scala/platform/sandboxnext/Cli.scala index 24039dd61cd1..97940a7656e8 100644 --- a/ledger/sandbox/src/main/scala/platform/sandboxnext/Cli.scala +++ b/ledger/sandbox/src/main/scala/platform/sandboxnext/Cli.scala @@ -21,6 +21,19 @@ private[sandboxnext] object Cli extends SandboxCli { Some(Seeding.Static), ) .parser + + parser + .opt[Unit]("eager-package-loading") + .hidden() + .optional() + .text("Deprecated. This flag no longer has any effect.") + .action((_, config) => { + System.err.println( + "WARNING: The `--eager-package-loading` flag no longer has any effect in the Sandbox. Packages are always loaded eagerly." + ) + config + }) + parser .opt[Boolean](name = "implicit-party-allocation") .optional() @@ -29,6 +42,7 @@ private[sandboxnext] object Cli extends SandboxCli { s"When referring to a party that doesn't yet exist on the ledger, $Name will implicitly allocate that party." + s" You can optionally disable this behavior to bring $Name into line with other ledgers." ) + parser .opt[String]("sql-backend-jdbcurl") .optional()