GithubHelp home page GithubHelp logo

tyrantdante / rules_xcodeproj Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mobilenativefoundation/rules_xcodeproj

0.0 0.0 0.0 30.27 MB

Bazel rules for generating Xcode projects.

License: MIT License

Shell 3.12% Python 1.97% Swift 57.08% Starlark 37.83%

rules_xcodeproj's Introduction

rules_xcodeproj

This repository contains rules for Bazel that can be used to generate Xcode projects from targets in your workspace.

If you run into any problems with these rules, please check our FAQ, check if another issue already exists and comment on it, or file a new issue!

Features

  • Full support for Xcode features:
    • Indexing (i.e. autocomplete, syntax highlighting, jump to definition)
    • Debugging
    • Runtime sanitizers
    • Inline warnings and errors
    • Fix-its (currently only in BwX mode)
    • Test selection and running
    • Embedded Targets (App Clips, App Extensions, and Watch Apps)
    • Dynamic frameworks
    • SwiftUI Previews
  • Focused Projects
    • Include a subset of your targets in Xcode
    • Unfocused targets are built with Bazel
    • Works in BwX mode as well!
  • Comprehensive Bazel rules support
    • Core Bazel C/C++/Objective-C
    • rules_swift
    • rules_apple
    • rules_ios
    • Most likely your custom rules as well!
  • Minimal configuration needed (see the usage section below)
  • Multiple ways of building your project in Xcode
    • Build your Bazel targets with Bazel (a.k.a Build with Bazel or BwB mode)
    • Build your Bazel targets with Xcode, not Bazel (a.k.a. Build with Xcode or BwX mode)1
  • It “just works”

We’ve also documented the high-level design goals of the ruleset.

Projects using rules_xcodeproj

  • Cash App
  • Envoy Mobile
  • Ergatta
  • Lyft
  • Mercari
  • Robinhood
  • Slack
  • Spotify
  • SwiftLint
  • Ten Ten
  • Tinder

If you are also using rules_xcodeproj for your project, feel free to open a PR to include it in the list above.

Compatibility

rules_xcodeproj Bazel rules_apple rules_swift Xcode macOS Supporting Branch
1.x 5.3–6.x 1.0.1–2.x 1.x 13.3–14.x 12–13.x main

More versions of these tools and rulesets might be supported, but these are the ones we’ve officially tested with.

Installation

From the release you wish to use, copy the Bzlmod or WORKSPACE snippet into your repository.

Usage

Please see the documentation in the docs directory and examples in the examples directory.

Simple iOS example

Given a root level BUILD file:

load(
  "@build_bazel_rules_apple//apple:ios.bzl",
  "ios_application",
  "ios_unit_test",
)
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
load(
    "@com_github_buildbuddy_io_rules_xcodeproj//xcodeproj:defs.bzl",
    "top_level_target",
    "xcodeproj",
)

xcodeproj(
    name = "xcodeproj",
    project_name = "App",
    tags = ["manual"],
    top_level_targets = [
        top_level_target(":App", target_environments = ["device", "simulator"]),
        ":Tests",
    ],
)

ios_application(
    name = "App",
    bundle_id = "com.example.app",
    families = ["iphone", "ipad"],
    infoplists = [":Info.plist"],
    minimum_os_version = "15.0",
    deps = [":Lib"],
)

swift_library(
    name = "Lib",
    srcs = glob(["src/*.swift"]),
)

ios_unit_test(
    name = "Tests",
    bundle_id = "com.example.tests",
    minimum_os_version = "15.0",
    test_host = "//App",
    visibility = ["//visibility:public"],
    deps = [":TestLib"],
)

swift_library(
    name = "TestLib",
    srcs = glob(["test/*.swift"]),
)

You can then create the Xcode project with:

bazel run //:xcodeproj

The generated project will be in the workspace next to the BUILD file at App.xcodeproj.

Footnotes

  1. Build with Bazel mode is the build mode with first class support. We will try to make Build with Xcode mode work with every project, but there are limitations that can make the experience subpar, or not work at all. We recommend using BwB mode if possible.

rules_xcodeproj's People

Contributors

brentleyjones avatar cgrindel avatar maxwelle avatar balestrapatrick avatar chiragramani avatar thii avatar erikkerber avatar jpsim avatar sebastianv1 avatar luispadron avatar ra1028 avatar pennig avatar a2 avatar antonito avatar jszumski avatar keith avatar mattrobmattrob avatar pswaminathan avatar cognitivedisson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.