Skip to content

Commit 980ff44

Browse files
committed
README info
1 parent e550384 commit 980ff44

File tree

1 file changed

+27
-28
lines changed

1 file changed

+27
-28
lines changed

README.md

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,26 @@
55
# Grease
66

77
A Gradle plugin for creating fat AARs, useful for distributing multiple modules in a single file.
8-
To install the plugin, you must configure the build script classpath:
8+
To install the plugin, apply it to your Android project:
99

1010
```kotlin
11-
buildscript {
11+
// settings.gradle.kts
12+
pluginManagement {
1213
repositories {
13-
jcenter()
14-
google()
15-
}
16-
dependencies {
17-
classpath("io.deepmedia.tools:grease:0.2.0")
14+
mavenCentral()
1815
}
1916
}
20-
```
2117

22-
## Usage
18+
// build.gradle.kts
19+
plugins {
20+
id("com.android.library")
21+
id("io.deepmedia.tools.grease") version "0.4.0"
22+
}
23+
```
2324

24-
To apply the plugin, declare it in your build script with the `io.deepmedia.tools.grease` id.
25-
This must be done after the com.android.library plugin:
25+
Note: it is important that Grease is applied *after* the Android library plugin.
2626

27-
```groovy
28-
apply plugin: 'com.android.library'
29-
apply plugin: 'io.deepmedia.tools.grease'
30-
```
27+
## Usage
3128

3229
Once applied, Grease will create Gradle configurations that you can use to select which of your
3330
dependencies should be bundled in the final fat AAR.
@@ -61,19 +58,21 @@ dependencies that you own, to be sure that they won't be present in the classpat
6158

6259
### Transitivity
6360

64-
When you add a grease dependency, by default all transitive dependencies are greased as well, so
65-
they will become part of the fat AARs. To avoid this, you can mark the configuration as non transitive:
61+
By default, declaring a specific grease dependency **will not** include transitive dependencies.
62+
To do so, you can use grease configurations ending in `Tree`:
6663

6764
```kotlin
68-
configurations["grease"].isTransitive = false
69-
configurations["greaseRelease"].isTransitive = false
70-
configurations["greaseDebug"].isTransitive = false
71-
72-
// Variant specific configurations are created lazily so you must wait for them to be
73-
// available before modifying them.
74-
configurations.configureEach {
75-
if (name == "greaseBlueCircleDebug") {
76-
isTransitive = false
77-
}
65+
dependencies {
66+
grease("my-package:artifact:1.0.0") // not transitive
67+
greaseTree("my-other-package:other-artifact:1.0.0") // transitive
7868
}
79-
```
69+
```
70+
71+
### Relocations
72+
73+
We support relocations through the popular [Shadow](https://github.com/GradleUp/shadow) plugin. Inside the `grease`
74+
extension, you can use:
75+
76+
- `relocate(prefix: String)` to relocate all included packages by prefixing them with the given prefix. Defaults to `"grease"`.
77+
- `relocate(from: String, to: String, configure: Action<SimpleRelocator>)` to register a package-specific relocator,
78+
as described in the [shadow plugin docs](https://gradleup.com/shadow/configuration/relocation/#relocating-packages)

0 commit comments

Comments
 (0)