Skip to content

Commit

Permalink
Fix Sdk-Version field in daml-sdk-head (digital-asset#3759)
Browse files Browse the repository at this point in the history
In digital-asset#3706 we fixed the SDK versions of the daml-trigger an daml-script
libraries and (rightfully) stopped filtering out 0.0.0 from the SDK
version check in `damlc build`. However, this broke daml-sdk-head
since we still distributed the DARs in daml-sdk-head with the
Sdk-Version set to whatever the current release is rather than 0.0.0.
  • Loading branch information
cocreature authored and mergify[bot] committed Dec 6, 2019
1 parent 3f12e60 commit ab59376
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions release/util.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ def sdk_tarball(name, version):
"//daml-script/daml:daml-script.dar",
"//daml-assistant/daml-sdk:sdk_deploy.jar",
],
tools = ["@zip_dev_env//:zip"],
outs = ["{}.tar.gz".format(name)],
cmd = """
# damlc
VERSION=$$(cat $(location {version}))
ZIP=$$PWD/$(location @zip_dev_env//:zip)
OUT=sdk-$$VERSION
mkdir -p $$OUT
Expand All @@ -45,6 +47,18 @@ def sdk_tarball(name, version):
cp -t $$OUT/daml-libs $(location //triggers/daml:daml-trigger.dar)
cp -t $$OUT/daml-libs $(location //daml-script/daml:daml-script.dar)
# Patch the SDK version in all bundled DAML libraries.
# This is necessary to make daml-sdk-head work despite the check in damlc
# that DAR dependencies are built with the same SDK.
for file in $$OUT/daml-libs/*; do
file=$$PWD/$$file
chmod +w $$file
unzip -q $$file META-INF/MANIFEST.MF -d $$OUT/daml-libs
sed -i "s/Sdk-Version:.*/Sdk-Version: $$VERSION/" $$OUT/daml-libs/META-INF/MANIFEST.MF
(cd $$OUT/daml-libs; $$ZIP -q $$file META-INF/MANIFEST.MF)
rm $$OUT/daml-libs/META-INF/MANIFEST.MF
done
mkdir -p $$OUT/daml-helper
tar xf $(location //daml-assistant/daml-helper:daml-helper-dist) --strip-components=1 -C $$OUT/daml-helper
Expand Down

0 comments on commit ab59376

Please sign in to comment.