Skip to content
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

Remove restriction in custom_res against top-level directory #176

Merged

Conversation

pswaminathan
Copy link
Contributor

@pswaminathan pswaminathan commented Jun 18, 2024

Currently, custom_res rule enforces that dir_name is not in the same directory as the package. It does this implicitly:

old_resource_path.replace("/" + dir_name, "/res")

This means that if "/" + dir_name does not exist in the resource path, nothing will be replaced, and the rule fails. Meaning that, for instance:

.
├── BUILD.bazel
├── res
├── res-debug
└── res-release

This fails, because the resource path is res-debug/values/example.xml.

By the nature of the rule, the resource paths having dir_name plus a slash at the end feels more correct to enforce than starting with a slash.

Currently, custom_res rule enforces that dir_name is not in the same
directory as the package. It does this implicitly:

```
old_resource_path.replace("/" + dir_name, "/res")
```

This means that if `"/" + dir_name` does not exist in the resource path,
nothing will be replaced, and the rule fails. Meaning that, for instance:

```
.
├── BUILD.bazel
├── res
├── res-debug
└── res-release
```

This fails, because the resource path is `res-debug/values/example.xml`.

By the nature of the rule, the dir_name ending in a slash feels more correct
to enforce than starting with a slash.
@arunkumar9t2
Copy link
Contributor

Thanks!

@arunsampathkumar-grabtaxi arunsampathkumar-grabtaxi merged commit 72a8915 into grab:master Jun 19, 2024
3 checks passed
@pswaminathan pswaminathan deleted the ps/res-toplevel-fix branch June 21, 2024 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants