Bazel
About Bazel Getting started User guide Reference Extending Community Versions
  • 6.2
  • 6.1
  • 6.0
  • 5.4.1
  • 4.2.4
  • Nightly
  • More…
  • English
  • Bahasa Indonesia
  • Deutsch
  • Español
  • Español – América Latina
  • Français
  • Italiano
  • Polski
  • Português
  • Português – Brasil
  • Tiếng Việt
  • Türkçe
  • Русский
  • עברית
  • العربيّة
  • فارسی
  • हिंदी
  • বাংলা
  • ภาษาไทย
  • 中文 – 简体
  • 中文 – 繁體
  • 日本語
  • 한국어
GitHub
  • Guides to maximize Bazel's power through advanced concepts and extensions
Concepts Writing rules Distributing rules APIs
Bazel
  • About Bazel
  • Getting started
  • User guide
  • Reference
  • Extending
    • Concepts
    • Writing rules
    • Distributing rules
    • APIs
  • Community
  • Versions
    • More
  • GitHub
  • Build API
    • Overview
    • Global functions
      • Overview
      • .bzl files
      • All Starlark files
      • BUILD files
      • MODULE.bazel files
      • WORKSPACE files
    • Configuration Fragments
      • Overview
      • apple
      • bazel_py
      • coverage
      • cpp
      • j2objc
      • java
      • objc
      • platform
      • proto
      • py
      • swift
    • Providers
      • Overview
      • AnalysisTestResultInfo
      • AndroidNeverLinkLibrariesProvider
      • AppleDebugOutputs
      • AppleDynamicFramework
      • AppleExecutableBinary
      • BaselineProfileProvider
      • CcInfo
      • CcToolchainConfigInfo
      • CcToolchainInfo
      • ConstraintCollection
      • ConstraintSettingInfo
      • ConstraintValueInfo
      • DebugPackageInfo
      • DefaultInfo
      • ExecutionInfo
      • FeatureFlagInfo
      • file_provider
      • FilesToRunProvider
      • GeneratedExtensionRegistryProvider
      • IncompatiblePlatformProvider
      • InstrumentedFilesInfo
      • java_compilation_info
      • java_output_jars
      • JavaInfo
      • JavaPluginData
      • JavaPluginInfo
      • JavaRuntimeInfo
      • JavaToolchainInfo
      • ObjcProvider
      • OutputGroupInfo
      • PlatformInfo
      • ProguardSpecProvider
      • ProtoRegistryProvider
      • PyInfo
      • PyRuntimeInfo
      • RunEnvironmentInfo
      • TemplateVariableInfo
      • ToolchainInfo
      • ToolchainTypeInfo
      • XcodeProperties
      • XcodeVersionConfig
    • Built-in Types
      • Overview
      • Action
      • actions
      • apple_platform
      • apple_platform_type
      • apple_toolchain
      • Args
      • Aspect
      • Attribute
      • bazel_module
      • bazel_module_tags
      • BuildSetting
      • CcCompilationOutputs
      • CcLinkingOutputs
      • CompilationContext
      • configuration
      • ctx
      • depset
      • DirectoryExpander
      • DottedVersion
      • exec_result
      • ExecGroupCollection
      • ExecGroupContext
      • ExecTransitionFactory
      • extension_metadata
      • FeatureConfiguration
      • File
      • fragments
      • java_annotation_processing
      • java_output
      • Label
      • LateBoundDefault
      • LibraryToLink
      • License
      • LinkerInput
      • LinkingContext
      • module_ctx
      • native_rule_transition
      • path
      • Provider
      • repository_ctx
      • repository_os
      • repository_rule
      • root
      • rule
      • rule_attributes
      • runfiles
      • struct
      • SymlinkEntry
      • tag_class
      • Target
      • TemplateDict
      • toolchain_type
      • ToolchainContext
      • transition
    • Top-level Modules
      • Overview
      • apple_common
      • attr
      • cc_common_internal_do_not_use
      • cmd_helper
      • config
      • config_common
      • coverage_common
      • java_common
      • native
      • platform_common
      • proto
      • proto_common
      • testing
    • Core Starlark data types
      • Overview
      • bool
      • builtin_function_or_method
      • dict
      • float
      • function
      • int
      • json
      • list
      • range
      • string
      • tuple
    • Repository rules
      • Overview
      • git
      • http
      • utils
  • 6.2
  • 6.1
  • 6.0
  • 5.4.1
  • 4.2.4
  • Nightly
  • More…
Save the Date: BazelCon 2023 will be held October 24-25 at Google Munich! Learn more
  • Bazel
  • Extending
  • APIs

rule

Report an issueopen_in_new View sourceopen_in_new

A callable value representing the type of a native or Starlark rule. Calling the value during evaluation of a package's BUILD file creates an instance of the rule and adds it to the package's target set. For more information, visit this page aboutRules.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2023-04-17 UTC.

  • Stay connected

    • Blog
    • GitHub
  • Support

    • Support
    • Issue tracker
    • Slack
    • Stack Overflow
  • Terms
  • Privacy
  • English
  • Bahasa Indonesia
  • Deutsch
  • Español
  • Español – América Latina
  • Français
  • Italiano
  • Polski
  • Português
  • Português – Brasil
  • Tiếng Việt
  • Türkçe
  • Русский
  • עברית
  • العربيّة
  • فارسی
  • हिंदी
  • বাংলা
  • ภาษาไทย
  • 中文 – 简体
  • 中文 – 繁體
  • 日本語
  • 한국어