mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-17 15:57:21 +03:00
Add a windows installer for the SDK (#738)
This commit is contained in:
parent
451858335f
commit
c37df1a07a
3
.dadew
3
.dadew
@ -11,6 +11,7 @@
|
||||
"vcredist-14.0.23026",
|
||||
"bazel",
|
||||
"nodejs-10.12.0",
|
||||
"python-3.6.7"
|
||||
"python-3.6.7",
|
||||
"nsis-3.04"
|
||||
]
|
||||
}
|
||||
|
17
WORKSPACE
17
WORKSPACE
@ -366,6 +366,23 @@ dev_env_tool(
|
||||
win_tool = "java-openjdk-8u201",
|
||||
)
|
||||
|
||||
# This only makes sense on Windows so we just put dummy values in the nix fields.
|
||||
dev_env_tool(
|
||||
name = "makensis_dev_env",
|
||||
nix_include = [""],
|
||||
nix_path = "bin/makensis.exe",
|
||||
tool = "makensis",
|
||||
win_include = [
|
||||
"bin",
|
||||
"contrib",
|
||||
"include",
|
||||
"plugins",
|
||||
"stubs",
|
||||
],
|
||||
win_path = "bin/makensis.exe",
|
||||
win_tool = "nsis-3.04",
|
||||
) if is_windows else None
|
||||
|
||||
# Dummy target //external:python_headers.
|
||||
# To avoid query errors due to com_google_protobuf.
|
||||
# See https://github.com/protocolbuffers/protobuf/blob/d9ccd0c0e6bbda9bf4476088eeb46b02d7dcd327/util/python/BUILD
|
||||
|
@ -69,7 +69,7 @@ dev_env_tool = repository_rule(
|
||||
mandatory = False,
|
||||
),
|
||||
"nix_label": attr.label(
|
||||
mandatory = True,
|
||||
mandatory = False,
|
||||
),
|
||||
"nix_include": attr.string_list(
|
||||
mandatory = True,
|
||||
|
@ -49,6 +49,7 @@ function build-full() {
|
||||
# FIXME: Until all bazel issues on Windows are resolved we will be testing only specific bazel targets
|
||||
bazel build `-`-experimental_execution_log_file ${ARTIFACT_DIRS}/build_full_execution_windows.log `
|
||||
//release:sdk-release-tarball `
|
||||
//release/windows-installer:windows-installer `
|
||||
//:git-revision `
|
||||
@com_github_grpc_grpc//:grpc `
|
||||
//3rdparty/... `
|
||||
|
14
deps.bzl
14
deps.bzl
@ -237,3 +237,17 @@ java_import(
|
||||
name = "gson",
|
||||
actual = "@com_google_code_gson_gson//jar",
|
||||
)
|
||||
|
||||
if "nsis_untgz_plugin" not in native.existing_rules():
|
||||
http_archive(
|
||||
name = "nsis_untgz_plugin",
|
||||
url = "http://www.fdos.org/win32/nsis/plugins/untgz.1.0.18.zip",
|
||||
sha256 = "2aad9f451b5a9c38f2c0ca103608a9f229734409922846060b5f15c6cfb79b71",
|
||||
build_file_content = """
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
filegroup(
|
||||
name = "untgz",
|
||||
srcs = glob(["untgz/**/*"]),
|
||||
)
|
||||
""",
|
||||
)
|
||||
|
33
dev-env/windows/manifests/nsis-3.04.json
Normal file
33
dev-env/windows/manifests/nsis-3.04.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"homepage": "http://nsis.sourceforge.net/",
|
||||
"license": "Zlib",
|
||||
"version": "3.04",
|
||||
"url": "https://downloads.sourceforge.net/project/nsis/NSIS%203/3.04/nsis-3.04.zip",
|
||||
"bin": [
|
||||
"makensis.exe"
|
||||
],
|
||||
"hash": "sha1:ed241f7384f4e59d84b9a62c71d1f6955b6a719a",
|
||||
"extract_dir": "nsis-3.04",
|
||||
"env_set": {
|
||||
"NSISDIR": "$dir"
|
||||
},
|
||||
"checkver": {
|
||||
"url": "http://nsis.sourceforge.net/Download",
|
||||
"re": "\\/rn\\/v([\\d.]+)\""
|
||||
},
|
||||
"autoupdate": {
|
||||
"url": "https://downloads.sourceforge.net/project/nsis/NSIS%20$majorVersion/$version/nsis-$version.zip",
|
||||
"extract_dir": "nsis-$version"
|
||||
},
|
||||
"persist": "nsisconf.nsh",
|
||||
"shortcuts": [
|
||||
[
|
||||
"makensisw.exe",
|
||||
"NSIS Compiler Interface"
|
||||
],
|
||||
[
|
||||
"bin\\zip2exe.exe",
|
||||
"NSIS Zip2Exe"
|
||||
]
|
||||
]
|
||||
}
|
36
release/windows-installer/BUILD.bazel
Normal file
36
release/windows-installer/BUILD.bazel
Normal file
@ -0,0 +1,36 @@
|
||||
# Copyright (c) 2019 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"]),
|
||||
hazel_deps = [
|
||||
"base",
|
||||
"nsis",
|
||||
],
|
||||
src_strip_prefix = "src",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["//:sdk-version-hs-lib"],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "windows-installer",
|
||||
srcs = ["//release:sdk-release-tarball.tar.gz"],
|
||||
outs = ["daml-sdk-installer.exe"],
|
||||
cmd = """
|
||||
set -eou pipefail
|
||||
PLUGINFILES=( $(locations @nsis_untgz_plugin//:untgz) )
|
||||
PLUGINDIR=$$(dirname $$PLUGINFILES[0])
|
||||
$(location :windows-installer-gen) ./installer.nsi $(location //release:sdk-release-tarball.tar.gz) $$PLUGINDIR
|
||||
$(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",
|
||||
"@nsis_untgz_plugin//:untgz",
|
||||
],
|
||||
) if is_windows else None
|
28
release/windows-installer/src/WindowsInstaller.hs
Normal file
28
release/windows-installer/src/WindowsInstaller.hs
Normal file
@ -0,0 +1,28 @@
|
||||
-- Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
||||
-- SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
module Main (main) where
|
||||
|
||||
import Data.String
|
||||
import Development.NSIS
|
||||
import System.Environment
|
||||
|
||||
import SdkVersion
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
[installerFile, sdkTarball, pluginDir] <- getArgs
|
||||
writeFile installerFile $ nsis $ installer sdkTarball pluginDir
|
||||
|
||||
installer :: FilePath -> FilePath -> Action SectionId
|
||||
installer sdkTarball pluginDir = do
|
||||
name "DAML SDK installer"
|
||||
outFile "daml-sdk-installer.exe"
|
||||
addPluginDir (fromString pluginDir)
|
||||
section "" [] $ do
|
||||
setOutPath "$TEMP"
|
||||
file [] (fromString sdkTarball)
|
||||
plugin "untgz" "extract" ["-d" :: Exp String, "$TEMP", "$TEMP/sdk-release-tarball.tar.gz"]
|
||||
let dir = "$TEMP/sdk-" <> sdkVersion
|
||||
execWait $ fromString $ "\"" <> dir <> "\\daml\\daml.exe\" install " <> dir <> " --activate"
|
Loading…
Reference in New Issue
Block a user