Buck: android_manifest()

android_manifest()

This is liable to change in the future.

An android_manifest() rule is used to generate an Android Manifest to be used by android_binary and android_aar rules. This rule takes a skeleton manifest, and merges it with manifests found in any deps.

Arguments

  • name (required) #

    The name of the rule.

  • skeleton (required) #

    Either a build target or a path to a file representing the manifest that will be merged with any manifests associated with this rule's deps.

  • deps (defaults to []) #

    A collection of dependencies that includes android_library rules. The manifest files of the android_library rules will be filtered out to become dependent source files for the manifest.

  • visibility (defaults to []) #

    List of build target patterns that identify the build rules that can include this rule in its deps.

  • licenses (defaults to []) #

    Set of license files for this library. To get the list of license files for a given build rule and all of its dependencies, you can use buck query.

  • labels (defaults to []) #

    Set of arbitrary strings which allow you to annotate a build rule with tags that can be searched for over an entire dependency tree using buck query attrfilter.

Examples

Here's an example of an android_manifest() that has no deps.

android_manifest(
  name = 'my-manifest',
  skeleton = 'AndroidManifestSkeleton.xml',
)

This is what AndroidManfiestSkeleton.xml looks like.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.example"
          android:versionCode="1"
          android:versionName="1.0">

    <uses-sdk targetSdkVersion="19" minSdkVersion="17"/>
    <application
        android:label="@string/app_name"
        android:icon="@drawable/ic_launcher">
        <activity
            android:name="MyActivity"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
</manifest>

You could also use a genrule to generate the manifest file and reference the build target in the skeleton argument.