bazelbuild / bazelbuild/rules_apple

Question: data attribute for macos_command_line_application or alternative

Open
#2,446 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
593
Forks
334
Avg merge
16h 48m
Merged PRs (30d)
9

Description

I want to run my python script(py_binary) from Swift and I ended up having the following setup, which compiles without an issue

```
swift_library(
name = "Sources",
srcs = ["main.swift"],
visibility = ["//visibility:public"],
data = ["//src/image_gen:main"], # py_binary
)

apple_bundle_version(
name = "CommandLineSwiftVersion",
build_version = "1.0",
)

macos_command_line_application(
name = "CommandLineSwift",
bundle_id = "com.example.command-line-swift",
infoplists = [":Info.plist"],
minimum_os_version = "13.6",
version = ":CommandLineSwiftVersion",
deps = [
":Sources",
],
)
```

According to docs, py_binary runfiles are supposed to end up in CommandLineSwift's bin folder(transitively trough swift_library), but Somehow py_binary runfiles never end up in there

However, the other way around - works. I can add `CommandLineSwift` to `py_binary` `data` attribute without any issues. Am I doing smth wrong here? Is there other way to do it?

Contributor guide

Open the contributing guide

Research direction

Reproduce the setup from the issue with main.swift, Info.plist, the swift_library target, and the py_binary dependency. Start by checking the generated CommandLineSwift bundle and its runfiles, then compare the documented data propagation in the relevant macos_command_line_application and swift_library entry points. Done means determining whether the missing runfiles are expected and documenting or fixing the supported dependency path.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, swift
Domain
build-system, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.