Skip to content

Generate DarResources.scala#4181

Open
moritzkiefer-da wants to merge 2 commits intomainfrom
cocreature/generate-dar-resources
Open

Generate DarResources.scala#4181
moritzkiefer-da wants to merge 2 commits intomainfrom
cocreature/generate-dar-resources

Conversation

@moritzkiefer-da
Copy link
Contributor

[ci]

Pull Request Checklist

Cluster Testing

  • If a cluster test is required, comment /cluster_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.
  • If a hard-migration test is required (from the latest release), comment /hdm_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.

PR Guidelines

  • Include any change that might be observable by our partners or affect their deployment in the release notes.
  • Specify fixed issues with Fixes #n, and mention issues worked on using #n
  • Include a screenshot for frontend-related PRs - see README or use your favorite screenshot tool

Merge Guidelines

  • Make the git commit message look sensible when squash-merging on GitHub (most likely: just copy your PR description).

@moritzkiefer-da moritzkiefer-da force-pushed the cocreature/generate-dar-resources branch from 6e622bc to 98928be Compare March 2, 2026 11:48
[ci]

Signed-off-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
@moritzkiefer-da moritzkiefer-da force-pushed the cocreature/generate-dar-resources branch 3 times, most recently from 0c4573d to 6c2419c Compare March 2, 2026 14:17
.
[ci]

Signed-off-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
@moritzkiefer-da moritzkiefer-da force-pushed the cocreature/generate-dar-resources branch from 6c2419c to ea515cf Compare March 2, 2026 15:19
import com.digitalasset.canton.discard.Implicits.DiscardOps

object DarResourcesGenerator {
def render(): String = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a bunch of libraries to produce actual scala ASTs instead of doing string concatenation. I honestly have a hard time justifying any of them here. This seems much simpler 🤷

uses: ./splice-shared-gha/.github/actions/nix/run_bash_command_in_nix
with:
cmd: git add . && git diff --staged --exit-code test*.log
cmd: git add . && git diff --staged --exit-code test*.log '**/DarResources.scala'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did confirm that this does indeed fail CI as expected

uses: ./splice-shared-gha/.github/actions/sbt/execute_sbt_command
with:
cmd: "Test/compile lint updateTestConfigForParallelRuns"
cmd: "Test/compile lint updateTestConfigForParallelRuns updateDarResources"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I did consider instead making this a proper SBT code generator that automatically runs when you compile. I decided against it because it seems like we run clean more often than we change Daml models so not having to rely on SBT caching for this seems better.
  2. It doesn't seem to be that slow, around 20s maybe (and we could make it faster) so putting it here in the CI job seemed fine.

import java.nio.file.Path
import scala.util.Using

object DarResources {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a 1:1 copy of the existing DAR resources. I think the next step here would be to auto-generate this as well from the dars we have in the dars directory. That seems to naturally fit into #3667

@moritzkiefer-da moritzkiefer-da marked this pull request as ready for review March 2, 2026 17:01
@moritzkiefer-da
Copy link
Contributor Author

@isegall-da this is not particularly pretty, it does solve the issue though. As usual I'm a bit short on time (was doing this while blocked on LSU and DABFT and I'm getting unblocked there) and I expect #3667 will change some aspects of this. Feel free (even more so than usual) that this needs more work to be mergeable. Will definitely delay it but while it's obviously a nice speed up it's also not an urgent change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants