line / rules_apple_line

LINE's Apple rules for Bazel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Facing pathing issues with modules-includes when building for application

tinder-maxwellelliott opened this issue · comments

Hello There,

I am facing an issue with module-includes pathing when I am building an ios_application rule using objc_static_framework. I am seeing the following issue:

<module-includes>:3:9: note: in file included from <module-includes>:3:
#import "../../../../../external/Branch/Branch-SDK/Branch-SDK/BNCCommerceEvent.h"
        ^
OMITTED/external/Branch/Branch-SDK/Branch-SDK/BNCCommerceEvent.h:9:9: error: 'BNCServerRequest.h' file not found
#import "BNCServerRequest.h"
        ^
OMITTED/TestHarnessViewController.swift:9:8: error: could not build Objective-C module 'Branch'
import Branch

With the following Folder structure:

tree -d ios-branch-deep-linking-attribution-0.33.1/Branch-SDK/Branch-SDK
├── BNCCommerceEvent.h
├── BNCCommerceEvent.m
..Some File omitted for brevity
├── Branch.h
├── Branch.m
├── Networking
..Some File omitted for brevity
│   ├── BNCServerRequest.h
│   ├── BNCServerRequest.m
│   └── Requests
..Some File omitted for brevity
│   ├── BranchCPIDRequest.h
│   ├── BranchCPIDRequest.m

Now I am able to build the backing ObjC library and the Framework for this dependency, yet when I import this code into ios_application via apple_library it cannot build. I have tried flattening the directory structure and that did make it work (i.e. Moving all files to a single directory), this would be my easiest option but this is an external dependency I do not own.

Oddly enough I also got this to work by placing this single objc_static_framework as a dependency of another objc_library rule and importing that into an ios_application rule. This will not work for my project since my App is pure swift

Am I missing something here? I have tried adding paths to includes but I get the same error.

Can you try running Bazel with --incompatible_objc_compile_info_migration? It's required for building with the latest rules_apple, which I haven't tested this with.

--incompatible_objc_compile_info_migration plus adding Branch-SDK/Branch-SDK to my includes did the trick. Thanks again 😄