@@ -138,17 +138,16 @@ OPENROAD_LIBRARY_DEPS = [
138138 },
139139)
140140
141+ # Flags applied to top-level OpenROAD targets only. Flags that apply
142+ # globally to every cc_* target (-Wall, -Wextra, -Wno-sign-compare,
143+ # -Wno-unused-parameter, etc.) live in .bazelrc — do not repeat them here.
141144OPENROAD_COPTS = [
142145 "-Wno-error" ,
143- "-Wall" ,
144- "-Wextra" ,
145146 "-pedantic" ,
146147 "-Wno-cast-qual" , # typically from TCL swigging
147148 "-Wno-missing-braces" , # typically from TCL swigging
148149 "-Wredundant-decls" ,
149150 "-Wformat-security" ,
150- "-Wno-sign-compare" ,
151- "-Wno-unused-parameter" ,
152151 "-Wmismatched-tags" ,
153152 "-fopenmp" ,
154153]
@@ -307,16 +306,14 @@ tcl_wrap_cc(
307306 ],
308307)
309308
310- # This target compiles the SWIG C++ wrapper into a shared library (.so)
311- # that Python can load dynamically.
312309cc_binary (
313310 name = "_openroadpy.so" ,
314311 srcs = [":openroad_swig-py" ],
315312 defines = [PYTHON_STABLE_API_DEFINE ],
316313 linkopts = PYTHON_EXTENSION_LINKOPTS ,
317314 linkshared = True ,
318315 deps = [
319- ":openroad_lib" , # Depends on the core odb C++ library
316+ ":openroad_lib" ,
320317 ":ord" ,
321318 "//src/ant" ,
322319 "//src/cgt" ,
@@ -344,14 +341,10 @@ cc_binary(
344341 ],
345342)
346343
347- # This packages the SWIG-generated Python wrapper (odb.py) and the
348- # compiled C++ extension (_odb.so) together.
349344py_library (
350345 name = "openroad_py" ,
351- srcs = [":openroad_swig-py" ], # Use the .py output from the swig-py rule
352- # The data attribute makes the .so file available at runtime.
346+ srcs = [":openroad_swig-py" ],
353347 data = [":_openroadpy.so" ],
354- # This allows imports relative to the workspace root.
355348 imports = ["." ],
356349 visibility = ["//visibility:public" ],
357350 deps = [
@@ -431,6 +424,25 @@ filegroup(
431424 visibility = ["//:__subpackages__" ],
432425)
433426
427+ # ---------------------------------------------------------------------------
428+ # Packaging aliases
429+ #
430+ # The implementation lives in //packaging/ to isolate @rules_pkg loads from
431+ # downstream consumers, but the user-facing targets stay at the top level.
432+ # ---------------------------------------------------------------------------
433+
434+ alias (
435+ name = "install" ,
436+ actual = "//packaging:install" ,
437+ visibility = ["//visibility:public" ],
438+ )
439+
440+ alias (
441+ name = "tarfile" ,
442+ actual = "//packaging:tarfile" ,
443+ visibility = ["//visibility:public" ],
444+ )
445+
434446# Lightweight test suites that run without building OpenROAD.
435447# Usage:
436448# bazelisk test --test_tag_filters=doc_check //src/... # all documentation checks
@@ -492,12 +504,52 @@ sh_binary(
492504 ],
493505)
494506
507+ # --- Bazel linting (buildifier -lint=warn) --------------------------------
508+
509+ # buildifier: disable=native-sh-test
510+ sh_test (
511+ name = "lint_bzl_test" ,
512+ srcs = ["//bazel:bzl_lint_test.sh" ],
513+ args = ["$(rootpath @buildifier_prebuilt//:buildifier)" ],
514+ data = [
515+ "@buildifier_prebuilt//:buildifier" ,
516+ ],
517+ tags = ["local" ],
518+ )
519+
520+ # --- Bazel formatting check (buildifier -mode=check -lint=off) ------------
521+
522+ # buildifier: disable=native-sh-test
523+ sh_test (
524+ name = "fmt_bzl_test" ,
525+ srcs = ["//bazel:bzl_fmt_test.sh" ],
526+ args = ["$(rootpath @buildifier_prebuilt//:buildifier)" ],
527+ data = [
528+ "@buildifier_prebuilt//:buildifier" ,
529+ ],
530+ tags = ["local" ],
531+ )
532+
533+ # --- Bazel auto-format only (buildifier -mode=fix) ------------------------
534+
535+ # buildifier: disable=native-sh-binary
536+ sh_binary (
537+ name = "tidy_bzl" ,
538+ srcs = ["//bazel:bzl_tidy.sh" ],
539+ args = ["$(rootpath @buildifier_prebuilt//:buildifier)" ],
540+ data = [
541+ "@buildifier_prebuilt//:buildifier" ,
542+ ],
543+ )
544+
495545# --- Umbrella targets ------------------------------------------------------
496546
497547test_suite (
498548 name = "lint_test" ,
499549 tests = [
550+ ":fmt_bzl_test" ,
500551 ":fmt_tcl_test" ,
552+ ":lint_bzl_test" ,
501553 ":lint_tcl_test" ,
502554 ],
503555)
@@ -513,12 +565,19 @@ sh_binary(
513565 "$(rootpath //bazel:tclfmt)" ,
514566 "$(rootpath //bazel:tcl_lint_test.sh)" ,
515567 "$(rootpath //bazel:tclint)" ,
568+ "$(rootpath //bazel:bzl_tidy.sh)" ,
569+ "$(rootpath @buildifier_prebuilt//:buildifier)" ,
570+ "$(rootpath //bazel:bzl_lint_test.sh)" ,
571+ "$(rootpath @buildifier_prebuilt//:buildifier)" ,
516572 ],
517573 data = [
518574 "tclint.toml" ,
575+ "//bazel:bzl_lint_test.sh" ,
576+ "//bazel:bzl_tidy.sh" ,
519577 "//bazel:tcl_lint_test.sh" ,
520578 "//bazel:tcl_tidy.sh" ,
521579 "//bazel:tclfmt" ,
522580 "//bazel:tclint" ,
581+ "@buildifier_prebuilt//:buildifier" ,
523582 ],
524583)
0 commit comments