Skip to content

Commit

Permalink
[core] try to fix android instrumented test building error (#19447)
Browse files Browse the repository at this point in the history
# Why

multiple libc++_shared.so build errors from android instrumented test: https://github.com/expo/expo/actions/runs/3202259013/jobs/5231059790

# How

- always exclude libc++_shared.so from packaging.
- this pr also removes the previous change from #19254, we don't have to exclude META-INF files. [they are excluded by default](https://android.googlesource.com/platform/tools/base/+/mirror-goog-studio-main/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/packaging/PackagingOptionsUtils.kt#20). the reason we need to do it because the `excludes = []` reset all list. replace the statement by `excludes += [...]` is better than this.

# Test Plan

- android instrumented test ci passed: https://github.com/expo/expo/actions/runs/3203065701/jobs/5232723291
- all ci passed (updates e2e seems broken on main)
- check regression from #19254 by running `yarn e2e` locally in expo-dev-client
  • Loading branch information
Kudo committed Oct 7, 2022
1 parent e069458 commit 96505ed
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions packages/expo-modules-core/android/build.gradle
Expand Up @@ -39,12 +39,6 @@ buildscript {
}
}

def isAndroidTest = {
Gradle gradle = getGradle()
String tskReqStr = gradle.getStartParameter().getTaskRequests().toString()
return tskReqStr.contains("AndroidTest")
}.call()

def isExpoModulesCoreTests = {
Gradle gradle = getGradle()
String tskReqStr = gradle.getStartParameter().getTaskRequests().toString()
Expand Down Expand Up @@ -212,7 +206,6 @@ android {
// Gradle will add cmake target dependencies into packaging.
// Theses files are intermediated linking files to build modules-core and should not be in final package.
def sharedLibraries = [
"**/libc++_shared.so",
"**/libfabricjni.so",
"**/libfbjni.so",
"**/libfolly_json.so",
Expand All @@ -237,16 +230,11 @@ android {
// In android (instrumental) tests, we want to package all so files to enable our JSI functionality.
// Otherwise, those files should be excluded, because will be loaded by the application.
if (isExpoModulesCoreTests) {
excludes = []
pickFirsts = sharedLibraries
pickFirsts += sharedLibraries
} else {
excludes = sharedLibraries
}
if (isExpoModulesCoreTests || isAndroidTest) {
excludes.add("META-INF/MANIFEST.MF")
excludes.add("META-INF/com.android.tools/proguard/coroutines.pro")
excludes.add("META-INF/proguard/coroutines.pro")
excludes += sharedLibraries
}
excludes.add("**/libc++_shared.so")
}

configurations {
Expand Down

0 comments on commit 96505ed

Please sign in to comment.