Skip to content

Commit

Permalink
Rollback of commit 97eaf91.
Browse files Browse the repository at this point in the history
*** Reason for rollback ***

Broke bazel on mac

*** Original change description ***

Add a //src:bazel-notools target that is the same as the Bazel binary except without the embedded tools.

Its use requires the addition of a local_workspace(name = "bazel_tools", path=...) to the WORKSPACE file. It is useful if you don't care about the set of embedded tools (because you provide them to Bazel in another way anyway) but you do care about the size of the Bazel binary (it's 16 MB compared to 56 MB with the tools).

--
MOS_MIGRATED_REVID=105553886
  • Loading branch information
c-parsons authored and laszlocsomor committed Oct 16, 2015
1 parent 99f831e commit dcd9a53
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 76 deletions.
63 changes: 32 additions & 31 deletions src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ filegroup(
],
)

[genrule(
name = "install_base_key-file" + suffix,
genrule(
name = "install_base_key-file",
srcs = [
"//src/main/java:bazel-main_deploy.jar",
"//src/main/cpp:client",
Expand All @@ -25,16 +25,14 @@ filegroup(
"//src/main/tools:process-wrapper",
"//src/main/tools:namespace-sandbox",
"//src/main/tools:build_interface_so",
] + embedded_tools,
outs = ["install_base_key" + suffix],
":embedded_tools",
],
outs = ["install_base_key"],
cmd = select({
":darwin": md5_cmd % "/sbin/md5",
"//conditions:default": md5_cmd % "md5sum",
}),
) for suffix, embedded_tools in {
"": [":embedded_tools"],
"_notools": [],
}.items()]
)

# Try to grab the java version from the java_toolchain.
# Unfortunately, we don't have access to the javac options
Expand Down Expand Up @@ -94,51 +92,54 @@ genrule(
]),
)

[genrule(
name = "package-zip" + suffix,
genrule(
name = "package-zip",
srcs = [
# The script assumes that the deploy jar is the first item here, the
# install base key is the second, and the embedded tools zip (if exists)
# is the third
"//src/main/java:bazel-main_deploy.jar",
"install_base_key" + suffix,
] + ([":embedded_tools.zip"] if embed else []) + [
"//src/main/cpp:client",
":libunix",
"//src/main/tools:build-runfiles",
"//src/main/tools:process-wrapper",
"//src/main/tools:jdk-support",
"//src/main/tools:namespace-sandbox",
"//src/main/tools:build_interface_so",
"install_base_key",
":java-version",
":embedded_tools.zip",
],
outs = ["package" + suffix + ".zip"],
cmd = "$(location :package-bazel.sh) $@ " + ("" if embed else "''") + " $(SRCS)",
tools = ["package-bazel.sh"],
) for suffix, embed in [
("", True),
("_notools", False),
]]
outs = ["package.zip"],
# Terrible hack to remove timestamps in the zip file
cmd = "\n".join([
"mkdir -p $(@D)/package-zip",
"cp $(SRCS) $(@D)/package-zip",
# TODO(dmarting): we should change the client to connect to server.jar
# instead of the first binary in the list.
"mv $(@D)/package-zip/bazel-main_deploy.jar $(@D)/package-zip/A-server.jar",
"touch -t 198001010000.00 $(@D)/package-zip/*",
"mkdir $(@D)/package-zip/embedded_tools",
"(cd $(@D)/package-zip/embedded_tools && unzip -q ../embedded_tools.zip)",
"rm $(@D)/package-zip/embedded_tools.zip",
"P=$$PWD; (cd $(@D)/package-zip && zip -qrD $$P/$@ *)",
"rm -fr $(@D)/package-zip",
]),
)

[genrule(
name = "bazel-bin" + suffix,
genrule(
name = "bazel-bin",
srcs = [
"//src/main/cpp:client",
"package-zip" + suffix,
"package-zip",
],
outs = ["bazel" + suffix],
cmd = "cat $(location //src/main/cpp:client) $(location :package-zip" + suffix + ") > $@ && zip -qA $@",
outs = ["bazel"],
cmd = "cat $(location //src/main/cpp:client) $(location :package-zip) > $@ && zip -qA $@",
executable = 1,
output_to_bindir = 1,
visibility = [
"//scripts:__pkg__", # For bash completion generation
"//scripts/packages:__pkg__", # For installer generation
"//src/test:__subpackages__", # For integration tests
],
) for suffix in [
"",
"_notools",
]]
)

config_setting(
name = "darwin",
Expand Down
45 changes: 0 additions & 45 deletions src/package-bazel.sh

This file was deleted.

0 comments on commit dcd9a53

Please sign in to comment.