Skip to content

Commit

Permalink
Merge pull request #2298 from hzeller/feature-20241210-noinstall
Browse files Browse the repository at this point in the history
Always use included script for installing.
  • Loading branch information
hzeller authored Dec 11, 2024
2 parents 936dfb1 + 7a75dbf commit 3d821c6
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 76 deletions.
15 changes: 13 additions & 2 deletions .github/bin/simple-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,28 @@ fi
TARGET_DIR=$1
mkdir -p "${TARGET_DIR}"

BASE_DIR=bazel-bin/verible/verilog/tools
# Requires to have built before with
# bazel build :install-binaries

# Could we get the list of source from bazel query somehow ?

TOOLS_DIR=bazel-bin/verible/verilog/tools
for f in diff/verible-verilog-diff \
formatter/verible-verilog-format \
kythe/verible-verilog-kythe-extractor \
kythe/verible-verilog-kythe-kzip-writer \
lint/verible-verilog-lint \
ls/verible-verilog-ls \
obfuscator/verible-verilog-obfuscate \
preprocessor/verible-verilog-preprocessor \
project/verible-verilog-project \
syntax/verible-verilog-syntax
do
install "${BASE_DIR}/$f" "${TARGET_DIR}"
install "${TOOLS_DIR}/$f" "${TARGET_DIR}"
done

COMMON_TOOLS_DIR=bazel-bin/verible/common/tools
for f in verible-patch-tool
do
install "${COMMON_TOOLS_DIR}/$f" "${TARGET_DIR}"
done
15 changes: 9 additions & 6 deletions .github/workflows/verible-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,10 @@ jobs:

- name: Gather and pack binaries
if: matrix.mode == 'compile' && matrix.arch == 'x86_64'
run: bazel run :install -c fastbuild -- $VERIBLE_BINDIR && tar cfv verible-bin.tar -C $VERIBLE_BINDIR .
run: |
bazel build -c fastbuild :install-binaries
.github/bin/simple-install.sh $VERIBLE_BINDIR
tar cfv verible-bin.tar -C $VERIBLE_BINDIR .
- name: Upload bazel-bin
if: matrix.mode == 'compile' && matrix.arch == 'x86_64'
Expand Down Expand Up @@ -385,9 +388,7 @@ jobs:
.github/bin/run-clang-tidy-cached.cc --checks="-*"
MacOsBuild:
# New MacOS has a broken patch utility:
# //verible/verilog/tools/lint:lint-tool_test trips over a no-newline-at-end-of-file
runs-on: macos-12
runs-on: macos-latest
steps:

- name: Install Dependencies
Expand All @@ -414,7 +415,9 @@ jobs:
restore-keys: bazelcache_macos_

- name: Tests
run: bazel test -c opt --noshow_progress --test_output=errors --cxxopt=-Wno-range-loop-analysis //...
# MacOS has a broken patch utility:
# //verible/verilog/tools/lint:lint-tool_test trips over a no-newline-at-end-of-file
run: bazel test -c opt --noshow_progress --test_output=errors --cxxopt=-Wno-range-loop-analysis -- //... -//verible/verilog/tools/lint:lint-tool_test

- name: Build
run: bazel build -c opt --noshow_progress --test_output=errors --cxxopt=-Wno-range-loop-analysis :install-binaries
Expand Down Expand Up @@ -486,7 +489,7 @@ jobs:
- name: Prepare release
run: |
$VERSION = git describe --match=v*
C:/ProgramData/chocolatey/lib/bazel/bazel.exe run -c opt :install -- "c:/verible-${VERSION}-win64"
bash .github/bin/simple-install.sh "c:/verible-${VERSION}-win64"
7z a "verible-${VERSION}-win64.zip" "c:/verible-${VERSION}-win64"
- name: 📤 Upload artifact
Expand Down
8 changes: 1 addition & 7 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,11 @@ filegroup(
name = "install-scripts",
srcs = [
"//verible/common/tools:verible-transform-interactive",
"//verible/verilog/tools/formatter:git-verilog-format",
"//verible/verilog/tools/formatter:git-verible-verilog-format",
"//verible/verilog/tools/formatter:verible-verilog-format-changed-lines-interactive",
],
)

# Installing; see README.md
alias(
name = "install",
actual = "//bazel:install",
)

genrule(
name = "lint_doc",
outs = ["documentation_verible_lint_rules.md"],
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use_repo(m4, "m4")
register_toolchains("@m4//:toolchain")

# Register bison rules and toolchain.
bazel_dep(name = "rules_bison", version = "0.2.2")
bazel_dep(name = "rules_bison", version = "0.3")

bison = use_extension(
"@rules_bison//bison/extensions:bison_repository_ext.bzl",
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,13 @@ For simple installation, we provide regular [binary releases].
If you prefer to build and install the binaries locally yourself:

```bash
# In your home directory
bazel run -c opt :install -- ~/bin
bazel build -c opt :install-binaries

# For a system directory that requires root-access, call with -s option.
# (Do _not_ run bazel with sudo.)
bazel run -c opt :install -- -s /usr/local/bin
# install In your home directory
.github/bin/simple-install.sh ~/bin

# For a system directory that requires root-access, call scfript with sudo.
sudo .github/bin/simple-install.sh /usr/local/bin
```

(this requies a compliant `install` utility, otherwise simply copy
Expand Down
21 changes: 0 additions & 21 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,6 @@ http_archive(
# External tools needed
#

# 'make install' equivalent rule 2023-02-21
http_archive(
name = "com_github_google_rules_install",
# The installer uses an option -T that is not available on MacOS, but
# it is benign to leave out.
# Upstream bug https://github.com/google/bazel_rules_install/issues/31
patch_args = ["-p1"],
patches = ["//bazel:installer.patch"],
sha256 = "aba3c1ae179beb92c1fc4502d66d7d7c648f90eb51897aa4b0ae4a76ce225eec",
strip_prefix = "bazel_rules_install-6001facc1a96bafed0e414a529b11c1819f0cdbe",
urls = ["https://github.com/google/bazel_rules_install/archive/6001facc1a96bafed0e414a529b11c1819f0cdbe.zip"],
)

load("@com_github_google_rules_install//:deps.bzl", "install_rules_dependencies")

install_rules_dependencies()

load("@com_github_google_rules_install//:setup.bzl", "install_rules_setup")

install_rules_setup()

http_archive(
name = "rules_m4",
sha256 = "10ce41f150ccfbfddc9d2394ee680eb984dc8a3dfea613afd013cfb22ea7445c",
Expand Down
22 changes: 0 additions & 22 deletions WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
@@ -1,33 +1,11 @@
workspace(name = "com_google_verible")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

#
# External tools needed
#

# 'make install' equivalent rule 2023-02-21
http_archive(
name = "com_github_google_rules_install",
# The installer uses an option -T that is not available on MacOS, but
# it is benign to leave out.
# Upstream bug https://github.com/google/bazel_rules_install/issues/31
patch_args = ["-p1"],
patches = ["//bazel:installer.patch"],
sha256 = "aba3c1ae179beb92c1fc4502d66d7d7c648f90eb51897aa4b0ae4a76ce225eec",
strip_prefix = "bazel_rules_install-6001facc1a96bafed0e414a529b11c1819f0cdbe",
urls = ["https://github.com/google/bazel_rules_install/archive/6001facc1a96bafed0e414a529b11c1819f0cdbe.zip"],
)

load("@com_github_google_rules_install//:deps.bzl", "install_rules_dependencies")

install_rules_dependencies()

load("@com_github_google_rules_install//:setup.bzl", "install_rules_setup")

install_rules_setup()

# 2024-02-06
http_archive(
name = "rules_compdb",
Expand Down
11 changes: 0 additions & 11 deletions bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Rules for adding './configure && make' style dependencies.
"""

load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("@com_github_google_rules_install//installer:def.bzl", "installer")

package(
default_applicable_licenses = ["//:license"],
Expand Down Expand Up @@ -46,13 +45,3 @@ config_setting(
name = "static_linked_executables",
flag_values = {":create_static_linked_executables": "true"},
)

# This installer is here, so that the toplevel BUILD file does not have
# to pull in the full rules_install to keep that light of dependencies.
installer(
name = "install",
data = [
"//:install-binaries",
"//:install-scripts",
],
)
2 changes: 1 addition & 1 deletion verible/verilog/tools/formatter/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ cc_binary(
# //verible/verilog/tools/formatter:verible-verilog-format
# //verible/common/tools:verible-patch-tool
filegroup(
name = "git-verilog-format",
name = "git-verible-verilog-format",
srcs = ["git-verible-verilog-format.sh"],
visibility = ["//:__pkg__"], # for release
)
Expand Down

0 comments on commit 3d821c6

Please sign in to comment.