Skip to content

Commit

Permalink
Update README with new links
Browse files Browse the repository at this point in the history
Signed-off-by: Keith Smiley <[email protected]>
  • Loading branch information
keith committed Feb 25, 2022
1 parent cf1ca45 commit badb8fe
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Path remapping is done with regex substitution. `index-import` accepts one or mo

### Index File Format

The index consists of two types of files, Unit files and Record files. Both are [LLVM Bitstream](https://www.llvm.org/docs/BitCodeFormat.html#bitstream-format), a common binary format used by LLVM/Clang/Swift. Record files contain no paths and can be simply copied. Only Unit files contain paths, so only unit files need to be rewritten. A read/write API is available in the `clangIndex` library. `index-import` uses [`IndexUnitReader`](https://github.com/apple/swift-clang/blob/swift-5.0-branch/include/clang/Index/IndexUnitReader.h) and [`IndexUnitWriter`](https://github.com/apple/swift-clang/blob/swift-5.0-branch/include/clang/Index/IndexUnitWriter.h).
The index consists of two types of files, Unit files and Record files. Both are [LLVM Bitstream](https://www.llvm.org/docs/BitCodeFormat.html#bitstream-format), a common binary format used by LLVM/Clang/Swift. Record files contain no paths and can be simply copied. Only Unit files contain paths, so only unit files need to be rewritten. A read/write API is available in the `clangIndex` library. `index-import` uses [`IndexUnitReader`](https://github.com/apple/llvm-project/blob/swift/release/5.5/clang/include/clang/Index/IndexUnitReader.h) and [`IndexUnitWriter`](https://github.com/apple/llvm-project/blob/swift/release/5.5/clang/include/clang/Index/IndexUnitWriter.h).

## Resources

Expand All @@ -44,7 +44,7 @@ index-import \
"$build_dir2/Index/DataStore"
```

A more complex example is importing an index from a [Bazel](https://bazel.build) built project. This example makes would be run as an Xcode "Run Script" build phase, which provides many environment variables, including: `SRCROOT`, `CONFIGURATION_TEMP_DIR`, `ARCHS`.
A more complex example is importing an index from a [Bazel](https://bazel.build) built project. This example would be run as an Xcode "Run Script" build phase, which provides many environment variables, including: `SRCROOT`, `CONFIGURATION_TEMP_DIR`, `ARCHS`.

```sh
#!/bin/bash
Expand Down Expand Up @@ -75,15 +75,13 @@ index-import \

## Build Instructions

The build uses [CMake](https://cmake.org) because [swift-clang](https://www.github.com/apple/swift-clang) uses CMake. The `index-import` build script is small, but depends on the larger swift-clang project. To build `index-import`, first [install the tools required by Swift](https://github.com/apple/swift/blob/main/docs/HowToGuides/GettingStarted.md#system-requirements), then build swift-clang by following the [Swift build instructions](https://github.com/apple/swift/blob/main/docs/HowToGuides/GettingStarted.md#building-the-project-for-the-first-time).
The build uses [CMake](https://cmake.org) because [Apple's LLVM fork](https://github.com/apple/llvm-project) uses CMake. The `index-import` build script is small, but depends on the libraries from LLVM. To build `index-import`, first [install the tools required by Swift](https://github.com/apple/swift/blob/main/docs/HowToGuides/GettingStarted.md#system-requirements), then build swift by following the [Swift build instructions](https://github.com/apple/swift/blob/main/docs/HowToGuides/GettingStarted.md#building-the-project-for-the-first-time).

When building Swift, keep the following in mind:

1. Checkout the desired release branch of Swift
1. Checkout the desired release branch of Swift using something like `./swift/utils/update-checkout --clone --scheme release/5.5`.
2. Build Swift using `--release`/`-R` for performance

To checkout a specific version of Swift, use the `update-checkout` script. For example: `./swift/utils/update-checkout --clone --tag swift-5.0.1-RELEASE`.

Building all of Swift can take a long time, and most of that isn't needed by `index-import`. A faster way to build `index-import`, is to build only `libIndexStore.dylib`. Here are the commands to do just that:

```sh
Expand Down

0 comments on commit badb8fe

Please sign in to comment.