Skip to content

Commit eb534f3

Browse files
authored
Merge pull request #12 from fmasa/aar-extract-improvements
Fix dependencies and permissions in AAR extraction
2 parents eedc7cf + f241925 commit eb534f3

File tree

3 files changed

+10
-20
lines changed

3 files changed

+10
-20
lines changed

.github/workflows/build-pr.yml

-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ jobs:
1111
with:
1212
distribution: 'zulu'
1313
java-version: 17
14-
- name: CopyAars
15-
uses: eskatos/gradle-command-action@v1
16-
with:
17-
arguments: copyAars
1814
- name: Build
1915
uses: eskatos/gradle-command-action@v1
2016
with:

README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,7 @@ FirebaseDatabase.getInstance().setPersistenceEnabled(false)
142142

143143
This library is built with Gradle.
144144

145-
Run `./gradlew build` to build, the first time you run build it will fail as it requires the output of the custom `copyAars` and `extractClasses`
146-
gradle tasks to be present in the build folder before the project will successfully compile. These tasks extract the jar files from the
147-
Firebase Android library AAR files to the `build/jar` folder and run on `./gradlew build`.
145+
Run `./gradlew build` to build the library locally.
148146

149147
### Implementation details
150148

build.gradle.kts

+9-13
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,16 @@ val copyAars by tasks.registering(Copy::class) {
4141
into("build/aar")
4242
}
4343

44-
val extractClasses by tasks.creating {
44+
val extractClasses by tasks.registering(Copy::class) {
4545
dependsOn(copyAars)
46-
val aarFileTree = fileTree("build/aar")
47-
48-
aarFileTree.forEach { aarFile: File ->
49-
50-
dependsOn(
51-
tasks.create(aarFile.name, Copy::class) {
52-
from(zipTree(aarFile))
53-
include("classes.jar")
54-
rename("classes.jar", aarFile.nameWithoutExtension + ".jar")
55-
into("build/jar")
56-
}
57-
)
46+
configurations["aar"].forEach { aarFile ->
47+
copy {
48+
from(zipTree(aarFile))
49+
include("classes.jar")
50+
fileMode = 0b01110110000
51+
rename("classes.jar", aarFile.nameWithoutExtension + ".jar")
52+
into("build/jar")
53+
}
5854
}
5955
}
6056

0 commit comments

Comments
 (0)