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
|
|
|
|
|
2019-04-12 14:10:16 +03:00
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
|
2019-04-04 11:33:38 +03:00
|
|
|
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(
|
2019-04-12 14:10:16 +03:00
|
|
|
name = "out", # named out, so it goes to same place as before
|
|
|
|
deps = [
|
|
|
|
":daml_extension_lib",
|
|
|
|
],
|
2019-04-04 11:33:38 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
pkg_tar(
|
2019-04-12 14:10:16 +03:00
|
|
|
name = "dot-dist",
|
|
|
|
srcs = glob([
|
|
|
|
"package.json",
|
|
|
|
"syntaxes/*",
|
|
|
|
"snippets/*",
|
|
|
|
"images/*",
|
|
|
|
"*.json",
|
|
|
|
"README.md",
|
|
|
|
]) + [
|
|
|
|
":out",
|
2019-06-20 15:55:30 +03:00
|
|
|
"src/webview.js",
|
2019-04-12 14:10:16 +03:00
|
|
|
"@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",
|
2019-04-25 18:53:47 +03:00
|
|
|
"//:VERSION",
|
2019-04-12 14:10:16 +03:00
|
|
|
],
|
|
|
|
extension = "tar.gz",
|
|
|
|
mode = "0755",
|
|
|
|
package_dir = "daml-extension",
|
|
|
|
remap_paths = {
|
|
|
|
"../daml_extension_deps/node_modules": "node_modules",
|
|
|
|
},
|
|
|
|
strip_prefix = "./",
|
2019-04-04 11:33:38 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
# 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(
|
2019-04-12 14:10:16 +03:00
|
|
|
name = "dist",
|
2019-04-04 11:33:38 +03:00
|
|
|
srcs = [":dot-dist"],
|
|
|
|
outs = ["dist.tar.gz"],
|
|
|
|
cmd = """
|
|
|
|
tar zxf $<
|
|
|
|
tar zcf $@ daml-extension
|
|
|
|
""",
|
|
|
|
)
|