-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add bzlmod support files. #999
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fixedReleaser: | ||
login: jsharpe | ||
email: [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"homepage": "https://github.com/bazel-contrib/rules_cuda", | ||
jsharpe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"maintainers": [ | ||
{ | ||
"email": "[email protected]", | ||
"github": "jsharpe", | ||
"name": "James Sharpe" | ||
} | ||
], | ||
"repository": ["github:bazel-contrib/rules_cuda"], | ||
"versions": [], | ||
"yanked_versions": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# We recommend included a bcr test workspace that exercises your ruleset with bzlmod. | ||
# For an example, see https://github.com/aspect-build/bazel-lib/tree/main/e2e/bzlmod. | ||
jsharpe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#bcr_test_module: | ||
# module_path: "examples" | ||
# matrix: | ||
# platform: ["debian10", "macos", "ubuntu2004", "windows"] | ||
# tasks: | ||
# run_tests: | ||
# name: "Run test module" | ||
# platform: ${{ platform }} | ||
# test_targets: | ||
# - "//..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"integrity": "", | ||
"strip_prefix": "{REPO}-{VERSION}", | ||
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{VERSION}/{REPO}-{TAG}.tar.gz" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"bazelbuild/rules_foreign_cc" | ||
|
||
module( | ||
name = "rules_foreign_cc", | ||
version = "0.0.0", | ||
compatibility_level = 1, | ||
) | ||
|
||
bazel_dep(name = "bazel_skylib", version = "1.1.1") | ||
bazel_dep(name = "platforms", version = "0.0.5") | ||
bazel_dep(name = "rules_python", version = "0.20.0") | ||
|
||
tools = use_extension("@rules_foreign_cc//foreign_cc:extensions.bzl", "tools") | ||
use_repo( | ||
tools, | ||
"cmake_3.23.2_toolchains", | ||
"cmake_src", | ||
"gnumake_src", | ||
"ninja_1.11.1_toolchains", | ||
"ninja_build_src", | ||
"pkgconfig_src", | ||
"rules_foreign_cc_framework_toolchain_freebsd", | ||
"rules_foreign_cc_framework_toolchain_linux", | ||
"rules_foreign_cc_framework_toolchain_macos", | ||
"rules_foreign_cc_framework_toolchain_windows", | ||
) | ||
|
||
register_toolchains( | ||
"@rules_foreign_cc_framework_toolchain_freebsd//:toolchain", | ||
"@rules_foreign_cc_framework_toolchain_linux//:toolchain", | ||
"@rules_foreign_cc_framework_toolchain_macos//:toolchain", | ||
"@rules_foreign_cc_framework_toolchain_windows//:toolchain", | ||
"@rules_foreign_cc//toolchains:built_make_toolchain", | ||
"@rules_foreign_cc//toolchains:preinstalled_autoconf_toolchain", | ||
"@rules_foreign_cc//toolchains:preinstalled_automake_toolchain", | ||
"@rules_foreign_cc//toolchains:preinstalled_m4_toolchain", | ||
"@rules_foreign_cc//toolchains:preinstalled_pkgconfig_toolchain", | ||
"@cmake_3.23.2_toolchains//:all", | ||
"@ninja_1.11.1_toolchains//:all", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
workspace(name = "rules_foreign_cc") | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
http_archive( | ||
name = "bazelci_rules", | ||
sha256 = "eca21884e6f66a88c358e580fd67a6b148d30ab57b1680f62a96c00f9bc6a07e", | ||
strip_prefix = "bazelci_rules-1.0.0", | ||
url = "https://github.com/bazelbuild/continuous-integration/releases/download/rules-1.0.0/bazelci_rules-1.0.0.tar.gz", | ||
) | ||
|
||
load("@bazelci_rules//:rbe_repo.bzl", "rbe_preconfig") | ||
|
||
# Creates a default toolchain config for RBE. | ||
# Use this as is if you are using the rbe_ubuntu16_04 container, | ||
# otherwise refer to RBE docs. | ||
rbe_preconfig( | ||
name = "buildkite_config", | ||
toolchain = "ubuntu1804-bazel-java11", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
bazel_dep(name = "rules_foreign_cc", version = "0.0.0") | ||
local_path_override( | ||
module_name = "rules_foreign_cc", | ||
path = "..", | ||
) | ||
|
||
tools = use_extension("@rules_foreign_cc//foreign_cc:extensions.bzl", "tools") | ||
tools.cmake(version = "3.23.1") | ||
tools.ninja(version = "1.11.1") | ||
|
||
bazel_dep(name = "platforms", version = "0.0.6") | ||
bazel_dep(name = "rules_swift", version = "1.6.0", repo_name = "build_bazel_rules_swift") | ||
bazel_dep(name = "rules_apple", version = "2.1.0", repo_name = "build_bazel_rules_apple") | ||
bazel_dep(name = "apple_support", version = "1.4.1", repo_name = "build_bazel_apple_support") | ||
|
||
# bazel_dep(name = "rules_android", version = "0.1.1") | ||
# bazel_dep(name = "rules_jvm_external", version = "5.1") | ||
# | ||
# maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") | ||
# | ||
# maven.install( | ||
# name = "maven_deps", | ||
# artifacts = [ | ||
# "com.android.support.constraint:constraint-layout:aar:1.1.2", | ||
# "com.android.support:appcompat-v7:aar:26.1.0", | ||
# ], | ||
# repositories = [ | ||
# "https://jcenter.bintray.com/", | ||
# "https://maven.google.com", | ||
# "https://repo1.maven.org/maven2", | ||
# ], | ||
# ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
workspace(name = "rules_foreign_cc_examples") | ||
|
||
load("//deps:repositories.bzl", "repositories") | ||
|
||
repositories() | ||
|
||
load("//deps:deps_android.bzl", "deps_android") | ||
|
||
deps_android() | ||
|
||
load("//deps:deps_jvm_external.bzl", "deps_jvm_external") | ||
|
||
deps_jvm_external() | ||
|
||
local_repository( | ||
name = "rules_foreign_cc_examples_third_party", | ||
path = "third_party", | ||
) | ||
|
||
load("@rules_foreign_cc_examples_third_party//:repositories.bzl", examples_third_party_repositories = "repositories") | ||
|
||
examples_third_party_repositories() | ||
|
||
load("@rules_foreign_cc_examples_third_party//:setup.bzl", examples_third_party_setup = "setup") | ||
|
||
examples_third_party_setup() | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
http_archive( | ||
name = "bazelci_rules", | ||
sha256 = "eca21884e6f66a88c358e580fd67a6b148d30ab57b1680f62a96c00f9bc6a07e", | ||
strip_prefix = "bazelci_rules-1.0.0", | ||
url = "https://github.com/bazelbuild/continuous-integration/releases/download/rules-1.0.0/bazelci_rules-1.0.0.tar.gz", | ||
) | ||
|
||
load("@bazelci_rules//:rbe_repo.bzl", "rbe_preconfig") | ||
|
||
# Creates a default toolchain config for RBE. | ||
# Use this as is if you are using the rbe_ubuntu16_04 container, | ||
# otherwise refer to RBE docs. | ||
rbe_preconfig( | ||
name = "buildkite_config", | ||
toolchain = "ubuntu1804-bazel-java11", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,51 @@ | ||
"""Entry point for extensions used by bzlmod.""" | ||
|
||
load("//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies") | ||
load("//toolchains:prebuilt_toolchains.bzl", "prebuilt_toolchains") | ||
|
||
def _init(_): | ||
rules_foreign_cc_dependencies(register_toolchains = False, register_preinstalled_tools = False) | ||
_DEFAULT_CMAKE_VERSION = "3.23.2" | ||
_DEFAULT_NINJA_VERSION = "1.11.1" | ||
|
||
ext = module_extension(implementation = _init) | ||
cmake_toolchain_version = tag_class(attrs = { | ||
"version": attr.string(doc = "The cmake version", default = _DEFAULT_CMAKE_VERSION), | ||
}) | ||
|
||
ninja_toolchain_version = tag_class(attrs = { | ||
"version": attr.string(doc = "The ninja version", default = _DEFAULT_NINJA_VERSION), | ||
}) | ||
|
||
def _init(module_ctx): | ||
rules_foreign_cc_dependencies( | ||
register_toolchains = False, | ||
register_built_tools = True, | ||
register_default_tools = False, | ||
register_preinstalled_tools = False, | ||
register_built_pkgconfig_toolchain = True, | ||
) | ||
|
||
versions = { | ||
"cmake": _DEFAULT_CMAKE_VERSION, | ||
"ninja": _DEFAULT_NINJA_VERSION, | ||
} | ||
|
||
for mod in module_ctx.modules: | ||
if not mod.is_root: | ||
for toolchain in mod.tags.cmake: | ||
versions["cmake"] = toolchain.version | ||
|
||
for toolchain in mod.tags.ninja: | ||
versions["ninja"] = toolchain.version | ||
|
||
prebuilt_toolchains( | ||
cmake_version = versions["cmake"], | ||
ninja_version = versions["ninja"], | ||
register_toolchains = False, | ||
) | ||
|
||
tools = module_extension( | ||
implementation = _init, | ||
tag_classes = { | ||
"cmake": cmake_toolchain_version, | ||
"ninja": ninja_toolchain_version, | ||
}, | ||
) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No MacOS or windows builds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the issues with bzlmod specific issues happen at analysis time; I initially have just left this scoped to linux just for the sake of keeping CI times down as macOS in particular is slow.