Rules
j2objc_library
View rule sourcej2objc_library(name, deps, compatible_with, deprecation, distribs, entry_classes, features, jre_deps, licenses, restricted_to, tags, target_compatible_with, testonly, visibility)
This rule uses J2ObjC to translate Java source files to Objective-C, which then can be used used as dependencies of objc_library and objc_binary rules. Detailed information about J2ObjC itself can be found at the J2ObjC site
Custom J2ObjC transpilation flags can be specified using the build flag
--j2objc_translation_flags in the command line.
Please note that the translated files included in a j2objc_library target will be compiled using the default compilation configuration, the same configuration as for the sources of an objc_library rule with no compilation options specified in attributes.
Plus, generated code is de-duplicated at target level, not source level. If you have two different Java targets that include the same Java source files, you may see a duplicate symbol error at link time. The correct way to resolve this issue is to move the shared Java source files into a separate common target that can be depended upon.
Arguments
| Attributes | |
|---|---|
| name | Name; required A unique name for this target. | 
| deps | List of labels; default is  j2objc_library,java_library,java_importandjava_proto_librarytargets that contain
        Java files to be transpiled to Objective-C.All  The J2ObjC translation works differently depending on the type of source Java source
        files included in the transitive closure. For each .java source files included in
         Users can import the J2ObjC-generated header files in their code. The import paths for
        these files are the root-relative path of the original Java artifacts. For example,
         
        If proto_library rules are in the transitive closure of this rule, J2ObjC protos will also
        be generated, compiled and linked-in at the binary level. For proto
         | 
| entry_classes | List of strings; default is  --j2objc_dead_code_removal
        is on. The Java classes should be specified in their canonical names as defined by
        the Java
        Language Specification.
        When flag--j2objc_dead_code_removalis specified, the list of entry classes
        will be collected transitively and used as entry points to perform dead code analysis.
        Unused classes will then be removed from the final ObjC app bundle. | 
| jre_deps | List of labels; default is  j2objc_libraryrule. Only core JRE functionality is linked by default. | 
objc_import
View rule sourceobjc_import(name, deps, hdrs, alwayslink, archives, compatible_with, deprecation, distribs, features, includes, licenses, restricted_to, sdk_dylibs, sdk_frameworks, sdk_includes, tags, target_compatible_with, testonly, textual_hdrs, visibility, weak_sdk_frameworks)
This rule encapsulates an already-compiled static library in the form of an
.a file. It also allows exporting headers and resources using the same
attributes supported by objc_library.
Arguments
| Attributes | |
|---|---|
| name | Name; required A unique name for this target. | 
| deps | List of labels; default is  | 
| hdrs | List of labels; default is  These headers describe the public interface for the library and will be made available for inclusion by sources in this rule or in dependent rules. Headers not meant to be included by a client of this library should be listed in the srcs attribute instead. These will be compiled separately from the source if modules are enabled. | 
| alwayslink | Boolean; default is  srcsandnon_arc_srcs, even if some contain no
          symbols referenced by the binary.
          This is useful if your code isn't explicitly called by code in
          the binary, e.g., if your code registers to receive some callback
          provided by some service. | 
| archives | List of labels; requiredThe list of .afiles provided to Objective-C targets that
        depend on this target. | 
| includes | List of strings; default is  #include/#importsearch paths to add to this target
          and all depending targets.
          This is to support third party and open-sourced libraries that do not
          specify the entire workspace path in their#import/#includestatements.
          The paths are interpreted relative to the package directory, and the
          genfiles and bin roots (e.g.  Unlike COPTS, these flags are added for this rule and every rule that depends on it. (Note: not the rules it depends upon!) Be very careful, since this may have far-reaching effects. When in doubt, add "-iquote" flags to COPTS instead. | 
| sdk_dylibs | List of strings; default is  | 
| sdk_frameworks | List of strings; default is  When linking a top level Apple binary, all SDK frameworks listed in that binary's transitive dependency graph are linked. | 
| sdk_includes | List of strings; default is  #include/#importsearch paths to add to this target
          and all depending targets, where each path is relative to$(SDKROOT)/usr/include. | 
| textual_hdrs | List of labels; default is  | 
| weak_sdk_frameworks | List of strings; default is  | 
objc_library
View rule sourceobjc_library(name, deps, srcs, data, hdrs, alwayslink, compatible_with, copts, defines, deprecation, distribs, enable_modules, exec_compatible_with, exec_properties, features, implementation_deps, includes, licenses, linkopts, module_map, module_name, non_arc_srcs, pch, restricted_to, sdk_dylibs, sdk_frameworks, sdk_includes, tags, target_compatible_with, testonly, textual_hdrs, toolchains, visibility, weak_sdk_frameworks)
This rule produces a static library from the given Objective-C source files.
Arguments
| Attributes | |
|---|---|
| name | Name; required A unique name for this target. | 
| deps | List of labels; default is  | 
| srcs | List of labels; default is  | 
| hdrs | List of labels; default is  These headers describe the public interface for the library and will be made available for inclusion by sources in this rule or in dependent rules. Headers not meant to be included by a client of this library should be listed in the srcs attribute instead. These will be compiled separately from the source if modules are enabled. | 
| alwayslink | Boolean; default is  srcsandnon_arc_srcs, even if some contain no
          symbols referenced by the binary.
          This is useful if your code isn't explicitly called by code in
          the binary, e.g., if your code registers to receive some callback
          provided by some service. | 
| copts | List of strings; default is  Note that for the generated Xcode project, directory paths specified using "-I" flags in copts are parsed out, prepended with "$(WORKSPACE_ROOT)/" if they are relative paths, and added to the header search paths for the associated Xcode target. | 
| defines | List of strings; default is  -Dflags to pass to the compiler. They should be in
          the formKEY=VALUEor simplyKEYand are
          passed not only to the compiler for this target (ascoptsare) but also to allobjc_dependers of this target.
          Subject to "Make variable" substitution and
          Bourne shell tokenization. | 
| enable_modules | Boolean; default is  | 
| implementation_deps | List of labels; default is  deps, the headers and include paths of these libraries (and all their
          transitive deps) are only used for compilation of this library, and not libraries that
          depend on it. Libraries specified withimplementation_depsare still linked
          in binary targets that depend on this library. | 
| includes | List of strings; default is  #include/#importsearch paths to add to this target
          and all depending targets.
          This is to support third party and open-sourced libraries that do not
          specify the entire workspace path in their#import/#includestatements.
          The paths are interpreted relative to the package directory, and the
          genfiles and bin roots (e.g.  Unlike COPTS, these flags are added for this rule and every rule that depends on it. (Note: not the rules it depends upon!) Be very careful, since this may have far-reaching effects. When in doubt, add "-iquote" flags to COPTS instead. | 
| linkopts | List of strings; default is  | 
| module_map | Label; default is  | 
| module_name | String; default is  | 
| non_arc_srcs | List of labels; default is  | 
| pch | Label; default is  | 
| sdk_dylibs | List of strings; default is  | 
| sdk_frameworks | List of strings; default is  When linking a top level Apple binary, all SDK frameworks listed in that binary's transitive dependency graph are linked. | 
| sdk_includes | List of strings; default is  #include/#importsearch paths to add to this target
          and all depending targets, where each path is relative to$(SDKROOT)/usr/include. | 
| textual_hdrs | List of labels; default is  | 
| weak_sdk_frameworks | List of strings; default is  | 
available_xcodes
View rule sourceavailable_xcodes(name, default, deprecation, distribs, features, licenses, tags, testonly, versions, visibility)
Two targets of this rule can be depended on by an xcode_config rule instance to
indicate the remotely and locally available xcode versions.
This allows selection of an official xcode version from the collectively available xcodes.
Arguments
| Attributes | |
|---|---|
| name | Name; required A unique name for this target. | 
| default | Label; nonconfigurable; requiredThe default xcode version for this platform. | 
| versions | List of labels; nonconfigurable; default is  | 
xcode_config
View rule sourcexcode_config(name, default, deprecation, distribs, features, licenses, local_versions, remote_versions, tags, testonly, versions, visibility)
A single target of this rule can be referenced by the --xcode_version_config build
flag to translate the --xcode_version flag into an accepted official xcode version.
This allows selection of an official xcode version from a number of registered aliases.
Arguments
| Attributes | |
|---|---|
| name | Name; required A unique name for this target. | 
| default | Label; nonconfigurable; default is  xcode_versiontarget is to be used if
        noxcode_versionbuild flag is specified. This is required if anyversionsare set. This may not be set ifremote_versionsorlocal_versionsis set. | 
| local_versions | Label; nonconfigurable; default is  xcode_versiontargets that are available locally.
        These are used along withlocal_versionsto select a mutually available
        version. This may not be set ifversionsis set. | 
| remote_versions | Label; nonconfigurable; default is  xcode_versiontargets that are available remotely.
        These are used along withremote_versionsto select a mutually available
        version. This may not be set ifversionsis set. | 
| versions | List of labels; nonconfigurable; default is  xcode_versiontargets that may be used.
        If the value of thexcode_versionbuild flag matches one of the aliases
        or version number of any of the givenxcode_versiontargets, the matching
        target will be used. This may not be set ifremote_versionsorlocal_versionsis set. | 
xcode_version
View rule sourcexcode_version(name, default_ios_sdk_version, default_macos_sdk_version, default_tvos_sdk_version, default_visionos_sdk_version, default_watchos_sdk_version, deprecation, distribs, features, licenses, tags, testonly, version, visibility)
Represents a single official xcode version with acceptable aliases for that xcode version.
See the xcode_config rule.
Arguments
| Attributes | |
|---|---|
| name | Name; required A unique name for this target. | 
| default_ios_sdk_version | String; nonconfigurable; default is  ios_sdk_versionbuild flag will override the value specified here. | 
| default_macos_sdk_version | String; nonconfigurable; default is  macos_sdk_versionbuild flag will override the value specified here. | 
| default_tvos_sdk_version | String; nonconfigurable; default is  tvos_sdk_versionbuild flag will override the value specified here. | 
| default_visionos_sdk_version | String; nonconfigurable; default is  visionos_sdk_versionbuild flag will override the value specified here. | 
| default_watchos_sdk_version | String; nonconfigurable; default is  watchos_sdk_versionbuild flag will override the value specified here. | 
| version | String; nonconfigurable; requiredThe official version number of a version of Xcode. |