Skip to content

Commit

Permalink
Merge pull request #16 from LemonadeLabInc/gradle_property_for_auto_p…
Browse files Browse the repository at this point in the history
…lugin_apply

feat: switch plugin application by flag
  • Loading branch information
tkcmrc authored Jul 16, 2020
2 parents 97d0bc6 + 5c209fd commit 606dd78
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 18 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ customize the standard build conventions to the ones used at

Supported Version
-----------------
* Gradle 2.13 - 4.0.1
* Android 1.5.0/2.1.0 - 2.3.0
* Gradle 2.13 - 5.6.4
* Android plugin 3.6.0

In order to take advantage of the latest versions of Gradle and Android, see [updating.md](updating.md).

Expand Down Expand Up @@ -78,6 +78,7 @@ This plugin will:
plugin was specified in the build file.
* Add the [S3 Repository Plugin](#s3-repository-plugin) if the project has
the `s3.repository` property or `S3_REPOSITORY` environment variable.
> <small>_Note:_ if you'd like to avoid using these libraries, set `leomo.enableAutoPluginApply` property (or `LEOMO_ENABLE_AUTO_PLUGIN_APPLY` environment variable) to false. Default true.</small>
The plugin will also inject a `lemonade` extension in the project containing
few utility methods:
Expand Down
34 changes: 20 additions & 14 deletions src/main/groovy/de/lemona/gradle/plugins/GradlePlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,29 @@ class GradlePlugin implements Plugin<Project> {
// Configure the project
project.configure(project) {

// Trigger actions on our plugins
plugins.withId('java') { project.apply plugin: 'de.lemona.gradle.java' }
plugins.withId('java-library') { project.apply plugin: 'de.lemona.gradle.java' }
plugins.withId('maven-publish') { project.apply plugin: 'de.lemona.gradle.publish' }
Boolean _autoPluginApply = Utilities.resolveValue(project, 'leomo.enableAutoPluginApply', 'LEOMO_ENABLE_AUTO_PLUGIN_APPLY', true).toBoolean()

plugins.withId('com.android.application') {
project.apply plugin: 'de.lemona.gradle.android'
}
plugins.withId('com.android.library') {
project.apply plugin: 'de.lemona.gradle.android'
}
if (_autoPluginApply) {
logger.debug('Start applying suitable plugins')

plugins.withId('com.jfrog.bintray') { project.apply plugin: 'de.lemona.gradle.bintray' }
// Trigger actions on our plugins
plugins.withId('java') { project.apply plugin: 'de.lemona.gradle.java' }
plugins.withId('java-library') { project.apply plugin: 'de.lemona.gradle.java' }
plugins.withId('maven-publish') { project.apply plugin: 'de.lemona.gradle.publish' }

// S3 plugin gets triggered by property/env variable....
if (Utilities.resolveValue(project, 's3.repository', 'S3_REPOSITORY') != null) {
project.apply plugin: 'de.lemona.gradle.s3'
plugins.withId('com.android.application') {
project.apply plugin: 'de.lemona.gradle.android'
}
plugins.withId('com.android.library') {
project.apply plugin: 'de.lemona.gradle.android'
}

plugins.withId('com.jfrog.bintray') { project.apply plugin: 'de.lemona.gradle.bintray' }

// S3 plugin gets triggered by property/env variable....
if (Utilities.resolveValue(project, 's3.repository', 'S3_REPOSITORY') != null) {
project.apply plugin: 'de.lemona.gradle.s3'
}
}

// Configure the default repositories: ours, google, jcenter, and maven central
Expand Down
10 changes: 8 additions & 2 deletions updating.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# Updating individual projects
## Version 0.3.8
This version supports `leomo.enableAutoPluginApply` to enable/disable automatic plugin binding.

## Version 0.3.0
0.3.0 supports Gradle 5.
As default, the main plugin (`de.lemona.gradle`) automatically applies other plugins based on the build file of dependent projects.

If you'd like to apply these plugins manually, please set the property to `false`.

## Version 0.3.7
0.3.7 supports Gradle 5.
You can use the latest (as 2020) Android gradle plugin in dependent Android projects.
However, the publishing plugin doesn't have a backward compatibility for Android projects.
So, please update the followings:
Expand Down

0 comments on commit 606dd78

Please sign in to comment.