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

[WIP] Objc modular imports #6243

Closed
wants to merge 4 commits into from
Closed

Conversation

ob
Copy link
Contributor

@ob ob commented Sep 26, 2018

This adds support for using modular imports (@import module) from objc_library rules.

Implementation note:

I again had to remove the extraneous CcCompilationContext mentioned in #5954, and still have the same question from that PR.

I also cleaned up what looked like unused code (that's why there are two commits).

@iirina iirina added the z-team-Apple Deprecated. Send to rules_apple, or label team-Rules-CPP + platform:apple label Sep 26, 2018
@@ -380,7 +380,7 @@ public void testProvidesObjcHeadersWithDotMFiles() throws Exception {
assertThat(getArifactPaths(target, HEADER))
.containsExactly("objc/a.h", "objc/b.h", "objc/f.m");
assertThat(getArifactPaths(depender, HEADER))
.containsExactly("objc/a.h", "objc/b.h", "objc/f.m", "objc2/d.h", "objc2/e.m");
.containsExactly("objc/a.h", "objc/b.h", "objc/f.m", "objc/private.h", "objc2/d.h", "objc2/e.m");
Copy link
Member

Choose a reason for hiding this comment

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

This is checking the header field of the ObjcProvider, right? AFAIK, it definitely should not be propagating private headers that are only listed in srcs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was going by this comment from #5954.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, that's a fair point (a public header including a private header). I'd have to dig deeper to see why that hasn't been an issue today, unless people just so habitually glob .h files into hdrs and .m files into srcs that it doesn't ever come up. 🤷‍♂️

As long as the HEADER field is only used to determine which header files end up in downstream actions' sandboxes, that should be fine. But if we ever query that field anywhere else with the assumption that that's the "public interface" of the library, we'd need to figure out what to do there. I don't know if that's an issue anywhere currently, though.

Module map creation uses the hdrs attribute, not the provider, I believe, so that should be unaffected.

@ob
Copy link
Contributor Author

ob commented Sep 26, 2018

One thing to consider is that with too many dependencies this has the potential to exceed the maximum command line argument. I should probably pass all the flags as a response file.

@ob ob changed the title Objc modular imports [WIP] Objc modular imports Sep 26, 2018
@lberki lberki requested review from hlopko and removed request for lberki September 27, 2018 09:22
The CreateSourceAction function is called _per file_, so this was
adding the flags multiple times. Call it before the loop so that
the flags are only added once.
@ob
Copy link
Contributor Author

ob commented Sep 27, 2018

I am a bit confused why here -fmodules is only passed to the compiler when Bazel itself generates the module map and not when the user provided a module map. I want to pass -fmodules in both cases.

@jin jin added the WIP label Jan 3, 2019
@ob
Copy link
Contributor Author

ob commented Jan 30, 2019

This is no longer being pursued in this form, I'll take another crack once the C++ rules are in StarLark.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes z-team-Apple Deprecated. Send to rules_apple, or label team-Rules-CPP + platform:apple
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants