Skip to content

Commit

Permalink
[go] fix bundleVersionedReleaseLocalLintAar build error (expo#23120)
Browse files Browse the repository at this point in the history
# Why

fix error when prebuilt hermes cache hit

```
Execution failed for task ':expoview:bundleVersionedReleaseLocalLintAar'
> Error while evaluating property 'hasLocalAarDeps' of task ':expoview:bundleVersionedReleaseLocalLintAar'
   > Direct local .aar file dependencies are not supported when building an AAR. The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR. Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error). The following direct local .aar file dependencies of the :expoview project caused this error: /home/expo/workingdir/build/android/prebuiltHermes/hermes-engine-release.aar
```

# How

set the `bundleVersionedReleaseLocalLintAar` and `bundleUnversionedReleaseLocalLintAar` to have no local aar dependencies.

# Test Plan

ci passed
  • Loading branch information
Kudo authored Jun 27, 2023
1 parent b7484f5 commit b29c181
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
16 changes: 16 additions & 0 deletions android/expoview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -348,4 +348,20 @@ dependencies {
implementation "androidx.work:work-runtime:2.7.1"
}

project.afterEvaluate {
// Workaround for AGP 7 local lint aar task with errors from a library project owning other aars.
// In our case, it's the expoview (library project) owning hermes aar
// ```
// Error while evaluating property 'hasLocalAarDeps' of task ':expoview:bundleVersionedReleaseLocalLintAar'
// > Direct local .aar file dependencies are not supported when building an AAR.
// The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR.
// Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error).
// The following direct local .aar file dependencies of the :expoview project caused this error:
// /home/runner/work/expo/expo/node_modules/hermes-engine/android/hermes-release.aar
// ```
// For the workaround, we just pretend we don't have local aar dependencies.
tasks.findByName("bundleVersionedReleaseLocalLintAar")?.localAarDeps?.setFrom([])
tasks.findByName("bundleUnversionedReleaseLocalLintAar")?.localAarDeps?.setFrom([])
}

useVendoredModulesForExpoView('unversioned')
16 changes: 16 additions & 0 deletions android/versioned-abis/expoview-abi49_0_0/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,20 @@ dependencies {
implementation "androidx.work:work-runtime:2.7.1"
}

project.afterEvaluate {
// Workaround for AGP 7 local lint aar task with errors from a library project owning other aars.
// In our case, it's the expoview (library project) owning hermes aar
// ```
// Error while evaluating property 'hasLocalAarDeps' of task ':expoview:bundleVersionedReleaseLocalLintAar'
// > Direct local .aar file dependencies are not supported when building an AAR.
// The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR.
// Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error).
// The following direct local .aar file dependencies of the :expoview project caused this error:
// /home/runner/work/expo/expo/node_modules/hermes-engine/android/hermes-release.aar
// ```
// For the workaround, we just pretend we don't have local aar dependencies.
tasks.findByName("bundleVersionedReleaseLocalLintAar")?.localAarDeps?.setFrom([])
tasks.findByName("bundleUnversionedReleaseLocalLintAar")?.localAarDeps?.setFrom([])
}

useVendoredModulesForExpoView('sdk49')

0 comments on commit b29c181

Please sign in to comment.