# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. # SPDX-License-Identifier: Apache-2.0 load("//bazel_tools:haskell.bzl", "da_haskell_binary") load("@os_info//:os_info.bzl", "is_linux", "is_windows") da_haskell_binary( name = "windows-installer-gen", srcs = glob(["src/**/*.hs"]), hackage_deps = [ "base", "filepath", "nsis", ], src_strip_prefix = "src", visibility = ["//visibility:public"], deps = ["//:sdk-version-hs-lib"], ) genrule( name = "windows-installer", # daml-logo.ico was created with the following command: # convert \ # docs/theme/da_theme_skeleton/static/images/favicon/apple-touch-icon.png \ # -define icon:auto-resize=64,48,32,16 release/windows-installer/daml-logo.ico srcs = [ "//release:sdk-release-tarball.tar.gz", ":daml-logo.ico", ], outs = ["daml-sdk-installer.exe"], cmd = """ set -eou pipefail rm -rf release-dir mkdir -p release-dir tar xf $(location //release:sdk-release-tarball.tar.gz) --strip-components=1 -C release-dir $(location :windows-installer-gen) ./installer.nsi release-dir $(location :daml-logo.ico) $(location @makensis_dev_env//:makensis) ./installer.nsi cp ./daml-sdk-installer.exe $(location daml-sdk-installer.exe) """, tools = [ ":windows-installer-gen", "@makensis_dev_env//:makensis", ], ) if is_windows else None