Skip to content
This repository was archived by the owner on Sep 15, 2021. It is now read-only.

Commit 45ae581

Browse files
authored
Use a prebuilt Stardoc release binary (#172)
Instead of forcing users to depend on @io_bazel so that Stardoc is built from source for each invocation, a prebuilt Stardoc binary will be included in this repository, and updated on release cuts. This also eliminates buggy behavior when Stardoc and @io_bazel repositories are out of sync in a user's workspace. Closes #170
1 parent f57c988 commit 45ae581

File tree

6 files changed

+62
-9
lines changed

6 files changed

+62
-9
lines changed

WORKSPACE

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ node_repositories()
1212
load("@io_bazel_rules_sass//:defs.bzl", "sass_repositories")
1313
sass_repositories()
1414

15-
15+
#######################################################################
16+
##### MOST USERS SHOULD NOT NEED TO COPY ANYTHING BELOW THIS LINE #####
17+
#######################################################################
1618
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
1719

1820
# Needed for skydoc only (not Stardoc), which is deprecated. Users should include
@@ -22,3 +24,10 @@ git_repository(
2224
remote = "https://github.com/protocolbuffers/protobuf.git",
2325
commit = "7b28271a61a3da0a37f6fda399b0c4c86464e5b3", # 2018-11-16
2426
)
27+
28+
# Needed for generating the Stardoc release binary.
29+
git_repository(
30+
name = "io_bazel",
31+
remote = "https://github.com/bazelbuild/bazel.git",
32+
commit = "49107ad79ef08811db22636928dfd113a9acf902", # Mar 08, 2019
33+
)

setup.bzl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,6 @@ def skydoc_repositories():
7474
remote = "https://github.com/bazelbuild/rules_sass.git",
7575
commit = "8ccf4f1c351928b55d5dddf3672e3667f6978d60",
7676
)
77-
_include_if_not_defined(
78-
git_repository,
79-
name = "io_bazel",
80-
remote = "https://github.com/bazelbuild/bazel.git",
81-
# TODO: Update to a newer tagged version when available.
82-
commit = "1488f91fec238adacbd0517fcee15d8ec0599b8d", # Feb 27, 2019
83-
)
8477
_include_if_not_defined(
8578
http_archive,
8679
name = "markupsafe_archive",

stardoc/BUILD

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,25 @@ stardoc(
2323
],
2424
deps = [":stardoc_lib"],
2525
)
26+
27+
java_binary(
28+
name = "stardoc",
29+
main_class = "com.google.devtools.build.skydoc.SkydocMain",
30+
runtime_deps = [
31+
":prebuilt_stardoc_binary",
32+
],
33+
jvm_flags = [
34+
# quiet warnings from com.google.protobuf.UnsafeUtil,
35+
# see: https://github.com/google/protobuf/issues/3781
36+
# TODO(cparsons): Remove once Stardoc has the fix.
37+
"-XX:+IgnoreUnrecognizedVMOptions",
38+
"--add-opens=java.base/java.nio=ALL-UNNAMED",
39+
"--add-opens=java.base/java.lang=ALL-UNNAMED",
40+
],
41+
)
42+
43+
java_import(
44+
name = "prebuilt_stardoc_binary",
45+
jars = ["stardoc_binary.jar"],
46+
visibility = ["//visibility:private"],
47+
)

stardoc/stardoc.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ non-default semantic flags required to use the given Starlark symbols.
107107
"stardoc": attr.label(
108108
doc = "The location of the stardoc tool.",
109109
allow_files = True,
110-
default = Label("@io_bazel//src/main/java/com/google/devtools/build/skydoc"),
110+
default = Label("//stardoc:stardoc"),
111111
cfg = "host",
112112
executable = True,
113113
),

stardoc/stardoc_binary.jar

8.74 MB
Binary file not shown.

update-release-binary.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2019 The Bazel Authors. All rights reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# Renerates the Stardoc release binary from source in @io_bazel.
17+
#
18+
# This should only need to be run for cutting a new Stardoc release.
19+
20+
set -eu
21+
22+
echo "** Building Stardoc from source..."
23+
bazel build @io_bazel//src/main/java/com/google/devtools/build/skydoc:skydoc_deploy.jar
24+
25+
echo "** Copying Stardoc binary..."
26+
cp bazel-bin/external/io_bazel/src/main/java/com/google/devtools/build/skydoc/skydoc_deploy.jar \
27+
stardoc/stardoc_binary.jar
28+
29+
echo "** Stardoc copied."

0 commit comments

Comments
 (0)