Skip to content

Commit

Permalink
Add support for Android Gradle Plugin 4.2.0 (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
adriangl authored May 5, 2021
1 parent 5211721 commit 9728514
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

# Generated files
.idea/**/contentModel.xml
.idea/**/libraries-with-intellij-classes.xml

# Sensitive or high-churn files
.idea/**/dataSources/
Expand Down Expand Up @@ -129,5 +130,5 @@ gradle-app.setting
# Output directory for tests
/output

# Donenv configuration file
# Dotenv configuration file
.env
1 change: 0 additions & 1 deletion .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ poEditor {
}
```
### Changed
- No changed features!
- Add support for Android Gradle Plugin version 4.2.0
### Deprecated
- No deprecated features!
### Removed
- No removed features!
- Remove support for Android Gradle Plugin versions lower than 4.2.0
### Fixed
- No fixed issues!
### Security
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ repositories {
dependencies {
implementation(localGroovy())

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

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

Expand Down
14 changes: 8 additions & 6 deletions src/main/kotlin/com/hyperdevs/poeditor/gradle/PoEditorPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

package com.hyperdevs.poeditor.gradle

import com.android.build.api.extension.ApplicationAndroidComponentsExtension
import com.android.build.api.extension.LibraryAndroidComponentsExtension
import com.android.build.gradle.AppPlugin
import com.android.build.gradle.LibraryExtension
import com.android.build.gradle.LibraryPlugin
Expand Down Expand Up @@ -83,16 +85,15 @@ class PoEditorPlugin : Plugin<Project> {
// configurations with Android app modules.
val configsExtensionContainer = project.container<PoEditorPluginExtension>()
val androidExtension = project.the<BaseAppModuleExtension>()
val androidComponentsExtension = project.the<ApplicationAndroidComponentsExtension>()
(androidExtension as ExtensionAware).extensions.add(POEDITOR_CONFIG_NAME, configsExtensionContainer)

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

// Add tasks for every flavor or build type
androidExtension.onVariants {
// Add main extension since we have the main extension evaluated here
androidComponentsExtension.beforeVariants {
addMainPoEditorTask(project, mainExtension)

val configs = getConfigs(this.productFlavors.map { it.second }, this.buildType)
val configs = getConfigs(it.productFlavors.map { it.second }, it.buildType)

generatePoEditorTasks(configs,
project,
Expand Down Expand Up @@ -121,16 +122,17 @@ class PoEditorPlugin : Plugin<Project> {
// configurations with Android library modules.
val configsExtensionContainer = project.container<PoEditorPluginExtension>()
val androidExtension = project.the<LibraryExtension>()
val androidComponentsExtension = project.the<LibraryAndroidComponentsExtension>()
(androidExtension as ExtensionAware).extensions.add(POEDITOR_CONFIG_NAME, configsExtensionContainer)

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

// Add tasks for every flavor or build type
androidExtension.onVariants {
androidComponentsExtension.beforeVariants {
// Add main extension since we have the main extension evaluated here
addMainPoEditorTask(project, mainExtension)

val configs = getConfigs(this.productFlavors.map { it.second }, this.buildType)
val configs = getConfigs(it.productFlavors.map { it.second }, it.buildType)

generatePoEditorTasks(configs,
project,
Expand Down

0 comments on commit 9728514

Please sign in to comment.