Skip to content

Commit

Permalink
Fix dependencies between tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
fmasa committed Apr 17, 2024
1 parent ba03c0e commit 712380e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
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
23 changes: 9 additions & 14 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +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")
fileMode = 0b01110110000
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

0 comments on commit 712380e

Please sign in to comment.