-
Notifications
You must be signed in to change notification settings - Fork 90
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
Generate index for objective-c code. Remap and move index to deriveddata. #69
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
segiddins
reviewed
Jun 3, 2020
kastiglione
reviewed
Jun 4, 2020
amberdixon
force-pushed
the
amber/indexing
branch
from
June 5, 2020 23:37
303b856
to
3db1270
Compare
amberdixon
changed the title
[WIP] Add indexing support
Generate index for objective-c code. Remap and move index to deriveddata.
Jun 5, 2020
amberdixon
force-pushed
the
amber/indexing
branch
from
June 5, 2020 23:51
3db1270
to
85bd4d5
Compare
segiddins
reviewed
Jun 6, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should gitignore
*/.xcodeproj/bazelinstallers/index-import
so we don't commit binaries into the repo?
...os/xcodeproj/Single-Application-Project-AllTargets.xcodeproj/bazelinstallers/_swiftmodule.sh
Outdated
Show resolved
Hide resolved
...deproj/Single-Application-Project-DirectTargetsOnly.xcodeproj/bazelinstallers/_indexstore.sh
Outdated
Show resolved
Hide resolved
...eproj/Single-Application-Project-DirectTargetsOnly.xcodeproj/bazelinstallers/_swiftmodule.sh
Outdated
Show resolved
Hide resolved
segiddins
approved these changes
Jun 9, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the
index-store-path
option when invoking clang to compile objective-c to build libraries. It also adds a step to the post-build installer which uses index-import to update the paths referenced by the index generated by bazel and place the index in the derived data directory.I set the
CLANG_ENABLE_MODULES
setting to true, because in local development, I noticed that indexing was failing on some of my projects, due to this build setting not being set.I also made the operations performed in the installer script write to log files in a new bazel-diagnostics directory that lives in derived data. This should make it easier to diagnose issues.
Other notes:
I called
defaults write com.apple.dt.Xcode IDEIndexShowLog YES
from Terminal and then was able to view what xcode's indexer was doing. Note that if Xcode's indexer isn't enabled or if the indexer fails when it runs clang on a source file, Xcode auto-complete functionality won't work! We still need to figure out a way to convince Xcode that it's indexer is working, so that autocomplete operations will work on the bazel generated index.When the sample code that is used for testing in this repo is compiled, no index records or units are generated. Therefore, I did not test my implementation against this sample code. (In the future, we should tweak the sample code so that it will generate index files. This may involve adding some methods/classes/a public API to it.)
When I tested locally, I pointed my own iOS repo to my local rules_ios checkout.
bazel run :ProjectName
.defaults write com.apple.dt.XCode IDEIndexDisable 1
from terminal. This indexer will generate record and unit files (if it works) and then you won't necessarily be using bazel-generated record and unit files.a. Check out the index-import library and build it. The latest version on master includes a binary called validate-index that ensures your unit paths are valid. Run validate-index on DerivedDataForYourProject/Index/DataStore. The command should return an exit status of 0.
b. Run absolute-unit on one of the unit files in DerivedDataForYourProject/Index/DataStore/v5/units to sanity check that units are being generated and mapped correctly.