### Example using --generator_output_groups=all_targets Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/usage.md Example command to build all targets the same way that Xcode does. ```bash bazel run //:xcodeproj -- --generator_output_groups=all_targets build ``` -------------------------------- ### xcschemes.run args example Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/bazel.md Example of how to define command-line arguments for the Run action. ```python xcschemes.run( args = [ "-arg1", xcschemes.arg("-arg2", enabled = False), ], ) ``` -------------------------------- ### Example of args parameter Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/bazel.md Example demonstrating how to use the args parameter with strings and xcschemes.arg. ```bazel xcschemes.test( args = [ "-arg1", xcschemes.arg("-arg2", enabled = False), ], ) ``` -------------------------------- ### xcschemes.run env example Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/bazel.md Example of how to define environment variables for the Run action. ```python xcschemes.run( env = { "VAR1": "value 1", "VAR 2": xcschemes.env_value("value2", enabled = False), }, ) ``` -------------------------------- ### Example usage of xcode_provisioning_profile Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/bazel.md An example demonstrating how to use the xcode_provisioning_profile rule in conjunction with ios_application and local_provisioning_profile. ```starlark ios_application( ..., provisioning_profile = ":xcode_profile", ..., ) xcode_provisioning_profile( name = "xcode_profile", managed_by_xcode = True, provisioning_profile = ":provisioning_profile", ) local_provisioning_profile( name = "provisioning_profile", profile_name = "iOS Team Provisioning Profile: com.example.app", team_id = "A12B3CDEFG", ) ``` -------------------------------- ### Example of env parameter Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/bazel.md Example demonstrating how to use the env parameter with strings and xcschemes.env_value. ```bazel xcschemes.test( env = { "VAR1": "value 1", "VAR 2": xcschemes.env_value("value2", enabled = False), }, ) ``` -------------------------------- ### Example with --download_intermediates Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/usage.md Example command to cause intermediates to be downloaded the same way that a normal Xcode build downloads them. ```bash bazel run //:xcodeproj -- --generator_output_groups=all_targets --download_intermediates build ``` -------------------------------- ### xcschemes.autogeneration_config - run example Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/bazel.md Example of configuring the run action for xcschemes.autogeneration_config. ```starlark xcodeproj( ..., scheme_autogeneration_config = xcschemes.autogeneration_config( run = xcschemes.autogeneration.run( pre_actions = [ xcschemes.pre_post_actions.build_script( title = "Build Start", script_text = "echo build start", ), xcschemes.pre_post_actions.launch_script( title = "Run Start", script_text = "echo run", ), ], ), ), ) ``` -------------------------------- ### xcschemes.run build_targets example Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/bazel.md Example of how to define additional build targets for the Run action. ```python xcschemes.run( build_targets = [ xcschemes.top_level_anchor_target( "//App", ... ), "//App:Test", xcschemes.top_level_build_target( "//CommandLineTool", ... ), ], ) ``` -------------------------------- ### Xcode Configurations Example Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/bazel.md Example of how to define Xcode configurations with different compilation modes. ```starlark { "Dev": { "//command_line_option:compilation_mode": "dbg", }, "AppStore": { "//command_line_option:compilation_mode": "opt", }, } ``` -------------------------------- ### Example of env parameter Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/bazel.md Example demonstrating how to use the env parameter with environment variables. ```python xcschemes.profile( env = { "VAR1": "value 1", "VAR 2": xcschemes.env_value("value2", enabled = False), }, ) ``` -------------------------------- ### Example of args parameter Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/bazel.md Example demonstrating how to use the args parameter with strings and enabled=False. ```python xcschemes.profile( args = [ "-arg1", xcschemes.arg("-arg2", enabled = False), ], ) ``` -------------------------------- ### xcschemes.autogeneration_config - profile example Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/bazel.md Example of configuring the profile action for xcschemes.autogeneration_config. ```starlark xcodeproj( ..., scheme_autogeneration_config = xcschemes.autogeneration_config( profile = xcschemes.autogeneration.profile( pre_actions = [ xcschemes.pre_post_actions.launch_script( title = "Profile Start", script_text = "echo profile", ), ], ), ), ) ``` -------------------------------- ### Example of build_targets parameter Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/bazel.md Example demonstrating how to use the build_targets parameter with different target types. ```bazel xcschemes.test( build_targets = [ xcschemes.top_level_anchor_target( "//App", ... ), "//App:Test", xcschemes.top_level_build_target( "//CommandLineTool", ... ), ], ) ``` -------------------------------- ### Example Invocation Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/tools/generators/target_build_settings/README.md An example of how to invoke the target_build_settings generator with various arguments. ```shell $ target_build_settings \ 0 \ /tmp/pbxproj_partials/target_build_settings \ /tmp/pbxproj_partials/swift_debug_settings \ 1 \ 2 \ /tmp/pbxproj_partials/transitive_swift_debug_settings_0 \ /tmp/pbxproj_partials/transitive_swift_debug_settings_1 \ 4 \ 0 \ 1 \ bazel-out/generated/Info.plist \ project/level/app.entitlements \ '' \ '' \ '' \ 0 \ bazel-out/watchos-arm64_32-min7.0-applebin_watchos-watchos_arm64_32-opt-ST-c58d72818890/bin/Lib \ '' \ '' \ 0 \ -target \ arm64_32-apple-watchos7.0 \ -sdk \ __BAZEL_XCODE_SDKROOT__ \ -debug-prefix-map \ __BAZEL_XCODE_DEVELOPER_DIR__=DEVELOPER_DIR \ -file-prefix-map \ __BAZEL_XCODE_DEVELOPER_DIR__=DEVELOPER_DIR \ -emit-object \ -output-file-map \ bazel-out/watchos-arm64_32-min7.0-applebin_watchos-watchos_arm64_32-opt-ST-c58d72818890/bin/Lib/Lib.output_file_map.json \ -Xfrontend \ -no-clang-module-breadcrumbs \ -swift-version \ 4.2 \ -emit-module-path \ bazel-out/watchos-arm64_32-min7.0-applebin_watchos-watchos_arm64_32-opt-ST-c58d72818890/bin/Lib/Lib.swiftmodule \ -emit-objc-header-path \ bazel-out/watchos-arm64_32-min7.0-applebin_watchos-watchos_arm64_32-opt-ST-c58d72818890/bin/Lib/generated/Lib-Swift.h \ -enable-bare-slash-regex \ -DNDEBUG \ -O \ -whole-module-optimization \ -Xfrontend \ -no-serialize-debugging-options \ -g \ -Xwrapped-swift=-debug-prefix-pwd-is-dot \ -Xwrapped-swift=-file-prefix-pwd-is-dot \ -module-cache-path \ bazel-out/watchos-arm64_32-min7.0-applebin_watchos-watchos_arm64_32-opt-ST-c58d72818890/bin/_swift_module_cache \ -Fexternal/_main~non_module_deps~com_github_krzyzanowskim_cryptoswift/CryptoSwift.xcframework/watchos-arm64_32_armv7k \ -Xcc \ -Fexternal/_main~non_module_deps~com_github_krzyzanowskim_cryptoswift/CryptoSwift.xcframework/watchos-arm64_32_armv7k \ -Xcc \ -iquoteexternal/_main~non_module_deps~com_github_krzyzanowskim_cryptoswift \ -Xcc \ -iquotebazel-out/watchos-arm64_32-min7.0-applebin_watchos-watchos_arm64_32-opt-ST-c58d72818890/bin/external/_main~non_module_deps~com_github_krzyzanowskim_cryptoswift \ -Xcc \ -iquote. \ -Xcc \ -iquotebazel-out/watchos-arm64_32-min7.0-applebin_watchos-watchos_arm64_32-opt-ST-c58d72818890/bin \ -Xcc \ -fmodule-map-file=external/_main~non_module_deps~com_github_krzyzanowskim_cryptoswift/CryptoSwift.xcframework/watchos-arm64_32_armv7k/CryptoSwift.framework/Modules/module.modulemap \ -Xfrontend \ -color-diagnostics \ -num-threads \ 12 \ -module-name \ Lib \ -Xwrapped-swift=-global-index-store-import-path=bazel-out/_global_index_store \ -index-store-path \ bazel-out/watchos-arm64_32-min7.0-applebin_watchos-watchos_arm64_32-opt-ST-c58d72818890/bin/Lib/Lib.indexstore \ -Xfrontend \ -disable-autolink-framework \ -Xfrontend \ CryptoSwift \ -Xfrontend \ -vfsoverlay \ -Xfrontend \ project/relative/overlay.yaml \ -Xcc \ -ivfsoverlay=external/overlay.yaml \ -vfsoverlay \ bazel-out/generated/overlay.yaml \ -Xfrontend \ -explicit-swift-module-map-file \ -Xfrontend \ bazel-out/generated/map.json \ -Xfrontend \ -load-plugin-executable \ -Xfrontend \ bazel-out/generated/macro \ -parse-as-library \ -application-extension \ -static \ -Xcc \ -Os \ -Xcc \ -DNDEBUG=1 \ -Xcc \ -Wno-unused-variable \ -Xcc \ -Winit-self \ -Xcc \ -Wno-extra \ ``` -------------------------------- ### Example invocation Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/tools/generators/pbxproj_prefix/README.md An example of how to invoke the `pbxproj_prefix` generator with various arguments. ```shell $ pbxproj_prefix \ /tmp/pbxproj_partials/pbxproj_prefix \ rules_xcodeproj \ /tmp/workspace \ bazel-output-base/rules_xcodeproj.noindex/build_output_base/execroot/_main/bazel-out/darwin_arm64-dbg/bin/external/_main~internal~rules_xcodeproj_generated/generator/tools/generators/xcodeproj/xcodeproj_execution_root_file \ bazel-out/darwin_arm64-dbg/bin/external/_main~internal~rules_xcodeproj_generated/generator/tools/generators/xcodeproj/xcodeproj_target_ids \ bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/_main~non_module_deps~rules_xcodeproj_index_import/index-import \ 1 \ bazel-out/darwin_arm64-dbg/bin/external/_main~internal~rules_xcodeproj_generated/generator/tools/generators/xcodeproj/xcodeproj_pbxproj_partials/resolved_repositories \ 14.0 \ Release \ enGB \ --organization-name MobileNativeFoundation \ --platforms \ iphonesimulator \ macosx \ watchos \ --xcode-configurations \ Debug \ Release \ --pre-build-script bazel-out/darwin_arm64-dbg/bin/external/_main~internal~rules_xcodeproj_generated/generator/tools/generators/xcodeproj/xcodeproj_pre_build_script ``` -------------------------------- ### Example of build_targets parameter Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/bazel.md Example demonstrating how to use the build_targets parameter with different target types. ```python xcschemes.profile( build_targets = [ xcschemes.top_level_anchor_target( "//App", ... ), "//App:Test", xcschemes.top_level_build_target( "//CommandLineTool", ... ), ], ) ``` -------------------------------- ### Target Build Settings Example Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/tools/generators/target_build_settings/README.md An example of `OTHER_SWIFT_FLAGS` and `SWIFT_COMPILATION_MODE` for a target. ```shell OTHER_SWIFT_FLAGS "-Xcc -working-directory -Xcc $(PROJECT_DIR) -working-directory $(PROJECT_DIR) -Xcc -ivfsoverlay$(OBJROOT)/bazel-out-overlay.yaml -vfsoverlay $(OBJROOT)/bazel-out-overlay.yaml -DNDEBUG -O -I$(BAZEL_OUT)/macos-arm64-min12.0-applebin_macos-darwin_arm64-opt-ST-89c7f8a7bb2e/bin/external/_main~non_module_deps~com_github_apple_swift_argument_parser -I$(BAZEL_OUT)/macos-arm64-min12.0-applebin_macos-darwin_arm64-opt-ST-89c7f8a7bb2e/bin/tools/lib/ToolCommon -I$(BAZEL_OUT)/macos-arm64-min12.0-applebin_macos-darwin_arm64-opt-ST-89c7f8a7bb2e/bin/external/_main~non_module_deps~com_github_apple_swift_collections -I$(BAZEL_OUT)/macos-arm64-min12.0-applebin_macos-darwin_arm64-opt-ST-89c7f8a7bb2e/bin/external/_main~non_module_deps~com_github_kylef_pathkit -I$(BAZEL_OUT)/macos-arm64-min12.0-applebin_macos-darwin_arm64-opt-ST-89c7f8a7bb2e/bin/external/_main~non_module_deps~com_github_michaeleisel_zippyjson -I$(BAZEL_OUT)/macos-arm64-min12.0-applebin_macos-darwin_arm64-opt-ST-89c7f8a7bb2e/bin/external/_main~non_module_deps~com_github_tadija_aexml -I$(BAZEL_OUT)/macos-arm64-min12.0-applebin_macos-darwin_arm64-opt-ST-89c7f8a7bb2e/bin/external/_main~non_module_deps~com_github_tuist_xcodeproj -Xcc -I -Xcc $(BAZEL_EXTERNAL)/_main~non_module_deps~com_github_michaeleisel_jjliso8601dateformatter/Sources/JJLISO8601DateFormatter/include -Xcc -I -Xcc $(BAZEL_OUT)/macos-arm64-min12.0-applebin_macos-darwin_arm64-opt-ST-89c7f8a7bb2e/bin/external/_main~non_module_deps~com_github_michaeleisel_jjliso8601dateformatter/Sources/JJLISO8601DateFormatter/include -Xcc -I -Xcc $(BAZEL_EXTERNAL)/_main~non_module_deps~com_github_michaeleisel_zippyjsoncfamily/Sources/ZippyJSONCFamily/include -Xcc -I -Xcc $(BAZEL_OUT)/macos-arm64-min12.0-applebin_macos-darwin_arm64-opt-ST-89c7f8a7bb2e/bin/external/_main~non_module_deps~com_github_michaeleisel_zippyjsoncfamily/Sources/ZippyJSONCFamily/include -Xcc -iquote -Xcc $(BAZEL_EXTERNAL)/_main~non_module_deps~com_github_michaeleisel_jjliso8601dateformatter -Xcc -iquote -Xcc $(BAZEL_OUT)/macos-arm64-min12.0-applebin_macos-darwin_arm64-opt-ST-89c7f8a7bb2e/bin/external/_main~non_module_deps~com_github_michaeleisel_jjliso8601dateformatter -Xcc -iquote -Xcc $(BAZEL_EXTERNAL)/_main~non_module_deps~com_github_michaeleisel_zippyjsoncfamily -Xcc -iquote -Xcc $(BAZEL_OUT)/macos-arm64-min12.0-applebin_macos-darwin_arm64-opt-ST-89c7f8a7bb2e/bin/external/_main~non_module_deps~com_github_michaeleisel_zippyjsoncfamily -Xcc -iquote -Xcc $(PROJECT_DIR) -Xcc -iquote -Xcc $(BAZEL_OUT)/macos-arm64-min12.0-applebin_macos-darwin_arm64-opt-ST-89c7f8a7bb2e/bin -Xcc -fmodule-map-file=$(BAZEL_OUT)/macos-arm64-min12.0-applebin_macos-darwin_arm64-opt-ST-89c7f8a7bb2e/bin/external/_main~non_module_deps~com_github_michaeleisel_jjliso8601dateformatter/JJLISO8601DateFormatter.swift.modulemap -Xcc -fmodule-map-file=$(BAZEL_OUT)/macos-arm64-min12.0-applebin_macos-darwin_arm64-opt-ST-89c7f8a7bb2e/bin/external/_main~non_module_deps~com_github_michaeleisel_zippyjsoncfamily/ZippyJSONCFamily.swift.modulemap -static -Xcc -Os -Xcc -DNDEBUG=1 -Xcc -Wno-unused-variable -Xcc -Winit-self -Xcc -Wno-extra" SWIFT_COMPILATION_MODE wholemodule ``` -------------------------------- ### Example usage of library_targets Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/bazel.md Example demonstrating how to use the library_targets parameter with both label strings andxcschemes.library_target calls. ```bzl xcschemes.launch_target( # ... library_targets = [ "//Modules/Lib1", xcschemes.library_target( "//Modules/Lib2", # ... ), ], ) ``` -------------------------------- ### Consolidation Map Example 1 Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/tools/generators/pbxtargetdependencies/README.md Example content for another consolidation map file, detailing target mappings. ```text generator.library //tools/generators/legacy:generator.library macos-x86_64-min12.0-applebin_macos-darwin_x86_64-dbg-STABLE-1 0171A3113B ``` -------------------------------- ### Consolidation Map Example 0 Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/tools/generators/pbxtargetdependencies/README.md Example content for a consolidation map file, detailing target mappings. ```text generator //tools/generators/legacy:generator applebin_macos-darwin_x86_64-dbg-STABLE-3 00564AEDC80171A3113B tests.__internal__.__test_bundle //tools/generators/legacy/test:tests.__internal__.__test_bundle applebin_macos-darwin_x86_64-dbg-STABLE-3 005110672D0171A3113B ``` -------------------------------- ### Example usage of the xcodeproj macro Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/bazel.md An example demonstrating how to use the xcodeproj macro to create an Xcode project with specified targets. ```starlark xcodeproj( name = "xcodeproj", project_name = "App", tags = ["manual"], top_level_targets = [ top_level_target(":App", target_environments = ["device", "simulator"]), ":Tests", ], ) ``` -------------------------------- ### Example usage of xcodeproj_extra_files Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/bazel.md Display the README.md file located alongside the Swift library in Xcode ```starlark load("@rules_xcodeproj//xcodeproj:xcodeproj_extra_files.bzl", "xcodeproj_extra_files") swift_library( ... aspect_hints = [":library_extra_files"], ... ) # Display the README.md file located alongside the Swift library in Xcode xcode_project_extra_files( name = "library_extra_files", files = ["README.md"], ) ``` -------------------------------- ### Example usage of library_targets Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/bazel.md Example showing how to use the library_targets attribute with a mix of label strings andxcschemes.library_target calls. ```bazel xcschemes.top_level_anchor_target( ...) library_targets = [ "//Modules/Lib1", xcschemes.library_target( "//Modules/Lib2", ... ), ], ) ``` ```bazel xcschemes.top_level_anchor_target( ...) library_targets = [ xcschemes.library_target("//Modules/Lib1"), xcschemes.library_target( "//Modules/Lib2", ... ), ], ) ``` -------------------------------- ### Loading the xcodeproj rule Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/xcodeproj/internal/docs/bazel.header.md Example of how to load the `xcodeproj` rule in a Bazel BUILD file. ```starlark load("@rules_xcodeproj//xcodeproj:xcodeproj.bzl", "xcodeproj") ``` -------------------------------- ### Example invocation Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/tools/generators/xcschemes/README.md An example of how to invoke the `xcschemes` generator with various arguments. ```shell $ xcschemes \ /tmp/pbxproj_partials/xcschemes \ /tmp/pbxproj_partials/xcschememanagement.plist \ auto \ Debug \ /tmp/workspace \ some/project.xcodeproj \ bazel-output-base/rules_xcodeproj.noindex/build_output_base/execroot/_main/bazel-out/darwin_arm64-dbg/bin/external/_main~internal~rules_xcodeproj_generated/generator/tools/xcodeproj/xcodeproj_extension_point_identifiers \ bazel-output-base/rules_xcodeproj.noindex/build_output_base/execroot/_main/bazel-out/darwin_arm64-dbg/bin/external/_main~internal~rules_xcodeproj_generated/generator/tools/xcodeproj/xcodeproj_pbxproj_partials/execution_actions_file \ bazel-output-base/rules_xcodeproj.noindex/build_output_base/execroot/_main/bazel-out/darwin_arm64-dbg/bin/external/_main~internal~rules_xcodeproj_generated/generator/tools/xcodeproj/xcodeproj_pbxproj_partials/targets_args_env \ bazel-output-base/rules_xcodeproj.noindex/build_output_base/execroot/_main/bazel-out/darwin_arm64-dbg/bin/external/_main~internal~rules_xcodeproj_generated/generator/tools/xcodeproj/xcodeproj_pbxproj_partials/custom_schemes_file \ --consolidation-maps \ /tmp/pbxproj_partials/consolidation_maps/0 \ /tmp/pbxproj_partials/consolidation_maps/1 ``` -------------------------------- ### xcschemes.autogeneration_config - test example Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/bazel.md Example of configuring the test action for xcschemes.autogeneration_config. ```starlark xcodeproj( ..., scheme_autogeneration_config = xcschemes.autogeneration_config( test = xcschemes.autogeneration.test( options = xcschemes.test_options( app_language = "en", app_region = "US", code_coverage = False, ) ) ) ) ``` -------------------------------- ### Example Invocation Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/tools/generators/pbxtargetdependencies/README.md An example command-line invocation for the `pbxtargetdependencies` generator. ```shell $ pbxtargetdependencies \ /tmp/pbxproj_partials/pbxtargetdependencies \ /tmp/pbxproj_partials/pbxtargetdependencies \ /tmp/pbxproj_partials/pbxproject_target_attributes \ /tmp/pbxproj_partials/consolidation_maps_inputs_file \ 14.0 \ auto \ --target-and-test-hosts \ '//tools/generators/legacy/test:tests.__internal__.__test_bundle applebin_macos-darwin_x86_64-dbg-STABLE-3' \ '//tools/generators/legacy:generator applebin_macos-darwin_x86_64-dbg-STABLE-3' ``` -------------------------------- ### Example Invocation Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/tools/generators/swift_debug_settings/README.md An example of how to invoke the swift_debug_settings generator with its command-line arguments. ```shell swift_debug_settings \ 0 \ /tmp/pbxproj_partials/Debug-swift_debug_settings.py \ 'arm64-apple-macosx generator' \ /tmp/pbxproj_partials/generator.rules_xcodeproj.debug_settings \ 'arm64-apple-macosx swiftc' \ /tmp/pbxproj_partials/swiftc.rules_xcodeproj.debug_settings ``` -------------------------------- ### xcschemes.autogeneration_config - scheme_name_exclude_patterns example Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/bazel.md Example of configuring scheme name exclude patterns for xcschemes.autogeneration_config. ```starlark xcodeproj( ..., scheme_name_exclude_patterns = xcschemes.autogeneration_config( scheme_name_exclude_patterns = [ ".*somePattern.*", "^AnotherPattern.*", ], ), ) ``` -------------------------------- ### Configuring Xcode managed provisioning profiles Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/faq.md Example of how to correctly configure provisioning profiles when using Xcode managed profiles with rules_xcodeproj. ```starlark ios_application( ... provisioning_profile = ":xcode_profile", ... ) xcode_provisioning_profile( name = "xcode_profile", managed_by_xcode = True, provisioning_profile = ":provisioning_profile", ) ``` -------------------------------- ### Building all targets in the project using Xcode Previews configuration Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/usage.md This command shows how to build all targets in the project, mimicking the behavior of Xcode Previews, by using a specific Bazel configuration and output groups. ```bash bazel run //:xcodeproj -- --config=swiftuipreviews --generator_output_groups=all_targets build ``` -------------------------------- ### Running aquery through the API Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/usage.md This example demonstrates how to run aquery commands through the rules_xcodeproj API to ensure targets are properly configured and to prevent fetching external dependencies in the primary output base. ```bash bazel run //:xcodeproj -- 'aquery "set(//some:target)"' ``` -------------------------------- ### Example of library_targets in top_level_build_target Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/docs/bazel.md Illustrates how to specify additional library targets, including using the `xcschemes.library_target` function. ```bzl xcschemes.top_level_build_target( # ... other arguments library_targets = [ "//Modules/Lib1", xcschemes.library_target( "//Modules/Lib2", # ... other arguments for library_target ), ], ) ``` -------------------------------- ### Testing Changes in Example Projects Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/CONTRIBUTING.md Command to generate Xcode projects for example projects to test changes. ```bash bazel run //examples/cc:xcodeproj ``` -------------------------------- ### Simple iOS example BUILD file Source: https://github.com/mobilenativefoundation/rules_xcodeproj/blob/main/README.md A BUILD file demonstrating how to configure an iOS application, a library, and unit tests using rules_xcodeproj. ```python load( "@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_unit_test", ) load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") load( "@rules_xcodeproj//xcodeproj:defs.bzl", "top_level_target", "xcodeproj", ) xcode_project( 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", visibility = ["//visibility:public"], 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"]), ) ```