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

[8.1.0] Add --incompatible_enforce_starlark_utf8 #25148

Closed
wants to merge 1 commit into from

Conversation

iancha1992
Copy link
Member

If enabled (or set to error), fail if Starlark files are not UTF-8 encoded. If set to warning (the default), emits a warning instead.

Bazel already assumes that Starlark files are UTF-8 encoded for e.g. filenames in actions executed remotely. This flag doesn't affect this, it only makes encoding failures more visible.

Work towards #374

Closes #24944.

PiperOrigin-RevId: 721513249
Change-Id: I1d3363168c6cd5d37abf96e0401e34866b6679d7

Commit e7934ce

If enabled (or set to `error`), fail if Starlark files are not UTF-8 encoded. If set to `warning` (the default), emits a warning instead.

Bazel already assumes that Starlark files are UTF-8 encoded for e.g. filenames in actions executed remotely. This flag doesn't affect this, it only makes encoding failures more visible.

Work towards #374

Closes bazelbuild#24944.

PiperOrigin-RevId: 721513249
Change-Id: I1d3363168c6cd5d37abf96e0401e34866b6679d7
@iancha1992 iancha1992 added awaiting-review PR is awaiting review from an assigned reviewer team-Loading-API BUILD file and macro processing: labels, package(), visibility, glob labels Jan 30, 2025
@iancha1992 iancha1992 requested a review from tetromino January 30, 2025 22:52
@iancha1992 iancha1992 requested a review from a team as a code owner January 30, 2025 22:52
@github-actions github-actions bot added the team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. label Jan 30, 2025
@iancha1992 iancha1992 removed the team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. label Jan 30, 2025
@iancha1992 iancha1992 enabled auto-merge January 30, 2025 22:53
@iancha1992
Copy link
Member Author

@tetromino could you please take a look at the presubmit errors? Thanks

@fmeum
Copy link
Collaborator

fmeum commented Jan 31, 2025

@iancha1992 I sent #25152. The diff, in case you would rather apply it here:

diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceFileFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceFileFunction.java
index 74b975ac71..22e4b73e4d 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceFileFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceFileFunction.java
@@ -439,7 +439,7 @@ public class WorkspaceFileFunction implements SkyFunction {
         StarlarkUtil.InvalidUtf8Exception e) {
       throw resolvedValueError("Failed to read WORKSPACE file");
     }
-    StarlarkFile file = StarlarkFile.parse(parserInput);
+    StarlarkFile file = StarlarkFile.parse(parserInput, options);
     if (!file.ok()) {
       Event.replayEventsOn(env.getListener(), file.errors());
       throw resolvedValueError("Failed to parse WORKSPACE file");

@iancha1992 iancha1992 closed this Jan 31, 2025
auto-merge was automatically disabled January 31, 2025 20:07

Pull request was closed

@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Jan 31, 2025
github-merge-queue bot pushed a commit that referenced this pull request Jan 31, 2025
If enabled (or set to `error`), fail if Starlark files are not UTF-8
encoded. If set to `warning` (the default), emits a warning instead.

Bazel already assumes that Starlark files are UTF-8 encoded for e.g.
filenames in actions executed remotely. This flag doesn't affect this,
it only makes encoding failures more visible.

Work towards #374

Closes #24944.

PiperOrigin-RevId: 721513249
Change-Id: I1d3363168c6cd5d37abf96e0401e34866b6679d7

(cherry picked from commit e7934ce)

Fixes #25148
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Loading-API BUILD file and macro processing: labels, package(), visibility, glob
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants