daml/release/BUILD.bazel
associahedron 2713d6978d
Reduce SDK tarball size by 70% by deduplicating Scala dependencies. (#3678)
* Start moving all the jars into a single jar.

* Fold navigator into daml-sdk jar

* include sandbox

* Remove unnecessary compileDeps.

CHANGELOG_BEGIN

- [DAML SDK] Reduced the size of the DAML SDK by about
60% uncompressed, 70% compressed, by deduplicating Scala
dependencies.

CHANGELOG_END

* update copyright header

* buildifier fix
2019-11-29 13:26:47 +00:00

140 lines
4.0 KiB
Python

# Copyright (c) 2019 The DAML Authors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load("//bazel_tools:haskell.bzl", "da_haskell_binary")
da_haskell_binary(
name = "release",
srcs = glob(["src/**/*.hs"]),
hackage_deps = [
"aeson",
"async",
"ansi-terminal",
"base",
"base64-bytestring",
"bytestring",
"conduit",
"conduit-extra",
"containers",
"connection",
"cryptohash",
"directory",
"exceptions",
"extra",
"fast-logger",
"filepath",
"http-client",
"http-client-tls",
"http-conduit",
"http-types",
"lifted-async",
"lifted-base",
"monad-control",
"monad-logger",
"optparse-applicative",
"path",
"path-io",
"process",
"retry",
"safe",
"safe-exceptions",
"time",
"text",
"temporary",
"transformers",
"unliftio-core",
"unordered-containers",
"yaml",
"mtl",
"xml-conduit",
],
src_strip_prefix = "src",
visibility = ["//visibility:public"],
deps = [],
)
# This tarball is used by the new daml assistant.
genrule(
name = "sdk-release-tarball",
srcs = [
":sdk-config.yaml.tmpl",
":install.sh",
":install.bat",
"//ledger-service/http-json:release/json-api-logback.xml",
"//:NOTICES",
"//:VERSION",
"//daml-assistant:daml-dist",
"//compiler/damlc:damlc-dist",
"//compiler/daml-extension:vsix",
"//daml-assistant/daml-helper:daml-helper-dist",
"//templates:templates-tarball.tar.gz",
"//triggers/daml:daml-trigger.dar",
"//daml-script/daml:daml-script.dar",
"//daml-assistant/daml-sdk:sdk_deploy.jar",
],
outs = ["sdk-release-tarball.tar.gz"],
cmd = """
# damlc
VERSION=$$(cat $(location //:VERSION))
OUT=sdk-$$VERSION
mkdir -p $$OUT
cp $(location //:NOTICES) $$OUT/NOTICES
cp $(location :install.sh) $$OUT/install.sh
cp $(location :install.bat) $$OUT/install.bat
cp $(location :sdk-config.yaml.tmpl) $$OUT/sdk-config.yaml
sed -i "s/__VERSION__/$$VERSION/" $$OUT/sdk-config.yaml
mkdir -p $$OUT/daml
tar xf $(location //daml-assistant:daml-dist) --strip-components=1 -C $$OUT/daml
mkdir -p $$OUT/damlc
tar xf $(location //compiler/damlc:damlc-dist) --strip-components=1 -C $$OUT/damlc
mkdir -p $$OUT/daml-libs
cp -t $$OUT/daml-libs $(location //triggers/daml:daml-trigger.dar)
cp -t $$OUT/daml-libs $(location //daml-script/daml:daml-script.dar)
mkdir -p $$OUT/daml-helper
tar xf $(location //daml-assistant/daml-helper:daml-helper-dist) --strip-components=1 -C $$OUT/daml-helper
mkdir -p $$OUT/studio
cp $(location //compiler/daml-extension:vsix) $$OUT/studio/daml-bundled.vsix
mkdir -p $$OUT/templates
tar xf $(location //templates:templates-tarball.tar.gz) --strip-components=1 -C $$OUT/templates
mkdir -p $$OUT/daml-sdk
cp $(location //daml-assistant/daml-sdk:sdk_deploy.jar) $$OUT/daml-sdk/daml-sdk.jar
cp -L $(location //ledger-service/http-json:release/json-api-logback.xml) $$OUT/daml-sdk/
tar zcf $(location sdk-release-tarball.tar.gz) --format=ustar $$OUT
""",
visibility = ["//visibility:public"],
)
# Same as the above, but with head version 0.0.0.
genrule(
name = "sdk-head-tarball",
srcs = [
":sdk-config.yaml.tmpl",
":sdk-release-tarball.tar.gz",
],
outs = ["sdk-head-tarball.tar.gz"],
cmd = """
VERSION=0.0.0
OUT=sdk-head
mkdir -p $$OUT
tar xf $(location sdk-release-tarball.tar.gz) --strip-components=1 -C $$OUT
cp $(location :sdk-config.yaml.tmpl) $$OUT/sdk-config.yaml
sed -i "s/__VERSION__/$$VERSION/" $$OUT/sdk-config.yaml
tar zcf $(location sdk-head-tarball.tar.gz) --format=ustar $$OUT
""",
visibility = ["//visibility:public"],
)