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

objc_import missing data argument #17018

Open
xiemotongye opened this issue Dec 14, 2022 · 8 comments
Open

objc_import missing data argument #17018

xiemotongye opened this issue Dec 14, 2022 · 8 comments
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Rules-ObjC Issues for Objective-C maintainers type: feature request

Comments

@xiemotongye
Copy link

Description of the feature request:

Hi wonderful Bazel folks,

This is a feature request.

I'd noticed that objc_import--unlike most other cc rules(cc_import, cc_library, objc_library)--doesn't allow you to specify data.
I think objc_import should be equivalent to objc_library. It's so weird that objc_import does not support the data argument.

What underlying problem are you trying to solve with this feature?

I'm using a .a file with some resources. When I specify data to objc_import, bazel told me: no such attribute 'data' in 'objc_import' rule.

Which operating system are you running Bazel on?

macOS 12.6

What is the output of bazel info release?

release 6.0.0rc4

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

git@github.com:bazelbuild/bazel.git
89eba259031ff29136fdb59351adc1e754004672
7ccc66108f08f7b6c6f6e5229f70f29962ea19ce

Have you found anything relevant by searching the web?

Yes.
Just found objc_import missing deps argument.
This issue only mentioned deps arguments, but no mention for data arguments.

Any other information, logs, or outputs that you want to share?

No response

@oquenchil oquenchil added team-Rules-ObjC Issues for Objective-C maintainers untriaged and removed untriaged team-Rules-CPP Issues for C++ rules labels Jan 23, 2023
@cpsauer
Copy link
Contributor

cpsauer commented May 11, 2023

+1 on the utility of this

[As food for thought: Might it just make sense to mostly unify these rules?]

@keith keith added P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed untriaged labels Dec 18, 2023
@cpsauer
Copy link
Contributor

cpsauer commented Dec 22, 2023

(objc_import is starlarkified, right? Perhaps that makes this a good time... I started to look into, but wasn't sure how the data attrs were getting gathered up into providers in the cc_import equivalent--perhaps they're traversed with an aspect?--nor what the SKIP_CONSTRAINTS_OVERRIDE was about. If anyone knows--or knows who would know--please say.)

@keith
Copy link
Member

keith commented Dec 22, 2023

As far as how data is used in apple targets that is from an aspect in rules_apple, so I would try adding the same attr as objc_library (this one

"data": attr.label_list(allow_files = True),
) and seeing if that "just works" the only place I can see objc_library using that directly is for this
dependency_attributes = ["deps", "data", "binary", "xctest_app"],
which objc_import doesn't have

@cpsauer
Copy link
Contributor

cpsauer commented Dec 22, 2023

Thanks Keith!

Gave that a quick whirl, but the data don't get picked up and bundled as they would with objc_library. Any ideas?

(Figured I had comparative advantage if it were easy, given a real world test case, and already knowing how to use --experimental_builtins_bzl_path="%workspace%", but I think you (and others) definitely have advantage wrt understanding the gather-up process.)

@keith
Copy link
Member

keith commented Dec 22, 2023

@cpsauer
Copy link
Contributor

cpsauer commented Dec 22, 2023

Got it. Looks like resources.collect no-ops gracefully if the attrdoesn't exist--so that change is our first move.

Should I be concerned also about, e.g., cc_binaries failing to collect the data? (I was surprised to see these not getting passed up e.g. via some cc provider.)

cpsauer added a commit to cpsauer/rules_apple that referenced this issue Dec 22, 2023
@cpsauer
Copy link
Contributor

cpsauer commented Dec 22, 2023

It does still does seem like objc_import is so very close to being able to just be implemented as a facade around objc_library. objc_library would just need to be able to take .a files, like cc_library.

brentleyjones pushed a commit to bazelbuild/rules_apple that referenced this issue Jan 2, 2024
@keith, tossing up a quick PR per your suggestion in
bazelbuild/bazel#17018 (comment)
to lay the groundwork
@cpsauer
Copy link
Contributor

cpsauer commented Jan 2, 2024

Prerequisite change merged into rules_apple today.

Added the core change in #20716 (have ofc verified that they work together.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Rules-ObjC Issues for Objective-C maintainers type: feature request
Projects
None yet
Development

No branches or pull requests

5 participants
@keith @xiemotongye @cpsauer @oquenchil and others