Skip to content

Commit

Permalink
Merge pull request #3 from creati8e/fix/as-3.6
Browse files Browse the repository at this point in the history
Add new plugin constant "minifyReleaseWithR8"
  • Loading branch information
iMofas authored Sep 30, 2019
2 parents 9a9dabb + 0a6eedf commit a111249
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gradle Plugin that generates randomized dictionaries for proguard

**Tested on Android Gradle Plugin version 3.4.1.**
**Tested on Android Gradle Plugin version 3.5.0 and 3.6.0-alpha10**

## How to add
Add to your **root project's** `build.gradle`:
Expand All @@ -17,7 +17,7 @@ buildscript {
}
dependencies {
classpath "gradle.plugin.ru.cleverpumpkin.proguard-dictionaries-generator:plugin:1.0.6"
classpath "gradle.plugin.ru.cleverpumpkin.proguard-dictionaries-generator:plugin:1.0.7"
}
}
```
Expand All @@ -31,7 +31,7 @@ buildscript {
}
}
dependencies {
classpath("gradle.plugin.ru.cleverpumpkin.proguard-dictionaries-generator:plugin:1.0.6")
classpath("gradle.plugin.ru.cleverpumpkin.proguard-dictionaries-generator:plugin:1.0.7")
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ buildscript {
jcenter()
google()
mavenCentral()
gradlePluginPortal()
maven(uri("plugin/pluginRepo"))
maven("https://plugins.gradle.org/m2/")
}
dependencies {
classpath(BuildScriptPlugins.kotlin)
Expand Down
10 changes: 5 additions & 5 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,31 @@ import PluginVersions.SAMPLE
import PluginVersions.UPLOAD

object LibrariesVersions {
const val KOTLIN_VERSION = "1.3.11"
const val KOTLIN_VERSION = "1.3.50"
const val ANDROID_X_VERSION = "1.0.0"
const val GRADLE_PLUGIN_VERSION = "3.4.1"
const val GRADLE_PLUGIN_VERSION = "3.5.0"
}

object PluginVersions {
/**
* The constant used to specify the version of a plugin which will be uploaded to
* the Gradle Plugin portal when "publishPlugins" task runs.
*/
const val UPLOAD = "1.0.6"
const val UPLOAD = "1.0.7"

/**
* The constant used to specify the version of a plugin which is applied to the Sample app.
* Usually it equals [UPLOAD] constant and differs only when a new plugin version is about
* to be uploaded.
*/
const val SAMPLE = "1.0.6"
const val SAMPLE = "1.0.7"
}

object BuildScriptPlugins {
const val android = "com.android.tools.build:gradle:$GRADLE_PLUGIN_VERSION"
const val kotlin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"
const val dictionariesGenerator =
"gradle.plugin.ru.cleverpumpkin.proguard-dictionaries-generator:plugin:$SAMPLE"
"ru.cleverpumpkin.proguard-dictionaries-generator:plugin:$SAMPLE"
}

object Plugins {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ class ProguardR8DictionaryGeneratorPlugin : Plugin<Project> {

private companion object {
const val LOG_TAG = "ProguardR8DictionaryGenerator"
const val TARGET_R8_TASK = "transformClassesAndResourcesWithR8For"
const val TARGET_PROGUARD_TASK = "transformClassesAndResourcesWithProguardFor"
val TARGET_TASKS = listOf(
"minifyReleaseWithR8",
"transformClassesAndResourcesWithR8For",
"transformClassesAndResourcesWithProguardFor"
)
}

override fun apply(project: Project) {
Expand Down Expand Up @@ -63,8 +66,9 @@ class ProguardR8DictionaryGeneratorPlugin : Plugin<Project> {
}

private fun Project.findObfuscationTasks(): List<Task> {
return tasks.filter { task -> task.name.startsWith(TARGET_R8_TASK) } +
tasks.filter { task -> task.name.startsWith(TARGET_PROGUARD_TASK) }
return TARGET_TASKS.flatMap { taskName ->
tasks.filter { task -> task.name.startsWith(taskName) }
}
}

private fun Project.findPluginExtension(): ProguardR8DictionaryPluginExtension {
Expand Down

0 comments on commit a111249

Please sign in to comment.