Keep Bazel flags consistent

Whenever a Bazel configuration flag (i.e. --define, --copt) is
changed/added/removed, Bazel must reanalyze the entire build
graph (at least at the moment), which can be expensive.

In order to avoid doing so, we must keep all of the
analysis-cache-affecting flags used during the project generation
phase the same as the flags used during a build inside of Xcode.

There are a few keys points here:
- Make sure all of our Bazel invocations set the --override_repository
  flag and don't change its value between builds and generation
- We use different flags for Swift/non-Swift targets, so we have
  introduced a project-level which specifices which configuration
  flags to use during generation (Swift or non-Swift)
- User builds (from the command line) also follow the same
  restrictions; in order to make it easier for the user, we now have
  a script located inside the generated xcodeproj which allows
  building of a target with the same flags that Tulsi would use.

PiperOrigin-RevId: 204796256
32 files changed
tree: e4f1a840071122da11f92b60fbdc383ca1fc7aec
  1. site/
  2. src/
  3. Tulsi.tulsiproj/
  4. .gitignore
  5. .travis.yml
  6. AUTHORS
  7. BUILD
  8. CONTRIBUTING.md
  9. CONTRIBUTORS
  10. LICENSE
  11. README.md
  12. version.bzl
  13. WORKSPACE
README.md

Tulsi - an Xcode Project Generator For Bazel

Building and installing

  1. Open src/Tulsi.xcodeproj, and within Xcode, build the TulsiApp.

  2. Run the TulsiApp.

Notes

Tulsi-generated Xcode projects use Bazel to build, not Xcode via xcbuild. This means that many common components of an Xcode project are handled differently than you may be used to. Notable differences:

  • BUILD files are the source of truth; most changes made to your Xcode project won't affect the build.
    • Adding new sources to the Xcode project won't include them in your app; they must be added to BUILD files.
    • Changes made to your BUILD files, such as adding new library dependencies, are incorporated automatically when building your generated project. The only time you need to re-run Tulsi is if you want to add additional build targets or have new source files show up in Xcode for editing.
    • The Info.plist file is governed entirely by BUILD rules in Bazel and is not displayed in the Xcode UI.
    • Changes to compilation flags (i.e. -DHELLO) should be made in the BUILD files in order to affect the build; changes made to compilation settings in the Xcode UI will only affect indexing. You may want to regenerate your project using Tulsi after modifying compilation flags.