Skip to content

Commit

Permalink
Add extension BaseVariant.localAndroidResources
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsonlee committed May 23, 2023
1 parent bea0988 commit 42e074a
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ interface AGPInterface {

val BaseVariant.rawAndroidResources: FileCollection

val BaseVariant.localAndroidResources: FileCollection

val BaseVariant.javaCompilerTaskProvider: TaskProvider<out Task>

val BaseVariant.preBuildTaskProvider: TaskProvider<out Task>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ internal object V33 : AGPInterface {
override val BaseVariant.rawAndroidResources: FileCollection
get() = variantData.allRawAndroidResources

override val BaseVariant.localAndroidResources: FileCollection
get() = variantData.androidResources.values.map {
it.get()
}.reduce { collection, file ->
collection.plus(file)
}

override fun BaseVariant.getArtifactCollection(
configType: AndroidArtifacts.ConsumedConfigType,
scope: ArtifactScope,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ internal object V34 : AGPInterface {
override val BaseVariant.rawAndroidResources: FileCollection
get() = variantData.allRawAndroidResources

override val BaseVariant.localAndroidResources: FileCollection
get() = variantData.androidResources.values.map {
it.get()
}.reduce { collection, file ->
collection.plus(file)
}


override fun BaseVariant.getArtifactCollection(
configType: AndroidArtifacts.ConsumedConfigType,
scope: ArtifactScope,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ internal object V35 : AGPInterface {
override val BaseVariant.rawAndroidResources: FileCollection
get() = variantData.allRawAndroidResources

override val BaseVariant.localAndroidResources: FileCollection
get() = variantData.androidResources.values.map {
it.get()
}.reduce { collection, file ->
collection.plus(file)
}

override fun BaseVariant.getArtifactCollection(
configType: AndroidArtifacts.ConsumedConfigType,
scope: AndroidArtifacts.ArtifactScope,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ object V36 : AGPInterface {
override val BaseVariant.rawAndroidResources: FileCollection
get() = variantData.allRawAndroidResources

override val BaseVariant.localAndroidResources: FileCollection
get() = variantData.androidResources.values.reduce { collection, file ->
collection.plus(file)
}

override fun BaseVariant.getArtifactCollection(
configType: AndroidArtifacts.ConsumedConfigType,
scope: ArtifactScope,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ internal object V40 : AGPInterface {
override val BaseVariant.rawAndroidResources: FileCollection
get() = variantData.allRawAndroidResources

override val BaseVariant.localAndroidResources: FileCollection
get() = variantData.androidResources.values.reduce { collection, file ->
collection.plus(file)
}

override fun BaseVariant.getArtifactCollection(
configType: AndroidArtifacts.ConsumedConfigType,
scope: AndroidArtifacts.ArtifactScope,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ internal object V41 : AGPInterface {
override val BaseVariant.rawAndroidResources: FileCollection
get() = componentProperties.variantData.allRawAndroidResources

override val BaseVariant.localAndroidResources: FileCollection
get() = componentProperties.variantData.androidResources.values.reduce { collection, file ->
collection.plus(file)
}

override fun BaseVariant.getArtifactCollection(
configType: AndroidArtifacts.ConsumedConfigType,
scope: ArtifactScope,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ internal object V42 : AGPInterface {
override val BaseVariant.rawAndroidResources: FileCollection
get() = component.variantData.allRawAndroidResources

override val BaseVariant.localAndroidResources: FileCollection
get() = component.variantData.androidResources.values.reduce { collection, file ->
collection.plus(file)
}

override fun BaseVariant.getArtifactCollection(
configType: AndroidArtifacts.ConsumedConfigType,
scope: ArtifactScope,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ internal object V70 : AGPInterface {
override val BaseVariant.rawAndroidResources: FileCollection
get() = component.variantData.allRawAndroidResources

override val BaseVariant.localAndroidResources: FileCollection
get() = component.variantData.androidResources.values.reduce { collection, file ->
collection.plus(file)
}

override fun BaseVariant.getArtifactCollection(
configType: AndroidArtifacts.ConsumedConfigType,
scope: ArtifactScope,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ internal object V71 : AGPInterface {
override val BaseVariant.rawAndroidResources: FileCollection
get() = component.variantData.allRawAndroidResources

override val BaseVariant.localAndroidResources: FileCollection
get() = component.variantData.androidResources.values.reduce { collection, file ->
collection.plus(file)
}

override fun BaseVariant.getArtifactCollection(
configType: AndroidArtifacts.ConsumedConfigType,
scope: ArtifactScope,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ internal object V72 : AGPInterface {
override val BaseVariant.rawAndroidResources: FileCollection
get() = component.variantData.allRawAndroidResources

override val BaseVariant.localAndroidResources: FileCollection
get() = component.variantData.androidResources.values.reduce { collection, file ->
collection.plus(file)
}

override fun BaseVariant.getArtifactCollection(
configType: AndroidArtifacts.ConsumedConfigType,
scope: ArtifactScope,
Expand Down

0 comments on commit 42e074a

Please sign in to comment.