-
Notifications
You must be signed in to change notification settings - Fork 71
/
BUILD.bazel
83 lines (73 loc) · 1.92 KB
/
BUILD.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Protobuf JS runtime
#
# See also code generation logic under generator/
load("@rules_pkg//:mappings.bzl", "pkg_attributes", "pkg_files", "strip_prefix")
load("@rules_pkg//:pkg.bzl", "pkg_tar", "pkg_zip")
load("//:protobuf_javascript_release.bzl", "package_naming")
config_setting(
name = "x64_x86_windows",
values = {"cpu": "x64_x86_windows"},
)
config_setting(
name = "x64_windows",
values = {"cpu": "x64_windows"},
)
config_setting(
name = "k8",
values = {"cpu": "k8"},
)
package_naming(
name = "protobuf_javascript_pkg_naming",
platform = select({
":k8": "linux-x86_64", # currently the only supported build type in Github Actions
":x64_x86_windows": "win32",
":x64_windows": "win64",
"//conditions:default": "" # continues with current behavior when no --cpu is specified allowing existing internal builds to function
})
)
pkg_files(
name = "plugin_files",
srcs = ["//generator:protoc-gen-js"],
attributes = pkg_attributes(mode = "0555"),
prefix = "bin/",
)
pkg_files(
name = "dist_files",
srcs = glob([
"google/protobuf/*.js",
"google/protobuf/compiler/*.js"
]) + [
"google-protobuf.js",
"package.json",
"README.md",
"LICENSE.md",
"LICENSE-asserts.md",
],
strip_prefix = strip_prefix.from_root(""),
)
pkg_tar(
name = "dist_tar",
srcs = [
":dist_files",
":plugin_files",
],
extension = "tar.gz",
package_file_name = "protobuf-javascript-{version}-{platform}.tar.gz",
package_variables = ":protobuf_javascript_pkg_naming",
)
pkg_zip(
name = "dist_zip",
srcs = [
":dist_files",
":plugin_files",
],
package_file_name = "protobuf-javascript-{version}-{platform}.zip",
package_variables = ":protobuf_javascript_pkg_naming",
)
filegroup(
name = "dist_all",
srcs = [
":dist_tar",
":dist_zip",
]
)