Skip to content

Fix dependencies and permissions in AAR extraction #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 18, 2024
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
4 changes: 0 additions & 4 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ jobs:
with:
distribution: 'zulu'
java-version: 17
- name: CopyAars
uses: eskatos/gradle-command-action@v1
with:
arguments: copyAars
- name: Build
uses: eskatos/gradle-command-action@v1
with:
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,7 @@ FirebaseDatabase.getInstance().setPersistenceEnabled(false)

This library is built with Gradle.

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`
gradle tasks to be present in the build folder before the project will successfully compile. These tasks extract the jar files from the
Firebase Android library AAR files to the `build/jar` folder and run on `./gradlew build`.
Run `./gradlew build` to build the library locally.

### Implementation details

Expand Down
22 changes: 9 additions & 13 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,16 @@ val copyAars by tasks.registering(Copy::class) {
into("build/aar")
}

val extractClasses by tasks.creating {
val extractClasses by tasks.registering(Copy::class) {
dependsOn(copyAars)
val aarFileTree = fileTree("build/aar")

aarFileTree.forEach { aarFile: File ->

dependsOn(
tasks.create(aarFile.name, Copy::class) {
from(zipTree(aarFile))
include("classes.jar")
rename("classes.jar", aarFile.nameWithoutExtension + ".jar")
into("build/jar")
}
)
configurations["aar"].forEach { aarFile ->
copy {
from(zipTree(aarFile))
include("classes.jar")
fileMode = 0b01110110000
rename("classes.jar", aarFile.nameWithoutExtension + ".jar")
into("build/jar")
}
}
}

Expand Down
Loading