Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit d56ff1c Author: Tomasz Sapeta <1714764+tsapeta@users.noreply.github.com> Date: Wed Jul 29 11:49:15 2020 +0200 [et] Move UpdateVersions from xdl to expotools (#9336) # Why Part of expo/expo-cli#2282 # How Moved some functionality of xdl's UpdateVersions to expotools and refactored `et client-build` command a little bit. # Test Plan Tested with `et client-build -p ios --release --skip-upload`, will test Android soon commit b5532de Author: Michał Czernek <czernekmichal@gmail.com> Date: Wed Jul 29 11:13:45 2020 +0200 [expo-module-template] Add unit tests in android module template. commit fc7bc75 Author: Tomasz Sapeta <tsapeta@users.noreply.github.com> Date: Wed Jul 29 10:17:35 2020 +0200 [bare-expo] Install pods commit 9bca879 Author: Bartłomiej Klocek <bartlomiej.klocek@swmansion.com> Date: Wed Jul 29 10:03:05 2020 +0200 [media-library] Fix `getAssetsAsync` crash when given invalid `after` value on Android (#9466) # Why Fixes #9440 Non-number string values caused `Integer.parseInt()` throwing uncaught `NumberFormatException` in background thread - this crashed the whole application. # How Surrounded `parseInt()` within a `try-catch` block with fallback to default value. # Test Plan Tested `getAssetsAsync({after: ... })` for different string values (both valid and invalid) on Android emulator.
- Loading branch information
Showing
15 changed files
with
624 additions
and
350 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
apps/bare-expo/ios/Pods/.project_cache/installation_cache.yaml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
493 changes: 255 additions & 238 deletions
493
apps/bare-expo/ios/Pods/EXNotifications.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
apps/bare-expo/ios/Pods/Headers/Private/EXNotifications/EXNotificationCategoriesModule.h
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
apps/bare-expo/ios/Pods/Headers/Public/EXNotifications/EXNotificationCategoriesModule.h
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
32 changes: 32 additions & 0 deletions
32
...o-module-template/android/src/test/java/expo/modules/template/ModuleTemplateModuleTest.kt
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,32 @@ | ||
package expo.modules.template | ||
|
||
import io.mockk.mockk | ||
import org.junit.Assert.assertTrue | ||
import org.junit.Before | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.robolectric.RobolectricTestRunner | ||
import org.unimodules.test.core.PromiseMock | ||
import org.unimodules.test.core.moduleRegistryMock | ||
|
||
@RunWith(RobolectricTestRunner::class) | ||
class ModuleTemplateModuleTest { | ||
|
||
private var moduleRegistry = moduleRegistryMock() | ||
|
||
private lateinit var promise: PromiseMock | ||
|
||
private lateinit var module: ModuleTemplateModule | ||
|
||
@Before | ||
fun initializeMock() { | ||
promise = PromiseMock() | ||
module = ModuleTemplateModule(mockk()) | ||
} | ||
|
||
@Test | ||
fun testSomeGreatMethodAsync() { | ||
assertTrue(true) | ||
} | ||
|
||
} |
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,74 @@ | ||
import { Config, Versions } from '@expo/xdl'; | ||
|
||
export enum VersionsApiHost { | ||
PRODUCTION = 'exp.host', | ||
STAGING = 'staging.exp.host', | ||
} | ||
|
||
export type VersionsSchema = { | ||
sdkVersions: Record<string, VersionsSdkSchema>; | ||
turtleSdkVersions: { | ||
android: string; | ||
ios: string; | ||
}; | ||
}; | ||
|
||
export type VersionsSdkSchema = Partial<{ | ||
androidClientUrl: string; | ||
androidClientVersion: string; | ||
androidExpoViewUrl: string; | ||
expokitNpmPackage: string; | ||
expoReactNativeTag: string; | ||
facebookReactNativeVersion: string; | ||
facebookReactVersion: string; | ||
iosClientUrl: string; | ||
iosClientVersion: string; | ||
iosExpoViewUrl: string; | ||
packagesToInstallWhenEjecting: Record<string, string>; | ||
relatedPackages: Record<string, string>; | ||
releaseNoteUrl: string; | ||
}>; | ||
|
||
export async function getVersionsAsync( | ||
apiHost: VersionsApiHost = VersionsApiHost.STAGING | ||
): Promise<VersionsSchema> { | ||
return await runWithApiHost(apiHost, () => Versions.versionsAsync() as Promise<VersionsSchema>); | ||
} | ||
|
||
export async function getSdkVersionsAsync( | ||
sdkVersion: string, | ||
apiHost: VersionsApiHost = VersionsApiHost.STAGING | ||
): Promise<VersionsSdkSchema | null> { | ||
const versions = await getVersionsAsync(apiHost); | ||
return versions?.sdkVersions?.[sdkVersion] ?? null; | ||
} | ||
|
||
export async function setVersionsAsync( | ||
versions: VersionsSchema, | ||
apiHost: VersionsApiHost = VersionsApiHost.STAGING | ||
): Promise<void> { | ||
return await runWithApiHost(apiHost, () => Versions.setVersionsAsync(versions)); | ||
} | ||
|
||
export async function modifySdkVersionsAsync( | ||
sdkVersion: string, | ||
modifier: (sdkVersions: VersionsSdkSchema) => VersionsSdkSchema | Promise<VersionsSdkSchema> | ||
): Promise<VersionsSdkSchema> { | ||
const versions = await getVersionsAsync(); | ||
const sdkVersions = await modifier(versions.sdkVersions[sdkVersion] ?? {}); | ||
|
||
versions.sdkVersions[sdkVersion] = sdkVersions; | ||
await setVersionsAsync(versions); | ||
return sdkVersions; | ||
} | ||
|
||
async function runWithApiHost<T = any>( | ||
apiHost: VersionsApiHost, | ||
lambda: () => T | Promise<T> | ||
): Promise<T> { | ||
const originalHost = Config.api.host; | ||
Config.api.host = apiHost; | ||
const result = await lambda(); | ||
Config.api.host = originalHost; | ||
return result; | ||
} |
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,40 @@ | ||
import fs from 'fs-extra'; | ||
import path from 'path'; | ||
|
||
import { ANDROID_DIR } from '../Constants'; | ||
import { androidAppVersionAsync } from '../ProjectVersions'; | ||
import { spawnAsync } from '../Utils'; | ||
import { ClientBuilder, Platform, S3Client } from './types'; | ||
|
||
export default class AndroidClientBuilder implements ClientBuilder { | ||
platform: Platform = 'android'; | ||
|
||
getAppPath(): string { | ||
return path.join(ANDROID_DIR, 'app', 'build', 'outputs', 'apk', 'release', 'app-release.apk'); | ||
} | ||
|
||
getClientUrl(appVersion: string): string { | ||
return `https://d1ahtucjixef4r.cloudfront.net/Exponent-${appVersion}.apk`; | ||
} | ||
|
||
async getAppVersionAsync(): Promise<string> { | ||
return androidAppVersionAsync(); | ||
} | ||
|
||
async buildAsync() { | ||
await spawnAsync('fastlane', ['android', 'build', 'build_type:Release'], { stdio: 'inherit' }); | ||
} | ||
|
||
async uploadBuildAsync(s3Client: S3Client, appVersion: string) { | ||
const file = fs.createReadStream(this.getAppPath()); | ||
|
||
await s3Client | ||
.putObject({ | ||
Bucket: 'exp-android-apks', | ||
Key: `Exponent-${appVersion}.apk`, | ||
Body: file, | ||
ACL: 'public-read', | ||
}) | ||
.promise(); | ||
} | ||
} |
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,55 @@ | ||
import fs from 'fs-extra'; | ||
import path from 'path'; | ||
|
||
import { EXPO_DIR, IOS_DIR } from '../Constants'; | ||
import { iosAppVersionAsync } from '../ProjectVersions'; | ||
import { spawnAsync } from '../Utils'; | ||
import { ClientBuilder, Platform } from './types'; | ||
|
||
export default class IosClientBuilder implements ClientBuilder { | ||
platform: Platform = 'ios'; | ||
|
||
getAppPath(): string { | ||
return path.join( | ||
IOS_DIR, | ||
'simulator-build', | ||
'Build', | ||
'Products', | ||
'Release-iphonesimulator', | ||
'Exponent.app' | ||
); | ||
} | ||
|
||
getClientUrl(appVersion: string): string { | ||
return `https://dpq5q02fu5f55.cloudfront.net/Exponent-${appVersion}.tar.gz`; | ||
} | ||
|
||
async getAppVersionAsync(): Promise<string> { | ||
return await iosAppVersionAsync(); | ||
} | ||
|
||
async buildAsync() { | ||
await spawnAsync('fastlane', ['ios', 'create_simulator_build'], { stdio: 'inherit' }); | ||
} | ||
|
||
async uploadBuildAsync(s3Client, appVersion: string) { | ||
const tempAppPath = path.join(EXPO_DIR, 'temp-app.tar.gz'); | ||
|
||
await spawnAsync('tar', ['-zcvf', tempAppPath, '-C', this.getAppPath(), '.'], { | ||
stdio: ['ignore', 'ignore', 'inherit'], // only stderr | ||
}); | ||
|
||
const file = fs.createReadStream(tempAppPath); | ||
|
||
await s3Client | ||
.putObject({ | ||
Bucket: 'exp-ios-simulator-apps', | ||
Key: `Exponent-${appVersion}.tar.gz`, | ||
Body: file, | ||
ACL: 'public-read', | ||
}) | ||
.promise(); | ||
|
||
await fs.remove(tempAppPath); | ||
} | ||
} |
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,15 @@ | ||
import aws from 'aws-sdk'; | ||
import { Platform } from '../ProjectVersions'; | ||
|
||
export { Platform }; | ||
|
||
export type S3Client = aws.S3; | ||
|
||
export interface ClientBuilder { | ||
platform: Platform; | ||
getAppPath: () => string; | ||
getClientUrl: (appVersion: string) => string; | ||
getAppVersionAsync: () => Promise<string>; | ||
buildAsync: () => Promise<void>; | ||
uploadBuildAsync: (s3Client: S3Client, appVersion: string) => Promise<void>; | ||
} |
Oops, something went wrong.