Skip to content

Comments

fix: Allow generated files in platform_transition_filegroup#1240

Open
philsc wants to merge 1 commit intobazel-contrib:mainfrom
philsc:fix-transition-filegroup-with-generated-files
Open

fix: Allow generated files in platform_transition_filegroup#1240
philsc wants to merge 1 commit intobazel-contrib:mainfrom
philsc:fix-transition-filegroup-with-generated-files

Conversation

@philsc
Copy link

@philsc philsc commented Feb 6, 2026

I'm currently running into this error:

$ bazel build //lib/tests/transitions:transitioned_dynamic_path
INFO: Invocation ID: ea3f3d4e-ea1a-49cc-84b5-e5d5e1577aaa
ERROR: /home/philipp.schrader/repos/bazel-lib/lib/tests/transitions/BUILD.bazel:104:30: in srcs attribute of platform_transition_filegroup rule //lib/tests/transitions:transitioned_dynamic_path: generated file '//lib/tests/transitions:dynamic_path.txt' is misplaced here (expected no files)
ERROR: /home/philipp.schrader/repos/bazel-lib/lib/tests/transitions/BUILD.bazel:104:30: Analysis of target '//lib/tests/transitions:transitioned_dynamic_path' (config: 4996c2f) failed
ERROR: Analysis of target '//lib/tests/transitions:transitioned_dynamic_path' failed; build aborted
INFO: Elapsed time: 0.077s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully

Fix the issue by allowing files in the srcs attribute.

This is useful if the genrule is operating on a transitioned binary
of some kind.

@philsc philsc force-pushed the fix-transition-filegroup-with-generated-files branch from 87d421e to cb81d62 Compare February 6, 2026 18:45
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cb81d622e3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 39 to 42
"srcs": attr.label_list(
allow_empty = False,
allow_files = True,
cfg = _transition_platform,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Handle File inputs before enabling allow_files

With allow_files = True, ctx.attr.srcs may contain File objects for file labels (including generated outputs). _platform_transition_filegroup_impl later indexes each src as src[DefaultInfo], which only works for targets, so using a file label will now fail at analysis time with a type/provider error. This means the new support for generated files is still broken unless the implementation switches to ctx.files.srcs (and handles runfiles separately) or branches on File vs target.

Useful? React with 👍 / 👎.

@aspect-workflows
Copy link

aspect-workflows bot commented Feb 6, 2026

Bazel 8 (Test)

2 test targets passed

Targets
//lib/tests/copy_to_directory:case_22_test [k8-fastbuild]                    84ms
//lib/tests/copy_to_directory_bin_action:test [k8-fastbuild]                 95ms

Total test execution time was 179ms. 134 tests (98.5%) were fully cached saving 16s.


Bazel 9 (Test)

2 test targets passed

Targets
//lib/tests/copy_to_directory:case_22_test [k8-fastbuild]                    60ms
//lib/tests/copy_to_directory_bin_action:test [k8-fastbuild]                 54ms

Total test execution time was 114ms. 134 tests (98.5%) were fully cached saving 18s.


Bazel 7 (Test)

e2e/api_entries

All tests were cache hits

1 test (100.0%) was fully cached saving 24ms.


Bazel 8 (Test)

e2e/api_entries

All tests were cache hits

1 test (100.0%) was fully cached saving 30ms.


Bazel 9 (Test)

e2e/api_entries

All tests were cache hits

1 test (100.0%) was fully cached saving 50ms.


Bazel 7 (Test)

e2e/copy_action

All tests were cache hits

1 test (100.0%) was fully cached saving 31ms.


Bazel 8 (Test)

e2e/copy_action

All tests were cache hits

1 test (100.0%) was fully cached saving 26ms.


Bazel 9 (Test)

e2e/copy_action

All tests were cache hits

1 test (100.0%) was fully cached saving 32ms.


Bazel 7 (Test)

e2e/copy_to_directory

All tests were cache hits

6 tests (100.0%) were fully cached saving 297ms.


Bazel 8 (Test)

e2e/copy_to_directory

All tests were cache hits

6 tests (100.0%) were fully cached saving 286ms.


Bazel 9 (Test)

e2e/copy_to_directory

All tests were cache hits

6 tests (100.0%) were fully cached saving 349ms.


Bazel 7 (Test)

e2e/coreutils

All tests were cache hits

4 tests (100.0%) were fully cached saving 247ms.


Bazel 8 (Test)

e2e/coreutils

All tests were cache hits

4 tests (100.0%) were fully cached saving 216ms.


Bazel 9 (Test)

e2e/coreutils

All tests were cache hits

4 tests (100.0%) were fully cached saving 198ms.


Bazel 7 (Test)

e2e/external_copy_to_directory

All tests were cache hits

1 test (100.0%) was fully cached saving 31ms.


Bazel 8 (Test)

e2e/external_copy_to_directory

All tests were cache hits

1 test (100.0%) was fully cached saving 26ms.


Bazel 9 (Test)

e2e/external_copy_to_directory

All tests were cache hits

1 test (100.0%) was fully cached saving 32ms.


Bazel 7 (Test)

e2e/smoke

All tests were cache hits

4 tests (100.0%) were fully cached saving 611ms.


Bazel 8 (Test)

e2e/smoke

All tests were cache hits

4 tests (100.0%) were fully cached saving 508ms.


Bazel 9 (Test)

e2e/smoke

All tests were cache hits

4 tests (100.0%) were fully cached saving 618ms.


Bazel 7 (Test)

e2e/write_source_files

All tests were cache hits

1 test (100.0%) was fully cached saving 39ms.


Bazel 8 (Test)

e2e/write_source_files

All tests were cache hits

1 test (100.0%) was fully cached saving 33ms.


Bazel 9 (Test)

e2e/write_source_files

All tests were cache hits

1 test (100.0%) was fully cached saving 40ms.

I'm currently running into this error:

    $ bazel build //lib/tests/transitions:transitioned_dynamic_path
    INFO: Invocation ID: ea3f3d4e-ea1a-49cc-84b5-e5d5e1577aaa
    ERROR: /home/philipp.schrader/repos/bazel-lib/lib/tests/transitions/BUILD.bazel:104:30: in srcs attribute of platform_transition_filegroup rule //lib/tests/transitions:transitioned_dynamic_path: generated file '//lib/tests/transitions:dynamic_path.txt' is misplaced here (expected no files)
    ERROR: /home/philipp.schrader/repos/bazel-lib/lib/tests/transitions/BUILD.bazel:104:30: Analysis of target '//lib/tests/transitions:transitioned_dynamic_path' (config: 4996c2f) failed
    ERROR: Analysis of target '//lib/tests/transitions:transitioned_dynamic_path' failed; build aborted
    INFO: Elapsed time: 0.077s, Critical Path: 0.00s
    INFO: 1 process: 1 internal.
    ERROR: Build did NOT complete successfully

Fix the issue by allowing files in the `srcs` attribute.

This is useful if the `genrule` is operating on a transitioned binary
of some kind.
@philsc philsc force-pushed the fix-transition-filegroup-with-generated-files branch from cb81d62 to f152912 Compare February 6, 2026 18:47
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.

1 participant