forked from expo/expo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[android][tools] add sdk 48 versioned code (expo#21076)
# Why add android sdk 48 versioned code # How - `et add-sdk -p android -s 48.0.0` - there is a big problem for versioning this time where versioned aar size is from ~17MB to ~131MB because of prefab, so it's not able to commit to git. this pr proposes to upload versioned aar to github and having an `et android-download-versioned-aars` to download aars before gradle building. # Test Plan - sdk 48 android versioned expo go + sdk 48 ncl smoking test - ci passed
- Loading branch information
Showing
1,926 changed files
with
223,873 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"sdkVersions":["46.0.0","47.0.0"]} | ||
{"sdkVersions":["46.0.0","47.0.0","48.0.0"]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
155 changes: 155 additions & 0 deletions
155
android/vendored/sdk48/@react-native-async-storage/async-storage/android/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
import java.nio.file.Paths | ||
|
||
def resolveModulePath(packageName) { | ||
def basePath = rootDir.toPath().normalize() | ||
|
||
// Node's module resolution algorithm searches up to the root directory, | ||
// after which the base path will be null | ||
while (basePath) { | ||
def candidatePath = Paths.get(basePath.toString(), 'node_modules', packageName) | ||
if (candidatePath.toFile().exists()) { | ||
return candidatePath.toString() | ||
} | ||
|
||
basePath = basePath.getParent() | ||
} | ||
|
||
return null | ||
} | ||
|
||
def safeExtGet(prop, fallback) { | ||
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback | ||
} | ||
|
||
def getFlagOrDefault(flagName, defaultValue) { | ||
rootProject.hasProperty(flagName) ? rootProject.properties[flagName] == "true" : defaultValue | ||
} | ||
|
||
def getVersionOrDefault(String flagName, String defaultVersion) { | ||
rootProject.hasProperty(flagName) ? rootProject.properties[flagName] : defaultVersion | ||
} | ||
|
||
configurations { | ||
compileClasspath | ||
} | ||
|
||
buildscript { | ||
// kotlin version is dictated by rootProject extension or property in gradle.properties | ||
ext.asyncStorageKtVersion = rootProject.ext.has('kotlinVersion') | ||
? rootProject.ext['kotlinVersion'] | ||
: rootProject.hasProperty('AsyncStorage_kotlinVersion') | ||
? rootProject.properties['AsyncStorage_kotlinVersion'] | ||
: '1.6.10' | ||
|
||
repositories { | ||
mavenCentral() | ||
google() | ||
} | ||
dependencies { | ||
def projectExampleDir = Paths.get(project.projectDir.getParent(), "example", "android").toString() | ||
def rootProjectDir = rootProject.projectDir.getPath() | ||
if (projectExampleDir == rootProjectDir) { | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$asyncStorageKtVersion" | ||
} | ||
} | ||
} | ||
|
||
// AsyncStorage has default size of 6MB. | ||
// This is a sane limit to protect the user from the app storing too much data in the database. | ||
// This also protects the database from filling up the disk cache and becoming malformed. | ||
// If you really need bigger size, please keep in mind the potential consequences. | ||
long dbSizeInMB = 6L | ||
def newDbSize = rootProject.properties['AsyncStorage_db_size_in_MB'] | ||
if (newDbSize != null && newDbSize.isLong()) { | ||
dbSizeInMB = newDbSize.toLong() | ||
} | ||
|
||
// Instead of reusing AsyncTask thread pool, AsyncStorage can use its own executor | ||
def useDedicatedExecutor = getFlagOrDefault('AsyncStorage_dedicatedExecutor', false) | ||
|
||
// Use next storage implementation | ||
def useNextStorage = getFlagOrDefault("AsyncStorage_useNextStorage", false) | ||
|
||
apply plugin: 'com.android.library' | ||
if (useNextStorage) { | ||
apply plugin: 'kotlin-android' | ||
apply plugin: 'kotlin-kapt' | ||
apply from: './testresults.gradle' | ||
} | ||
|
||
android { | ||
compileSdkVersion safeExtGet('compileSdkVersion', 31) | ||
defaultConfig { | ||
minSdkVersion safeExtGet('minSdkVersion', 21) | ||
targetSdkVersion safeExtGet('targetSdkVersion', 31) | ||
buildConfigField "Long", "AsyncStorage_db_size", "${dbSizeInMB}L" | ||
buildConfigField "boolean", "AsyncStorage_useDedicatedExecutor", "${useDedicatedExecutor}" | ||
buildConfigField "boolean", "AsyncStorage_useNextStorage", "${useNextStorage}" | ||
} | ||
lintOptions { | ||
abortOnError false | ||
} | ||
|
||
if (useNextStorage) { | ||
testOptions { | ||
unitTests { | ||
returnDefaultValues = true | ||
includeAndroidResources = true | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm | ||
url "${resolveModulePath("react-native")}/android" | ||
} | ||
google() | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
|
||
if (useNextStorage) { | ||
def room_version = getVersionOrDefault('AsyncStorage_next_roomVersion', '2.4.2') | ||
def coroutines_version = "1.6.0" | ||
def coroutinesTest_version = "1.6.0" | ||
// if we don't provide explicit dependency on reflection, kotlin plugin | ||
// would add one automatically, probably a version that is not compatible with | ||
// used kotlin | ||
def kotlinReflect_version = project.ext.asyncStorageKtVersion | ||
def junit_version = "4.13.2" | ||
def robolectric_version = "4.7.3" | ||
def truth_version = "1.1.3" | ||
def androidxtest_version = "1.4.0" | ||
def androidtest_junit_version = "1.1.3" | ||
|
||
implementation "androidx.room:room-runtime:$room_version" | ||
implementation "androidx.room:room-ktx:$room_version" | ||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinReflect_version" | ||
|
||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" | ||
kapt "androidx.room:room-compiler:$room_version" | ||
|
||
testImplementation "junit:junit:$junit_version" | ||
testImplementation "androidx.test:runner:$androidxtest_version" | ||
testImplementation "androidx.test:rules:$androidxtest_version" | ||
testImplementation "androidx.test.ext:junit:$androidtest_junit_version" | ||
testImplementation "org.robolectric:robolectric:$robolectric_version" | ||
testImplementation "com.google.truth:truth:$truth_version" | ||
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesTest_version" | ||
} | ||
|
||
//noinspection GradleDynamicVersion | ||
implementation 'host.exp:reactandroid-abi48_0_0:1.0.0' | ||
compileOnly 'com.facebook.fbjni:fbjni:+' | ||
compileOnly 'com.facebook.yoga:proguard-annotations:+' | ||
compileOnly 'com.facebook.soloader:soloader:+' | ||
compileOnly 'com.facebook.fresco:fbcore:+' | ||
compileOnly 'com.facebook.infer.annotation:infer-annotation:+' | ||
compileOnly 'androidx.annotation:annotation:+' | ||
compileOnly 'com.google.code.findbugs:jsr305:+' | ||
compileOnly 'androidx.appcompat:appcompat:+' | ||
// From node_modules | ||
} |
1 change: 1 addition & 0 deletions
1
android/vendored/sdk48/@react-native-async-storage/async-storage/android/gradle.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
android.useAndroidX=true |
6 changes: 6 additions & 0 deletions
6
...ored/sdk48/@react-native-async-storage/async-storage/android/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="abi48_0_0.com.reactnativecommunity.asyncstorage"> | ||
|
||
</manifest> | ||
|
Oops, something went wrong.