Skip to content

Commit 9728514

Browse files
authored
Add support for Android Gradle Plugin 4.2.0 (#27)
1 parent 5211721 commit 9728514

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
# Generated files
1717
.idea/**/contentModel.xml
18+
.idea/**/libraries-with-intellij-classes.xml
1819

1920
# Sensitive or high-churn files
2021
.idea/**/dataSources/
@@ -129,5 +130,5 @@ gradle-app.setting
129130
# Output directory for tests
130131
/output
131132

132-
# Donenv configuration file
133+
# Dotenv configuration file
133134
.env

.idea/codeStyles/Project.xml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ poEditor {
3232
}
3333
```
3434
### Changed
35-
- No changed features!
35+
- Add support for Android Gradle Plugin version 4.2.0
3636
### Deprecated
3737
- No deprecated features!
3838
### Removed
39-
- No removed features!
39+
- Remove support for Android Gradle Plugin versions lower than 4.2.0
4040
### Fixed
4141
- No fixed issues!
4242
### Security

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ repositories {
5757
dependencies {
5858
implementation(localGroovy())
5959

60-
compileOnly("com.android.tools.build:gradle:4.2.0-alpha01")
60+
compileOnly("com.android.tools.build:gradle:4.2.0")
6161

6262
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.72")
6363

src/main/kotlin/com/hyperdevs/poeditor/gradle/PoEditorPlugin.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
package com.hyperdevs.poeditor.gradle
2020

21+
import com.android.build.api.extension.ApplicationAndroidComponentsExtension
22+
import com.android.build.api.extension.LibraryAndroidComponentsExtension
2123
import com.android.build.gradle.AppPlugin
2224
import com.android.build.gradle.LibraryExtension
2325
import com.android.build.gradle.LibraryPlugin
@@ -83,16 +85,15 @@ class PoEditorPlugin : Plugin<Project> {
8385
// configurations with Android app modules.
8486
val configsExtensionContainer = project.container<PoEditorPluginExtension>()
8587
val androidExtension = project.the<BaseAppModuleExtension>()
88+
val androidComponentsExtension = project.the<ApplicationAndroidComponentsExtension>()
8689
(androidExtension as ExtensionAware).extensions.add(POEDITOR_CONFIG_NAME, configsExtensionContainer)
8790

8891
val configPoEditorTaskProvidersMap: MutableMap<ConfigName, TaskProvider<*>> = mutableMapOf()
8992

9093
// Add tasks for every flavor or build type
91-
androidExtension.onVariants {
92-
// Add main extension since we have the main extension evaluated here
94+
androidComponentsExtension.beforeVariants {
9395
addMainPoEditorTask(project, mainExtension)
94-
95-
val configs = getConfigs(this.productFlavors.map { it.second }, this.buildType)
96+
val configs = getConfigs(it.productFlavors.map { it.second }, it.buildType)
9697

9798
generatePoEditorTasks(configs,
9899
project,
@@ -121,16 +122,17 @@ class PoEditorPlugin : Plugin<Project> {
121122
// configurations with Android library modules.
122123
val configsExtensionContainer = project.container<PoEditorPluginExtension>()
123124
val androidExtension = project.the<LibraryExtension>()
125+
val androidComponentsExtension = project.the<LibraryAndroidComponentsExtension>()
124126
(androidExtension as ExtensionAware).extensions.add(POEDITOR_CONFIG_NAME, configsExtensionContainer)
125127

126128
val configPoEditorTaskProvidersMap: MutableMap<ConfigName, TaskProvider<*>> = mutableMapOf()
127129

128130
// Add tasks for every flavor or build type
129-
androidExtension.onVariants {
131+
androidComponentsExtension.beforeVariants {
130132
// Add main extension since we have the main extension evaluated here
131133
addMainPoEditorTask(project, mainExtension)
132134

133-
val configs = getConfigs(this.productFlavors.map { it.second }, this.buildType)
135+
val configs = getConfigs(it.productFlavors.map { it.second }, it.buildType)
134136

135137
generatePoEditorTasks(configs,
136138
project,

0 commit comments

Comments
 (0)