forked from bazelbuild/bazel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUILD
106 lines (96 loc) · 2.72 KB
/
BUILD
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# Packaging
genrule(
name = "client-info-file",
outs = ["client_info"],
cmd = "touch $@",
executable = 1,
)
md5_cmd = "set -e -o pipefail && cat $(SRCS) | %s | awk '{ print $$1; }' > $@"
# TODO(bazel-team): find a better way to handle dylib extensions.
filegroup(
name = "libunix",
srcs = select({
":darwin": ["//src/main/native:libunix.dylib"],
"//conditions:default": ["//src/main/native:libunix.so"],
}),
visibility = ["//src/test/java:__pkg__"],
)
genrule(
name = "install_base_key-file",
srcs = [
"//src/main/java:bazel-main_deploy.jar",
"//src/main/cpp:client",
":libunix",
"//src/main/tools:build-runfiles",
"//src/main/tools:process-wrapper",
":namespace-sandbox",
"client_info",
"//src/main/tools:build_interface_so",
],
outs = ["install_base_key"],
cmd = select({
":darwin": md5_cmd % "/sbin/md5",
"//conditions:default": md5_cmd % "md5sum",
}),
)
genrule(
name = "java-version",
outs = ["java.version"],
cmd = "echo 1.8 >$@",
)
genrule(
name = "package-zip",
srcs = [
"//src/main/java:bazel-main_deploy.jar",
# The jar must the first in the zip file because the client launcher
# looks for the first entry in the zip file for the java server.
"//src/main/cpp:client",
":libunix",
"//src/main/tools:build-runfiles",
"//src/main/tools:process-wrapper",
"//src/main/tools:jdk-support",
":namespace-sandbox",
"client_info",
"//src/main/tools:build_interface_so",
"install_base_key",
":java-version",
],
outs = ["package.zip"],
# Terrible hack to remove timestamps in the zip file
cmd = "mkdir $(@D)/package-zip && " +
"cp $(SRCS) $(@D)/package-zip && " +
"touch -t 198001010000.00 $(@D)/package-zip/* && " +
"zip -qj $@ $(@D)/package-zip/* && " +
"rm -fr $(@D)/package-zip",
)
genrule(
name = "bazel-bin",
srcs = [
"//src/main/cpp:client",
"package-zip",
],
outs = ["bazel"],
cmd = "cat $(location //src/main/cpp:client) package-zip > $@ && zip -qA $@",
executable = 1,
output_to_bindir = 1,
visibility = ["//src/test:__subpackages__"], # For integration tests
)
filegroup(
name = "tools",
srcs = [
"//src/java_tools/buildjar:JavaBuilder_deploy.jar",
"//src/java_tools/singlejar:SingleJar_deploy.jar",
"//third_party/ijar",
],
)
filegroup(
name = "namespace-sandbox",
srcs = [
"//src/main/tools:namespace-sandbox",
],
)
config_setting(
name = "darwin",
values = {"cpu": "darwin"},
visibility = ["//visibility:public"],
)