From db24043737127f66de55b7f2845522af618b520d Mon Sep 17 00:00:00 2001 From: Rob Schiemann Date: Thu, 15 Feb 2024 15:48:42 -0800 Subject: [PATCH] Revert "Remove GRAIL references (#94)" This reverts commit 36d9f61a0da0a5ce885b7cd99a63c88ab8fb2a7a. --- LANGUAGE.md | 83 +++++++++++++---------- R/container/README.md | 16 ++--- R/container/binary.bzl | 2 +- R/container/defs.bzl | 4 +- R/container/library.bzl | 2 +- R/defs.bzl | 10 +-- R/dependencies.bzl | 18 ++--- R/internal/binary.bzl | 18 ++--- R/internal/build.bzl | 34 +++++----- R/internal/common.bzl | 4 +- R/internal/coverage_deps.bzl | 4 +- R/internal/library.bzl | 10 +-- R/internal/tests.bzl | 22 +++--- R/internal/toolchains/local_toolchain.bzl | 12 ++-- R/internal/toolchains/toolchain.bzl | 2 +- R/makevars/darwin.bzl | 6 +- R/makevars/linux.bzl | 6 +- R/repositories.bzl | 8 +-- README.md | 69 +++++++------------ WORKSPACE | 2 +- gazelle/BUILD | 2 +- gazelle/rlang.go | 2 +- scripts/razel.R | 4 +- tests/BUILD | 16 ++--- tests/WORKSPACE | 16 ++--- tests/binary/BUILD | 2 +- tests/binary/binary_test.sh | 4 +- tests/container/BUILD | 8 +-- tests/container/image_test.sh | 38 +++++------ tests/coverage/coverage_test.sh | 2 +- tests/cran/BUILD.RProtoBuf | 2 +- tests/cran/Makevars.gnu | 2 +- tests/cran/build_file_overrides.csv | 2 +- tests/flock/BUILD | 2 +- tests/flock/flock_test.sh | 8 +-- tests/init.bzl | 4 +- tests/packages/exampleA/BUILD | 2 +- tests/packages/exampleB/BUILD | 2 +- tests/packages/exampleC/BUILD | 2 +- tests/packages/exampleD/BUILD | 2 +- tests/run_tests.sh | 2 +- tests/stamping/BUILD | 8 +-- tests/state/BUILD | 4 +- tests/state/state_test.sh | 2 +- tests/workspaceroot/BUILD.bazel | 2 +- tests/workspaceroot/WORKSPACE | 6 +- 46 files changed, 238 insertions(+), 240 deletions(-) diff --git a/LANGUAGE.md b/LANGUAGE.md index a94d239..e4506ef 100644 --- a/LANGUAGE.md +++ b/LANGUAGE.md @@ -1,8 +1,23 @@ -# R guide +# GRAIL R guide -R originated as a blend between _Scheme_, a functional programming language, and _S_, a statistical computing language. The language specification started as a toy used within a closed-group of statisticians in the early 1990s [1], and grew organically in the public domain from the year 2000. Parts of the language will feel familiar to users of languages like Lisp or Haskell, and other parts will feel familiar to users of software like Matlab. +Language Guide for writing code at GRAIL in the R language. + +NOTE: This is a snapshot of what GRAIL has maintained internally as a +style guide. This does not talk about environment configuration and +integration with the build system. This is here until I find a better place for +it. + +Author: Siddhartha Bagaria + +Reviewers: Steven Banville and Hyunsung John Kim + +Last Updated: May 9, 2019 + +---- + +R originated as a blend between *Scheme*, a functional programming language, and *S*, a statistical computing language. The language specification started as a toy used within a closed-group of statisticians in the early 1990s [1], and grew organically in the public domain from the year 2000. Parts of the language will feel familiar to users of languages like Lisp or Haskell, and other parts will feel familiar to users of software like Matlab. The language provides very few primitives, and most operators, like `+` or `[` are implemented as functions, which can be overloaded and overridden by users. Given the power and flexibility, it is important that users of the language limit themselves to a known safe set of features, and understand their implications. @@ -11,24 +26,23 @@ For a more comprehensive reading on the language, please see the [official manua At GRAIL, the following is a community agreed set of rules to simplify the language and be consistent in our usage. It is not the aim of this guide to act as a tutorial or a reference. - ## Table of Contents - [Language](#language) - - [Attaching](#attaching) - - [Variable Sequence Generation](#variable-sequence-generation) - - [Warnings](#warnings) - - [Vectors, Indexing and Recycling](#vectors--indexing-and-recycling) - - [OOP](#oop) - - [Metaprogramming](#metaprogramming) - - [Discouraged Functions](#discouraged-functions) + + [Attaching](#attaching) + + [Variable Sequence Generation](#variable-sequence-generation) + + [Warnings](#warnings) + + [Vectors, Indexing and Recycling](#vectors--indexing-and-recycling) + + [OOP](#oop) + + [Metaprogramming](#metaprogramming) + + [Discouraged Functions](#discouraged-functions) - [Dependencies](#dependencies) - - [Tidy Evaluation](#tidy-evaluation) + + [Tidy Evaluation](#tidy-evaluation) - [Data Manipulation Verbs](#data-manipulation-verbs) - [Pipe Operator](#pipe-operator) - [Packages](#packages) - [Style](#style) - - [Syntax](#syntax) + + [Syntax](#syntax) - [File Names](#file-names) - [Package Names](#package-names) - [Object Names](#object-names) @@ -36,7 +50,7 @@ At GRAIL, the following is a community agreed set of rules to simplify the langu - [Returns](#returns) - [Arguments](#arguments) - [Errors](#errors) - - [Formatting](#formatting) + + [Formatting](#formatting) - [Line Length](#line-length) - [Spacing](#spacing) - [Code Blocks](#code-blocks) @@ -44,7 +58,7 @@ At GRAIL, the following is a community agreed set of rules to simplify the langu - [Roxygen Documentation](#roxygen-documentation) - [TODOs](#todos) ---- +------ ## Language @@ -74,7 +88,7 @@ library(roguePkg) **Cons**: Although messages are printed on the console listing the objects that were masked by new definitions, these can be easily missed. This makes code behavior dependent on the order or existence of attach operations, which is obviously undesirable. -**Decision**: Avoid attaching as much as you can, and qualify all your objects with the namespace, e.g. `dplyr::mutate`. Attach when you are absolutely sure you are not unintentionally masking. If you do have to attach, in interactive runs, visually inspect the output from your attach operation, and in non-interactive runs, check the output of [base::conflicts](https://www.rdocumentation.org/packages/base/versions/3.6.0/topics/conflicts) function. Also, see the _Good Practice_ section on [base::attach](https://www.rdocumentation.org/packages/base/versions/3.6.0/topics/attach). +**Decision**: Avoid attaching as much as you can, and qualify all your objects with the namespace, e.g. `dplyr::mutate`. Attach when you are absolutely sure you are not unintentionally masking. If you do have to attach, in interactive runs, visually inspect the output from your attach operation, and in non-interactive runs, check the output of [base::conflicts](https://www.rdocumentation.org/packages/base/versions/3.6.0/topics/conflicts) function. Also, see the *Good Practice* section on [base::attach](https://www.rdocumentation.org/packages/base/versions/3.6.0/topics/attach). ```R # Bad @@ -92,7 +106,7 @@ somePkg::some_var A convenient way to generate sequences in R is using the `:` operator, e.g. `1:3`. This section concerns when at least one side of the operator is variable. -**Pros**: It is a much more intuitive way to think that you are _counting_ from `1` to `x`. +**Pros**: It is a much more intuitive way to think that you are *counting* from `1` to `x`. **Cons**: This pattern is often misused as a way to get a sequence of length `x` because it gives incorrect results when `x < 1`, because `1:0 == c(1, 0)` which is not the intended result in most cases, where you would expect an empty vector. @@ -148,10 +162,10 @@ It pays to keep in mind that there are no scalars in R, and that vectors of insu ```R > df <- data.frame(foo = 1:2, bar = 3:4) - + > df[, "foo"] [1] 1 2 - + > df[, "foo", drop = FALSE] foo 1 1 @@ -166,17 +180,17 @@ It pays to keep in mind that there are no scalars in R, and that vectors of insu [1] TRUE > c(FALSE, FALSE) || c(FALSE, TRUE) [1] FALSE - + # Good > c(TRUE, FALSE) & c(TRUE, TRUE) [1] TRUE FALSE > c(FALSE, FALSE) | c(FALSE, TRUE) [1] FALSE TRUE - + # Bad > if (x & y) { ... } > ifelse(x && y, ..., ...) - + # Good > if (x && y) { ... } > ifelse(x & y, ..., ...) @@ -186,17 +200,17 @@ It pays to keep in mind that there are no scalars in R, and that vectors of insu ```R # Different behaviors of list concatenation - + > a <- list(one=1, two=2) > b <- list(three=3, four=4) - + > class(c(a, b)) [1] "list" > length(c(a, b)) [1] 4 > class(c(a, b, recursive=TRUE)) [1] "numeric" - + > length(list(a, b)) [1] 2 ``` @@ -205,12 +219,12 @@ It pays to keep in mind that there are no scalars in R, and that vectors of insu ```R > x <- as.list(1:2) - + > class(x[[2]]) [1] "integer" > class(x[2]) [1] "list" - + > class(x[1:2]) [1] "list" > class(x[[1:2]]) @@ -223,7 +237,7 @@ It pays to keep in mind that there are no scalars in R, and that vectors of insu ```R > x <- 1 - + # Maybe unintended results > x[3] <- 3 > x @@ -289,13 +303,14 @@ The following functions from standard packages are discouraged because of unexpe 2. `base::subset` See warning in the [documentation](https://www.rdocumentation.org/packages/base/versions/3.6.0/topics/subset) about caveats with nonstandard evaluation of the argument. ---- +------ + ## Dependencies [top](#toc) -"_Dependencies are invitations for other people to break your code_" +"*Dependencies are invitations for other people to break your code*" R has a thriving ecosystem of community contributions in the form of established package repositories like CRAN and Bioconductor. CRAN [Task Views](https://cran.r-project.org/web/views/) and Bioc [Views](https://www.bioconductor.org/packages/release/BiocViews.html) provide a catalogued view of these ~13,000 packages. @@ -329,7 +344,7 @@ One of the major objectives of Tidy Evaluation is to make the data your executio #### Pipe Operator -`` magrittr::`%>%` `` +``magrittr::`%>%` `` Read this [blog post](http://www.win-vector.com/blog/2017/07/in-praise-of-syntactic-sugar/) for some discussion on semantics of the pipe operator, and alternatives. @@ -345,7 +360,7 @@ Read this [blog post](http://www.win-vector.com/blog/2017/07/in-praise-of-syntac 4. Break long flows (> 10 steps) by assigning intermediate variable names. 5. Prefer alternative implementations which have cleaner standard evaluation semantics, e.g. the dot pipe operator ([introduction](https://winvector.github.io/wrapr/articles/dot_pipe.html), [technical article](https://journal.r-project.org/archive/2018/RJ-2018-042/RJ-2018-042.pdf)). ---- +----- ## Packages @@ -363,7 +378,7 @@ Prefer writing and maintaining your code as an R package. Some useful guidelines 6. When using Roxygen, collect all package level directives, i.e. package documentation, `@importFrom` directives, etc., above a single symbol (typically `NULL` or `"_PACKAGE"`), usually in the file `zzz.R`. 7. Write unit tests for your package when possible. Any executable file in the tests directory is considered a test. The preferred unit testing framework at GRAIL is `testthat`. ---- +---- ## Style @@ -524,7 +539,7 @@ get_best_label <- function(too_scores, too_labels_map) { ... } #### TODOs -1. Use a consistent style for TODOs throughout your code. +1. Use a consistent style for TODOs throughout your code. `TODO(username): Explicit description of action to be taken` ## Open Questions @@ -532,7 +547,7 @@ get_best_label <- function(too_scores, too_labels_map) { ... } 1. Pros and cons of `tibble` as an alternative to `data.frame`. Looks like accessing non-existent columns generate a warning, and `drop=FALSE` is default. 2. Performance benchmarks of Tidy Evaluation compared to alternatives. 3. Preference to single quotes over double quotes for string constants. -4. Generating errors for unintended use of `switch`, `ifelse`, `case_when`, etc. +4. Generating errors for unintended use of `switch`, `ifelse`, `case_when`, etc. 5. Examples of well formatted code blocks. --- diff --git a/R/container/README.md b/R/container/README.md index 3717bde..a6adee8 100644 --- a/R/container/README.md +++ b/R/container/README.md @@ -1,4 +1,5 @@ -# Container Support +Container Support +================ You can create Docker or OCI images of R packages using Bazel. @@ -32,7 +33,6 @@ container_pull( ``` - ## r_library_image In a `BUILD` file, define your library of R packages and install them @@ -40,7 +40,7 @@ in a Docker image using this rule. Dependencies are installed implicitly in an efficient layered mechanism. ```python -load("@rules_r//R:defs.bzl", "r_library") +load("@com_grail_rules_r//R:defs.bzl", "r_library") r_library( name = "my_r_library", @@ -48,7 +48,7 @@ r_library( "//path/to/packageA:r_pkg_target", "//path/to/packageB:r_pkg_target", ], -) +) r_library_image( name = "my_r_library_image", @@ -68,7 +68,7 @@ reason, you can use the `r_library_tar` rule to provide a tar to the container. ```python load("@io_bazel_rules_docker//container:container.bzl", "container_image") -load("@rules_r//R:defs.bzl", "r_library_tar") +load("@com_grail_rules_r//R:defs.bzl", "r_library_tar") r_library_tar( name = "my_r_library_archive", @@ -86,7 +86,6 @@ container_image( ``` - ## r_binary_image This rule wraps an `r_binary` target in a container, ideal for quickly setting @@ -99,7 +98,7 @@ additionally a `binary` attribute. For more details on how the rule works, see the documentation in [binary.bzl][binary.bzl]. ```python -load("@rules_r//R:defs.bzl", "r_library") +load("@com_grail_rules_r//R:defs.bzl", "r_library") r_binary( name = "my_r_binary", @@ -108,7 +107,7 @@ r_binary( "//path/to/packageA:r_pkg_target", "//path/to/packageB:r_pkg_target", ], -) +) r_binary_image( name = "my_r_binary_image", @@ -117,5 +116,6 @@ r_binary_image( ) ``` + [library.bzl]: library.bzl [binary.bzl]: binary.bzl diff --git a/R/container/binary.bzl b/R/container/binary.bzl index bc74c75..03eeed0 100644 --- a/R/container/binary.bzl +++ b/R/container/binary.bzl @@ -24,7 +24,7 @@ load( _app_layer = "app_layer", _layer_file_path = "layer_file_path", ) -load("@rules_r//R:providers.bzl", "RBinary") +load("@com_grail_rules_r//R:providers.bzl", "RBinary") # Similar to dep_layer_impl, but with output group files. # We expect to capture any empty files in the app layer. diff --git a/R/container/defs.bzl b/R/container/defs.bzl index d8d4071..a8a73cd 100644 --- a/R/container/defs.bzl +++ b/R/container/defs.bzl @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@rules_r//R/container:library.bzl", _r_library_image = "r_library_image") -load("@rules_r//R/container:binary.bzl", _r_binary_image = "r_binary_image") +load("@com_grail_rules_r//R/container:library.bzl", _r_library_image = "r_library_image") +load("@com_grail_rules_r//R/container:binary.bzl", _r_binary_image = "r_binary_image") r_library_image = _r_library_image diff --git a/R/container/library.bzl b/R/container/library.bzl index afe7723..663d6b5 100644 --- a/R/container/library.bzl +++ b/R/container/library.bzl @@ -20,7 +20,7 @@ load( "@io_bazel_rules_docker//container:layer.bzl", _layer = "layer", ) -load("@rules_r//R:providers.bzl", "RLibrary") +load("@com_grail_rules_r//R:providers.bzl", "RLibrary") def _tools_layer_impl(ctx): provider = ctx.attr.library[RLibrary] diff --git a/R/defs.bzl b/R/defs.bzl index 4e2266f..0142116 100644 --- a/R/defs.bzl +++ b/R/defs.bzl @@ -35,11 +35,11 @@ sandbox and generate a script to run the executable. r_test is similar to r_binary, but acts as a test. """ -load("@rules_r//R/internal:build.bzl", _r_binary_pkg = "r_binary_pkg", _r_pkg = "r_pkg", _r_source_pkg = "r_source_pkg") -load("@rules_r//R/internal:library.bzl", _r_library = "r_library", _r_library_tar = "r_library_tar") -load("@rules_r//R/internal:tests.bzl", _r_pkg_test = "r_pkg_test", _r_unit_test = "r_unit_test") -load("@rules_r//R/internal:binary.bzl", _r_binary = "r_binary", _r_markdown = "r_markdown", _r_test = "r_test") -load("@rules_r//R/internal/toolchains:toolchain.bzl", _r_toolchain = "r_toolchain") +load("@com_grail_rules_r//R/internal:build.bzl", _r_binary_pkg = "r_binary_pkg", _r_pkg = "r_pkg", _r_source_pkg = "r_source_pkg") +load("@com_grail_rules_r//R/internal:library.bzl", _r_library = "r_library", _r_library_tar = "r_library_tar") +load("@com_grail_rules_r//R/internal:tests.bzl", _r_pkg_test = "r_pkg_test", _r_unit_test = "r_unit_test") +load("@com_grail_rules_r//R/internal:binary.bzl", _r_binary = "r_binary", _r_markdown = "r_markdown", _r_test = "r_test") +load("@com_grail_rules_r//R/internal/toolchains:toolchain.bzl", _r_toolchain = "r_toolchain") r_source_pkg = _r_source_pkg diff --git a/R/dependencies.bzl b/R/dependencies.bzl index f0a1690..d342521 100644 --- a/R/dependencies.bzl +++ b/R/dependencies.bzl @@ -13,23 +13,23 @@ # limitations under the License. load( - "@rules_r//internal:versions.bzl", + "@com_grail_rules_r//internal:versions.bzl", _is_at_least = "is_at_least", ) load( - "@rules_r//R/makevars:darwin.bzl", + "@com_grail_rules_r//R/makevars:darwin.bzl", _local_darwin_makevars = "local_darwin_makevars", ) load( - "@rules_r//R/makevars:linux.bzl", + "@com_grail_rules_r//R/makevars:linux.bzl", _local_linux_makevars = "local_linux_makevars", ) load( - "@rules_r//R/internal/toolchains:local_toolchain.bzl", + "@com_grail_rules_r//R/internal/toolchains:local_toolchain.bzl", _local_r_toolchain = "local_r_toolchain", ) load( - "@rules_r//R/internal:coverage_deps.bzl", + "@com_grail_rules_r//R/internal:coverage_deps.bzl", _r_coverage_dependencies = "r_coverage_dependencies", ) @@ -47,22 +47,22 @@ def r_rules_dependencies(): _maybe( _local_darwin_makevars, - name = "rules_r_makevars_darwin", + name = "com_grail_rules_r_makevars_darwin", ) _maybe( _local_linux_makevars, - name = "rules_r_makevars_linux", + name = "com_grail_rules_r_makevars_linux", ) def r_register_toolchains(**kwargs): _maybe( _local_r_toolchain, - name = "rules_r_toolchains", + name = "com_grail_rules_r_toolchains", **kwargs ) native.register_toolchains( - "@rules_r_toolchains//:toolchain", + "@com_grail_rules_r_toolchains//:toolchain", ) def _maybe(repo_rule, name, **kwargs): diff --git a/R/internal/binary.bzl b/R/internal/binary.bzl index 9670979..1855a11 100644 --- a/R/internal/binary.bzl +++ b/R/internal/binary.bzl @@ -13,11 +13,11 @@ # limitations under the License. load( - "@rules_r//internal:shell.bzl", + "@com_grail_rules_r//internal:shell.bzl", _sh_quote_args = "sh_quote_args", ) load( - "@rules_r//R/internal:common.bzl", + "@com_grail_rules_r//R/internal:common.bzl", _dict_to_r_vec = "dict_to_r_vec", _env_vars = "env_vars", _executables = "executables", @@ -27,7 +27,7 @@ load( _runfiles = "runfiles", _runtime_path_export = "runtime_path_export", ) -load("@rules_r//R:providers.bzl", "RBinary", "RLibrary", "RPackage") +load("@com_grail_rules_r//R:providers.bzl", "RBinary", "RLibrary", "RPackage") def _r_markdown_stub(ctx): stub = ctx.actions.declare_file(ctx.label.name + "_stub.R") @@ -47,7 +47,7 @@ def _r_markdown_stub(ctx): return stub def _r_binary_impl(ctx): - info = ctx.toolchains["@rules_r//R:toolchain_type"].RInfo + info = ctx.toolchains["@com_grail_rules_r//R:toolchain_type"].RInfo if "render_function" in dir(ctx.attr): src = _r_markdown_stub(ctx) @@ -160,7 +160,7 @@ _R_BINARY_ATTRS = { ), "_binary_sh_tpl": attr.label( allow_single_file = True, - default = "@rules_r//R/scripts:binary.sh.tpl", + default = "@com_grail_rules_r//R/scripts:binary.sh.tpl", ), } @@ -184,7 +184,7 @@ _R_MARKDOWN_ATTRS.update({ ), "_render_R_tpl": attr.label( allow_single_file = True, - default = "@rules_r//R/scripts:render.R.tpl", + default = "@com_grail_rules_r//R/scripts:render.R.tpl", ), }) @@ -192,7 +192,7 @@ r_binary = rule( attrs = _R_BINARY_ATTRS, doc = "Rule to run a binary with a configured R library.", executable = True, - toolchains = ["@rules_r//R:toolchain_type"], + toolchains = ["@com_grail_rules_r//R:toolchain_type"], implementation = _r_binary_impl, ) @@ -201,7 +201,7 @@ r_test = rule( doc = "Rule to run a binary with a configured R library.", executable = True, test = True, - toolchains = ["@rules_r//R:toolchain_type"], + toolchains = ["@com_grail_rules_r//R:toolchain_type"], implementation = _r_binary_impl, ) @@ -209,6 +209,6 @@ r_markdown = rule( attrs = _R_MARKDOWN_ATTRS, doc = "Rule to render a markdown.", executable = True, - toolchains = ["@rules_r//R:toolchain_type"], + toolchains = ["@com_grail_rules_r//R:toolchain_type"], implementation = _r_binary_impl, ) diff --git a/R/internal/build.bzl b/R/internal/build.bzl index e443147..71c0e3d 100644 --- a/R/internal/build.bzl +++ b/R/internal/build.bzl @@ -13,11 +13,11 @@ # limitations under the License. load( - "@rules_r//internal:shell.bzl", + "@com_grail_rules_r//internal:shell.bzl", _sh_quote_args = "sh_quote_args", ) load( - "@rules_r//R/internal:common.bzl", + "@com_grail_rules_r//R/internal:common.bzl", _build_path_export = "build_path_export", _count_group_matches = "count_group_matches", _env_vars = "env_vars", @@ -30,7 +30,7 @@ load( _srcs_dir = "srcs_dir", _tests_dir = "tests_dir", ) -load("@rules_r//R:providers.bzl", "RLibrary", "RPackage") +load("@com_grail_rules_r//R:providers.bzl", "RLibrary", "RPackage") # From the global R Makeconf. _NATIVE_SOURCE_EXTS = [ @@ -357,7 +357,7 @@ def _merge_tests(ctx, in_tar, out_tar, pkg_name, pkg_src_dir, test_files): ) def _build_impl(ctx): - info = ctx.toolchains["@rules_r//R:toolchain_type"].RInfo + info = ctx.toolchains["@com_grail_rules_r//R:toolchain_type"].RInfo pkg_name = _package_name(ctx) pkg_src_dir = _package_dir(ctx) @@ -560,7 +560,7 @@ def _build_impl(ctx): ] def _build_source_pkg_impl(ctx): - info = ctx.toolchains["@rules_r//R:toolchain_type"].RInfo + info = ctx.toolchains["@com_grail_rules_r//R:toolchain_type"].RInfo pkg_name = _package_name(ctx) pkg_src_dir = _package_dir(ctx) @@ -692,7 +692,7 @@ def _build_source_pkg_impl(ctx): ] def _build_binary_pkg_impl(ctx): - info = ctx.toolchains["@rules_r//R:toolchain_type"].RInfo + info = ctx.toolchains["@com_grail_rules_r//R:toolchain_type"].RInfo pkg_name = _package_name(ctx) pkg_lib_dir = ctx.actions.declare_directory("lib") @@ -811,22 +811,22 @@ _COMMON_BUILD_ATTRS = { ), "_build_pkg_common_sh": attr.label( allow_single_file = True, - default = "@rules_r//R/scripts:build_pkg_common.sh", + default = "@com_grail_rules_r//R/scripts:build_pkg_common.sh", ), "_build_pkg_bin_sh": attr.label( allow_single_file = True, - default = "@rules_r//R/scripts:build_pkg_bin.sh", + default = "@com_grail_rules_r//R/scripts:build_pkg_bin.sh", executable = True, cfg = "host", ), "_flock": attr.label( - default = "@rules_r//R/scripts:flock", + default = "@com_grail_rules_r//R/scripts:flock", executable = True, cfg = "host", ), "_instrument_R": attr.label( allow_single_file = True, - default = "@rules_r//R/scripts:instrument.R", + default = "@com_grail_rules_r//R/scripts:instrument.R", ), } @@ -878,19 +878,19 @@ _BUILD_ATTRS = { ), "_build_pkg_src_sh": attr.label( allow_single_file = True, - default = "@rules_r//R/scripts:build_pkg_src.sh", + default = "@com_grail_rules_r//R/scripts:build_pkg_src.sh", executable = True, cfg = "host", ), "_merge_test_files_sh": attr.label( allow_single_file = True, - default = "@rules_r//R/scripts:merge_test_files.sh", + default = "@com_grail_rules_r//R/scripts:merge_test_files.sh", executable = True, cfg = "host", ), "_stamp_description_sh": attr.label( allow_single_file = True, - default = "@rules_r//R/scripts:stamp_description.sh", + default = "@com_grail_rules_r//R/scripts:stamp_description.sh", executable = True, cfg = "host", ), @@ -919,7 +919,7 @@ _BINARY_PKG_ATTRS.update({ ), "_build_binary_sh": attr.label( allow_single_file = True, - default = "@rules_r//R/scripts:build_binary.sh", + default = "@com_grail_rules_r//R/scripts:build_binary.sh", executable = True, cfg = "host", ), @@ -934,7 +934,7 @@ r_pkg = rule( "src_archive": "%{name}.tar.gz", "so_lib": "%{name}.so", }, - toolchains = ["@rules_r//R:toolchain_type"], + toolchains = ["@com_grail_rules_r//R:toolchain_type"], implementation = _build_impl, ) @@ -947,7 +947,7 @@ r_source_pkg = rule( "src_archive": "%{name}.tar.gz", "so_lib": "%{name}.so", }, - toolchains = ["@rules_r//R:toolchain_type"], + toolchains = ["@com_grail_rules_r//R:toolchain_type"], implementation = _build_source_pkg_impl, ) @@ -959,6 +959,6 @@ r_binary_pkg = rule( "bin_archive": "%{name}.bin.tar.gz", "so_lib": "%{name}.so", }, - toolchains = ["@rules_r//R:toolchain_type"], + toolchains = ["@com_grail_rules_r//R:toolchain_type"], implementation = _build_binary_pkg_impl, ) diff --git a/R/internal/common.bzl b/R/internal/common.bzl index 1c2bfb8..a35910d 100644 --- a/R/internal/common.bzl +++ b/R/internal/common.bzl @@ -13,10 +13,10 @@ # limitations under the License. load( - "@rules_r//internal:shell.bzl", + "@com_grail_rules_r//internal:shell.bzl", _sh_quote = "sh_quote", ) -load("@rules_r//R:providers.bzl", "RBinary", "RLibrary", "RPackage") +load("@com_grail_rules_r//R:providers.bzl", "RBinary", "RLibrary", "RPackage") def get_r_version(rctx, rscript): # Return R version using the given Rscript path. diff --git a/R/internal/coverage_deps.bzl b/R/internal/coverage_deps.bzl index 5d4d092..b6b6168 100644 --- a/R/internal/coverage_deps.bzl +++ b/R/internal/coverage_deps.bzl @@ -13,7 +13,7 @@ # limitations under the License. load( - "@rules_r//R:repositories.bzl", + "@com_grail_rules_r//R:repositories.bzl", _r_repository = "r_repository", _r_repository_list = "r_repository_list", ) @@ -28,7 +28,7 @@ def r_coverage_dependencies(**kwargs): other_args = { "pkg_type": "both", }, - package_list = "@rules_r//R/internal:coverage_deps_list.csv", + package_list = "@com_grail_rules_r//R/internal:coverage_deps_list.csv", remote_repos = { # CRAN does not retain binary archives for macOS. "CRAN": "https://cran.microsoft.com/snapshot/2022-02-28", diff --git a/R/internal/library.bzl b/R/internal/library.bzl index c76f176..76628a7 100644 --- a/R/internal/library.bzl +++ b/R/internal/library.bzl @@ -13,15 +13,15 @@ # limitations under the License. load( - "@rules_r//R/internal:common.bzl", + "@com_grail_rules_r//R/internal:common.bzl", _layer_library_deps = "layer_library_deps", _library_deps = "library_deps", _runfiles = "runfiles", ) -load("@rules_r//R:providers.bzl", "RLibrary", "RPackage") +load("@com_grail_rules_r//R:providers.bzl", "RLibrary", "RPackage") def _library_impl(ctx): - info = ctx.toolchains["@rules_r//R:toolchain_type"].RInfo + info = ctx.toolchains["@com_grail_rules_r//R:toolchain_type"].RInfo library_deps = _library_deps(ctx.attr.pkgs) @@ -74,13 +74,13 @@ r_library = rule( ), "_library_sh_tpl": attr.label( allow_single_file = True, - default = "@rules_r//R/scripts:library.sh.tpl", + default = "@com_grail_rules_r//R/scripts:library.sh.tpl", ), }, doc = ("Rule to install the given package and all dependencies to " + "a user provided or system default R library site."), executable = True, - toolchains = ["@rules_r//R:toolchain_type"], + toolchains = ["@com_grail_rules_r//R:toolchain_type"], implementation = _library_impl, ) diff --git a/R/internal/tests.bzl b/R/internal/tests.bzl index 17c8784..7409ac0 100644 --- a/R/internal/tests.bzl +++ b/R/internal/tests.bzl @@ -13,11 +13,11 @@ # limitations under the License. load( - "@rules_r//internal:shell.bzl", + "@com_grail_rules_r//internal:shell.bzl", _sh_quote_args = "sh_quote_args", ) load( - "@rules_r//R/internal:common.bzl", + "@com_grail_rules_r//R/internal:common.bzl", _env_vars = "env_vars", _executables = "executables", _flatten_pkg_deps_list = "flatten_pkg_deps_list", @@ -28,10 +28,10 @@ load( _runtime_path_export = "runtime_path_export", _tests_dir = "tests_dir", ) -load("@rules_r//R:providers.bzl", "RLibrary", "RPackage") +load("@com_grail_rules_r//R:providers.bzl", "RLibrary", "RPackage") def _test_impl(ctx): - info = ctx.toolchains["@rules_r//R:toolchain_type"].RInfo + info = ctx.toolchains["@com_grail_rules_r//R:toolchain_type"].RInfo pkg = ctx.attr.pkg pkg_deps = _flatten_pkg_deps_list(ctx.attr.suggested_deps) @@ -130,7 +130,7 @@ r_unit_test = rule( ), "_test_sh_tpl": attr.label( allow_single_file = True, - default = "@rules_r//R/scripts:test.sh.tpl", + default = "@com_grail_rules_r//R/scripts:test.sh.tpl", ), "_coverage_deps": attr.label_list( default = [ @@ -142,23 +142,23 @@ r_unit_test = rule( ), "_collect_coverage_R": attr.label( allow_single_file = True, - default = "@rules_r//R/scripts:collect_coverage.R", + default = "@com_grail_rules_r//R/scripts:collect_coverage.R", ), "_lcov_merger": attr.label( allow_single_file = True, - default = "@rules_r//R/scripts:lcov_merger.sh", + default = "@com_grail_rules_r//R/scripts:lcov_merger.sh", ), }, doc = ("Rule to keep all deps in the sandbox, and run the test " + "scripts of the specified package. The package itself must " + "be one of the deps."), test = True, - toolchains = ["@rules_r//R:toolchain_type"], + toolchains = ["@com_grail_rules_r//R:toolchain_type"], implementation = _test_impl, ) def _check_impl(ctx): - info = ctx.toolchains["@rules_r//R:toolchain_type"].RInfo + info = ctx.toolchains["@com_grail_rules_r//R:toolchain_type"].RInfo pkg_name = ctx.attr.pkg[RPackage].pkg_name src_archive = ctx.attr.pkg[RPackage].src_archive @@ -235,13 +235,13 @@ r_pkg_test = rule( ), "_check_sh_tpl": attr.label( allow_single_file = True, - default = "@rules_r//R/scripts:check.sh.tpl", + default = "@com_grail_rules_r//R/scripts:check.sh.tpl", ), }, doc = ("Rule to keep all deps of the package in the sandbox, build " + "a source archive of this package, and run R CMD check on " + "the package source archive in the sandbox."), test = True, - toolchains = ["@rules_r//R:toolchain_type"], + toolchains = ["@com_grail_rules_r//R:toolchain_type"], implementation = _check_impl, ) diff --git a/R/internal/toolchains/local_toolchain.bzl b/R/internal/toolchains/local_toolchain.bzl index 962c148..66a7065 100644 --- a/R/internal/toolchains/local_toolchain.bzl +++ b/R/internal/toolchains/local_toolchain.bzl @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@rules_r//internal:os.bzl", _detect_os = "detect_os") +load("@com_grail_rules_r//internal:os.bzl", _detect_os = "detect_os") _home_env_var = "BAZEL_R_HOME" @@ -22,7 +22,7 @@ def _path_must_exist(rctx, str_path): fail("'%s' does not exist" % str_path) return path -_BUILD = """load("@rules_r//R/internal/toolchains:toolchain.bzl", "r_toolchain") +_BUILD = """load("@com_grail_rules_r//R/internal/toolchains:toolchain.bzl", "r_toolchain") exports_files( ["{state_file}"] @@ -43,8 +43,8 @@ r_toolchain( toolchain( name = "toolchain", - toolchain = "@rules_r_toolchains//:r_toolchain_generic", - toolchain_type = "@rules_r//R:toolchain_type", + toolchain = "@com_grail_rules_r_toolchains//:r_toolchain_generic", + toolchain_type = "@com_grail_rules_r//R:toolchain_type", visibility = ["//visibility:public"], ) """ @@ -96,7 +96,7 @@ def _local_r_toolchain_impl(rctx): makevars_site_str = "None" if rctx.attr.makevars_site: - makevars_repo = "@rules_r_makevars_%s" % os + makevars_repo = "@com_grail_rules_r_makevars_%s" % os makevars_site_str = "\"%s\"" % makevars_repo llvm_cov_dir = rctx.path(Label(makevars_repo)).dirname llvm_cov_path = llvm_cov_dir.get_child("llvm-cov") @@ -159,7 +159,7 @@ local_r_toolchain = repository_rule( ), "_system_state_computer": attr.label( allow_single_file = True, - default = "@rules_r//R/scripts:system_state.sh", + default = "@com_grail_rules_r//R/scripts:system_state.sh", doc = "Executable to output R system state", ), }, diff --git a/R/internal/toolchains/toolchain.bzl b/R/internal/toolchains/toolchain.bzl index 625c173..5ee8e85 100644 --- a/R/internal/toolchains/toolchain.bzl +++ b/R/internal/toolchains/toolchain.bzl @@ -126,7 +126,7 @@ _r_toolchain = rule( def r_toolchain(**kwargs): if kwargs.get("stamp") == None: _r_toolchain(stamp = select({ - "@rules_r//R/internal/toolchains:stamp": True, + "@com_grail_rules_r//R/internal/toolchains:stamp": True, "//conditions:default": False, }), **kwargs) else: diff --git a/R/makevars/darwin.bzl b/R/makevars/darwin.bzl index 8bf2a1d..39ade6d 100644 --- a/R/makevars/darwin.bzl +++ b/R/makevars/darwin.bzl @@ -13,7 +13,7 @@ # limitations under the License. load( - "@rules_r//internal:shell.bzl", + "@com_grail_rules_r//internal:shell.bzl", _sh_quote = "sh_quote", ) @@ -46,7 +46,7 @@ local_darwin_makevars = repository_rule( attrs = { "src": attr.label( allow_single_file = True, - default = "@rules_r//R/makevars:Makevars.darwin.tpl", + default = "@com_grail_rules_r//R/makevars:Makevars.darwin.tpl", doc = "Template Makevars file.", ), "env": attr.string_dict( @@ -64,7 +64,7 @@ local_darwin_makevars = repository_rule( "true or false. Also used to check gcc to find gfortran."), ), "_processor": attr.label( - default = "@rules_r//R/makevars:Makevars.darwin.sh", + default = "@com_grail_rules_r//R/makevars:Makevars.darwin.sh", doc = ("Processor script to perform template substitution. " + "Takes input file as STDIN and returns the processed " + "file as STDOUT. May perform side actions in the " + diff --git a/R/makevars/linux.bzl b/R/makevars/linux.bzl index 67fb81a..edd356b 100644 --- a/R/makevars/linux.bzl +++ b/R/makevars/linux.bzl @@ -13,7 +13,7 @@ # limitations under the License. load( - "@rules_r//internal:shell.bzl", + "@com_grail_rules_r//internal:shell.bzl", _sh_quote = "sh_quote", ) @@ -39,14 +39,14 @@ local_linux_makevars = repository_rule( attrs = { "src": attr.label( allow_single_file = True, - default = "@rules_r//R/makevars:Makevars.linux.tpl", + default = "@com_grail_rules_r//R/makevars:Makevars.linux.tpl", doc = "Template Makevars file.", ), "env": attr.string_dict( doc = "Environment variables to provide to processor.", ), "_processor": attr.label( - default = "@rules_r//R/makevars:Makevars.linux.sh", + default = "@com_grail_rules_r//R/makevars:Makevars.linux.sh", doc = ("Processor script to perform template substitution. " + "Takes input file as STDIN and returns the processed " + "file as STDOUT. May perform side actions in the " + diff --git a/R/repositories.bzl b/R/repositories.bzl index 7786706..11096c1 100644 --- a/R/repositories.bzl +++ b/R/repositories.bzl @@ -13,21 +13,21 @@ # limitations under the License. load( - "@rules_r//R/internal:common.bzl", + "@com_grail_rules_r//R/internal:common.bzl", _dict_to_r_vec = "dict_to_r_vec", _get_r_version = "get_r_version", _quote_dict_values = "quote_dict_values", _quote_literal = "quote_literal", _unquote_string = "unquote_string", ) -load("@rules_r//internal:shell.bzl", _sh_quote = "sh_quote") +load("@com_grail_rules_r//internal:shell.bzl", _sh_quote = "sh_quote") _rscript = attr.string( default = "Rscript", doc = "Name, path or label of the interpreter to use for running the razel script.", ) _razel = attr.label( - default = "@rules_r//scripts:razel.R", + default = "@com_grail_rules_r//scripts:razel.R", allow_single_file = True, doc = "R source file containing razel functions.", ) @@ -159,7 +159,7 @@ def _failing_r_repository_list(rctx, msg_suffix): ] content = """ -load("@rules_r//R:repositories.bzl", "failing_repository") +load("@com_grail_rules_r//R:repositories.bzl", "failing_repository") # R{version_str} not found on host machine; substituting package repositories # with rules that will fail on first load. diff --git a/README.md b/README.md index 72cbc1d..dae60e3 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# R Rules for Bazel [![Tests](https://github.com/grailbio/rules_r/actions/workflows/tests.yml/badge.svg)](https://github.com/grailbio/rules_r/actions/workflows/tests.yml) +R Rules for Bazel [![Tests](https://github.com/grailbio/rules_r/actions/workflows/tests.yml/badge.svg)](https://github.com/grailbio/rules_r/actions/workflows/tests.yml) +================= #### General Information - - [Overview](#overview) - [Getting Started](#getting-started) - [Configuration](#configuration) @@ -11,7 +11,6 @@ - [Known Issues](#known-issues) #### Rules - - [r_pkg](#r_pkg) - [r_library](#r_library) - [r_unit_test](#r_unit_test) @@ -22,7 +21,6 @@ - [r_toolchain](#r_toolchain) #### Repository Rules - - [r_repository](#r_repository) - [r_repository_list](#r_repository_list) - [r_rules_dependencies](#r_rules_dependencies) @@ -30,12 +28,10 @@ - [r_register_toolchains](#r_register_toolchains) #### Container Rules - - [r_library_image](R/container/README.md#r_library_image) - [r_binary_image](R/container/README.md#r_binary_image) - ## Overview These rules are used for building [R][r] packages with Bazel. Although R has an @@ -45,10 +41,10 @@ Bazel, over a custom solution of tracking the package dependency graph and triggering builds accordingly on each commit, is that R packages can be built and tested as part of one build system in multi-language monorepos. -These rules are mature for production use. +These rules are mature for production use. We use these rules internally at +GRAIL to build 800+ R packages from CRAN and Bioconductor. - ## Getting started The following assumes that you are familiar with how to use Bazel in general. @@ -60,12 +56,12 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # Change master to the git tag you want. http_archive( - name = "rules_r", + name = "com_grail_rules_r", strip_prefix = "rules_r-master", urls = ["https://github.com/grailbio/rules_r/archive/master.tar.gz"], ) -load("@rules_r//R:dependencies.bzl", "r_register_toolchains", "r_rules_dependencies") +load("@com_grail_rules_r//R:dependencies.bzl", "r_register_toolchains", "r_rules_dependencies") r_rules_dependencies() @@ -73,9 +69,8 @@ r_register_toolchains() ``` You can load the rules in your BUILD file like so: - ```python -load("@rules_r//R:defs.bzl", +load("@com_grail_rules_r//R:defs.bzl", "r_pkg", "r_library", "r_unit_test", "r_pkg_test") ``` @@ -83,7 +78,6 @@ Advanced users can also set up [Gazelle][gazelle] to maintain the BUILD files for the R packages in their repo automatically. - ## Configuration The following software must be installed on your system: @@ -107,13 +101,11 @@ reproducible builds. For _macOS_, this setup will help you cover the requirements for a large number of packages: - ``` brew install gcc pkg-config icu4c openssl ``` For _Ubuntu_, this (or equivalent for other Unix systems) helps: - ``` apt-get install pkgconf libssl-dev libxml2-dev libcurl4-openssl-dev ``` @@ -128,7 +120,6 @@ other packages from R by setting a different value for `R_LIBS_USER`. When moving to Bazel for installing R packages on your system, we recommend cleaning up existing machines: - ``` sudo Rscript \ -e 'options("repos"="https://cloud.r-project.org")' \ @@ -145,7 +136,6 @@ For more details on how R searches different paths for packages, see [libPaths][libPaths]. - ## External packages To depend on external packages from CRAN and other remote repos, you can define the @@ -157,7 +147,7 @@ but outside your main repository, you will have to use `local_repository` with a saved BUILD file. Same for VCS repositories. ``` -load("@rules_r//R:repositories.bzl", "r_repository", "r_repository_list") +load("@com_grail_rules_r//R:repositories.bzl", "r_repository", "r_repository_list") # R packages with non-standard sources. r_repository( @@ -190,20 +180,18 @@ r_repositories() The list of all external R packages configured this way can be obtained from your shell with - ``` $ bazel query 'filter(":R_", //external:*)' ``` **NOTE**: Periods ('.') in the package names are replaced with underscores -('\_') because bazel does not allow periods in repository names. +('_') because bazel does not allow periods in repository names. To generate and maintain a CSV file containing all your external dependencies for use with `r_repository_list`, you can use the functions in the script `repo_management.R`. For example: - ```bash script="/path/to/rules_r/scripts/repo_management.R" package_list_csv="/path/to/output/csv/file" @@ -212,7 +200,7 @@ bioc_version="bioc_version to use, e.g. 3.11" # This will be the cache directory for a local copy of all the packages. # The output CSV will always reflect the state of this directory. -local_r_repo="${HOME}/.cache/r-repo" +local_r_repo="${HOME}/.cache/grail-r-repo" Rscript - < - ## Examples Some examples are available in the tests directory of this repo. - - See [tests/packages/exampleA][exampleA] for a barebones R package. - See [tests/packages/exampleB][exampleB] for a barebones R package that depends on another package. - See [tests/packages/exampleC][exampleC] for an R package that depends on external R packages and @@ -248,7 +234,6 @@ Also see [Razel scripts][scripts] that provide utility functions to generate `BU and `WORKSPACE` rules. - ## Contributing Contributions are most welcome. Please submit a pull request giving the owners @@ -256,15 +241,14 @@ of this github repo access to your branch for minor style related edits, etc. We opening an issue first to discuss the nature of your change before beginning work on it. - ## Known Issues Please check open issues at the github repo. + # Rules - ## r_pkg ```python @@ -455,8 +439,8 @@ the right flags. - + ## r_library ```python @@ -501,8 +485,8 @@ container_image rule. - + ## r_unit_test ```python @@ -564,8 +548,8 @@ in the package, and C/C++ code in the `src` directory of R packages. - + ## r_pkg_test ```python @@ -636,8 +620,8 @@ sandbox. - + ## r_binary ```python @@ -718,7 +702,6 @@ the runfiles of the root executable. - ## r_test ```python @@ -728,7 +711,6 @@ r_test(name, src, deps, data, env_vars, tools, rscript_args, script_args) This is identical to [r_binary](#r_binary) but is run as a test. - ## r_markdown ```python @@ -752,7 +734,6 @@ directory of the render function, typically the same directory as the input file. - ## r_toolchain ```python @@ -845,10 +826,10 @@ to configure the default registered toolchains. + # Repository Rules - ## r_repository ```python @@ -923,8 +904,8 @@ the BUILD file automatically. See section on - + ## r_repository_list ```python @@ -992,12 +973,12 @@ as `r_repositories()`, for `r_repository` definitions for packages in - + ## r_rules_dependencies ```python -load("@rules_r//R:dependencies.bzl", "r_rules_dependencies") +load("@com_grail_rules_r//R:dependencies.bzl", "r_rules_dependencies") r_rules_dependencies() ``` @@ -1005,12 +986,12 @@ r_rules_dependencies() Repository rule that provides repository definitions for dependencies of the BUILD system. One such dependency is the site-wide Makevars file. - + ## r_coverage_dependencies ```python -load("@rules_r//R:dependencies.bzl", "r_coverage_dependencies") +load("@com_grail_rules_r//R:dependencies.bzl", "r_coverage_dependencies") r_coverage_dependencies() @@ -1023,12 +1004,12 @@ Repository rule that provides repository definitions for dependencies in computing code coverage for unit tests. Not needed if users already have a repository definition for the [covr](https://github.com/r-lib/covr) package. - + ## r_register_toolchains ```python -load("@rules_r//R:dependencies.bzl", "r_register_toolchains") +load("@com_grail_rules_r//R:dependencies.bzl", "r_register_toolchains") r_register_toolchains(r_home, strict, makevars_site, version, args, tools) ``` @@ -1039,14 +1020,15 @@ environment. If you want to register your own toolchain for specific platforms, register them before calling this function in your WORKSPACE file to give them preference. + **NOTE**: These toolchains read your system state and cache the findings for future runs. Whenever you install a new R version, or if you want to reset the toolchain for any reason, run: - ```bash bazel sync --configure ``` + @@ -1105,6 +1087,7 @@ bazel sync --configure
+ [r]: https://cran.r-project.org [gazelle]: gazelle [scripts]: scripts diff --git a/WORKSPACE b/WORKSPACE index 4535e22..834565f 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -workspace(name = "rules_r") +workspace(name = "com_grail_rules_r") diff --git a/gazelle/BUILD b/gazelle/BUILD index eba1f76..a65148e 100644 --- a/gazelle/BUILD +++ b/gazelle/BUILD @@ -23,7 +23,7 @@ go_library( "resolve.go", "rlang.go", ], - importpath = "bazel.io/gazelle/rlang", + importpath = "grail.com/bazel/gazelle/rlang", visibility = ["//visibility:public"], deps = [ "@bazel_gazelle//config:go_default_library", diff --git a/gazelle/rlang.go b/gazelle/rlang.go index 056f774..3489f17 100644 --- a/gazelle/rlang.go +++ b/gazelle/rlang.go @@ -65,7 +65,7 @@ func (rLang) Kinds() map[string]rule.KindInfo { func (rLang) Loads() []rule.LoadInfo { return []rule.LoadInfo{ { - Name: "@rules_r//R:defs.bzl", + Name: "@com_grail_rules_r//R:defs.bzl", Symbols: []string{ "r_pkg", "r_library", diff --git a/scripts/razel.R b/scripts/razel.R index 21df832..1e8938d 100644 --- a/scripts/razel.R +++ b/scripts/razel.R @@ -140,7 +140,7 @@ buildify <- function(pkg_directory = ".", tags_attr <- ifelse(external, ' tags=["external-r-repo"]\n', '') - header <- paste0('load("@rules_r//R:defs.bzl",', + header <- paste0('load("@com_grail_rules_r//R:defs.bzl",', '"r_pkg", "r_source_pkg", "r_binary_pkg",', '"r_library", "r_unit_test", "r_pkg_test")\n\n', 'package(default_visibility = ["//visibility:public"])') @@ -456,7 +456,7 @@ generateWorkspaceMacro <- function(local_repo_dir = NULL, "# R version information", r_version_lines, "", - "load(\"@rules_r//R:repositories.bzl\", \"r_repository\")", + "load(\"@com_grail_rules_r//R:repositories.bzl\", \"r_repository\")", "", "def r_repositories():") -> header writeLines(header, output_con) diff --git a/tests/BUILD b/tests/BUILD index 0aae1be..446562f 100644 --- a/tests/BUILD +++ b/tests/BUILD @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@rules_r//R:defs.bzl", "r_library") +load("@com_grail_rules_r//R:defs.bzl", "r_library") r_library( name = "library", @@ -26,7 +26,7 @@ r_library( ], ) -load("@rules_r//R:defs.bzl", "r_toolchain") +load("@com_grail_rules_r//R:defs.bzl", "r_toolchain") r_toolchain( name = "r-toolchain-linux", @@ -45,7 +45,7 @@ r_toolchain( makevars_site = "//cran:Makevars.gnu", r = "/usr/bin/R", rscript = "/usr/bin/Rscript", - system_state_file = "@rules_r_toolchains//:system_state.txt", + system_state_file = "@com_grail_rules_r_toolchains//:system_state.txt", tools = [ "@llvm_toolchain_llvm//:bin/clang", "@llvm_toolchain_llvm//:bin/clang++", @@ -72,8 +72,8 @@ r_toolchain( ], "//conditions:default": None, }), - makevars_site = "@rules_r_makevars_darwin", - system_state_file = "@rules_r_toolchains//:system_state.txt", + makevars_site = "@com_grail_rules_r_makevars_darwin", + system_state_file = "@com_grail_rules_r_toolchains//:system_state.txt", tools = [ "@llvm_toolchain_llvm//:bin/clang", "@llvm_toolchain_llvm//:bin/clang++", @@ -114,7 +114,7 @@ toolchain( "@bazel_tools//platforms:x86_64", ], toolchain = ":r-toolchain-linux", - toolchain_type = "@rules_r//R:toolchain_type", + toolchain_type = "@com_grail_rules_r//R:toolchain_type", visibility = ["//visibility:public"], ) @@ -129,7 +129,7 @@ toolchain( "@bazel_tools//platforms:x86_64", ], toolchain = ":r-toolchain-darwin", - toolchain_type = "@rules_r//R:toolchain_type", + toolchain_type = "@com_grail_rules_r//R:toolchain_type", visibility = ["//visibility:public"], ) @@ -137,7 +137,7 @@ toolchain( name = "toolchain-nix", tags = ["manual"], toolchain = ":r-toolchain-nix", - toolchain_type = "@rules_r//R:toolchain_type", + toolchain_type = "@com_grail_rules_r//R:toolchain_type", visibility = ["//visibility:public"], ) diff --git a/tests/WORKSPACE b/tests/WORKSPACE index 6b9da18..9e039c7 100644 --- a/tests/WORKSPACE +++ b/tests/WORKSPACE @@ -12,13 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -workspace(name = "rules_r_tests") +workspace(name = "com_grail_rules_r_tests") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # rules_r workspace. local_repository( - name = "rules_r", + name = "com_grail_rules_r", path = "..", ) @@ -57,24 +57,24 @@ nixpkgs_package( use_r_from_nix = False # Initialize rules_r. -load("@rules_r//R:dependencies.bzl", "r_rules_dependencies") +load("@com_grail_rules_r//R:dependencies.bzl", "r_rules_dependencies") r_rules_dependencies() -load("@rules_r_tests//:init.bzl", "r_register_toolchains") +load("@com_grail_rules_r_tests//:init.bzl", "r_register_toolchains") rscript = r_register_toolchains(use_r_from_nix) # Initialize R packages. -load("@rules_r//R:repositories.bzl", "r_repository_list") +load("@com_grail_rules_r//R:repositories.bzl", "r_repository_list") r_repository_list( name = "r_repositories_bzl", - build_file_overrides = "@rules_r_tests//cran:build_file_overrides.csv", + build_file_overrides = "@com_grail_rules_r_tests//cran:build_file_overrides.csv", other_args = { "pkg_type": "both", }, - package_list = "@rules_r_tests//cran:packages.csv", + package_list = "@com_grail_rules_r_tests//cran:packages.csv", remote_repos = { # CRAN does not retain binary archives for macOS. "CRAN": "https://cran.microsoft.com/snapshot/2022-02-28", @@ -86,7 +86,7 @@ load("@r_repositories_bzl//:r_repositories.bzl", "r_repositories") r_repositories() -load("@rules_r//R:dependencies.bzl", "r_coverage_dependencies") +load("@com_grail_rules_r//R:dependencies.bzl", "r_coverage_dependencies") r_coverage_dependencies(rscript = rscript) diff --git a/tests/binary/BUILD b/tests/binary/BUILD index 0a34c50..87bfc1b 100644 --- a/tests/binary/BUILD +++ b/tests/binary/BUILD @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@rules_r//R:defs.bzl", "r_binary", "r_test") +load("@com_grail_rules_r//R:defs.bzl", "r_binary", "r_test") r_binary( name = "binary", diff --git a/tests/binary/binary_test.sh b/tests/binary/binary_test.sh index c23cc7a..caf65a4 100755 --- a/tests/binary/binary_test.sh +++ b/tests/binary/binary_test.sh @@ -26,11 +26,11 @@ if ! [[ "${RUNFILES_DIR:-}" ]]; then cd "${BASH_SOURCE[0]}.runfiles" RUNFILES_DIR=$(pwd -P) export RUNFILES_DIR - cd "rules_r_tests" + cd "com_grail_rules_r_tests" fi # shortpath to binary from runfiles dir. -BINARY="../rules_r_tests/binary/binary" +BINARY="../com_grail_rules_r_tests/binary/binary" if ! "${BINARY}"; then echo "Binary should have passed." diff --git a/tests/container/BUILD b/tests/container/BUILD index 6489066..5aabb0a 100644 --- a/tests/container/BUILD +++ b/tests/container/BUILD @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@rules_r//R:defs.bzl", "r_library_tar") +load("@com_grail_rules_r//R:defs.bzl", "r_library_tar") r_library_tar( name = "library_archive", @@ -22,17 +22,17 @@ r_library_tar( "tools", ], library = "//:library", - library_path = "rules_r/r-libs", + library_path = "grail/r-libs", ) ## Image related tests -load("@rules_r//R/container:defs.bzl", "r_binary_image", "r_library_image") +load("@com_grail_rules_r//R/container:defs.bzl", "r_binary_image", "r_library_image") r_library_image( name = "library_image", base = "@r_base//image", - directory = "rules_r", + directory = "grail", library = "//:library", library_path = "r-libs", tags = ["no-remote-cache"], diff --git a/tests/container/image_test.sh b/tests/container/image_test.sh index 097ad69..4c9eecd 100755 --- a/tests/container/image_test.sh +++ b/tests/container/image_test.sh @@ -19,7 +19,7 @@ set -eou pipefail if [[ "${TEST_SRCDIR:-}" ]]; then # Ensure we are in the correct workspace for this test. echo "Moving to the right bazel workspace:" - pushd "${TEST_SRCDIR}/rules_r_tests/container" + pushd "${TEST_SRCDIR}/com_grail_rules_r_tests/container" echo "" else cd "$(dirname "${BASH_SOURCE[0]}")/bazel-bin/container" @@ -43,33 +43,33 @@ check() { fi } -check "library_image-layer.tar" "./rules_r/r-libs/exampleC/DESCRIPTION" "false" -check "library_image-layer.tar" "./rules_r/r-libs/bitops/DESCRIPTION" "false" -check "library_image_internal-layer.tar" "./rules_r/r-libs/exampleC/DESCRIPTION" "true" -check "library_image_internal-layer.tar" "./rules_r/r-libs/bitops/DESCRIPTION" "false" -check "library_image_external-layer.tar" "./rules_r/r-libs/exampleC/DESCRIPTION" "false" -check "library_image_external-layer.tar" "./rules_r/r-libs/bitops/DESCRIPTION" "true" -check "library_image_tools-layer.tar" "./rules_r/r-libs/exampleC/DESCRIPTION" "false" -check "library_image_tools-layer.tar" "./rules_r/r-libs/bitops/DESCRIPTION" "false" +check "library_image-layer.tar" "./grail/r-libs/exampleC/DESCRIPTION" "false" +check "library_image-layer.tar" "./grail/r-libs/bitops/DESCRIPTION" "false" +check "library_image_internal-layer.tar" "./grail/r-libs/exampleC/DESCRIPTION" "true" +check "library_image_internal-layer.tar" "./grail/r-libs/bitops/DESCRIPTION" "false" +check "library_image_external-layer.tar" "./grail/r-libs/exampleC/DESCRIPTION" "false" +check "library_image_external-layer.tar" "./grail/r-libs/bitops/DESCRIPTION" "true" +check "library_image_tools-layer.tar" "./grail/r-libs/exampleC/DESCRIPTION" "false" +check "library_image_tools-layer.tar" "./grail/r-libs/bitops/DESCRIPTION" "false" -check "library_archive.tar.gz" "./rules_r/r-libs/exampleC/DESCRIPTION" "false" -check "library_archive.tar.gz" "./rules_r/r-libs/bitops/DESCRIPTION" "true" +check "library_archive.tar.gz" "./grail/r-libs/exampleC/DESCRIPTION" "false" +check "library_archive.tar.gz" "./grail/r-libs/bitops/DESCRIPTION" "true" # Check binary script and R library packages. check "binary_image-layer.tar" "/app/binary/binary" "true" -check "binary_image-layer.tar" "./app/binary/binary.runfiles/rules_r_tests/binary/binary.R" "true" -check "binary_image-layer.tar" "./app/binary/binary.runfiles/rules_r_tests/packages/exampleA/lib/exampleA/DESCRIPTION" "true" -check "binary_image-layer.tar" "./app/binary/binary.runfiles/rules_r_tests/packages/exampleB/lib/exampleB/DESCRIPTION" "true" -check "binary_image-layer.tar" "./app/binary/binary.runfiles/rules_r_tests/packages/exampleC/lib/exampleC/DESCRIPTION" "true" +check "binary_image-layer.tar" "./app/binary/binary.runfiles/com_grail_rules_r_tests/binary/binary.R" "true" +check "binary_image-layer.tar" "./app/binary/binary.runfiles/com_grail_rules_r_tests/packages/exampleA/lib/exampleA/DESCRIPTION" "true" +check "binary_image-layer.tar" "./app/binary/binary.runfiles/com_grail_rules_r_tests/packages/exampleB/lib/exampleB/DESCRIPTION" "true" +check "binary_image-layer.tar" "./app/binary/binary.runfiles/com_grail_rules_r_tests/packages/exampleC/lib/exampleC/DESCRIPTION" "true" check "binary_image-layer.tar" "./app/binary/binary.runfiles/R_bitops/lib/bitops/DESCRIPTION" "true" check "binary_image-layer.tar" "./app/binary/binary.runfiles/R_R6/lib/R6/DESCRIPTION" "true" # Check that explicitly layered packages are not in the top layer, but in one layer below. check "binary_image_explicit_layers-layer.tar" "/app/binary/binary" "true" -check "binary_image_explicit_layers-layer.tar" "./app/binary/binary.runfiles/rules_r_tests/binary/binary.R" "true" -check "binary_image_explicit_layers-layer.tar" "./app/binary/binary.runfiles/rules_r_tests/packages/exampleA/lib/exampleA/DESCRIPTION" "true" -check "binary_image_explicit_layers-layer.tar" "./app/binary/binary.runfiles/rules_r_tests/packages/exampleB/lib/exampleB/DESCRIPTION" "true" -check "binary_image_explicit_layers-layer.tar" "./app/binary/binary.runfiles/rules_r_tests/packages/exampleC/lib/exampleC/DESCRIPTION" "true" +check "binary_image_explicit_layers-layer.tar" "./app/binary/binary.runfiles/com_grail_rules_r_tests/binary/binary.R" "true" +check "binary_image_explicit_layers-layer.tar" "./app/binary/binary.runfiles/com_grail_rules_r_tests/packages/exampleA/lib/exampleA/DESCRIPTION" "true" +check "binary_image_explicit_layers-layer.tar" "./app/binary/binary.runfiles/com_grail_rules_r_tests/packages/exampleB/lib/exampleB/DESCRIPTION" "true" +check "binary_image_explicit_layers-layer.tar" "./app/binary/binary.runfiles/com_grail_rules_r_tests/packages/exampleC/lib/exampleC/DESCRIPTION" "true" check "binary_image_explicit_layers-layer.tar" "./app/binary/binary.runfiles/R_bitops/lib/bitops/DESCRIPTION" "false" check "binary_image_explicit_layers-layer.tar" "./app/binary/binary.runfiles/R_R6/lib/R6/DESCRIPTION" "false" check "binary_image_explicit_layers.0-layer.tar" "./app/R_bitops/lib/bitops/DESCRIPTION" "true" diff --git a/tests/coverage/coverage_test.sh b/tests/coverage/coverage_test.sh index 8dc1635..ec5d914 100755 --- a/tests/coverage/coverage_test.sh +++ b/tests/coverage/coverage_test.sh @@ -114,7 +114,7 @@ toolchain_args=( "--extra_toolchains=//:toolchain-${os}" "--extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-${os}" "--incompatible_enable_cc_toolchain_resolution" - "--toolchain_resolution_debug=rules_r" + "--toolchain_resolution_debug=com_grail_rules_r" ) "${bazel}" coverage "${bazel_test_opts[@]}" "${toolchain_args[@]}" //... expect_equal "custom_toolchain_C.xml" "${coverage_file_C}" diff --git a/tests/cran/BUILD.RProtoBuf b/tests/cran/BUILD.RProtoBuf index 8a5f2df..f83348c 100644 --- a/tests/cran/BUILD.RProtoBuf +++ b/tests/cran/BUILD.RProtoBuf @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@rules_r//R:defs.bzl", "r_library", "r_pkg", "r_pkg_test", "r_unit_test") +load("@com_grail_rules_r//R:defs.bzl", "r_library", "r_pkg", "r_pkg_test", "r_unit_test") package(default_visibility = ["//visibility:public"]) diff --git a/tests/cran/Makevars.gnu b/tests/cran/Makevars.gnu index 8eea339..af2db70 100644 --- a/tests/cran/Makevars.gnu +++ b/tests/cran/Makevars.gnu @@ -36,7 +36,7 @@ CXX11 = ${LLVM_BIN}clang++ CXX14 = ${LLVM_BIN}clang++ CXX17 = ${LLVM_BIN}clang++ -# Reproducibility flags copied from @rules_r_makevars_linux +# Reproducibility flags copied from @com_grail_rules_r_makevars_linux CPPFLAGS += "-Wno-builtin-macro-redefined" \ "-D__DATE__=\"redacted\"" \ "-D__TIMESTAMP__=\"redacted\"" \ diff --git a/tests/cran/build_file_overrides.csv b/tests/cran/build_file_overrides.csv index 9c6b7e2..ec6970c 100644 --- a/tests/cran/build_file_overrides.csv +++ b/tests/cran/build_file_overrides.csv @@ -1,2 +1,2 @@ "Package","build_file" -"RProtoBuf","@rules_r_tests//cran:BUILD.RProtoBuf" +"RProtoBuf","@com_grail_rules_r_tests//cran:BUILD.RProtoBuf" diff --git a/tests/flock/BUILD b/tests/flock/BUILD index 24e77d0..4a69bfb 100644 --- a/tests/flock/BUILD +++ b/tests/flock/BUILD @@ -15,5 +15,5 @@ sh_test( name = "flock_test", srcs = ["flock_test.sh"], - data = ["@rules_r//R/scripts:flock"], + data = ["@com_grail_rules_r//R/scripts:flock"], ) diff --git a/tests/flock/flock_test.sh b/tests/flock/flock_test.sh index 90eb590..4f55040 100755 --- a/tests/flock/flock_test.sh +++ b/tests/flock/flock_test.sh @@ -49,7 +49,7 @@ pids=() # Acquire a lock on the first file in a subshell for some time. ( exec 200>"${lock_1}" - external/rules_r/R/scripts/flock 200 || fail "unable to acquire lock 1 in proc 1" + external/com_grail_rules_r/R/scripts/flock 200 || fail "unable to acquire lock 1 in proc 1" mark "${marker_1}" wait_on_marker "${marker_2}" # Wait until the second subshell has tried acquiring the lock. exec 200>&- # Close the file descriptor; releasing the lock. @@ -61,17 +61,17 @@ pids+=($!) ( wait_on_marker "${marker_1}" # Wait until the first subshell has acquired the lock. exec 200>"${lock_1}" - external/rules_r/R/scripts/flock 200 && fail "should not have acquired lock 1 in proc 2" + external/com_grail_rules_r/R/scripts/flock 200 && fail "should not have acquired lock 1 in proc 2" mark "${marker_2}" wait_on_marker "${marker_3}" - external/rules_r/R/scripts/flock 200 || fail "unable to acquire lock 1 in proc 2" + external/com_grail_rules_r/R/scripts/flock 200 || fail "unable to acquire lock 1 in proc 2" ) & pids+=($!) # Try to acquire a lock on a different file, and succeed immediately. ( exec 200>"${lock_2}" - external/rules_r/R/scripts/flock 200 || fail "unable to acquire lock 2 in proc 3" + external/com_grail_rules_r/R/scripts/flock 200 || fail "unable to acquire lock 2 in proc 3" ) & pids+=($!) diff --git a/tests/init.bzl b/tests/init.bzl index f6edefb..70208ec 100644 --- a/tests/init.bzl +++ b/tests/init.bzl @@ -12,12 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@rules_r//R:dependencies.bzl", _r_register_toolchains = "r_register_toolchains") +load("@com_grail_rules_r//R:dependencies.bzl", _r_register_toolchains = "r_register_toolchains") def r_register_toolchains(use_r_from_nix = False): if use_r_from_nix: rscript = "@Rnix//:bin/Rscript" - native.register_toolchains("@rules_r_tests//:toolchain-nix") + native.register_toolchains("@com_grail_rules_r_tests//:toolchain-nix") else: rscript = "Rscript" _r_register_toolchains() diff --git a/tests/packages/exampleA/BUILD b/tests/packages/exampleA/BUILD index b0526a2..8aa541f 100644 --- a/tests/packages/exampleA/BUILD +++ b/tests/packages/exampleA/BUILD @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@rules_r//R:defs.bzl", "r_pkg") +load("@com_grail_rules_r//R:defs.bzl", "r_pkg") r_pkg( name = "exampleA", diff --git a/tests/packages/exampleB/BUILD b/tests/packages/exampleB/BUILD index 2eed33f..35a3d40 100644 --- a/tests/packages/exampleB/BUILD +++ b/tests/packages/exampleB/BUILD @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@rules_r//R:defs.bzl", "r_pkg") +load("@com_grail_rules_r//R:defs.bzl", "r_pkg") r_pkg( name = "exampleB", diff --git a/tests/packages/exampleC/BUILD b/tests/packages/exampleC/BUILD index 0f62175..6100436 100644 --- a/tests/packages/exampleC/BUILD +++ b/tests/packages/exampleC/BUILD @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@rules_r//R:defs.bzl", "r_library", "r_pkg", "r_pkg_test", "r_unit_test") +load("@com_grail_rules_r//R:defs.bzl", "r_library", "r_pkg", "r_pkg_test", "r_unit_test") package(default_visibility = ["//visibility:public"]) diff --git a/tests/packages/exampleD/BUILD b/tests/packages/exampleD/BUILD index 602dac4..1f2cde1 100644 --- a/tests/packages/exampleD/BUILD +++ b/tests/packages/exampleD/BUILD @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@rules_r//R:defs.bzl", "r_library", "r_pkg", "r_pkg_test", "r_unit_test") +load("@com_grail_rules_r//R:defs.bzl", "r_library", "r_pkg", "r_pkg_test", "r_unit_test") package(default_visibility = ["//visibility:public"]) diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 8764997..571486f 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -43,7 +43,7 @@ echo "::group::Storing debug artifacts" export ARTIFACTS_DIR="/tmp/debug-artifacts/$(uname)" mkdir -p "${ARTIFACTS_DIR}" "${bazel}" query --output=build 'kind("r_repository", "//external:*")' > "${ARTIFACTS_DIR}/repository_list.txt" -cp "$("${bazel}" info output_base)/external/rules_r_toolchains/system_state.txt" "${ARTIFACTS_DIR}/" +cp "$("${bazel}" info output_base)/external/com_grail_rules_r_toolchains/system_state.txt" "${ARTIFACTS_DIR}/" echo "::endgroup::" echo "::group::Default tests" diff --git a/tests/stamping/BUILD b/tests/stamping/BUILD index dd4b7a7..6253f92 100644 --- a/tests/stamping/BUILD +++ b/tests/stamping/BUILD @@ -12,14 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@rules_r//R:defs.bzl", "r_test") +load("@com_grail_rules_r//R:defs.bzl", "r_test") r_test( name = "stamp_test", src = "stamp_test.sh", data = [ - "@rules_r//internal/statusfiles:stable", - "@rules_r//internal/statusfiles:volatile", + "@com_grail_rules_r//internal/statusfiles:stable", + "@com_grail_rules_r//internal/statusfiles:volatile", ], ) @@ -27,7 +27,7 @@ r_test( name = "nostamp_test", src = "nostamp_test.sh", data = [ - "@rules_r//internal/statusfiles:volatile", + "@com_grail_rules_r//internal/statusfiles:volatile", ], ) diff --git a/tests/state/BUILD b/tests/state/BUILD index df70a03..93e2c20 100644 --- a/tests/state/BUILD +++ b/tests/state/BUILD @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@rules_r//R:defs.bzl", "r_test") +load("@com_grail_rules_r//R:defs.bzl", "r_test") r_test( name = "state_test", src = "state_test.sh", - data = ["@rules_r_toolchains//:system_state.txt"], + data = ["@com_grail_rules_r_toolchains//:system_state.txt"], ) diff --git a/tests/state/state_test.sh b/tests/state/state_test.sh index b9c6346..2dd9711 100755 --- a/tests/state/state_test.sh +++ b/tests/state/state_test.sh @@ -15,7 +15,7 @@ set -euo pipefail -readonly state_file="./external/rules_r_toolchains/system_state.txt" +readonly state_file="./external/com_grail_rules_r_toolchains/system_state.txt" fail() { >&2 echo "$@" diff --git a/tests/workspaceroot/BUILD.bazel b/tests/workspaceroot/BUILD.bazel index 64db857..538d446 100644 --- a/tests/workspaceroot/BUILD.bazel +++ b/tests/workspaceroot/BUILD.bazel @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@rules_r//R:defs.bzl", "r_pkg", "r_pkg_test", "r_unit_test") +load("@com_grail_rules_r//R:defs.bzl", "r_pkg", "r_pkg_test", "r_unit_test") r_pkg( name = "workspaceroot", diff --git a/tests/workspaceroot/WORKSPACE b/tests/workspaceroot/WORKSPACE index f948f64..ebbfe3d 100644 --- a/tests/workspaceroot/WORKSPACE +++ b/tests/workspaceroot/WORKSPACE @@ -12,14 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -workspace(name = "rules_r_tests_workspaceroot") +workspace(name = "com_grail_rules_r_tests_workspaceroot") local_repository( - name = "rules_r", + name = "com_grail_rules_r", path = "../..", ) -load("@rules_r//R:dependencies.bzl", "r_coverage_dependencies", "r_register_toolchains", "r_rules_dependencies") +load("@com_grail_rules_r//R:dependencies.bzl", "r_coverage_dependencies", "r_register_toolchains", "r_rules_dependencies") r_rules_dependencies()