Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEL-8132 extract DAML LF haskell libraries (scripted) #7246

Merged
merged 13 commits into from
Sep 1, 2020

Conversation

jberthold-da
Copy link
Contributor

@jberthold-da jberthold-da commented Aug 27, 2020

We would like to use the LF reading libraries (DAML LF archive decoding to an AST) in a Haskell project.
An extraction script for these libraries once existed but is not available any more, so I have resurrected the script, adapted to current usage, and upgraded to the newest stackage LTS that can support it.

These libraries could be versioned manually to released SDKs and publsihed if desirable (without making any guarantees about the stability, therefore prefixing the version with 0..

CHANGELOG_BEGIN
Make Haskell libraries for DAML LF archives usable by other projects
CHANGELOG_END

Pull Request Checklist

  • Read and understand the contribution guidelines
  • Include appropriate tests
  • Set a descriptive title and thorough description
  • Add a reference to the issue this PR will solve, if appropriate
  • Include changelog additions in one or more commit message bodies between the CHANGELOG_BEGIN and CHANGELOG_END tags
  • Normal production system change, include purpose of change in description

NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with /AzurePipelines run to
trigger the build.

@jberthold-da jberthold-da added the language Language team work label Aug 27, 2020
CHANGELOG_BEGIN
Make Haskell libraries for DAML LF archives usable by other projects
CHANGELOG_END
@jberthold-da jberthold-da force-pushed the DEL-8132-extract-daml-lf-haskell-libraries branch from c1b66e8 to d400b18 Compare August 27, 2020 07:26
Copy link
Contributor

@cocreature cocreature left a comment

Choose a reason for hiding this comment

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

Looks sensible, I would recommend against the custom setup script but I’ll leave that up to you as the only user. Thanks!

build-scripts/build_hs_lf_tooling.sh Outdated Show resolved Hide resolved
mkdir -p "$DIR/protobuf/com/daml"
cp -RL "daml-lf/archive/src/main/protobuf/com/daml/daml_lf_dev" "$DIR/protobuf/com/daml/"
# generate code from protobuf using the matching tool, as a configure script
cat <<EOF >"$DIR/Setup.hs"
Copy link
Contributor

Choose a reason for hiding this comment

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

Custom setup scripts always end up causing problems at some point ime. Why did you decide against the approach the old script used which just used our Bazel setup to build the generated code and included that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The extracted library uses proto-suite-0.4.0.0 instead of the point between-versions used in the daml repo.
To use the released version, I need the packaged protobuf compiler => calling it in a custom setup.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just switch t a released version in the DAML repo? The more you diverge from the build setup used in the DAML Repo the more likely this is to break in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Happy to assist you in switching. I don't want to make that change on this PR, though.
IIUC it should be fine to just update the bazel configuration to depend on the (hackage-released) proto-suite-0.4.0.0. Is that right @garyverhaegen-da ? I can confirm all code in daml-lf-proto written against the generated Com.Daml.DamlLfDev.DamlLf* works with this version.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm actually not very familiar with that side of things, but it seems to me we are depending on the release 0.4.0.0 version of proto3-suite per stack-snapshot.yml. What am I missing? Where is that "in-between version" we're using defined?

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
@jberthold-da jberthold-da merged commit 6874f18 into master Sep 1, 2020
@jberthold-da jberthold-da deleted the DEL-8132-extract-daml-lf-haskell-libraries branch September 1, 2020 02:09
@hurryabit
Copy link
Contributor

@jberthold-da What stability guarantees do you expect from us? So far, the DAML-LF AST we use in the compiler was an implementation detail. Now, you depend on it and we can't change it freely anymore. I'm not particularly happy about this. cc @bame-da

@cocreature
Copy link
Contributor

cocreature commented Sep 2, 2020

@hurryabit we discussed this a bit last week. We provide zero stability guarantees and I recommended explicitly against using this. So this is very much a “use at your own risk” thing. Happy to provide more details elsewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language Language team work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants