Coder Social home page Coder Social logo

mobilenativefoundation / rules_xcodeproj Goto Github PK

View Code? Open in Web Editor NEW
512.0 22.0 80.0 59.82 MB

Bazel rules for generating Xcode projects.

License: MIT License

Starlark 35.19% Swift 60.86% Shell 1.49% Python 2.45%
bazel xcode xcodeproj bazel-rules ios macos swift tvos watchos visionos

rules_xcodeproj's People

Contributors

acbdev avatar balestrapatrick avatar brentleyjones avatar cgrindel avatar chiragramani avatar cognitivedisson avatar danaospo avatar david-lam avatar erikkerber avatar gferon avatar jpsim avatar keith avatar luispadron avatar markvasiv avatar mattrobmattrob avatar maxwelle avatar mjburghard avatar narlei avatar pennig avatar polac24 avatar pswaminathan avatar ra1028 avatar sanju-naik avatar sebastianv1 avatar sergeykhliustin avatar thiagohmcruz avatar thii avatar tinder-owenthomas avatar wendyliga avatar yongjincho92 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rules_xcodeproj's Issues

Feature Request: Enable Bazel Starlark Linting and Formatting

Tasks

  • Add Bazel target that can be used to check for lint and formatting issues using Buildifier
  • Add Bazel target that can fix lint and formatting issues using Buildifier.
  • Update the existing codebase to address existing lint and formatting issues.
  • Update the CI pipeline to execute the check target.

Suggested Implementation

  • First PR
    • Add keith/buildifier-prebuilt as a dev-only dependency.
    • Implement two runnable Bazel targets: one to check the lint issues and one to fix issues.
  • Second PR
    • Fix all of the existing lint issues
    • Add another entry to bazel_commands in the buildbuddy.yml file to execute the check Bazel target.

Address Bazel Starlark lint warnings about module visibility

There are a number of # buildifier: disable=bzl-visibility directives sprinkled throughout the codebase. The primary issue is that by convention code under private or internal directories should not be accessible in other parts of the codebase. We should discuss how we want visibility to work in the repository and then update the code so that these directives can be removed.

Bug: Product paths can clash

Describe the bug

Currently the path of produced products in the Products group is set to target.product.path.lastComponent. This means that targets with the same output name at different parts in the build graph will collide:

Multiple commands produce '/Users/brentley/Library/Developer/Xcode/DerivedData/cc_binary-ddhijfwpfdtklsexaboctfhzpnhc/Build/Products/Debug/liblib.a':

  1. Target 'cc_example__lib' (project 'cc_binary'): Libtool /Users/brentley/Library/Developer/Xcode/DerivedData/cc_binary-ddhijfwpfdtklsexaboctfhzpnhc/Build/Products/Debug/liblib.a normal
  2. Target 'examples_cc_binary_lib_lib' (project 'cc_binary'): Libtool /Users/brentley/Library/Developer/Xcode/DerivedData/cc_binary-ddhijfwpfdtklsexaboctfhzpnhc/Build/Products/Debug/liblib.a normal

Expected behavior

Just like how target names are disambiguated, product paths should be as well. In the above example, I think they should fall back to libcc_example__lib.a and libexamples_cc_binary_lib_lib.a. I haven't checked, but I assume there will be an issue when there are multiple configurations of the same product as well, and in that case the config hash should be added as well.

Additional context

This is where the path is currently set:
https://github.com/buildbuddy-io/rules_xcodeproj/blob/d778db82f56e3e29f3a0bfc2b39334b43654cf55/tools/generator/src/Generator%2BCreateProducts.swift#L14

It can be set to anything here, and the rest of the system references that value, so this is the only place (besides tests) that needs to have an effective change.

We should probably leverage DisambiguatedTarget, as it's already responsible for providing a unique target name, and the logic to unique the product name can probably live in Generator.disambiguateTargets():
https://github.com/buildbuddy-io/rules_xcodeproj/blob/d778db82f56e3e29f3a0bfc2b39334b43654cf55/tools/generator/src/Generator%2BDisambiguateTargets.swift#L4-L12

Create schemes

Currently we let Xcode create the schemes for us. This is finicky, and we will want to customize how the schemes are created, especially when Building with Bazel.

Fully support Bazel generated files

  • Show generated sources in Xcode: #65
  • Enable building of the generated sources listed in Xcode, from the command line: #66
  • Xcode builds generated sources automatically (as a dependency of other targets): #113
  • Show other generated files in Xcode (resources, entitlements, Info.plists, etc.)
  • Show inputs of generated files, transitively, in Xcode: #114
  • Don't create Xcode targets for tools dependencies: #212

Feature Request: Add Bazel integration tests

What

Implement Bazel integration tests that confirm that the functionality in this project works with select versions of Bazel.

How

  • Add rules_bazel_integration_test as a dev-only dependency.
  • Implement an integration test based upon the examples/ios_app in a similar manner to the existing fixture tests.
  • Define an integration test suite to execute the integration tests.

I will put together one or more PRs with the above functionality. I will reference this issue.

Feature Request: Make the spec diff tests more resilient

While working on #115, the spec diff tests began failing (see below . After inspection most of the issues are related to the sort order for the required_links and the Xcode targets.

|| ==================== Test output for //test:xcodeproj_generator:
|| Spec doesn't match expected:
|| 25d24
|| <         "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/tools/generator/libgenerator.library.a",
|| 27c26,27
|| <         "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_pointfreeco_xctest_dynamic_overlay/libXCTestDynamicOverlay.a"
|| ---
|| >         "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_pointfreeco_xctest_dynamic_overlay/libXCTestDynamicOverlay.a",
|| >         "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/tools/generator/libgenerator.library.a"
|| 30c30
|| <         "@com_github_kylef_pathkit//:PathKit darwin_x86_64-fastbuild-ST-1b9bd654f600",
|| ---
|| >         "@com_github_tadija_aexml//:AEXML darwin_x86_64-fastbuild-ST-1b9bd654f600",
|| 72,73c72,73
|| <                 "PRODUCT_MODULE_NAME": "PathKit",
|| <                 "PRODUCT_NAME": "PathKit",
|| ---
|| >                 "PRODUCT_MODULE_NAME": "AEXML",
|| >                 "PRODUCT_NAME": "AEXML",
|| 83c83
|| <             "label": "@com_github_kylef_pathkit//:PathKit",
|| ---
|| >             "label": "@com_github_tadija_aexml//:AEXML",
|| 85c85
|| <             "name": "PathKit",
|| ---
|| >             "name": "AEXML",
|| 88,91c88,91
|| <                     "name": "PathKit.swiftmodule",
|| <                     "swiftdoc": "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_kylef_pathkit/PathKit.swiftdoc",
|| <                     "swiftmodule": "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_kylef_pathkit/PathKit.swiftmodule",
|| <                     "swiftsourceinfo": "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_kylef_pathkit/PathKit.swiftsourceinfo"
|| ---
|| >                     "name": "AEXML.swiftmodule",
|| >                     "swiftdoc": "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_tadija_aexml/AEXML.swiftdoc",
|| >                     "swiftmodule": "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_tadija_aexml/AEXML.swiftmodule",
|| >                     "swiftsourceinfo": "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_tadija_aexml/AEXML.swiftsourceinfo"
|| 100,101c100,101
|| <                 "name": "PathKit",
|| <                 "path": "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_kylef_pathkit/libPathKit.a",
|| ---
|| >                 "name": "AEXML",
|| >                 "path": "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_tadija_aexml/libAEXML.a",
|| 105c105,109
|| <                 "external/com_github_kylef_pathkit/Sources/PathKit.swift"
|| ---
|| >                 "external/com_github_tadija_aexml/Sources/AEXML/Document.swift",
|| >                 "external/com_github_tadija_aexml/Sources/AEXML/Element.swift",
|| >                 "external/com_github_tadija_aexml/Sources/AEXML/Error.swift",
|| >                 "external/com_github_tadija_aexml/Sources/AEXML/Options.swift",
|| >                 "external/com_github_tadija_aexml/Sources/AEXML/Parser.swift"
|| 109c113
|| <         "@com_github_tadija_aexml//:AEXML darwin_x86_64-fastbuild-ST-1b9bd654f600",
|| ---
|| >         "@com_github_kylef_pathkit//:PathKit darwin_x86_64-fastbuild-ST-1b9bd654f600",
|| 151,152c155,156
|| <                 "PRODUCT_MODULE_NAME": "AEXML",
|| <                 "PRODUCT_NAME": "AEXML",
|| ---
|| >                 "PRODUCT_MODULE_NAME": "PathKit",
|| >                 "PRODUCT_NAME": "PathKit",
|| 162c166
|| <             "label": "@com_github_tadija_aexml//:AEXML",
|| ---
|| >             "label": "@com_github_kylef_pathkit//:PathKit",
|| 164c168
|| <             "name": "AEXML",
|| ---
|| >             "name": "PathKit",
|| 167,170c171,174
|| <                     "name": "AEXML.swiftmodule",
|| <                     "swiftdoc": "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_tadija_aexml/AEXML.swiftdoc",
|| <                     "swiftmodule": "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_tadija_aexml/AEXML.swiftmodule",
|| <                     "swiftsourceinfo": "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_tadija_aexml/AEXML.swiftsourceinfo"
|| ---
|| >                     "name": "PathKit.swiftmodule",
|| >                     "swiftdoc": "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_kylef_pathkit/PathKit.swiftdoc",
|| >                     "swiftmodule": "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_kylef_pathkit/PathKit.swiftmodule",
|| >                     "swiftsourceinfo": "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_kylef_pathkit/PathKit.swiftsourceinfo"
|| 179,180c183,184
|| <                 "name": "AEXML",
|| <                 "path": "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_tadija_aexml/libAEXML.a",
|| ---
|| >                 "name": "PathKit",
|| >                 "path": "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_kylef_pathkit/libPathKit.a",
|| 184,188c188
|| <                 "external/com_github_tadija_aexml/Sources/AEXML/Document.swift",
|| <                 "external/com_github_tadija_aexml/Sources/AEXML/Element.swift",
|| <                 "external/com_github_tadija_aexml/Sources/AEXML/Error.swift",
|| <                 "external/com_github_tadija_aexml/Sources/AEXML/Options.swift",
|| <                 "external/com_github_tadija_aexml/Sources/AEXML/Parser.swift"
|| ---
|| >                 "external/com_github_kylef_pathkit/Sources/PathKit.swift"
|| 421,422c421,422
|| <                 "@com_github_kylef_pathkit//:PathKit darwin_x86_64-fastbuild-ST-1b9bd654f600",
|| <                 "@com_github_tuist_xcodeproj//:XcodeProj darwin_x86_64-fastbuild-ST-1b9bd654f600"
|| ---
|| >                 "@com_github_tuist_xcodeproj//:XcodeProj darwin_x86_64-fastbuild-ST-1b9bd654f600",
|| >                 "@com_github_kylef_pathkit//:PathKit darwin_x86_64-fastbuild-ST-1b9bd654f600"
|| 784,785c784,785
|| <                 "//tools/generator:generator.library darwin_x86_64-fastbuild-ST-1b9bd654f600",
|| <                 "@com_github_pointfreeco_swift_custom_dump//:CustomDump darwin_x86_64-fastbuild-ST-1b9bd654f600"
|| ---
|| >                 "@com_github_pointfreeco_swift_custom_dump//:CustomDump darwin_x86_64-fastbuild-ST-1b9bd654f600",
|| >                 "//tools/generator:generator.library darwin_x86_64-fastbuild-ST-1b9bd654f600"
|| 882a883,884
|| >                 "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_pointfreeco_swift_custom_dump/libCustomDump.a",
|| >                 "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_pointfreeco_xctest_dynamic_overlay/libXCTestDynamicOverlay.a",
|| 886,888c888
|| <                 "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_kylef_pathkit/libPathKit.a",
|| <                 "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_pointfreeco_swift_custom_dump/libCustomDump.a",
|| <                 "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_pointfreeco_xctest_dynamic_overlay/libXCTestDynamicOverlay.a"
|| ---
|| >                 "bazel-out/darwin_x86_64-fastbuild-ST-1b9bd654f600/bin/external/com_github_kylef_pathkit/libPathKit.a"
|| 
|| Run `bazel run //test/fixtures:update` if you wish to accept these changes.
|| ================================================================================

Support `ios_app_clip`

  • Fix support for ios_app_clip if needed
  • Add "Embed App Clips" PBXCopyFilesBuildPhase
  • Add example to //examples/ios_app

Support `{ios,macos,tvos,watchos}_application`

  • ios_application
  • macos_application
  • tvos_application
  • watchos_application

For each:

  • Check if it's already supported, and if not, make required changes
  • Add an example
  • Add a fixture test

For watchos_application:

  • Also support "WatchApp for iOS App" with "Embed Watch Content" PBXCopyFilesBuildPhase : #718

Non-minimal fields that need support:

  • Fully support app_icons: #730
  • Support alternate_icons: #1125
  • Support codesignopts: #593
  • Support entitlements: #367
  • Support executable_name: #721
  • Support frameworks: #1163
  • Support infoplists: #225
  • Support launch_images: #713
  • Support launch_storyboard: #712
  • Support provisioning_profile
  • #1653
  • Support strings: #1176

Feature Request: Make `cc_library` target names pretty

Currently a cc_library at //examples/cc_binary/lib:lib will have a a target name of examples_cc_binary_lib_lib. This is the same for objc_library or swift_library, expect when module_name is set.

I think when there is no ambiguity between targets we should use name instead of the sanitized label. Does the name provide value as is (since you have to do includes as #include "examples/cc_binary/lib/header.h)?

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.