Skip to content

Commit a111249

Browse files
authored
Merge pull request #3 from creati8e/fix/as-3.6
Add new plugin constant "minifyReleaseWithR8"
2 parents 9a9dabb + 0a6eedf commit a111249

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Gradle Plugin that generates randomized dictionaries for proguard
44

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

77
## How to add
88
Add to your **root project's** `build.gradle`:
@@ -17,7 +17,7 @@ buildscript {
1717
}
1818
1919
dependencies {
20-
classpath "gradle.plugin.ru.cleverpumpkin.proguard-dictionaries-generator:plugin:1.0.6"
20+
classpath "gradle.plugin.ru.cleverpumpkin.proguard-dictionaries-generator:plugin:1.0.7"
2121
}
2222
}
2323
```
@@ -31,7 +31,7 @@ buildscript {
3131
}
3232
}
3333
dependencies {
34-
classpath("gradle.plugin.ru.cleverpumpkin.proguard-dictionaries-generator:plugin:1.0.6")
34+
classpath("gradle.plugin.ru.cleverpumpkin.proguard-dictionaries-generator:plugin:1.0.7")
3535
}
3636
}
3737
```

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ buildscript {
55
jcenter()
66
google()
77
mavenCentral()
8+
gradlePluginPortal()
89
maven(uri("plugin/pluginRepo"))
9-
maven("https://plugins.gradle.org/m2/")
1010
}
1111
dependencies {
1212
classpath(BuildScriptPlugins.kotlin)

buildSrc/src/main/kotlin/Dependencies.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@ import PluginVersions.SAMPLE
66
import PluginVersions.UPLOAD
77

88
object LibrariesVersions {
9-
const val KOTLIN_VERSION = "1.3.11"
9+
const val KOTLIN_VERSION = "1.3.50"
1010
const val ANDROID_X_VERSION = "1.0.0"
11-
const val GRADLE_PLUGIN_VERSION = "3.4.1"
11+
const val GRADLE_PLUGIN_VERSION = "3.5.0"
1212
}
1313

1414
object PluginVersions {
1515
/**
1616
* The constant used to specify the version of a plugin which will be uploaded to
1717
* the Gradle Plugin portal when "publishPlugins" task runs.
1818
*/
19-
const val UPLOAD = "1.0.6"
19+
const val UPLOAD = "1.0.7"
2020

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

2929
object BuildScriptPlugins {
3030
const val android = "com.android.tools.build:gradle:$GRADLE_PLUGIN_VERSION"
3131
const val kotlin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"
3232
const val dictionariesGenerator =
33-
"gradle.plugin.ru.cleverpumpkin.proguard-dictionaries-generator:plugin:$SAMPLE"
33+
"ru.cleverpumpkin.proguard-dictionaries-generator:plugin:$SAMPLE"
3434
}
3535

3636
object Plugins {

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip

plugin/src/main/java/ru/cleverpumpkin/plugin/ProguardR8DictionaryGeneratorPlugin.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ class ProguardR8DictionaryGeneratorPlugin : Plugin<Project> {
1212

1313
private companion object {
1414
const val LOG_TAG = "ProguardR8DictionaryGenerator"
15-
const val TARGET_R8_TASK = "transformClassesAndResourcesWithR8For"
16-
const val TARGET_PROGUARD_TASK = "transformClassesAndResourcesWithProguardFor"
15+
val TARGET_TASKS = listOf(
16+
"minifyReleaseWithR8",
17+
"transformClassesAndResourcesWithR8For",
18+
"transformClassesAndResourcesWithProguardFor"
19+
)
1720
}
1821

1922
override fun apply(project: Project) {
@@ -63,8 +66,9 @@ class ProguardR8DictionaryGeneratorPlugin : Plugin<Project> {
6366
}
6467

6568
private fun Project.findObfuscationTasks(): List<Task> {
66-
return tasks.filter { task -> task.name.startsWith(TARGET_R8_TASK) } +
67-
tasks.filter { task -> task.name.startsWith(TARGET_PROGUARD_TASK) }
69+
return TARGET_TASKS.flatMap { taskName ->
70+
tasks.filter { task -> task.name.startsWith(taskName) }
71+
}
6872
}
6973

7074
private fun Project.findPluginExtension(): ProguardR8DictionaryPluginExtension {

0 commit comments

Comments
 (0)