diff --git a/MODULE.bazel b/MODULE.bazel index 89d0da2..59e6382 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,7 +1,8 @@ """Module to handle everything bazel related concerning custom modules and rules""" -bazel_dep(name = "rules_cc", version = "0.1.1") -bazel_dep(name = "buildifier_prebuilt", version = "8.0.0") +bazel_dep(name = "rules_cc", version = "0.2.16") +bazel_dep(name = "rules_shell", version = "0.6.1") +bazel_dep(name = "buildifier_prebuilt", version = "8.2.1") bazel_dep(name = "stardoc", version = "0.7.2") bazel_dep(name = "ape", version = "1.0.1") bazel_dep(name = "aspect_rules_js", version = "2.0.1") diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index ff631b3..a6e0e45 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -25,7 +25,8 @@ "https://bcr.bazel.build/modules/bazel_features/1.18.0/MODULE.bazel": "1be0ae2557ab3a72a57aeb31b29be347bcdc5d2b1eb1e70f39e3851a7e97041a", "https://bcr.bazel.build/modules/bazel_features/1.19.0/MODULE.bazel": "59adcdf28230d220f0067b1f435b8537dd033bfff8db21335ef9217919c7fb58", "https://bcr.bazel.build/modules/bazel_features/1.21.0/MODULE.bazel": "675642261665d8eea09989aa3b8afb5c37627f1be178382c320d1b46afba5e3b", - "https://bcr.bazel.build/modules/bazel_features/1.21.0/source.json": "3e8379efaaef53ce35b7b8ba419df829315a880cb0a030e5bb45c96d6d5ecb5f", + "https://bcr.bazel.build/modules/bazel_features/1.28.0/MODULE.bazel": "4b4200e6cbf8fa335b2c3f43e1d6ef3e240319c33d43d60cc0fbd4b87ece299d", + "https://bcr.bazel.build/modules/bazel_features/1.28.0/source.json": "16a3fc5b4483cb307643791f5a4b7365fa98d2e70da7c378cdbde55f0c0b32cf", "https://bcr.bazel.build/modules/bazel_features/1.4.1/MODULE.bazel": "e45b6bb2350aff3e442ae1111c555e27eac1d915e77775f6fdc4b351b758b5d7", "https://bcr.bazel.build/modules/bazel_features/1.9.0/MODULE.bazel": "885151d58d90d8d9c811eb75e3288c11f850e1d6b481a8c9f766adee4712358b", "https://bcr.bazel.build/modules/bazel_features/1.9.1/MODULE.bazel": "8f679097876a9b609ad1f60249c49d68bfab783dd9be012faf9d82547b14815a", @@ -43,8 +44,8 @@ "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/source.json": "f121b43eeefc7c29efbd51b83d08631e2347297c95aac9764a701f2a6a2bb953", "https://bcr.bazel.build/modules/bazel_skylib_gazelle_plugin/1.7.1/MODULE.bazel": "c76b9d256c77c31754c5ac306d395fd47946d8d7470bea2474c3add17b334c3d", "https://bcr.bazel.build/modules/bazel_skylib_gazelle_plugin/1.7.1/source.json": "25a87991a554369633d706f924f67ca3eb4d9200af1bba7e57dceb85eb9198e4", - "https://bcr.bazel.build/modules/buildifier_prebuilt/8.0.0/MODULE.bazel": "ce80a1946ca406884aa20ad83fbbe74f9b13fb91ae6d8a8b8339e18e5eaebb2d", - "https://bcr.bazel.build/modules/buildifier_prebuilt/8.0.0/source.json": "b83ab501d5efda1b2c9f68086bac6b2e38cb17359fb6eabbc23465f6a61a2389", + "https://bcr.bazel.build/modules/buildifier_prebuilt/8.2.1/MODULE.bazel": "57f2736616367163651d9d3e918cddfd6c67ec7a541d924f2c4544d3fae8630e", + "https://bcr.bazel.build/modules/buildifier_prebuilt/8.2.1/source.json": "a3e79a347f9d8256d83eba2b621b5b6affa17c8b3236127f030db03b72a44a91", "https://bcr.bazel.build/modules/buildozer/7.1.2/MODULE.bazel": "2e8dd40ede9c454042645fd8d8d0cd1527966aa5c919de86661e62953cd73d84", "https://bcr.bazel.build/modules/buildozer/7.1.2/source.json": "c9028a501d2db85793a6996205c8de120944f50a0d570438fcae0457a5f9d1f8", "https://bcr.bazel.build/modules/download_utils/1.0.1/MODULE.bazel": "f1d0afade59e37de978506d6bbf08d7fe5f94964e86944aaf58efcead827b41b", @@ -109,7 +110,8 @@ "https://bcr.bazel.build/modules/rules_cc/0.0.8/MODULE.bazel": "964c85c82cfeb6f3855e6a07054fdb159aced38e99a5eecf7bce9d53990afa3e", "https://bcr.bazel.build/modules/rules_cc/0.0.9/MODULE.bazel": "836e76439f354b89afe6a911a7adf59a6b2518fafb174483ad78a2a2fde7b1c5", "https://bcr.bazel.build/modules/rules_cc/0.1.1/MODULE.bazel": "2f0222a6f229f0bf44cd711dc13c858dad98c62d52bd51d8fc3a764a83125513", - "https://bcr.bazel.build/modules/rules_cc/0.1.1/source.json": "d61627377bd7dd1da4652063e368d9366fc9a73920bfa396798ad92172cf645c", + "https://bcr.bazel.build/modules/rules_cc/0.2.16/MODULE.bazel": "9242fa89f950c6ef7702801ab53922e99c69b02310c39fb6e62b2bd30df2a1d4", + "https://bcr.bazel.build/modules/rules_cc/0.2.16/source.json": "d03d5cde49376d87e14ec14b666c56075e5e3926930327fd5d0484a1ff2ac1cc", "https://bcr.bazel.build/modules/rules_foreign_cc/0.9.0/MODULE.bazel": "c9e8c682bf75b0e7c704166d79b599f93b72cfca5ad7477df596947891feeef6", "https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/MODULE.bazel": "40c97d1144356f52905566c55811f13b299453a14ac7769dfba2ac38192337a8", "https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/source.json": "c8b1e2c717646f1702290959a3302a178fb639d987ab61d548105019f11e527e", @@ -173,7 +175,8 @@ "https://bcr.bazel.build/modules/rules_python/1.0.0/MODULE.bazel": "898a3d999c22caa585eb062b600f88654bf92efb204fa346fb55f6f8edffca43", "https://bcr.bazel.build/modules/rules_python/1.0.0/source.json": "b0162a65c6312e45e7912e39abd1a7f8856c2c7e41ecc9b6dc688a6f6400a917", "https://bcr.bazel.build/modules/rules_shell/0.2.0/MODULE.bazel": "fda8a652ab3c7d8fee214de05e7a9916d8b28082234e8d2c0094505c5268ed3c", - "https://bcr.bazel.build/modules/rules_shell/0.2.0/source.json": "7f27af3c28037d9701487c4744b5448d26537cc66cdef0d8df7ae85411f8de95", + "https://bcr.bazel.build/modules/rules_shell/0.6.1/MODULE.bazel": "72e76b0eea4e81611ef5452aa82b3da34caca0c8b7b5c0c9584338aa93bae26b", + "https://bcr.bazel.build/modules/rules_shell/0.6.1/source.json": "20ec05cd5e592055e214b2da8ccb283c7f2a421ea0dc2acbf1aa792e11c03d0c", "https://bcr.bazel.build/modules/stardoc/0.5.1/MODULE.bazel": "1a05d92974d0c122f5ccf09291442580317cdd859f07a8655f1db9a60374f9f8", "https://bcr.bazel.build/modules/stardoc/0.5.3/MODULE.bazel": "c7f6948dae6999bf0db32c1858ae345f112cacf98f174c7a8bb707e41b974f1c", "https://bcr.bazel.build/modules/stardoc/0.5.4/MODULE.bazel": "6569966df04610b8520957cb8e97cf2e9faac2c0309657c537ab51c16c18a2a4", @@ -604,145 +607,6 @@ ] } }, - "@@buildifier_prebuilt+//:defs.bzl%buildifier_prebuilt_deps_extension": { - "general": { - "bzlTransitiveDigest": "e+IcLwkzpj+j6N7ZA/IEcahqtz7pzMECMTRnXR70G+o=", - "usagesDigest": "N8lrm0ZTaWWFCLsIgGbyzX0cw5SlZ1DQ1u+U1dzVpw0=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "buildifier_darwin_amd64": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_file", - "attributes": { - "urls": [ - "https://github.com/bazelbuild/buildtools/releases/download/v8.0.0/buildifier-darwin-amd64" - ], - "downloaded_file_path": "buildifier", - "executable": true, - "sha256": "00c54f5363899653b6d5c86808d65447e10ab658a1b242707449c169c8f879d0" - } - }, - "buildifier_darwin_arm64": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_file", - "attributes": { - "urls": [ - "https://github.com/bazelbuild/buildtools/releases/download/v8.0.0/buildifier-darwin-arm64" - ], - "downloaded_file_path": "buildifier", - "executable": true, - "sha256": "cb2135ff8489bf3e1a1ba60be7d2cdab904dde7812426d4c72c021024c617fcb" - } - }, - "buildifier_linux_amd64": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_file", - "attributes": { - "urls": [ - "https://github.com/bazelbuild/buildtools/releases/download/v8.0.0/buildifier-linux-amd64" - ], - "downloaded_file_path": "buildifier", - "executable": true, - "sha256": "3482807cafadb64912ad912bdc752a8d4118d12b2f493f66f961f94d60f76d6a" - } - }, - "buildifier_linux_arm64": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_file", - "attributes": { - "urls": [ - "https://github.com/bazelbuild/buildtools/releases/download/v8.0.0/buildifier-linux-arm64" - ], - "downloaded_file_path": "buildifier", - "executable": true, - "sha256": "4f3a47fcb0d49388cc0c703ba43d83e10c51c35806640d5cab820720ee0540d7" - } - }, - "buildifier_windows_amd64": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_file", - "attributes": { - "urls": [ - "https://github.com/bazelbuild/buildtools/releases/download/v8.0.0/buildifier-windows-amd64.exe" - ], - "downloaded_file_path": "buildifier.exe", - "executable": true, - "sha256": "bbd11c7e68a985bcb14d1852f6855748dc1c6d98f9ad904d9d52381aee983a63" - } - }, - "buildozer_darwin_amd64": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_file", - "attributes": { - "urls": [ - "https://github.com/bazelbuild/buildtools/releases/download/v8.0.0/buildozer-darwin-amd64" - ], - "downloaded_file_path": "buildozer", - "executable": true, - "sha256": "c921d469ec4396e45ea2df605cd1e3841092e466fdd673820115d155c7e02579" - } - }, - "buildozer_darwin_arm64": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_file", - "attributes": { - "urls": [ - "https://github.com/bazelbuild/buildtools/releases/download/v8.0.0/buildozer-darwin-arm64" - ], - "downloaded_file_path": "buildozer", - "executable": true, - "sha256": "09c8e3114e36479a7b3f059c23c67322e70f04d7b09511319ea70af9a622fd20" - } - }, - "buildozer_linux_amd64": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_file", - "attributes": { - "urls": [ - "https://github.com/bazelbuild/buildtools/releases/download/v8.0.0/buildozer-linux-amd64" - ], - "downloaded_file_path": "buildozer", - "executable": true, - "sha256": "d0a7adf739fa389e0dc87eae5d11ed0a864260308b4887e5fd30a17d9c33ca9b" - } - }, - "buildozer_linux_arm64": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_file", - "attributes": { - "urls": [ - "https://github.com/bazelbuild/buildtools/releases/download/v8.0.0/buildozer-linux-arm64" - ], - "downloaded_file_path": "buildozer", - "executable": true, - "sha256": "410d0b1d46a3e044a5d5edb02f24152fd99d58cbddf26fcf802481e0e98bbc2e" - } - }, - "buildozer_windows_amd64": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_file", - "attributes": { - "urls": [ - "https://github.com/bazelbuild/buildtools/releases/download/v8.0.0/buildozer-windows-amd64.exe" - ], - "downloaded_file_path": "buildozer.exe", - "executable": true, - "sha256": "d4b571004dee5e34d1aa44a6d7f37102ba4de310163648289dfeb6b468048f58" - } - }, - "buildifier_prebuilt_toolchains": { - "repoRuleId": "@@buildifier_prebuilt+//:defs.bzl%_buildifier_toolchain_setup", - "attributes": { - "assets_json": "[{\"arch\":\"amd64\",\"name\":\"buildifier\",\"platform\":\"darwin\",\"sha256\":\"00c54f5363899653b6d5c86808d65447e10ab658a1b242707449c169c8f879d0\",\"version\":\"v8.0.0\"},{\"arch\":\"arm64\",\"name\":\"buildifier\",\"platform\":\"darwin\",\"sha256\":\"cb2135ff8489bf3e1a1ba60be7d2cdab904dde7812426d4c72c021024c617fcb\",\"version\":\"v8.0.0\"},{\"arch\":\"amd64\",\"name\":\"buildifier\",\"platform\":\"linux\",\"sha256\":\"3482807cafadb64912ad912bdc752a8d4118d12b2f493f66f961f94d60f76d6a\",\"version\":\"v8.0.0\"},{\"arch\":\"arm64\",\"name\":\"buildifier\",\"platform\":\"linux\",\"sha256\":\"4f3a47fcb0d49388cc0c703ba43d83e10c51c35806640d5cab820720ee0540d7\",\"version\":\"v8.0.0\"},{\"arch\":\"amd64\",\"name\":\"buildifier\",\"platform\":\"windows\",\"sha256\":\"bbd11c7e68a985bcb14d1852f6855748dc1c6d98f9ad904d9d52381aee983a63\",\"version\":\"v8.0.0\"},{\"arch\":\"amd64\",\"name\":\"buildozer\",\"platform\":\"darwin\",\"sha256\":\"c921d469ec4396e45ea2df605cd1e3841092e466fdd673820115d155c7e02579\",\"version\":\"v8.0.0\"},{\"arch\":\"arm64\",\"name\":\"buildozer\",\"platform\":\"darwin\",\"sha256\":\"09c8e3114e36479a7b3f059c23c67322e70f04d7b09511319ea70af9a622fd20\",\"version\":\"v8.0.0\"},{\"arch\":\"amd64\",\"name\":\"buildozer\",\"platform\":\"linux\",\"sha256\":\"d0a7adf739fa389e0dc87eae5d11ed0a864260308b4887e5fd30a17d9c33ca9b\",\"version\":\"v8.0.0\"},{\"arch\":\"arm64\",\"name\":\"buildozer\",\"platform\":\"linux\",\"sha256\":\"410d0b1d46a3e044a5d5edb02f24152fd99d58cbddf26fcf802481e0e98bbc2e\",\"version\":\"v8.0.0\"},{\"arch\":\"amd64\",\"name\":\"buildozer\",\"platform\":\"windows\",\"sha256\":\"d4b571004dee5e34d1aa44a6d7f37102ba4de310163648289dfeb6b468048f58\",\"version\":\"v8.0.0\"}]" - } - } - }, - "recordedRepoMappingEntries": [ - [ - "buildifier_prebuilt+", - "bazel_skylib", - "bazel_skylib+" - ], - [ - "buildifier_prebuilt+", - "bazel_tools", - "bazel_tools" - ] - ] - } - }, "@@rules_kotlin+//src/main/starlark/core/repositories:bzlmod_setup.bzl%rules_kotlin_extensions": { "general": { "bzlTransitiveDigest": "sFhcgPbDQehmbD1EOXzX4H1q/CD5df8zwG4kp4jbvr8=", diff --git a/bcr-modules/macros/add_module_macro.bzl b/bcr-modules/macros/add_module_macro.bzl index aadd7d2..3c35522 100644 --- a/bcr-modules/macros/add_module_macro.bzl +++ b/bcr-modules/macros/add_module_macro.bzl @@ -2,6 +2,7 @@ load("@rules_pkg//:mappings.bzl", "pkg_files") load("@rules_pkg//:pkg.bzl", "pkg_zip") +load("@rules_shell//shell:sh_binary.bzl", "sh_binary") load("//bcr-modules/rules:defs.bzl", "metadata_json") def _add_module_macro_impl(name, visibility, versions, **kwargs): @@ -37,7 +38,7 @@ def _add_module_macro_impl(name, visibility, versions, **kwargs): ) # bazel run target to directly put the generated metadata information into the vector-bazel-central-registry/modules folder in the repo - native.sh_binary( + sh_binary( name = name + ".add_to_repo", srcs = ["//tools:add_module.sh"], args = ["$(location @ape//ape:unzip)", "$(location " + name + ")", "vector-bazel-central-registry/modules/" + name], diff --git a/bcr-modules/macros/module_macro.bzl b/bcr-modules/macros/module_macro.bzl index bb489fd..eee2b02 100644 --- a/bcr-modules/macros/module_macro.bzl +++ b/bcr-modules/macros/module_macro.bzl @@ -36,10 +36,7 @@ def _module_macro_impl( # used to package our module archive while at the same time setting the mode to 0755, this had to be done via pes-cd before. pkg_tar( name = name, - srcs = [name + "_srcs"] if len(pkg_files_targets) <= 0 else pkg_files_targets + - [ - ":" + name + "_BUILD_bazel", - ], + srcs = [name + "_srcs", ":" + name + "_BUILD_bazel"] if len(pkg_files_targets) <= 0 else pkg_files_targets, extension = "tar.gz", mode = "0755", visibility = visibility, diff --git a/bcr-modules/macros/upload_macro.bzl b/bcr-modules/macros/upload_macro.bzl index 07f6807..1d56bc1 100644 --- a/bcr-modules/macros/upload_macro.bzl +++ b/bcr-modules/macros/upload_macro.bzl @@ -1,5 +1,6 @@ """A simple macro to build upload and download targets for a given module version and urls""" +load("@rules_shell//shell:sh_binary.bzl", "sh_binary") load("//bcr-modules:urls.bzl", "DEFAULT_DEV_GIT_UPLOAD_URL", "DEFAULT_PROD_GIT_UPLOAD_URL") def _get_url(url, upload_module_name, version): @@ -22,7 +23,7 @@ def _upload_macro_impl(name, visibility, upload_module_name, version, archive, d for target in URLS.keys(): # Add a convenience function to get moduel archive_override text - native.sh_binary( + sh_binary( name = target + "_get_archive_override", srcs = ["//tools:get_archive_override.sh"], args = [ diff --git a/bcr-modules/modules/rules_cfg5/0.0.2/BUILD.bazel b/bcr-modules/modules/rules_cfg5/0.0.2/BUILD.bazel index 60875d8..94feed9 100644 --- a/bcr-modules/modules/rules_cfg5/0.0.2/BUILD.bazel +++ b/bcr-modules/modules/rules_cfg5/0.0.2/BUILD.bazel @@ -58,6 +58,7 @@ module( "rules_common@0.2.0", # "rules_vtt@0.0.1", ], + integrity = "sha256-D2C00bzcFMYfFNhNd5HTmpGS3AaF+LDDDdoWbo0d1Wg=", module_version = "0.0.2", pkg_files_targets = [ "public", diff --git a/bcr-modules/modules/rules_cfg5/0.0.3/BUILD.bazel b/bcr-modules/modules/rules_cfg5/0.0.3/BUILD.bazel new file mode 100644 index 0000000..80b01a9 --- /dev/null +++ b/bcr-modules/modules/rules_cfg5/0.0.3/BUILD.bazel @@ -0,0 +1,68 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files") +load("//bcr-modules/macros:module_macro.bzl", "module") +load("//bcr-modules/macros:upload_macro.bzl", "module_upload") + +package(default_visibility = ["//visibility:public"]) + +module_upload( + name = "upload", + archive = ":rules_cfg5", + upload_module_name = "rules_cfg5", + version = "0.0.3", +) + +pkg_files( + name = "private", + srcs = [ + "//bcr-modules/modules/rules_cfg5/srcs:private/generate.bzl", + "//bcr-modules/modules/rules_cfg5/srcs:private/start.bzl", + "//bcr-modules/modules/rules_cfg5/srcs:private/toolchains.bzl", + ], + prefix = "private", +) + +pkg_files( + name = "private_common", + srcs = [ + "//bcr-modules/modules/rules_cfg5/srcs:private/common/component_refs.bzl", + ], + prefix = "private/common", +) + +pkg_files( + name = "private_templates", + srcs = [ + "//bcr-modules/modules/rules_cfg5/srcs:private/templates/filter_linux.sh.tpl", + "//bcr-modules/modules/rules_cfg5/srcs:private/templates/filter_windows.ps1.tpl", + ], + prefix = "private/templates", +) + +pkg_files( + name = "public", + srcs = [ + "//bcr-modules/modules/rules_cfg5/srcs:BUILD.bazel", + "//bcr-modules/modules/rules_cfg5/srcs:MODULE.bazel", + "//bcr-modules/modules/rules_cfg5/srcs:README.md", + "//bcr-modules/modules/rules_cfg5/srcs:defs.bzl", + "//bcr-modules/modules/rules_cfg5/srcs:generate.bzl", + ], +) + +module( + name = "rules_cfg5", + additional_dependencies = [ + "ape@1.0.1", + "bazel_skylib@1.7.1", + "rules_cc@0.1.1", + "rules_common@0.2.0", + # "rules_vtt@0.0.1", + ], + module_version = "0.0.3", + pkg_files_targets = [ + "public", + "private", + "private_common", + "private_templates", + ], +) diff --git a/bcr-modules/modules/rules_cfg5/BUILD.bazel b/bcr-modules/modules/rules_cfg5/BUILD.bazel index 35b7a81..c86bd63 100644 --- a/bcr-modules/modules/rules_cfg5/BUILD.bazel +++ b/bcr-modules/modules/rules_cfg5/BUILD.bazel @@ -6,6 +6,7 @@ module_bcr_dir( name = "rules_cfg5", versions = [ "0.0.2", + "0.0.3", ], visibility = ["//visibility:public"], ) diff --git a/bcr-modules/modules/rules_cfg5/srcs/MODULE.bazel b/bcr-modules/modules/rules_cfg5/srcs/MODULE.bazel index 26e4596..caae241 100644 --- a/bcr-modules/modules/rules_cfg5/srcs/MODULE.bazel +++ b/bcr-modules/modules/rules_cfg5/srcs/MODULE.bazel @@ -23,7 +23,7 @@ module( name = "rules_cfg5", - version = "0.0.2", + version = "0.0.3", compatibility_level = 0, ) diff --git a/bcr-modules/modules/rules_cfg5/srcs/private/rules.bzl b/bcr-modules/modules/rules_cfg5/srcs/private/rules.bzl index b6db161..edf3bbb 100644 --- a/bcr-modules/modules/rules_cfg5/srcs/private/rules.bzl +++ b/bcr-modules/modules/rules_cfg5/srcs/private/rules.bzl @@ -23,6 +23,8 @@ """Rules for cfg5""" +load("@rules_cc//cc/common:cc_common.bzl", "cc_common") +load("@rules_cc//cc/common:cc_info.bzl", "CcInfo") load("//rules/common:create_davinci_tool_workspace.bzl", "create_davinci_tool_workspace") #load("//rules/vtt:toolchains.bzl", "generate_tools_vtt") diff --git a/bcr-modules/modules/rules_cfg5/srcs/private/templates/filter_linux.sh.tpl b/bcr-modules/modules/rules_cfg5/srcs/private/templates/filter_linux.sh.tpl index 51d6a55..66187f1 100644 --- a/bcr-modules/modules/rules_cfg5/srcs/private/templates/filter_linux.sh.tpl +++ b/bcr-modules/modules/rules_cfg5/srcs/private/templates/filter_linux.sh.tpl @@ -1,87 +1,97 @@ -#!/bin/bash - -# MIT License - -# Copyright (c) 2025 Vector Group - -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: - -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -set -e -o pipefail - -# Filter generated files to include only needed files -mkdir -p "{headers_dir}" - - -mkdir -p "{sources_dir}" - - -# Create component-specific directories -{component_dirs_creation} - -# Function to determine component from filename -get_component() { - local file_path="$1" - local filename=$(basename "$file_path") - local base_name=$(basename "$filename" | sed 's/\\.[^.]*$//') - - # List of components - components=({components_list}) - - for component in "${components[@]}"; do - if [[ "$base_name" == "${component}_"* ]] || [[ "$base_name" == "$component" ]]; then - echo "$component" - return - fi - done - - echo "main" -} - -# Filter and copy header files -{rsync_exe} --log-file="{rsync_log_file_hdrs}" --verbose --prune-empty-dirs --archive --itemize-changes --quiet --filter "+ */" {excluded_files_patterns} --filter "+ **/*.h" --filter "- *" {generator_output_dir} {headers_dir} -chmod 777 "{headers_dir}" -R -# Filter and copy source files -{rsync_exe} --log-file="{rsync_log_file_srcs}" --verbose --prune-empty-dirs --archive --itemize-changes --quiet --filter "+ */" {excluded_files_patterns} --filter "+ **/*.c" --filter "+ **/*.asm" --filter "+ **/*.inc" --filter "+ **/*.inl" --filter "+ **/*.S" --filter "+ **/*.s" --filter "+ **/*.a" {additional_source_file_endings} --filter "- *" {generator_output_dir} {sources_dir} -chmod 777 "{sources_dir}" -R -# Move component-specific files from main directories to component directories -# Process headers first -find {headers_dir} -name "*.h" | while read -r file; do - component=$(get_component "$file") - - # If this file belongs to a specific component, move it to component directory - if [ "$component" != "main" ]; then - component_headers_dir="{headers_dir}/../generated_headers_$component" - if [ -d "$component_headers_dir" ]; then - mv "$file" "$component_headers_dir/" - fi - fi -done -# Process sources -find {sources_dir} -name "*.*" | while read -r file; do - component=$(get_component "$file") - - # If this file belongs to a specific component, move it to component directory - if [ "$component" != "main" ]; then - component_sources_dir="{sources_dir}/../generated_sources_$component" - if [ -d "$component_sources_dir" ]; then - mv "$file" "$component_sources_dir/" - fi - fi +#!/bin/bash + +# MIT License + +# Copyright (c) 2025 Vector Group + +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: + +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +set -e -o pipefail + +# Filter generated files to include only needed files +mkdir -p "{headers_dir}" + + +mkdir -p "{sources_dir}" + + +# Create component-specific directories +{component_dirs_creation} + +# Function to determine component from filename +get_component() { + local file_path="$1" + local filename=$(basename "$file_path") + local base_name="${filename%.*}" + + # List of components + components=({components_list}) + + # First, check for exact match (files named exactly like the component) + for component in "${components[@]}"; do + if [[ "$base_name" == "$component" ]]; then + echo "$component" + return + fi + done + + # Second, check for prefix match with underscore (e.g., Com_PduR) + # Sort by length (longest first) to avoid shorter names matching prefixes of longer names + for component in "${components[@]}"; do + if [[ "$base_name" == "${component}_"* ]]; then + echo "$component" + return + fi + done + + echo "main" +} + +# Filter and copy header files +{rsync_exe} --log-file="{rsync_log_file_hdrs}" --verbose --prune-empty-dirs --archive --itemize-changes --quiet --filter "+ */" {excluded_files_patterns} --filter "+ **/*.h" --filter "- *" {generator_output_dir} {headers_dir} +chmod 777 "{headers_dir}" -R +# Filter and copy source files +{rsync_exe} --log-file="{rsync_log_file_srcs}" --verbose --prune-empty-dirs --archive --itemize-changes --quiet --filter "+ */" {excluded_files_patterns} --filter "+ **/*.c" --filter "+ **/*.asm" --filter "+ **/*.inc" --filter "+ **/*.inl" --filter "+ **/*.S" --filter "+ **/*.s" --filter "+ **/*.a" {additional_source_file_endings} --filter "- *" {generator_output_dir} {sources_dir} +chmod 777 "{sources_dir}" -R +# Move component-specific files from main directories to component directories +# Process headers first +find {headers_dir} -name "*.h" | while read -r file; do + component=$(get_component "$file") + + # If this file belongs to a specific component, move it to component directory + if [ "$component" != "main" ]; then + component_headers_dir="{headers_dir}/../generated_headers_$component" + if [ -d "$component_headers_dir" ]; then + mv "$file" "$component_headers_dir/" + fi + fi +done +# Process sources +find {sources_dir} -name "*.*" | while read -r file; do + component=$(get_component "$file") + + # If this file belongs to a specific component, move it to component directory + if [ "$component" != "main" ]; then + component_sources_dir="{sources_dir}/../generated_sources_$component" + if [ -d "$component_sources_dir" ]; then + mv "$file" "$component_sources_dir/" + fi + fi done \ No newline at end of file diff --git a/bcr-modules/modules/rules_cfg5/srcs/private/templates/filter_windows.ps1.tpl b/bcr-modules/modules/rules_cfg5/srcs/private/templates/filter_windows.ps1.tpl index 680c283..74a37f3 100644 --- a/bcr-modules/modules/rules_cfg5/srcs/private/templates/filter_windows.ps1.tpl +++ b/bcr-modules/modules/rules_cfg5/srcs/private/templates/filter_windows.ps1.tpl @@ -69,9 +69,16 @@ try { $fileName = [System.IO.Path]::GetFileNameWithoutExtension($filePath) + # First, check for exact match (files named exactly like the component) foreach ($component in $components) { - # Check if filename starts with component name (e.g., Com_*, BswM_*, etc.) - if ($fileName -like "${component}_*" -or $fileName -eq $component) { + if ($fileName -eq $component) { + return $component + } + } + + # Second, check for prefix match with underscore (e.g., Com_PduR) + foreach ($component in $components) { + if ($fileName -like "${component}_*") { return $component } } diff --git a/bcr-modules/modules/rules_common/0.2.0/BUILD.bazel b/bcr-modules/modules/rules_common/0.2.0/BUILD.bazel index 0ecc693..4f2eaba 100644 --- a/bcr-modules/modules/rules_common/0.2.0/BUILD.bazel +++ b/bcr-modules/modules/rules_common/0.2.0/BUILD.bazel @@ -30,6 +30,7 @@ module( "ape@1.0.1", "bazel_skylib@1.7.1", ], + integrity = "sha256-e7YlsDOw56tZNJCf9BR/RcTDaMSH/6bSwLGjiZcUQ0A=", module_version = "0.2.0", pkg_files_targets = [ "public", diff --git a/bcr-modules/modules/rules_davinci_developer/0.0.1/BUILD.bazel b/bcr-modules/modules/rules_davinci_developer/0.0.1/BUILD.bazel index c7f5312..38bd5e4 100644 --- a/bcr-modules/modules/rules_davinci_developer/0.0.1/BUILD.bazel +++ b/bcr-modules/modules/rules_davinci_developer/0.0.1/BUILD.bazel @@ -26,6 +26,7 @@ module( additional_dependencies = [ "rules_common@0.2.0", ], + integrity = "sha256-WSlPCkm28Mi7IQqdGlrFgzzRC1s6GG2WOwB/ywvZfVU=", module_version = "0.0.1", pkg_files_targets = [ "public", diff --git a/bcr-modules/modules/rules_dvteam/0.0.1/BUILD.bazel b/bcr-modules/modules/rules_dvteam/0.0.1/BUILD.bazel index 4bf1ef7..ceceaf7 100644 --- a/bcr-modules/modules/rules_dvteam/0.0.1/BUILD.bazel +++ b/bcr-modules/modules/rules_dvteam/0.0.1/BUILD.bazel @@ -37,6 +37,7 @@ module( "rules_gradle@0.0.1", "rules_davinci_developer@0.0.1", ], + integrity = "sha256-odqR3sdmb3cQoOyi/qaW5n3ehoY+8rKrrkd98GlNLZs=", module_version = "0.0.1", pkg_files_targets = [ "public", diff --git a/bcr-modules/modules/rules_gradle/0.0.1/BUILD.bazel b/bcr-modules/modules/rules_gradle/0.0.1/BUILD.bazel index 18fba8c..2942870 100644 --- a/bcr-modules/modules/rules_gradle/0.0.1/BUILD.bazel +++ b/bcr-modules/modules/rules_gradle/0.0.1/BUILD.bazel @@ -31,6 +31,7 @@ pkg_files( module( name = "rules_gradle", + integrity = "sha256-hbwddMso/f3358BRgckbe8O1JSlO0oQb1KuSqf41tYc=", module_version = "0.0.1", pkg_files_targets = [ "public", diff --git a/bcr-modules/modules/rules_ocs/0.0.1/BUILD.bazel b/bcr-modules/modules/rules_ocs/0.0.1/BUILD.bazel index a2624e9..13e26b8 100644 --- a/bcr-modules/modules/rules_ocs/0.0.1/BUILD.bazel +++ b/bcr-modules/modules/rules_ocs/0.0.1/BUILD.bazel @@ -37,6 +37,7 @@ module( "bazel_skylib@1.7.1", "rules_davinci_developer@0.0.1", ], + integrity = "sha256-3vZWwd/Jbc9Z85luQsNJWl2ll6t8FMj+XAi9O229WDg=", module_version = "0.0.1", pkg_files_targets = [ "public", diff --git a/bcr-modules/rules/source_json.bzl b/bcr-modules/rules/source_json.bzl index 8d0b662..23871cd 100644 --- a/bcr-modules/rules/source_json.bzl +++ b/bcr-modules/rules/source_json.bzl @@ -30,6 +30,7 @@ fi # Close the JSON object cat <> {output_file} }} +EOL """ def _source_json_impl(ctx): diff --git a/vector-bazel-central-registry/modules/rules_cfg5/0.0.3/MODULE.bazel b/vector-bazel-central-registry/modules/rules_cfg5/0.0.3/MODULE.bazel new file mode 100644 index 0000000..6efdd88 --- /dev/null +++ b/vector-bazel-central-registry/modules/rules_cfg5/0.0.3/MODULE.bazel @@ -0,0 +1,10 @@ +module( + name = "rules_cfg5", + version = "0.0.3", + compatibility_level = 1, +) + +bazel_dep(name = "ape", version = "1.0.1") +bazel_dep(name = "bazel_skylib", version = "1.7.1") +bazel_dep(name = "rules_cc", version = "0.1.1") +bazel_dep(name = "rules_common", version = "0.2.0") diff --git a/vector-bazel-central-registry/modules/rules_cfg5/0.0.3/source.json b/vector-bazel-central-registry/modules/rules_cfg5/0.0.3/source.json new file mode 100644 index 0000000..446bb29 --- /dev/null +++ b/vector-bazel-central-registry/modules/rules_cfg5/0.0.3/source.json @@ -0,0 +1,4 @@ +{ + "url": "https://github.com/vectorgrp/bazel-rules/releases/download/rules_cfg5/0.0.3/rules_cfg5.tar.gz", + "integrity": "" +} diff --git a/vector-bazel-central-registry/modules/rules_cfg5/metadata.json b/vector-bazel-central-registry/modules/rules_cfg5/metadata.json index f176c1f..410908d 100644 --- a/vector-bazel-central-registry/modules/rules_cfg5/metadata.json +++ b/vector-bazel-central-registry/modules/rules_cfg5/metadata.json @@ -3,7 +3,8 @@ "maintainers": [], "repository": [], "versions": [ - "0.0.2" + "0.0.2", + "0.0.3" ], "yanked_versions": { } }