Skip to content

Latest commit

 

History

History
39 lines (26 loc) · 994 Bytes

README.md

File metadata and controls

39 lines (26 loc) · 994 Bytes

salty

When you can't desugar, add salt!

A Gradle plugin that inspects your bytecode to detect bad functions that are not safe to use on older Android versions.

Usage

Add the plugin:

plugins {
    id("com.gradleup.salty.android").version("0.0.1")
}

Configure the methods to forbid:

salty {
    forbiddenMethods.add("java.util.List.removeFirst")
}

Salty adds a saltyCheck${variantName} task that visits your app and dependencies bytecode using ASM and fails if an usage of any forbidden method is found.

$ ./gradlew :app:saltyCheckDebug

> Task :app:saltyCheckDebug FAILED
e: [...]/debug/com/example/android_test/MainActivity.class uses java.util.List.removeFirst

FAILURE: Build failed with an exception.

saltyCheck${variantName} is added to the check task so that it is run automatically.