Skip to content

Commit a48eab8

Browse files
committed
Fix README
1 parent 777c865 commit a48eab8

File tree

1 file changed

+29
-200
lines changed

1 file changed

+29
-200
lines changed

README.md

Lines changed: 29 additions & 200 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
[![Build Status](https://github.com/natario1/MavenPublisher/workflows/Build/badge.svg?event=push)](https://github.com/natario1/MavenPublisher/actions)
2-
[![Release](https://img.shields.io/github/release/natario1/MavenPublisher.svg)](https://github.com/natario1/MavenPublisher/releases)
3-
[![Issues](https://img.shields.io/github/issues-raw/natario1/MavenPublisher.svg)](https://github.com/natario1/MavenPublisher/issues)
1+
[![Build Status](https://github.com/deepmedia/Grease/workflows/Build/badge.svg?event=push)](https://github.com/deepmedia/Grease/actions)
2+
[![Release](https://img.shields.io/github/release/deepmedia/Grease.svg)](https://github.com/deepmedia/Grease/releases)
3+
[![Issues](https://img.shields.io/github/issues-raw/deepmedia/Grease.svg)](https://github.com/deepmedia/Grease/issues)
44

5-
*Need support, consulting, or have any other business-related question? Feel free to <a href="mailto:mat.iavarone@gmail.com">get in touch</a>.*
5+
# Grease
66

7-
*Like the project, make profit from it, or simply want to thank back? Please consider [sponsoring me](https://github.com/sponsors/natario1)!*
8-
9-
# MavenPublisher
10-
11-
A lightweight, handy tool for publishing your maven packages (for example, Android AARs, Java JARs, Kotlin KLibs)
12-
to different kinds of maven repositories. Currently, [Bintray](https://bintray.com) and local directories are supported.
13-
14-
To use any of the publisher plugins, you must configure the plugin repository in your build script:
7+
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:
159

1610
```kotlin
1711
buildscript {
@@ -20,210 +14,45 @@ buildscript {
2014
google()
2115
}
2216
dependencies {
23-
classpath("com.otaliastudios.tools:publisher:0.3.2")
17+
classpath("io.deepmedia.tools:grease:0.2.0")
2418
}
2519
}
2620
```
2721

28-
The publisher plugin uses an older version of itself to publish itself into Bintray's JCenter.
29-
This means that you can check the plugin source code to see an example of how to use it.
30-
31-
For more examples, please take a look at [natario1/Egloo](https://github.com/natario1/Egloo), [natario1/Firestore](https://github.com/natario1/Firestore) or [natario1/Elements](https://github.com/natario1/Elements).
32-
3322
## Usage
3423

35-
To apply the plugin, declare it in your build script with the `com.otaliastudios.tools.publisher` id:
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:
3626

3727
```groovy
38-
apply plugin: 'com.otaliastudios.tools.publisher'
28+
apply plugin: 'com.android.library'
29+
apply plugin: 'io.deepmedia.tools.grease'
3930
```
4031

41-
### Base Configuration
42-
43-
All publishers are configured with the same common fields, although specific publisher
44-
implementations can have extra fields (for example, for authentication). The common configuration
45-
is specified at the root level of the `publisher` block:
32+
Once applied, Grease will create Gradle configurations that you can use to select which of your
33+
dependencies should be bundled in the final fat AAR.
4634

4735
```kotlin
48-
publisher {
49-
// Project name. Defaults to rootProject.name
50-
project.name = "MavenPublisher"
51-
52-
// Project description. Can be null
53-
project.description = "Handy tool to publish maven packages in different repositories."
54-
55-
// Package artifact. Defaults to project's archivesBaseName
56-
project.artifact = "publisher"
57-
58-
// Package group id. Defaults to project's group
59-
project.group = "com.otaliastudios.tools"
60-
61-
// Project url
62-
project.url = "https://github.com/natario1/MavenPublisher"
63-
64-
// Project VCS url. Defaults to project.url
65-
project.vcsUrl = "https://github.com/natario1/MavenPublisher.git"
66-
67-
// Project packaging. Automatically set to AAR for Android libraries
68-
project.packaging = "aar"
69-
70-
// Project licenses
71-
project.addLicense(License.APACHE_2_0)
72-
project.addLicense("My license", "https://mylicense.org")
73-
74-
// Release version. Defaults to project's version
75-
release.version = "0.1.4"
76-
77-
// Release VCS tag. Defaults to "v${release.version}"
78-
release.vcsTag = "v0.1.4"
79-
80-
// Release description. Defaults to "${project.name} {release.vcsTag}"
81-
release.description = "New release"
82-
83-
// Release sources
84-
release.setSources(Release.SOURCES_AUTO) // creates a sources Jar
85-
release.setSources(sourcesJar.get())
86-
87-
// Release docs
88-
release.setDocs(Release.DOCS_AUTO) // create a docs Jar
89-
release.setDocs(dokkaJar.get())
90-
}
91-
```
92-
93-
Actual publishers can then be registered in this block by using their respective functions,
94-
for example:
36+
dependencies {
37+
// Api dependency. This will not be bundled.
38+
api("androidx.core:core:1.3.1")
9539

96-
```kotlin
97-
publisher {
98-
// Common configuration...
99-
project.name = "Project name"
100-
project.description = "Project description"
40+
// Implementation dependency. This will not be bundled.
41+
implementation("androidx.core:core:1.3.1")
10142

102-
bintray {
103-
// Override some fields or add missing ones
104-
project.name = "Project name for bintray"
105-
release.version = "1.0.0-nightly"
106-
}
43+
// Grease dependency! This will be bundled into the final AAR.
44+
grease("androidx.core:core:1.3.1")
10745

108-
directory {
109-
// Override some fields or add missing ones
110-
project.description = "Project description for local directory"
111-
release.version = "1.0.0-rc1"
112-
}
46+
// Build-type, product flavour and variant specific configurations.
47+
// Can be used to enable grease only on specific library variants.
48+
greaseRelease("androidx.core:core:1.3.1")
49+
greaseDebug("androidx.core:core:1.3.1")
11350
}
11451
```
11552

116-
### Specifying the publication contents
117-
118-
You have two options to specify the publication contents. MavenPublisher will try to infer default
119-
values based on the currently applied plugin.
120-
121-
- `publisher.component` : specifies the name of a `SoftwareComponent`. Defaults to "release" for Android projects and "java" for java projects, both of which create components for you.
122-
- `publisher.publication` : specifies the name of a `MavenPublication`. Defaults to null. When this is set, we'll use the publication's `SoftwareComponent` and modify the other publication fields to match the publisher configuration.
123-
124-
Typically, you should specify either one or the other.
125-
126-
### Secret values
127-
128-
Some sensitive values, especially in the auth configuration, are declared as secret.
129-
In this case, instead of passing the real value, you are supposed to pass a **key** to the real
130-
value.
131-
132-
The publisher will use this key and look for the value as follows:
133-
134-
- Look in environment variables
135-
- Search with `project.findProperty(key)`
136-
- Search in `local.properties` file, if present
137-
138-
### Publication tasks
139-
140-
The publisher plugin will add a task named `:publishTo` followed by the publication name.
141-
The publication name depends on the publisher being used (for example, bintray) and the name
142-
that is passed to the configuration. For example:
143-
144-
```kotlin
145-
publisher {
146-
// Common configuration ...
147-
148-
bintray {
149-
// Bintray onfiguration...
150-
}
151-
bintray("foo") {
152-
// Bintray configuration for foo...
153-
}
154-
bintray("bar") {
155-
// Bintray configuration for bar...
156-
}
157-
directory {
158-
// Local dir configuration...
159-
}
160-
directory("abc") {
161-
// Local dir configuration...
162-
}
163-
}
164-
```
165-
166-
In the example above, the following tasks will be available:
167-
168-
- `:publishToBintray`: publishes the default bintray configuration
169-
- `:publishToBintrayFoo`: publishes the `foo` bintray configuration
170-
- `:publishToBintrayBar`: publishes the `bar` bintray configuration
171-
- `:publishToDirectory`: publishes the default directory configuration
172-
- `:publishToDirectoryAbc`: publishes the `abc` bintray configuration
173-
- `:publishAllBintray`: publishes all "bintray" publications
174-
- `:publishAllDirectory`: publishes all "directory" publications
175-
- `:publishAll`: publishes everything
176-
177-
## Local repository publisher
178-
179-
In addition to the common configuration fields, the local publisher will ask you for a path to the
180-
local directory where the final package should be published. It can be set as follows:
181-
182-
```kotlin
183-
publisher {
184-
// Common configuration...
185-
directory {
186-
// Directory configuration...
187-
directory = "build/output"
188-
}
189-
190-
// If needed, you can add other named publications.
191-
directory("other") { ... }
192-
}
193-
```
194-
195-
As described earlier, all the configuration fields that are set in the `directory` block will override
196-
the root level values.
197-
198-
If the directory is not set, the local publisher will publish into the "maven local" repository,
199-
typically `$USER_HOME/.m2/repository` (see [docs](https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.dsl.RepositoryHandler.html#org.gradle.api.artifacts.dsl.RepositoryHandler:mavenLocal())).
200-
201-
## Bintray publisher
202-
203-
In addition to the common configuration fields, to authenticate to Bintray, you will need to pass
204-
a user name, a user key and the Bintray repo name as follows:
205-
206-
```kotlin
207-
publisher {
208-
// Common configuration...
209-
bintray {
210-
// Bintray configuration...
211-
auth.user = "BINTRAY_USER" // defaults to "auth.user"
212-
auth.key = "BINTRAY_KEY" // defaults to "auth.key"
213-
auth.repo = "BINTRAY_REPO" // defaults to "auth.repo"
214-
dryRun = false // true for a dry-run publication for testing
215-
}
216-
217-
// If needed, you can add other named publications.
218-
bintray("other") { ... }
219-
}
220-
```
221-
222-
As described earlier, all the configuration fields that are set in the `bintray` block will override
223-
the root level values.
224-
225-
Note that the `auth` values are [Secret values](#secret-values), so instead of passing the real
226-
value in plain text, a key (to an environment variable or local property) should be passed.
53+
Note that we used `androidx.core:core:1.3.1` as an example, but that is not recommended as it will
54+
likely cause compile issue on projects that consume the Grease AAR, if they already depend on the
55+
`androidx.core:core:1.3.1` (as most project do).
22756

228-
Since there is a default key, there is no need to declare your own keys in the plugin configuration -
229-
you can simply provide values for the default keys (for example, as env properties).
57+
If you don't control the projects that will consume the Grease AAR, you should only bundle in
58+
dependencies that you own, to be sure that they won't be present in the classpath of the consumer.

0 commit comments

Comments
 (0)