Split daml3-script into internal and stable package #20334
Draft
+384
−203
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The goal here is to move "exported" types/exceptions from daml script into a separate stable package, then force the rest of the types to be non serializable. We achieve the latter with a new
--force-utility-package
flag, which ensures the generated package will not be considered for upgrades.Note that all exceptions must be Stable, but not all newtypes/datatypes. However, since the Stable package must still compile, any types that exceptions depend on must also be stable.
In total, the stable types are:
data PartyManagement.PartyDetails
newtype PartyManagement.PartyIdHint
newtype PartyManagement.ParticipantName
newtype UserManagement.UserId
data UserManagement.User
data UserManagement.UserRight
exception UserManagement.InvalidUserId
exception UserManagement.UserAlreadyExists
exception UserManagement.UserNotFound
newtype Testing.CommandName
<- required by Testing.FailedCmd belownewtype Testing.ErrorClassName
<- required by Testing.FailedCmd belownewtype Testing.ErrorMessage
<- required by Testing.FailedCmd belowexception Testing.FailedCmd
I have also moved daml3-script over to our bazel
daml-compile
. This required some tweaks to the rule, as it was putting source files in odd locations, which didn't match what daml-script had done before.Previously, it would create a daml.yaml at root, then the source file paths would include their full bazel path (i.e.
daml-script/daml3/Daml/Script.daml
), whereas our goal would be simplydaml/Daml/Script.daml
To achieve this, I first fixed the
daml_compile
rule to remove the label's package path from the source file, then I added adaml_source
field, which we set todaml
, to be consistent with how script used to be built.This change has affected the independence check, as the source files within that dar are now correctly placed. Similarly, since dalf's include source locations with their full path, the top level dalf's hash has changed.