Home

Awesome

metalava-gradle

Build Gradle Plugin Portal Metalava

A Gradle plugin for Metalava, AOSP's tool for API metadata extraction and compatibility tracking.

Supported Plugins

This plugin currently supports the following plugins:

Setup

Kotlin

buildscript {
    repositories {
        maven("https://plugins.gradle.org/m2/")
    }
    dependencies {
        classpath("me.tylerbwong.gradle.metalava:plugin:<current_version>")
    }
}

apply(plugin = "me.tylerbwong.gradle.metalava")

or, using the new plugin API

plugins {
    id("me.tylerbwong.gradle.metalava") version "<current_version>"
}

Groovy

buildscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath "me.tylerbwong.gradle.metalava:plugin:<current_version>"
    }
}

apply plugin: "me.tylerbwong.gradle.metalava"

Also ensure that Google's Maven Repository is added to your project.

Usage

This plugin registers the following tasks:

metalavaGenerateSignature - Generates a Metalava signature descriptor file at a specified location.

metalavaCheckCompatibility - Checks API compatibility between the code base and the current API.

For Android library modules, a task is created for each build variant (e.g. metalavaGenerateSignatureRelease)

The plugin can also be configured using the metalava extension block

plugins {
    id("me.tylerbwong.gradle.metalava") version "<current_version>"
}

...

metalava {
    format.set(Format.V4)
    filename.set("api.txt")
    ...
}

Check out the samples for more example usages and see MetalavaExtension for all configurable options.

License

Copyright 2024 Tyler Wong

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.