Skip to content

Commit

Permalink
[RENAME] arm_gnu_toolchain -> toolchains_arm_gnu (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
hexdae authored Mar 30, 2024
1 parent 429fb81 commit 92de8c7
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 59 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release_prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ cat << EOF
2. Add to your \`MODULE.bazel\` file:
\`\`\`starlark
bazel_dep(name = "arm_gnu_toolchain", version = "${TAG:1}")
bazel_dep(name = "toolchains_arm_gnu", version = "${TAG:1}")
# Toolchains: arm-none-eabi
arm_toolchain = use_extension("@arm_gnu_toolchain//:extensions.bzl", "arm_toolchain")
arm_toolchain = use_extension("@toolchains_arm_gnu//:extensions.bzl", "arm_toolchain")
arm_toolchain.arm_none_eabi(version = "13.2.1")
use_repo(
arm_toolchain,
Expand Down
4 changes: 2 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"""ARM cross compilation toolchains for bazel"""

module(
name = "arm_gnu_toolchain",
name = "toolchains_arm_gnu",
version = "0.0.1",
compatibility_level = 1,
)

bazel_dep(name = "platforms", version = "0.0.8")
bazel_dep(name = "rules_cc", version = "0.0.9")

arm_toolchain = use_extension("@arm_gnu_toolchain//:extensions.bzl", "arm_toolchain")
arm_toolchain = use_extension("@toolchains_arm_gnu//:extensions.bzl", "arm_toolchain")

# NOTE: It's important that we update these versions whenever a new toolchain
# version is added--otherwise the Minimum Selected Version algorithm in the
Expand Down
24 changes: 12 additions & 12 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ Please look at the [`examples`](./examples/) folder for reference usage
```python
# MODULE.bazel

bazel_dep(name = "arm_gnu_toolchain", version = "0.0.1")
bazel_dep(name = "toolchains_arm_gnu", version = "0.0.1")

git_override(
module_name = "arm_gnu_toolchain",
module_name = "toolchains_arm_gnu",
remote = "https://github.com/hexdae/bazel-arm-none-eabi",
branch = "master",
)

# Toolchains: arm-none-eabi
arm_toolchain = use_extension("@arm_gnu_toolchain//:extensions.bzl", "arm_toolchain")
arm_toolchain = use_extension("@toolchains_arm_gnu//:extensions.bzl", "arm_toolchain")
arm_toolchain.arm_none_eabi(version = "9.2.1")
use_repo(
arm_toolchain,
Expand Down Expand Up @@ -125,12 +125,12 @@ git_repository(
)

# Toolchain: arm-none-eabi
load("@arm_gnu_toolchain//:deps.bzl", "arm_none_eabi_deps", "register_default_arm_none_eabi_toolchains")
load("@toolchains_arm_gnu//:deps.bzl", "arm_none_eabi_deps", "register_default_arm_none_eabi_toolchains")
arm_none_eabi_deps()
register_default_arm_none_eabi_toolchains()

# Toolchain arm-none-linux-gnueabihf
load("@arm_gnu_toolchain//:deps.bzl", "arm_none_linux_gnueabihf_deps", "register_default_arm_none_linux_gnueabihf_toolchains")
load("@toolchains_arm_gnu//:deps.bzl", "arm_none_linux_gnueabihf_deps", "register_default_arm_none_linux_gnueabihf_toolchains")
arm_none_linux_gnueabihf_deps()
register_default_arm_none_linux_gnueabihf_toolchains()
```
Expand All @@ -146,7 +146,7 @@ In a BUILD file:
```python
# path/to/toolchains/BUILD

load("@arm_gnu_toolchain//toolchain:toolchain.bzl", "arm_none_eabi_toolchain")
load("@toolchains_arm_gnu//toolchain:toolchain.bzl", "arm_none_eabi_toolchain")
arm_none_eabi_toolchain(
name = "custom_toolchain",
target_compatible_with = [
Expand Down
24 changes: 12 additions & 12 deletions deps.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""deps.bzl"""

load(
"@arm_gnu_toolchain//toolchain:toolchain.bzl",
"@toolchains_arm_gnu//toolchain:toolchain.bzl",
"register_arm_gnu_toolchain",
"target_constraints",
)
Expand Down Expand Up @@ -81,21 +81,21 @@ GCC_ARM_NONE_LINUX_GNUEABIHF = {
"sha256": "df0f4927a67d1fd366ff81e40bd8c385a9324fbdde60437a512d106215f257b3",
"strip_prefix": "arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-linux-gnueabihf",
"url": "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz?rev=adb0c0238c934aeeaa12c09609c5e6fc&hash=68DA67DE12CBAD82A0FA4B75247E866155C93053",
"patches": ["@arm_gnu_toolchain//toolchain:patches/0001-Resolve-libc-relative-to-sysroot.patch"],
"patches": ["@toolchains_arm_gnu//toolchain:patches/0001-Resolve-libc-relative-to-sysroot.patch"],
},
{
"name": "arm_none_linux_gnueabihf_linux_aarch64",
"sha256": "8ad384bb328bccc44396d85c8f8113b7b8c5e11bcfef322e77cda3ebe7baadb5",
"strip_prefix": "arm-gnu-toolchain-13.2.Rel1-aarch64-arm-none-linux-gnueabihf",
"url": "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-aarch64-arm-none-linux-gnueabihf.tar.xz?rev=fbdb67e76c8349e5ad27a7c40fb270c9&hash=8CD3EBFFDC5E211275B705F6F9BCC0F6F5B4A53E",
"patches": ["@arm_gnu_toolchain//toolchain:patches/0001-Resolve-libc-relative-to-sysroot.patch"],
"patches": ["@toolchains_arm_gnu//toolchain:patches/0001-Resolve-libc-relative-to-sysroot.patch"],
},
{
"name": "arm_none_linux_gnueabihf_windows_x86_64",
"sha256": "047e72bcef8f7767691f36929a8c74ef66f717cf6264a31f48dd31bfb067f4c8",
"strip_prefix": "arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-linux-gnueabihf",
"url": "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-mingw-w64-i686-arm-none-linux-gnueabihf.zip?rev=14b6dd20622a4beabb60a6ee41a4c141&hash=C1F9FA6DE8259B5ACA0211139F4304F2B942E489",
"patches": ["@arm_gnu_toolchain//toolchain:patches/0001-Resolve-libc-relative-to-sysroot.patch"],
"patches": ["@toolchains_arm_gnu//toolchain:patches/0001-Resolve-libc-relative-to-sysroot.patch"],
"bin_extension": ".exe",
},
],
Expand All @@ -110,7 +110,7 @@ def _arm_gnu_cross_hosted_platform_specific_repo_impl(repository_ctx):
)
repository_ctx.template(
"BUILD.bazel",
Label("@arm_gnu_toolchain//toolchain:templates/compiler.BUILD"),
Label("@toolchains_arm_gnu//toolchain:templates/compiler.BUILD"),
substitutions = {
"%toolchain_prefix%": repository_ctx.attr.toolchain_prefix,
"%version%": repository_ctx.attr.version,
Expand All @@ -137,7 +137,7 @@ def _arm_gnu_toolchain_repo_impl(repository_ctx):
"""Defines the top-level toolchain repository."""
repository_ctx.template(
"BUILD",
Label("@arm_gnu_toolchain//toolchain:templates/top.BUILD"),
Label("@toolchains_arm_gnu//toolchain:templates/top.BUILD"),
substitutions = {
"%toolchain_name%": repository_ctx.attr.toolchain_name,
"%version%": repository_ctx.attr.version,
Expand All @@ -147,15 +147,15 @@ def _arm_gnu_toolchain_repo_impl(repository_ctx):

repository_ctx.template(
"toolchain/BUILD",
Label("@arm_gnu_toolchain//toolchain:templates/toolchain.BUILD"),
Label("@toolchains_arm_gnu//toolchain:templates/toolchain.BUILD"),
substitutions = {
"%toolchain_name%": repository_ctx.attr.toolchain_name,
"%version%": repository_ctx.attr.version,
"%toolchain_prefix%": repository_ctx.attr.toolchain_prefix,
},
)

arm_gnu_toolchain_repo = repository_rule(
toolchains_arm_gnu_repo = repository_rule(
implementation = _arm_gnu_toolchain_repo_impl,
attrs = {
"toolchain_name": attr.string(mandatory = True),
Expand All @@ -164,8 +164,8 @@ arm_gnu_toolchain_repo = repository_rule(
},
)

def arm_gnu_toolchain_deps(toolchain, toolchain_prefix, version, archives):
arm_gnu_toolchain_repo(
def toolchains_arm_gnu_deps(toolchain, toolchain_prefix, version, archives):
toolchains_arm_gnu_repo(
name = toolchain,
toolchain_name = toolchain,
toolchain_prefix = toolchain_prefix,
Expand Down Expand Up @@ -195,7 +195,7 @@ def arm_none_eabi_deps(version = "13.2.1", archives = GCC_ARM_NONE_EABI):
version: The version of the toolchain to use. If None, the latest version is used.
archives: A dictionary of version to archive attributes.
"""
arm_gnu_toolchain_deps(
toolchains_arm_gnu_deps(
"arm_none_eabi",
"arm-none-eabi",
version,
Expand All @@ -217,7 +217,7 @@ def arm_none_linux_gnueabihf_deps(version = "13.2.1", archives = GCC_ARM_NONE_LI
version: The version of the toolchain to use. If None, the latest version is used.
archives: A dictionary of the version to archive attributes.
"""
arm_gnu_toolchain_deps(
toolchains_arm_gnu_deps(
"arm_none_linux_gnueabihf",
"arm-none-linux-gnueabihf",
version,
Expand Down
6 changes: 3 additions & 3 deletions examples/bzlmod/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ module(

bazel_dep(name = "aspect_bazel_lib", version = "2.0.0")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "arm_gnu_toolchain")
bazel_dep(name = "toolchains_arm_gnu")
local_path_override(
module_name = "arm_gnu_toolchain",
module_name = "toolchains_arm_gnu",
path = "../..",
)

arm_toolchain = use_extension("@arm_gnu_toolchain//:extensions.bzl", "arm_toolchain")
arm_toolchain = use_extension("@toolchains_arm_gnu//:extensions.bzl", "arm_toolchain")
arm_toolchain.arm_none_eabi(version = "13.2.1")
use_repo(
arm_toolchain,
Expand Down
24 changes: 12 additions & 12 deletions examples/bzlmod/MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/bzlmod/custom/toolchain/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@arm_gnu_toolchain//toolchain:toolchain.bzl", "arm_none_eabi_toolchain")
load("@toolchains_arm_gnu//toolchain:toolchain.bzl", "arm_none_eabi_toolchain")

# Cortex-M3 toolchain
arm_none_eabi_toolchain(
Expand Down
4 changes: 2 additions & 2 deletions examples/workspace/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ git_repository(
)

local_repository(
name = "arm_gnu_toolchain",
name = "toolchains_arm_gnu",
path = "../../",
)

load("@arm_gnu_toolchain//:deps.bzl", "arm_none_eabi_deps", "arm_none_linux_gnueabihf_deps", "register_default_arm_none_eabi_toolchains", "register_default_arm_none_linux_gnueabihf_toolchains")
load("@toolchains_arm_gnu//:deps.bzl", "arm_none_eabi_deps", "arm_none_linux_gnueabihf_deps", "register_default_arm_none_eabi_toolchains", "register_default_arm_none_linux_gnueabihf_toolchains")

# Toolchain: arm-none-eabi
arm_none_eabi_deps()
Expand Down
2 changes: 1 addition & 1 deletion examples/workspace/custom/toolchain/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@arm_gnu_toolchain//toolchain:toolchain.bzl", "arm_none_eabi_toolchain")
load("@toolchains_arm_gnu//toolchain:toolchain.bzl", "arm_none_eabi_toolchain")

# Cortex-M3 toolchain
arm_none_eabi_toolchain(
Expand Down
2 changes: 1 addition & 1 deletion extensions.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load(
"@arm_gnu_toolchain//:deps.bzl",
"@toolchains_arm_gnu//:deps.bzl",
"arm_none_eabi_deps",
"arm_none_linux_gnueabihf_deps",
)
Expand Down
2 changes: 1 addition & 1 deletion toolchain/templates/compiler.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ This BUILD file marks the top of the host-specific cross-toolchain repository.
If the host needs @arm_none_eabi_linux_x86_64, this is the build file at the
top of that repository.
"""
load("@arm_gnu_toolchain//toolchain:toolchain.bzl", "tools")
load("@toolchains_arm_gnu//toolchain:toolchain.bzl", "tools")

package(default_visibility = ["//visibility:public"])

Expand Down
2 changes: 1 addition & 1 deletion toolchain/templates/toolchain.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ For example, "@arm_none_eabi//toolchain:*"
package(default_visibility = ["//visibility:public"])

load(
"@arm_gnu_toolchain//toolchain:toolchain.bzl",
"@toolchains_arm_gnu//toolchain:toolchain.bzl",
"%toolchain_name%_toolchain",
"target_constraints",
)
Expand Down
Loading

0 comments on commit 92de8c7

Please sign in to comment.