Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ open class GreasePlugin : Plugin<Project> {

val resourcesMergingWorkdir = target.greaseBuildDir.get().dir(variant.name).dir("resources")
val mergedResourcesDir = resourcesMergingWorkdir.dir("merged")
val currentResourcesDir = resourcesMergingWorkdir.dir("current")
val blameDir = resourcesMergingWorkdir.dir("blame")
val extraAndroidRes = configurations.artifactsOf(AndroidArtifacts.ArtifactType.ANDROID_RES)
dependsOn(extraAndroidRes)
Expand All @@ -328,6 +329,11 @@ open class GreasePlugin : Plugin<Project> {

fun injectResources() {
target.delete(resourcesMergingWorkdir)
target.delete(currentResourcesDir)
target.copy {
from(outputDir.asFileTree)
into(currentResourcesDir)
}

val executorFacade = Workers.withGradleWorkers(
creationConfig.services.projectInfo.path,
Expand All @@ -340,7 +346,7 @@ open class GreasePlugin : Plugin<Project> {
resCompilerService = CopyToOutputDirectoryResourceCompilationService,
incrementalMergedResources = mergedResourcesDir.asFile,
mergedResources = outputDir.asFile.get(),
resourceSets = extraAndroidRes.files.toList(),
resourceSets = currentResourcesDir.asFileTree.files.toList() + extraAndroidRes.files,
minSdk = minSdk.get(),
aaptWorkerFacade = executorFacade,
blameLogOutputFolder = blameDir.asFile,
Expand Down
20 changes: 20 additions & 0 deletions tests/sample-dependency-library/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
}

android {
namespace = "io.deepmedia.tools.grease.sample.dependency.library"
compileSdk = 34
defaultConfig {
minSdk = 21
}

kotlinOptions {
jvmTarget = "1.8"
}
}

dependencies {
// Empty
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="library_dependency_res">library_dependency</string>
<string name="library_res">library2</string>
</resources>
6 changes: 4 additions & 2 deletions tests/sample-library/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
id("io.deepmedia.tools.grease")
}

Expand Down Expand Up @@ -58,6 +59,9 @@ android {
dependencies {
grease("androidx.core:core:1.0.0")

grease(project(":sample-dependency-pure"))
grease(project(":sample-dependency-library"))

// include deps to pom when publishing
api("com.google.android.material:material:1.0.0")
// Includes resource and some manifest changes
Expand All @@ -67,6 +71,4 @@ dependencies {
grease("org.tensorflow:tensorflow-lite:2.3.0")
// Manifest changes, layout resources
grease("com.otaliastudios:cameraview:2.7.2")

grease(project(":sample-dependency-pure"))
}
4 changes: 4 additions & 0 deletions tests/sample-library/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="library_res">library</string>
</resources>
3 changes: 2 additions & 1 deletion tests/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ dependencyResolutionManagement {
rootProject.name = "Grease"

include(":sample-library")
include(":sample-dependency-pure")
include(":sample-dependency-pure")
include(":sample-dependency-library")