daml/daml-foundations/daml-tools/daml-extension/BUILD.bazel

68 lines
2.0 KiB
Python
Raw Normal View History

2019-04-04 11:33:38 +03:00
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
package(default_visibility=["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
load("@build_bazel_rules_nodejs//:defs.bzl", "npm_package")
load("//bazel_tools:pkg.bzl", "pkg_tar")
ts_library(
name = "daml_extension_lib",
# TODO(MH): Unfortunately, the current packaging setup does not work with
# multiple source files. We need to figure out how to split this file up
# before it gets too big and package it properly.
srcs = ["src/extension.ts"],
node_modules = "@daml_extension_deps//:node_modules",
tsconfig = ":tsconfig.json",
)
# With this rule we get access to extension.js, as
# the ts_library only has the .d.ts file in the outputs.
# Could possibly also use filegroup, which allows specifying
# the output group (es5_source).
npm_package(
name = "out", # named out, so it goes to same place as before
deps = [
":daml_extension_lib",
]
)
pkg_tar(
name = "dot-dist",
extension = "tar.gz",
mode = "0755",
package_dir = "daml-extension",
remap_paths = {
"../daml_extension_deps/node_modules": "node_modules"
},
strip_prefix = "./",
srcs = glob([
"package.json",
"syntaxes/*",
"snippets/*",
"images/*",
"*.json",
"README.md",
]) + [
":out",
"@daml_extension_deps//vscode-jsonrpc:vscode-jsonrpc",
"@daml_extension_deps//vscode-languageclient:vscode-languageclient",
"@daml_extension_deps//vscode-languageserver-types:vscode-languageserver-types",
"@daml_extension_deps//which:which",
],
)
# NOTE(MH): The `pkg_tar` rule puts a `.` at the beginning of every path, which
# would break assumptions made in the sdk assistant. Hence we need to repack
# the tarball to get rid of the `.`.
genrule(
name = 'dist',
srcs = [":dot-dist"],
outs = ["dist.tar.gz"],
cmd = """
tar zxf $<
tar zcf $@ daml-extension
""",
)