Skip to content

Commit

Permalink
Merge pull request #2 from extmkv/refactor
Browse files Browse the repository at this point in the history
Adding applicationId to the list of placeholders
  • Loading branch information
extmkv authored Feb 6, 2024
2 parents a64b918 + 58280f8 commit 4653b92
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
application = { id = "com.android.application", version.ref = "androidGradle" }
library = { id = "com.android.library", version.ref = "androidGradle" }
androidGradleX = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
resourcePlaceholders = "pt.jcosta.resourceplaceholders:0.11.0"
resourcePlaceholders = "pt.jcosta.resourceplaceholders:0.11.1"
2 changes: 1 addition & 1 deletion plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group = "pt.jcosta.resourceplaceholders"
version = "0.11.0"
version = "0.11.1"

// Use java-gradle-plugin to generate plugin descriptors and specify plugin ids
gradlePlugin {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.timfreiheit.plugin.resourceplaceholders

import com.android.build.api.variant.AndroidComponentsExtension
import com.android.build.api.variant.ApplicationVariant
import com.android.build.gradle.api.AndroidBasePlugin
import org.gradle.api.Plugin
import org.gradle.api.Project
Expand Down Expand Up @@ -45,14 +46,20 @@ class ResourcePlaceholdersPlugin : Plugin<Project> {

val files = project.getResDirs()

val placeholders = variant.manifestPlaceholders.apply {
if (variant is ApplicationVariant) {
put("applicationId", variant.applicationId)
}
}

val task =
project.tasks.register(taskName, ResourcePlaceholdersTask::class.java) { task ->
task.inputs.files(files)
task.group = "resource-placeholders"
task.variantName = variant.name
task.source = variant.sources.res?.all
task.overrideFiles.set(extension.files)
task.placeholders.set(variant.manifestPlaceholders)
task.placeholders.set(placeholders)
task.destination.set(outputDir)
}

Expand Down

0 comments on commit 4653b92

Please sign in to comment.