Skip to content

Commit

Permalink
Merge pull request #2292 from hzeller/feature-20241122-update-paths
Browse files Browse the repository at this point in the history
Reorg files to have a toplevel verible/ directory
  • Loading branch information
hzeller authored Nov 23, 2024
2 parents 106f651 + 877f60d commit 7850f77
Show file tree
Hide file tree
Showing 1,523 changed files with 158,774 additions and 158,768 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ Checks: >
CheckOptions:
- key: misc-include-cleaner.IgnoreHeaders
value: .*_linter_test_utils\.h
value: .*-linter-test-utils\.h
17 changes: 12 additions & 5 deletions .github/bin/check-potential-problems.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ EXIT_CODE=0
#
# So, until these assumptions are fixed, we need to use absl::string_view that
# comes with the same implementation everywhere.
find common verilog -name "*.h" -o -name "*.cc" | \
find verible -name "*.h" -o -name "*.cc" | \
xargs grep -n "std::string_view"
if [ $? -eq 0 ]; then
echo "::error:: use absl::string_view instead of std::string_view"
Expand All @@ -44,7 +44,7 @@ fi
# is a good idea to move an implementation to a *.cc file anyway)
#
# TODO(hzeller): Arguably this might be good for common/util/logging.h as well.
find . -name "*.h" | xargs grep -n '#include "common/util/status_macros.h"'
find . -name "*.h" | xargs grep -n '#include "verible/common/util/status_macros.h"'
if [ $? -eq 0 ]; then
echo "::error:: using status_macros.h in a header pollutes global namespace."
echo
Expand All @@ -54,7 +54,7 @@ fi
# Don't accidentally use anything from the verilog namespace in the common
# verible namespace to make sure common stays independent.
# Use of that namespace in a comment is ok, or if waived with // NOLINT
find common -name "*.h" -o -name "*.cc" | xargs grep "verilog::" \
find verible/common -name "*.h" -o -name "*.cc" | xargs grep "verilog::" \
| egrep -v "(//.*verilog::|// NOLINT)"
if [ $? -eq 0 ]; then
echo "::error:: use of the verilog::-namespace inside common/"
Expand All @@ -63,14 +63,21 @@ if [ $? -eq 0 ]; then
fi

# Always use fully qualified include paths.
find common verilog -name "*.h" -o -name "*.cc" | \
find verible -name "*.h" -o -name "*.cc" | \
xargs egrep -n '#include "[^/]*"'
if [ $? -eq 0 ]; then
echo "::error:: always use a fully qualified name for #includes"
echo
EXIT_CODE=1
fi

find verible -name "*.h" -o -name "*.cc" | grep _ | grep -v _test
if [ $? -eq 0 ]; then
echo "::error:: File naming-convention for c++ files is to use dashes as separator with underscore only in test files; e.g. foo-bar_test.cc"
echo
EXIT_CODE=1
fi

# bazelbuild/rules_python is broken as it downloads a dynamically
# linked pre-built binary - This makes it _very_ platform specific.
# This should either compile Python from scratch or use the local system Python.
Expand All @@ -84,7 +91,7 @@ if [ $? -eq 0 ]; then
fi

# Never use std::regex.
find common verilog -name "*.h" -o -name "*.cc" | \
find verible -name "*.h" -o -name "*.cc" | \
xargs grep -n '#include <regex>'
if [ $? -eq 0 ]; then
echo "::error:: Don't use stdlib regex, it is slow and requires exceptions. Use RE2 instead (https://github.com/google/re2; header #include \"re2/re2.h\")."
Expand Down
2 changes: 1 addition & 1 deletion .github/bin/error-log-analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ def validate_slang(src, line, state, project, srcpath, err):
# Give version string for verible
proc = subprocess.run(
[args.verible_path +
"/bazel-bin/verilog/tools/syntax/verible-verilog-syntax",
"/bazel-bin/verible/verilog/tools/syntax/verible-verilog-syntax",
'--version'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
Expand Down
7 changes: 1 addition & 6 deletions .github/bin/run-clang-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,9 @@ ${CLANG_FORMAT} --version

# Run on all files.

# For now, we only use the Google style, without enforcing the pointer
# alignment. The toplevel .clang-format will over time make files people
# edit and locally format adhere to the style.
# (TODO: once there is a quiet phase with not much PRs open, do a bulk format).

find . -name "*.h" -o -name "*.cc" \
| egrep -v 'third_party/|external_libs/|.github/' \
| xargs -P2 ${CLANG_FORMAT} --style="Google" -i
| xargs -P2 ${CLANG_FORMAT} -i

# If we have buildifier installed, use that on BUILD files
if command -v ${BUILDIFIER} >/dev/null; then
Expand Down
4 changes: 2 additions & 2 deletions .github/bin/run-clang-tidy-cached.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ static constexpr ConfigValues kConfig = {
.cache_prefix = "verible_",
.file_exclude_re = ".git/|.github/" // stuff we're not interested in
"|vscode/" // some generated code in there
"|tree_operations_test" // very slow to process.
"|symbol_table_test", // ...
"|tree-operations_test" // very slow to process.
"|symbol-table_test", // ...
.toplevel_build_file = "MODULE.bazel",
.is_bazel_project = true,
};
Expand Down
2 changes: 1 addition & 1 deletion .github/bin/simple-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fi
TARGET_DIR=$1
mkdir -p "${TARGET_DIR}"

BASE_DIR=bazel-bin/verilog/tools
BASE_DIR=bazel-bin/verible/verilog/tools

for f in diff/verible-verilog-diff \
formatter/verible-verilog-format \
Expand Down
30 changes: 17 additions & 13 deletions .github/bin/smoke-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ readonly TERM_RED=$'\033[1;31m'
readonly TERM_BOLD=$'\033[1m'
readonly TERM_RESET=$'\033[0m'

readonly BINARY_BASE_DIR=bazel-bin/verilog/tools
readonly BINARY_BASE_DIR=bazel-bin/verible/verilog/tools

readonly ISSUE_PREFIX="https://github.com/chipsalliance/verible/issues"

Expand Down Expand Up @@ -81,6 +81,9 @@ readonly VERIBLE_TOOLS_TO_RUN="syntax/verible-verilog-syntax \
#
# There are some known issues which are all recorded in the associative
# array below, mapping them to Verible issue tracker numbers.
# TODO(hzeller): there should be a configuration file that contains two
# columns: URL + hash, so that we can fetch a particular known version not
# a moving target.
readonly TEST_GIT_PROJECTS="https://github.com/lowRISC/ibex \
https://github.com/lowRISC/opentitan \
https://github.com/chipsalliance/sv-tests \
Expand Down Expand Up @@ -135,10 +138,11 @@ ExpectedFailCount[lint:ibex]=14
ExpectedFailCount[project:ibex]=211
ExpectedFailCount[preprocessor:ibex]=385

ExpectedFailCount[syntax:opentitan]=53
ExpectedFailCount[lint:opentitan]=53
ExpectedFailCount[project:opentitan]=868
ExpectedFailCount[preprocessor:opentitan]=2381
ExpectedFailCount[syntax:opentitan]=61
ExpectedFailCount[lint:opentitan]=61
ExpectedFailCount[project:opentitan]=943
ExpectedFailCount[formatter:opentitan]=1
ExpectedFailCount[preprocessor:opentitan]=2555

ExpectedFailCount[syntax:sv-tests]=77
ExpectedFailCount[lint:sv-tests]=76
Expand Down Expand Up @@ -178,10 +182,10 @@ ExpectedFailCount[lint:XilinxUnisimLibrary]=4
ExpectedFailCount[project:XilinxUnisimLibrary]=22
ExpectedFailCount[preprocessor:XilinxUnisimLibrary]=96

ExpectedFailCount[syntax:black-parrot]=160
ExpectedFailCount[lint:black-parrot]=160
ExpectedFailCount[project:black-parrot]=175
ExpectedFailCount[preprocessor:black-parrot]=176
ExpectedFailCount[syntax:black-parrot]=154
ExpectedFailCount[lint:black-parrot]=154
ExpectedFailCount[project:black-parrot]=169
ExpectedFailCount[preprocessor:black-parrot]=170

ExpectedFailCount[syntax:ivtest]=166
ExpectedFailCount[lint:ivtest]=166
Expand All @@ -207,11 +211,11 @@ ExpectedFailCount[preprocessor:scr1]=46
ExpectedFailCount[project:serv]=1
ExpectedFailCount[preprocessor:serv]=1

ExpectedFailCount[syntax:basejump_stl]=474
ExpectedFailCount[lint:basejump_stl]=474
ExpectedFailCount[project:basejump_stl]=588
ExpectedFailCount[syntax:basejump_stl]=478
ExpectedFailCount[lint:basejump_stl]=478
ExpectedFailCount[project:basejump_stl]=593
ExpectedFailCount[formatter:basejump_stl]=1
ExpectedFailCount[preprocessor:basejump_stl]=623
ExpectedFailCount[preprocessor:basejump_stl]=629

ExpectedFailCount[syntax:opl3_fpga]=3
ExpectedFailCount[lint:opl3_fpga]=3
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/verible-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ jobs:
# that makes it into the compile. Use bant itself to find genrules.
bazel fetch ...
bazel build $(bin/bant -q genrule-outputs | awk '{print $2}') \
//common/analysis:command-file-lexer \
//verilog/parser:verilog-lex \
//verilog/parser:verilog-y \
//verilog/parser:verilog-y-final
//verible/common/analysis:command-file-lexer \
//verible/verilog/parser:verilog-lex \
//verible/verilog/parser:verilog-y \
//verible/verilog/parser:verilog-y-final
- name: Run bant build-cleaner
run: |
Expand Down Expand Up @@ -386,7 +386,7 @@ jobs:
MacOsBuild:
# New MacOS has a broken patch utility:
# //verilog/tools/lint:lint-tool_test trips over a no-newline-at-end-of-file
# //verible/verilog/tools/lint:lint-tool_test trips over a no-newline-at-end-of-file
runs-on: macos-12
steps:

Expand Down
32 changes: 16 additions & 16 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,26 @@ license(
filegroup(
name = "install-binaries",
srcs = [
"//common/tools:verible-patch-tool",
"//verilog/tools/diff:verible-verilog-diff",
"//verilog/tools/formatter:verible-verilog-format",
"//verilog/tools/kythe:verible-verilog-kythe-extractor",
"//verilog/tools/kythe:verible-verilog-kythe-kzip-writer",
"//verilog/tools/lint:verible-verilog-lint",
"//verilog/tools/ls:verible-verilog-ls",
"//verilog/tools/obfuscator:verible-verilog-obfuscate",
"//verilog/tools/preprocessor:verible-verilog-preprocessor",
"//verilog/tools/project:verible-verilog-project",
"//verilog/tools/syntax:verible-verilog-syntax",
"//verible/common/tools:verible-patch-tool",
"//verible/verilog/tools/diff:verible-verilog-diff",
"//verible/verilog/tools/formatter:verible-verilog-format",
"//verible/verilog/tools/kythe:verible-verilog-kythe-extractor",
"//verible/verilog/tools/kythe:verible-verilog-kythe-kzip-writer",
"//verible/verilog/tools/lint:verible-verilog-lint",
"//verible/verilog/tools/ls:verible-verilog-ls",
"//verible/verilog/tools/obfuscator:verible-verilog-obfuscate",
"//verible/verilog/tools/preprocessor:verible-verilog-preprocessor",
"//verible/verilog/tools/project:verible-verilog-project",
"//verible/verilog/tools/syntax:verible-verilog-syntax",
],
)

filegroup(
name = "install-scripts",
srcs = [
"//common/tools:verible-transform-interactive",
"//verilog/tools/formatter:git-verilog-format",
"//verilog/tools/formatter:verible-verilog-format-changed-lines-interactive",
"//verible/common/tools:verible-transform-interactive",
"//verible/verilog/tools/formatter:git-verilog-format",
"//verible/verilog/tools/formatter:verible-verilog-format-changed-lines-interactive",
],
)

Expand All @@ -55,9 +55,9 @@ alias(
genrule(
name = "lint_doc",
outs = ["documentation_verible_lint_rules.md"],
cmd = "$(location //verilog/tools/lint:verible-verilog-lint) " +
cmd = "$(location //verible/verilog/tools/lint:verible-verilog-lint) " +
"--generate_markdown > $(OUTS)",
tools = [
"//verilog/tools/lint:verible-verilog-lint",
"//verible/verilog/tools/lint:verible-verilog-lint",
],
)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ bazel build -c opt //...

You can access the generated artifacts under `bazel-bin/`. For instance the
syntax checker will be at
`bazel-bin/verilog/tools/syntax/verible-verilog-syntax` (corresponding to the
target name `//verilog/tools/syntax:verible-verilog-syntax`).
`bazel-bin/verible/verilog/tools/syntax/verible-verilog-syntax` (corresponding to the
target name `//verible/verilog/tools/syntax:verible-verilog-syntax`).

Moreover, if you need statically linked executables that don't depend on your
shared libraries, you can use custom config
Expand Down
Loading

0 comments on commit 7850f77

Please sign in to comment.