https://github.com/gradleup/salty
If you can't desugar, add salt!
https://github.com/gradleup/salty
Last synced: 5 months ago
JSON representation
If you can't desugar, add salt!
- Host: GitHub
- URL: https://github.com/gradleup/salty
- Owner: GradleUp
- License: mit
- Created: 2024-12-03T22:48:36.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-04T15:15:26.000Z (about 1 year ago)
- Last Synced: 2025-04-06T16:49:36.082Z (9 months ago)
- Language: Kotlin
- Homepage:
- Size: 772 KB
- Stars: 12
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
## 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.
- See https://youtrack.jetbrains.com/issue/KT-71375
- See https://jakewharton.com/kotlins-jdk-release-compatibility-flag/
## Usage
Add the plugin:
```kotlin
plugins {
id("com.gradleup.salty.android").version("0.0.1")
}
```
Configure the methods to forbid:
```kotlin
salty {
forbiddenMethods.add("java.util.List.removeFirst")
}
```
Salty adds a `saltyCheck${variantName}` task that visits your app and dependencies bytecode using [ASM](https://asm.ow2.io/) 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.