Compare commits

...
Author SHA1 Message Date
Evan Bacon 6d8726a1fc copied turtle related xdl files over 2021-01-27 18:02:31 -08:00
Wojciech Kozyra 1d773f35cf Release 0.20.7 2021-01-26 14:49:57 +01:00
Wojciech Kozyra 3daa678540 [android] remove Go suffix from android app name (#292) 2021-01-26 14:20:33 +01:00
Brent Vatne 616331b47b update changelog 2021-01-25 11:39:45 -08:00
Brent Vatne 0b9ab78453 Release 0.20.6 2021-01-25 11:36:30 -08:00
Brent Vatne 3e345ddaf8 [ios][android] Update tarballs for SDK 40 patch release 2021-01-21 20:40:43 -08:00
Cedric van Putten 4866c06a02 update changelog 2020-12-23 18:28:28 +01:00
Cedric van Putten c36723d96c Release 0.20.5 2020-12-23 18:25:36 +01:00
Cedric van Putten 28b0266ba2 [android] Upgrade to client 2.18.5 with background permission fix (#287) 2020-12-23 15:07:09 +01:00
Stanisław Chmiela 84a19ee261 Release 0.20.4 2020-12-17 15:57:42 +01:00
Stanisław Chmiela 8f3be65326 [ios] Fix expo-notifications initial notification not being delivered… (#285)
to expo-notifications

<!-- Thanks for contributing to _turtle_! Before you submit your pull request, please make sure to check the following boxes by putting an x in the [ ] (don't: [x ], [ x], do: [x]) -->

### Checklist
- [x] I've read the [Contribution Guidelines](https://github.com/expo/turtle/blob/master/CONTRIBUTING.md).
- [x] I've updated the [CHANGELOG](https://github.com/expo/turtle/blob/master/CHANGELOG.md) if necessary.
- [x] I've ensured the unit and smoke tests are still passing - either by running `yarn test:unit` and `yarn test:smoke:[ios|android]` or by checking the appropriate CircleCI builds' statuses.
- [x] **I've manually tested whether the changes I made work as expected.**

### Motivation and Context
Adds https://github.com/expo/expo/commit/0e0bbdd7b45b3e8f8725bcd831263f049c0aa16a and https://github.com/expo/expo/commit/c49a0464aef589dc9dd691cea78313d91959d64c fixing long-standing notifications bug.
2020-12-17 15:56:39 +01:00
Wojciech Kozyra 5d539a1bb2 update CHANGELOG 2020-12-10 12:11:09 +01:00
Wojciech Kozyra 833c9c1de5 Release 0.20.3 2020-12-10 12:09:10 +01:00
Eric Gonzalez ce74ab3161 Fixed the iOS build when user does not have elevated permissions (#283)
* Removed unnecessary sudo usage for ios buildsudo does not appear to be necessary to execute 'xcrun simctl list'

* Conditionally sudo-ing xcrun when building online
2020-12-10 10:47:25 +01:00
Brent Vatne 62df247645 [scripts] Verify jq installation before proceeding (#281) 2020-12-09 20:57:57 -08:00
Stanisław Chmiela 9bc4d75e9b Cut 0.20.2 version in changelog 2020-12-09 16:45:33 +01:00
Stanisław Chmiela b4d4b8a6c3 Release 0.20.2 2020-12-09 16:39:20 +01:00
Stanisław Chmiela 88d75c7581 Add changelog entry 2020-12-09 16:38:07 +01:00
Stanisław Chmiela 03be505cd0 [android] Upgrade SDK40 tarball with expo-notifications installation identifier fix 2020-12-09 15:58:41 +01:00
Eric Samelson 05568676ee update CHANGELOG 2020-12-08 18:54:00 -08:00
Eric Samelson 903e44bd29 Release 0.20.1 2020-12-08 18:51:55 -08:00
Brent Vatne 7697542b44 Update iOS client tarball 2020-12-08 18:44:45 -08:00
Eric Samelson 3baf4bcade [android] update SDK 40 shell tarball for release 2020-12-08 17:34:44 -08:00
Brent Vatne c7e98c5858 [ios] Update SDK 40 tarball for release 2020-12-08 13:12:26 -08:00
Dominik Sokal fc48d27e42 fix android smoke tests 2020-12-01 14:12:33 +01:00
Brent Vatne fdc702f273 Update CHANGELOG 2020-11-30 13:37:03 -08:00
Brent Vatne 9fda74dfa4 Release 0.20.0 2020-11-30 13:26:37 -08:00
Brent Vatne 6bab5f71ef [README] Update link to installation docs 2020-11-30 11:02:28 -08:00
Brent Vatne 3f1e9ce910 [android] Update sdk40 tarball 2020-11-30 11:01:37 -08:00
Brent Vatne 8fb54f3f27 Add iOS and Android SDK 40 tarballs 2020-11-27 11:53:29 -08:00
Bartłomiej Bukowski 069ef7e1c9 Update CHANGELOG.md 2020-11-19 21:23:53 +01:00
Bartłomiej Bukowski c0a742fa21 Release 0.19.1 2020-11-19 21:13:23 +01:00
Bartłomiej Bukowski fca72875dc [iOS] Rebuild shell tarballs (#278)
### Motivation and Context

- Accommodate https://github.com/expo/expo/pull/11052 in all shellApps.
- Rebuild iOS shellApps using Xcode 12.1 containing the iOS 14 image fix.
2020-11-19 21:02:25 +01:00
Bartłomiej Bukowski 15ed26d4cd [iOS] Run 'xcrun simctl list' before build to prevent ibtool crash (#279)
* [iOS] Run 'xcrun simctl list' before build to prevent ibtool crash

* Update CHANGELOG
2020-11-18 11:15:42 +01:00
Wojciech Kozyra 4c7af801f1 Revert "[ios][shellApps] Rebuild all supported shellApps with Xcode 12.1 (#273)"
This reverts commit c6946eca25.
2020-11-16 18:16:31 +01:00
Wojciech Kozyra 5012ec669d update CHANGELOG.md 2020-11-13 13:12:27 +01:00
Wojciech Kozyra 8b77a48b82 Release 0.19.0 2020-11-13 13:10:36 +01:00
Bartłomiej BukowskiandWojciech Kozyra c6946eca25 [ios][shellApps] Rebuild all supported shellApps with Xcode 12.1 (#273)
Co-authored-by: Wojciech Kozyra <[email protected]>
2020-11-11 12:08:25 +01:00
Eric Samelson 9627ecb80c Update CHANGELOG for 0.18.9 2020-11-09 16:24:03 -08:00
Eric Samelson 48c78f386a Release 0.18.9 2020-11-09 16:22:05 -08:00
Eric Samelson 0dc251e023 bump xdl to 58.0.20 2020-11-09 16:11:26 -08:00
Stanisław Chmiela d984061134 Update changelog for 0.18.8 2020-10-27 13:00:10 +01:00
Stanisław Chmiela ff6401ba6b Release 0.18.8 2020-10-27 12:59:02 +01:00
Stanisław Chmiela b443760699 Fix Reanimated v2 not being configured in production mode (#270)
<!-- Thanks for contributing to _turtle_! Before you submit your pull request, please make sure to check the following boxes by putting an x in the [ ] (don't: [x ], [ x], do: [x]) -->

### Checklist
- [x] I've read the [Contribution Guidelines](https://github.com/expo/turtle/blob/master/CONTRIBUTING.md).
- [x] I've updated the [CHANGELOG](https://github.com/expo/turtle/blob/master/CHANGELOG.md) if necessary.
- [x] I've ensured the unit and smoke tests are still passing - either by running `yarn test:unit` and `yarn test:smoke:[ios|android]` or by checking the appropriate CircleCI builds' statuses.
- [x] **I've manually tested whether the changes I made work as expected.**

### Motivation and Context

Apply https://github.com/expo/expo/pull/10807.

### Description
Fixes app crashing when using Reanimated v2.
2020-10-27 12:57:06 +01:00
Eric Samelson 0f0e86d17f Release 0.18.7 2020-10-23 15:28:41 -07:00
Eric Samelson f6697c0029 update CHANGELOG 2020-10-23 15:28:14 -07:00
Eric Samelson 22f802164d update android sdk 39 tarball 2020-10-23 14:53:13 -07:00
Charlie Cruzan aaa6e61061 Update CHANGELOG.md 2020-10-22 17:17:43 -04:00
cruzach e532e0270c Release 0.18.6 2020-10-22 17:13:42 -04:00
Charlie Cruzan bc0718ca7d [android] update sdk 39 tarball with notifications fixes
the following fixes are added in this update:

- https://github.com/expo/expo/commit/6ffe64f4a75f75edfdae226574842e97fd63d523

- https://github.com/expo/expo/commit/fa659fd3f74c32e989db5920a3e004bee58a931c

- https://github.com/expo/expo/commit/0faa400c630a5f88a029fe87c84cfa9e684e800a
2020-10-22 13:54:30 -04:00
Brent Vatne bf63dcea70 Update CHANGELOG 2020-10-07 12:34:43 -07:00
Brent Vatne 9551c8773d Release 0.18.5 2020-10-07 12:33:14 -07:00
Brent Vatne 470ff609fd [android] Always add expo-notifications for SDK >= 39 projects with android.enableDangerousExperimentalLeanBuilds enabled (#267) 2020-10-07 10:29:50 -07:00
Eric Samelson addba74b9d Release 0.18.4 2020-10-06 18:38:53 -07:00
Eric Samelson b63e9e3f34 update CHANGELOG 2020-10-06 18:37:48 -07:00
Eric Samelson 25aaa849f1 [android] update sdk 39 tarball for android notifications/updates fix 2020-10-06 18:36:22 -07:00
Brent Vatne edc712d820 update CHANGELOG 2020-10-03 22:51:11 -07:00
Brent Vatne 23c3e3509c Release 0.18.3 2020-10-03 22:48:52 -07:00
Brent Vatne 406a3be4f1 Update @expo/xdl to fix regression in SDK <= 39 splash 2020-10-03 22:15:55 -07:00
Eric Samelson dd60721270 update CHANGELOG 2020-10-03 15:19:38 -07:00
Eric Samelson 469ead8df8 Release 0.18.2 2020-10-03 15:18:25 -07:00
Brent Vatne aa0ce81e98 [ios] Update client tarball 2020-10-03 15:15:47 -07:00
Eric Samelson dccccb7716 [android] update SDK 39 tarball with linking fix 2020-10-03 15:10:09 -07:00
Brent Vatne 57f8404b6d [ios] update sdk39 tarball 2020-10-02 22:09:09 -07:00
Brent Vatne ba7309bc4b Update @expo/config and @expo/xdl. Temporarily bring in type definitions for color-string and xcode. 2020-10-02 20:58:39 -07:00
Brent Vatne 4aec3d5ba7 Update CHANGELOG 2020-10-02 18:40:08 -07:00
Brent Vatne d2eb447ebc [android] update sdk39 tarball 2020-10-02 18:16:21 -07:00
Dominik Sokal f177cf4d7f update ios smoke tests recordings (#264) 2020-09-29 15:31:52 +02:00
Dominik Sokal 59a181dee0 update CHANGELOG 2020-09-23 12:16:02 +02:00
Dominik Sokal f4bf860a9a Release 0.18.1 2020-09-23 12:12:59 +02:00
Dominik Sokal 932958ad46 fix building expo sdk 39 with turtle-cli 2020-09-23 12:09:45 +02:00
Eric Samelson 2a54b4578a update CHANGELOG 2020-09-21 15:08:37 -07:00
Eric Samelson 7e234d09a3 Release 0.18.0 2020-09-21 15:07:47 -07:00
Eric Samelson 5b22c351bf update CHANGELOG 2020-09-21 13:20:39 -07:00
Stanisław Chmiela e2020f1ab4 Add SDK39 iOS tarballs (#257) 2020-09-21 13:19:47 -07:00
Eric Samelson c935e53e50 [android][ios] remove SDK 35 tarballs 2020-09-18 15:14:20 -07:00
Eric Samelson 14e681f35f [android] add SDK 39 tarball (#260) 2020-09-18 15:13:32 -07:00
Wojciech Kozyra d3a7ccb582 force image rebuild 2020-09-18 12:34:14 +02:00
Wojciech Kozyra 62478de14a update CHANGELOG.md 2020-09-14 14:22:07 +02:00
Wojciech Kozyra 6594089779 Release 0.17.3 2020-09-14 14:19:59 +02:00
dependabot[bot] 11c5d3ee02 Bump http-proxy from 1.17.0 to 1.18.1 (#256)
Bumps [http-proxy](https://github.com/http-party/node-http-proxy) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/http-party/node-http-proxy/releases)
- [Changelog](https://github.com/http-party/node-http-proxy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/http-party/node-http-proxy/compare/1.17.0...1.18.1)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-09-11 12:21:47 +02:00
dependabot[bot] 99b7ac6660 Bump node-fetch from 2.3.0 to 2.6.1 (#259)
Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.3.0 to 2.6.1.
- [Release notes](https://github.com/bitinn/node-fetch/releases)
- [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/bitinn/node-fetch/compare/v2.3.0...v2.6.1)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-09-11 12:21:26 +02:00
Stanisław Chmiela 46fe34ed9c Hardcode maximum heap size (#255)
<!-- Thanks for contributing to _turtle_! Before you submit your pull request, please make sure to check the following boxes by putting an x in the [ ] (don't: [x ], [ x], do: [x]) -->

### Checklist
- [x] I've read the [Contribution Guidelines](https://github.com/expo/turtle/blob/master/CONTRIBUTING.md).
- [ ] I've updated the [CHANGELOG](https://github.com/expo/turtle/blob/master/CHANGELOG.md) if necessary.
- [x] I've ensured the unit and smoke tests are still passing - either by running `yarn test:unit` and `yarn test:smoke:[ios|android]` or by checking the appropriate CircleCI builds' statuses.
- [x] **I've manually tested whether the changes I made work as expected.**

### Motivation and Context

Builds started to fail with

```
Error occurred during initialization of VM
Initial heap size set to a larger value than the maximum heap size
Error: ./gradlew exited with non-zero code: 1
    at ChildProcess.completionListener (/app/turtle/node_modules/@expo/xdl/node_modules/@expo/spawn-async/build/spawnAsync.js:52:23)
    at Object.onceWrapper (events.js:418:26)
    at ChildProcess.emit (events.js:311:20)
    at ChildProcess.EventEmitter.emit (domain.js:482:12)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
    ...
    at spawnAsync (/app/turtle/node_modules/@expo/xdl/node_modules/@expo/spawn-async/build/spawnAsync.js:17:21)
    at spawnAsyncThrowError (/app/turtle/node_modules/@expo/xdl/build/detach/ExponentTools.js:201:45)
    at buildShellAppAsync (/app/turtle/node_modules/@expo/xdl/build/detach/AndroidShellApp.js:940:11)
    at async Object.createAndroidShellAppAsync (/app/turtle/node_modules/@expo/xdl/build/detach/AndroidShellApp.js:386:5)
    at async runShellAppBuilder (/app/turtle/build/builders/android.js:95:9)
    at async Object.buildAndroid [as android] (/app/turtle/build/builders/android.js:43:28)
    at async build (/app/turtle/build/jobManager.js:181:33)
    at async processJob (/app/turtle/build/jobManager.js:118:32)
    at async Object.doJob (/app/turtle/build/jobManager.js:49:5)
    at async main (/app/turtle/build/server.js:66:13)
```

### Description

Consulted and helped with by @wkozyra95 — removed experimental options that made maximum heap size being set to a low value. Hardcoded proper value.
2020-09-07 14:05:02 +02:00
Stanisław Chmiela 423fc8bbf5 Upgrade XDL so it processes root build.gradle too (#254)
<!-- Thanks for contributing to _turtle_! Before you submit your pull request, please make sure to check the following boxes by putting an x in the [ ] (don't: [x ], [ x], do: [x]) -->

### Checklist
- [x] I've read the [Contribution Guidelines](https://github.com/expo/turtle/blob/master/CONTRIBUTING.md).
- [x] I've updated the [CHANGELOG](https://github.com/expo/turtle/blob/master/CHANGELOG.md) if necessary.
- [x] I've ensured the unit and smoke tests are still passing - either by running `yarn test:unit` and `yarn test:smoke:[ios|android]` or by checking the appropriate CircleCI builds' statuses.
- [x] **I've manually tested whether the changes I made work as expected.**

### Motivation and Context

Lands https://github.com/expo/expo-cli/pull/2547 in Turtle. This is a prerequisite for https://github.com/expo/expo/pull/10059 to be able to land (otherwise Turtle would end up with the offending block in root `build.gradle` which would fail the builds since there is no `:ReactAndroid` project in Turtle workspace).

### Description

Upgrades XDL.
2020-09-04 13:02:32 +02:00
Wojciech Kozyra 4c8408a46b [docker-base] add gradle 6.2 and set ANDROID_NDK_HOME (#251)
* [docker-base] add gradle 6.2 and set ANDROID_NDK_HOME

* update CHANGELOG
2020-09-04 11:19:08 +02:00
dependabot[bot] 032d7c8b1f Bump decompress from 4.2.0 to 4.2.1 (#252)
Bumps [decompress](https://github.com/kevva/decompress) from 4.2.0 to 4.2.1.
- [Release notes](https://github.com/kevva/decompress/releases)
- [Commits](https://github.com/kevva/decompress/compare/v4.2.0...v4.2.1)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-09-04 09:36:01 +02:00
Dominik Sokal b2a0b3ce14 use http endpoints for status updates (#249)
* use http endpoints for status updates

* resend updates if www failed to process them

* make leader responsible for synchronizing build updates

* fix tests
2020-08-24 10:13:43 +02:00
Dominik Sokal 1ee922763e send logs url with finished and errored messages (#248) 2020-08-17 13:43:40 +02:00
Wojciech Kozyra c31cd379c1 update CHANGELOG.md 2020-08-06 18:00:17 +02:00
Wojciech Kozyra 67754eba2a Release 0.17.2 2020-08-06 17:57:15 +02:00
Wojciech Kozyra 351fed00df Updated iOS shell app for SDK 38 with fixed integer tagging in expo-gl for iOS 14. (#245) 2020-08-06 17:51:49 +02:00
Stanisław Chmiela 487032b11d Update version manually as release-it broke 2020-08-05 18:07:03 +02:00
Stanisław Chmiela 042dd2ccab Add CHANGELOG entry 2020-08-05 16:12:55 +02:00
Stanisław Chmiela 99ae0d1cea Update Android shell tarball for SDK38 with targetSdkVersion bumped to 29 (#244)
<!-- Thanks for contributing to _turtle_! Before you submit your pull request, please make sure to check the following boxes by putting an x in the [ ] (don't: [x ], [ x], do: [x]) -->

### Checklist
- [x] I've read the [Contribution Guidelines](https://github.com/expo/turtle/blob/master/CONTRIBUTING.md).
- [x] I've updated the [CHANGELOG](https://github.com/expo/turtle/blob/master/CHANGELOG.md) if necessary.
- [x] I've ensured the unit and smoke tests are still passing - either by running `yarn test:unit` and `yarn test:smoke:[ios|android]` or by checking the appropriate CircleCI builds' statuses.
- [x] **I've manually tested whether the changes I made work as expected.**

### Motivation and Context

See https://github.com/expo/expo/pull/9446 and https://forums.expo.io/t/google-api-level-29/41231.

### Description

Updated Android SDK38 tarball with project with updated `targetSdkVersion`.
2020-08-05 16:06:46 +02:00
dependabot[bot] ad2c87163b Bump elliptic from 6.4.1 to 6.5.3 (#243)
Bumps [elliptic](https://github.com/indutny/elliptic) from 6.4.1 to 6.5.3.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](https://github.com/indutny/elliptic/compare/v6.4.1...v6.5.3)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-31 12:12:03 +02:00
dependabot[bot] b4b9cf362e Bump lodash from 4.17.11 to 4.17.19 (#242)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.11...4.17.19)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-17 09:08:55 +02:00
Dominik Sokal 7ea4dac986 upgrade jest and ts-jest to fix smoke tests (#241) 2020-07-16 14:44:59 +02:00
Dominik Sokal cd8da71711 update CHANGELOG 2020-07-16 08:54:06 +02:00
Dominik Sokal 2a2a0f39e0 Release 0.17.0 2020-07-16 08:51:04 +02:00
Dominik Sokal fbabcdf521 build:android - allow for passing custom gradle args (#239)
* build:android - allow for passing custom gradle args

* update CHANGELOG

* upgrade @expo/xdl to 57.9.25-alpha.1
2020-07-15 11:50:21 +02:00
Dominik Sokal 0803811226 update @expo/xdl to 57.9.25-alpha.0 to get rid of dots when downloading gradle 2020-07-15 10:21:45 +02:00
dependabot[bot] 0976a642e1 Bump npm-registry-fetch from 8.0.0 to 8.1.1 (#238)
Bumps [npm-registry-fetch](https://github.com/npm/registry-fetch) from 8.0.0 to 8.1.1.
- [Release notes](https://github.com/npm/registry-fetch/releases)
- [Changelog](https://github.com/npm/npm-registry-fetch/blob/latest/CHANGELOG.md)
- [Commits](https://github.com/npm/registry-fetch/compare/v8.0.0...v8.1.1)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-08 10:00:37 +02:00
Dominik Sokal 16bd4fe7b6 run yarn before release 2020-07-01 09:38:08 +02:00
Dominik Sokal 3ccd705943 Release 0.16.2 2020-07-01 09:35:06 +02:00
Dominik Sokal 11cc4421dd Release 0.16.1 2020-07-01 09:32:42 +02:00
Wojciech Kozyra 32f5a0bb37 use @expo/config to read project config (#237)
* use @expo/config to read info about project

* update CHANGELOG.md
2020-07-01 09:20:36 +02:00
jameswilddev 61a1906e01 Allow override of protocol validation in--public-url (#235)
* Allow override of protocol validation (https://github.com/expo/turtle/issues/210).

* Fix lint.
2020-06-29 10:01:15 +02:00
Eric Samelson 19a17231b3 update CHANGELOG 2020-06-25 09:31:08 -07:00
Eric Samelson 98c03bc8a2 Release 0.16.0 2020-06-25 09:29:20 -07:00
Eric Samelson 83ab2539c1 [ios][android] remove SDK 34 shell apps 2020-06-23 14:07:24 -07:00
Eric Samelson 064619e1ae [android] add SDK 38 shell tarball (#233) 2020-06-23 14:06:37 -07:00
Tomasz Sapeta b7fe01b758 [ios] Add shell tarballs for SDK38 (#231) 2020-06-23 14:08:43 +02:00
Dominik Sokal 6583b1a1db upgrade ioredis to 4.17.3 2020-06-22 15:00:42 +02:00
Dominik Sokal f24081cb91 Release 0.15.1 2020-06-22 13:45:27 +02:00
Dominik Sokal 4e719a200b update CHANGLEOG 2020-06-22 13:44:51 +02:00
Dominik Sokal 0b13494402 configure turtle to use the redis ca certificate (#232)
* add .vscode to gitignore

* configure turtle to use the redis ca certificate
2020-06-22 13:42:07 +02:00
Dominik Sokal 0ca26a40aa fix announcing supported sdk versions 2020-06-22 12:26:06 +02:00
Dominik Sokal f171913bac [circleci] bump yarn cache key 2020-06-18 15:32:41 +02:00
Dominik Sokal b47ee91117 update CHANGELOG.md 2020-06-02 14:06:05 +02:00
Dominik Sokal 77cb28ce66 Release 0.15.0 2020-06-02 14:04:22 +02:00
Dominik Sokal 7a2453cf53 upgrade @expo/xdl to 57.9.13 (to remove *.bak files from .ipa) 2020-06-02 14:01:11 +02:00
Charlie Cruzan 924908905f Update CHANGELOG.md 2020-05-14 10:17:23 -04:00
cruzach 798b4acca6 Release 0.14.12 2020-05-14 10:15:22 -04:00
cruzach 2303b44dd2 [ios] Update iOS custom client shell app 2020-05-13 09:27:17 -04:00
cruzach c204e0bef2 update CHANGELOG 2020-05-04 15:34:30 -04:00
cruzach 0918d8299e Release 0.14.11 2020-05-04 15:28:22 -04:00
cruzach 3543acfb26 [ios] Update sdk-37 shell app for 2.15.5 release 2020-05-04 14:49:41 -04:00
Wojciech Kozyra 42b6ff634c Release 0.14.10 2020-05-01 17:54:45 +02:00
Wojciech Kozyra fcd42b272f Update CHANGELOG 2020-05-01 17:54:09 +02:00
Wojciech Kozyra ecaef3a91d enable lean builds (#217) 2020-05-01 17:51:19 +02:00
Stanisław Chmiela 413e6a564d Cut 0.14.9 in CHANGELOG 2020-04-21 11:13:40 +02:00
Stanisław Chmiela ac27332151 Release 0.14.9 2020-04-21 11:12:24 +02:00
Stanisław Chmiela 72744f58ec [android] Build only the app artifact and not all available libraries (#214)
### Motivation and Context

I have noticed that not only the `app` project is being built on Turtle, but all the projects. (cross-posting from https://github.com/expo/expo-cli/pull/1937)

### Description

I've scoped the Gradle command to only build/assemble the `:app` project. It should be safe to do for all SDKs, since on all SDKs the app project was called `app`.

Published an alpha version of XDL to NPM, upgraded Turtle to it, deployed to staging and ran the build. It was over a minute faster than without this change ([new](https://staging.expo.io/dashboard/sjchmiela/builds/5c386cef-e808-49d3-91d8-9ce42af77c36) vs [old](https://staging.expo.io/dashboard/sjchmiela/builds/3d36340e-6ae1-4476-91cb-07d81f1edd1e)). (cross-posting from https://github.com/expo/expo-cli/pull/1937)
2020-04-21 11:11:52 +02:00
Stanisław Chmiela 96af4f753d Cut 0.14.8 in CHANGELOG 2020-04-20 16:48:54 +02:00
Stanisław Chmiela 4059c6f354 Release 0.14.8 2020-04-20 16:47:22 +02:00
Stanisław Chmiela b48f89054b Update XDL to remove check-dynamic-macros call (#212)
### Motivation and Context

See https://github.com/expo/expo-cli/pull/1933 and https://github.com/expo/expo/pull/7919.

### Description

Updates XDL so it includes change introduced in https://github.com/expo/expo-cli/pull/1933.
2020-04-20 16:46:35 +02:00
Stanisław Chmiela 7361f4af52 [changelog] Update changelog with 0.14.7 2020-04-20 12:40:16 +02:00
Stanisław Chmiela 41b48f0c66 Release 0.14.7 2020-04-20 12:39:17 +02:00
Stanisław Chmiela 56b3011d25 Remove secrets from SDK37 shell app, fix google-services.json handling (#209)
<!-- Thanks for contributing to _turtle_! Before you submit your pull request, please make sure to check the following boxes by putting an x in the [ ] (don't: [x ], [ x], do: [x]) -->

### Checklist
- [x] I've read the [Contribution Guidelines] (https://github.com/expo/turtle/blob/master/CONTRIBUTING.md).
- [x] I've updated the [CHANGELOG](https://github.com/expo/turtle/blob/master/CHANGELOG.md) if necessary.
- [x] I've ensured the unit and smoke tests are still passing - either by running `yarn test:unit` and `yarn test:smoke:[ios|android]` or by checking the appropriate CircleCI builds' statuses.
- [x] **I've manually tested whether the changes I made work as expected.**

### Motivation and Context

- `google-services.json` was being handled unintuitively, fixed with https://github.com/expo/expo-cli/pull/1897
- Expo Client's secrets were leaking in shell apps, fixed with https://github.com/expo/expo/pull/7768
- When deployed, fixes https://github.com/expo/expo/issues/7727.

### Description

XDL was modifying `google-services.json`, removing valid keys if the user doesn't provide the same, removed key in _some other place_ (see https://github.com/expo/expo/issues/7727#issuecomment-611544439). Fixed the change in XDL, upgraded to the fixed version here. Also removed secrets from the shell app.
2020-04-20 12:38:27 +02:00
Stanisław Chmiela ef6f9e3c5d Install only production dependencies in shell apps (#211)
<!-- Thanks for contributing to _turtle_! Before you submit your pull request, please make sure to check the following boxes by putting an x in the [ ] (don't: [x ], [ x], do: [x]) -->

### Checklist
- [x] I've read the [Contribution Guidelines](https://github.com/expo/turtle/blob/master/CONTRIBUTING.md).
- [x] I've updated the [CHANGELOG](https://github.com/expo/turtle/blob/master/CHANGELOG.md) if necessary.
- [x] I've ensured the unit and smoke tests are still passing - either by running `yarn test:unit` and `yarn test:smoke:[ios|android]` or by checking the appropriate CircleCI builds' statuses.
- [x] **I've manually tested whether the changes I made work as expected.**

### Motivation and Context

The build process doesn't use any of the `devDependencies` of shell apps and installing them makes the process slower and using more memory.

### Description

Added the `--production` flag to dependencies installer happening inside shell apps so it installs only the real dependencies of the project. This omits dependencies like:
- `babel-core`, `prettier`, `eslint` — we won't transpile, analyze, prettify JS when building the project,
- `expo-cli` — we could use `expo-cli` when building the project, but we don't (`expotools` are used and they are installed in the shell app)
- `expo-yarn-workspaces` — the `--ignore-scripts` removes the need for `expo-yarn-workspaces`

### Test plan

I have tested these changes as part of https://github.com/expo/turtle/pull/209. I have built two apps on SDK37 and both were built successfully.
2020-04-20 10:33:49 +02:00
Stanisław Chmiela 0302a5f71b Revert "Install only production dependencies in shell apps when setting up CLI too"
This reverts commit abb604b3b5.
2020-04-20 10:26:16 +02:00
Stanisław Chmiela abb604b3b5 Install only production dependencies in shell apps when setting up CLI too 2020-04-20 09:41:27 +02:00
Wojciech Kozyra f87dcc6972 add --ignore-scripts to yarn install in shellapp 2020-04-09 16:37:56 +02:00
Dominik Sokal fb27531805 Release 0.14.6 2020-04-09 15:14:53 +02:00
Dominik Sokal b307e0ed7f update CHANGELOG 2020-04-09 15:13:56 +02:00
Wojciech Kozyra 9bfa7c5674 improve deployment speed for android workers (#205)
improve deployment speed for android workers
2020-04-09 13:43:45 +02:00
Dominik Sokal 0fcade4a1f include turtle mode in in-progress message (#206)
* send turtle mode in in-progress message

* update smoke test recordings
2020-04-09 10:20:56 +02:00
Dominik Sokal df4b38711a upgrade @expo/xdl to 57.8.17 to fix downloading assets smaller than 10 bytes (fixes expo/expo#7701) 2020-04-08 15:48:19 +02:00
dependabot[bot] a2b5aa2934 Bump acorn from 6.1.0 to 6.4.1 (#202)
Bumps [acorn](https://github.com/acornjs/acorn) from 6.1.0 to 6.4.1.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/6.1.0...6.4.1)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-04-08 10:13:07 +02:00
Dominik Sokal 556e0758e7 don't use nix for ios smoke tests 2020-04-07 10:22:28 +02:00
Dominik Sokal 762c6f0538 Release 0.14.5 2020-04-06 14:27:36 +02:00
Dominik Sokal f549695e07 [turtle-cli] make the @expo/config error more meaningful 2020-04-06 14:27:10 +02:00
Dominik Sokal 1e8868e190 Release 0.14.4 2020-04-06 13:25:00 +02:00
Dominik Sokal 93df019bbc update CHANGELOG 2020-04-06 13:24:20 +02:00
Dominik Sokal 5541daa6ec [turtle-cli] insatll @expo/config and use it for determining sdk version 2020-04-06 13:21:29 +02:00
Dominik Sokal 22d78bf6fc [circleci] update cache key for shell apps 2020-04-06 12:26:03 +02:00
Dominik Sokal 4c724289d7 install node deps in android shell app when running smoke tests 2020-04-06 12:25:46 +02:00
Dominik Sokal c5a44dfb67 [circleci] run ios smoke test for sdk37 2020-04-06 12:24:44 +02:00
Dominik Sokal 8bbdc55932 [android] update smoke tests recording file 2020-04-06 12:23:36 +02:00
Dominik Sokal 80233c5736 [ios] update smoke test recordings 2020-04-06 11:38:32 +02:00
Dominik Sokal 5a2b8c47f4 Release 0.14.3 2020-04-03 17:13:47 +02:00
Dominik Sokal ab9391d672 update CHANGELOG - change the version to 0.14.3 - I incidentally interrupted the release 2020-04-03 17:13:24 +02:00
Dominik Sokal e95a6f49ff Release 0.14.2 2020-04-03 17:11:15 +02:00
Dominik Sokal d662cd47b6 [android] update sdk37 tarball so it doesn't use jq internally (#201)
* [android] update sdk37 tarball so it doesn't use jq internally

* [android] update sdk37 tarball again

* update CHANGELOG
2020-04-03 17:10:19 +02:00
Eric Samelson ce5de0963b Release 0.14.1 2020-04-01 14:16:42 -07:00
Eric Samelson 8f717c6c2e update CHANGELOG 2020-04-01 14:16:29 -07:00
Eric Samelson 905b55b7a4 [ios] update SDK 37 shell tarball to properly exclude unnecessary unimodules 2020-04-01 12:21:38 -07:00
Eric Samelson 4588281ffa Update CHANGELOG 2020-03-31 14:42:25 -07:00
Eric Samelson bc13f12052 Release 0.14.0 2020-03-31 14:40:15 -07:00
Eric Samelson 63d3e82cd7 [ci] update android tests to use sdk 37 2020-03-31 12:30:21 -07:00
Eric Samelson b2f8fdd342 [ios][android] drop SDK 33 2020-03-30 21:53:42 -07:00
Eric Samelson 4d9b3bdee9 [android][sdk37] add SDK 37 shell tarball (#198) 2020-03-30 21:52:41 -07:00
Bartłomiej Bukowski 15c165be26 [ios][sdk37] Add SDK 37 shell app tarball (#194) 2020-03-30 21:51:32 -07:00
Dominik Sokal f63e34ace3 Upgrade node to v12 / Drop node v8 support / Drop SDK 31 and 32 (#186) 2020-03-23 16:17:18 -07:00
dependabot[bot] e4ec82d1db Bump acorn from 5.7.3 to 5.7.4 (#195)
Bumps [acorn](https://github.com/acornjs/acorn) from 5.7.3 to 5.7.4.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/5.7.3...5.7.4)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-03-18 15:35:29 +01:00
127 changed files with 13519 additions and 7647 deletions

No files matched your search

+69 -17
View File
@@ -9,7 +9,7 @@ executors:
working_directory: ~/turtle
mac:
macos: # https://circleci.com/docs/2.0/testing-ios/#supported-xcode-versions
xcode: '10.1.0'
xcode: "11.1.0"
working_directory: /Users/distiller/project
shell: /bin/bash -leo pipefail
android:
@@ -57,8 +57,8 @@ commands:
- run:
name: Configure aws-cli
command: |
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
setup_nix:
steps:
@@ -77,6 +77,49 @@ commands:
EOF
chmod +x /bin/rm
install_nodejs_mac:
parameters:
nodejs_version:
type: string
default: 12.16.1
yarn_version:
type: string
default: 1.22.0
steps:
- restore_cache:
key: "node-js-v1-darwin-archive-<< parameters.nodejs_version >>"
- run:
name: Uninstall yarn with brew
command: brew uninstall --force yarn
- install_node_and_yarn:
platform: darwin
nodejs_version: "<< parameters.nodejs_version >>"
yarn_version: "<< parameters.yarn_version >>"
- save_cache:
key: "node-js-v1-darwin-archive-<< parameters.nodejs_version >>"
paths:
- /private/tmp/nodejs.tar.xz
install_node_and_yarn:
parameters:
platform:
type: string
nodejs_version:
type: string
yarn_version:
type: string
steps:
- run:
name: Install node & yarn
command: |
NODEJS_ARCHIVE="/tmp/nodejs.tar.xz"
if [ ! -f "$NODEJS_ARCHIVE" ]; then
curl -o $NODEJS_ARCHIVE -SL "https://nodejs.org/dist/v<< parameters.nodejs_version >>/node-v<< parameters.nodejs_version >>-<< parameters.platform >>-x64.tar.xz"
fi
tar -xJf $NODEJS_ARCHIVE -C /usr/local --strip-components=1 --exclude CHANGELOG.md --exclude README.md --exclude LICENSE
ln -s /usr/local/bin/node /usr/local/bin/nodejs
npm install --global yarn@<< parameters.yarn_version >>
decrypt_secrets_if_possible:
steps:
- run:
@@ -93,18 +136,24 @@ commands:
workingdir:
type: string
default: .
platform:
type: string
default: linux
steps:
- restore_cache:
key: yarn-v1-{{ checksum "<< parameters.workingdir >>/yarn.lock" }}
key: yarn-v3-<< parameters.platform >>-{{ checksum "<< parameters.workingdir >>/yarn.lock" }}
save_yarn_cache:
parameters:
workingdir:
type: string
default: .
platform:
type: string
default: linux
steps:
- save_cache:
key: yarn-v1-{{ checksum "<< parameters.workingdir >>/yarn.lock" }}
key: yarn-v3-<< parameters.platform >>-{{ checksum "<< parameters.workingdir >>/yarn.lock" }}
paths:
- ~/.cache/yarn # `yarn cache dir`
@@ -115,10 +164,10 @@ commands:
default: ios
sdk_version:
type: string
default: sdk32
default: sdk39
steps:
- restore_cache:
key: "workingdir-v1-<< parameters.platform >>-<< parameters.sdk_version >>"
key: "workingdir-v2-<< parameters.platform >>-<< parameters.sdk_version >>"
save_workingdir_cache:
parameters:
@@ -130,10 +179,10 @@ commands:
default: ios
sdk_version:
type: string
default: sdk32
default: sdk39
steps:
- save_cache:
key: "workingdir-v1-<< parameters.platform >>-<< parameters.sdk_version >>"
key: "workingdir-v2-<< parameters.platform >>-<< parameters.sdk_version >>"
paths:
- "<< parameters.workingdir >>/<< parameters.platform >>/<< parameters.sdk_version >>"
@@ -180,20 +229,23 @@ jobs:
executor: mac
steps:
- install_nix
- install_nodejs_mac
- setup
- decrypt_secrets_if_possible
- restore_yarn_cache
- restore_yarn_cache:
platform: darwin
- run: yarn
- save_yarn_cache
- save_yarn_cache:
platform: darwin
- restore_workingdir_cache:
sdk_version: sdk35
sdk_version: sdk39
platform: ios
- run:
name: Run iOS smoke tests
command: ./scripts/tests/runIOSSmokeTestsCI.sh
command: SDK_VERSION=sdk39 ./scripts/tests/runIOSSmokeTestsCI.sh
- save_workingdir_cache:
workingdir: /Users/distiller/project/workingdir
sdk_version: sdk35
sdk_version: sdk39
platform: ios
android_smoke_tests:
@@ -205,11 +257,11 @@ jobs:
- run: yarn
- save_yarn_cache
- restore_workingdir_cache:
sdk_version: sdk32
sdk_version: sdk39
platform: android
- run:
name: Fetch Android shell app
command: SDK_VERSION=sdk32 ./scripts/android/fetchRemoteAndroidTarball.sh
command: SDK_VERSION=sdk39 ./scripts/android/fetchRemoteAndroidTarball.sh
- run:
name: Run Android smoke tests
command: |
@@ -217,7 +269,7 @@ jobs:
--run "./scripts/tests/runAndroidSmokeTestsCI.sh"
- save_workingdir_cache:
workingdir: ~/turtle/workingdir
sdk_version: sdk32
sdk_version: sdk39
platform: android
android_staging_deploy:
+1 -1
View File
@@ -22,6 +22,6 @@ export NODE_ENV=development
export EXPO_TURTLE_TOOLS_DIR="$(pwd)/tools"
PATH_add $EXPO_TURTLE_TOOLS_DIR/bin
if [ "$CI" = "true" ]; then
if [ "$CI" = "true" ] && [[ ! $OSTYPE =~ darwin.* ]]; then
PATH_add $EXPO_TURTLE_TOOLS_DIR/ci/bin
fi
+1
View File
@@ -6,6 +6,7 @@ google-cloud-credentials.json
/workingdir/*
/artifacts/*
.history
.vscode/
shell.apk
.secrets*
+1 -1
View File
@@ -1 +1 @@
v8.15.1
v12.16.1
+3
View File
@@ -10,6 +10,9 @@
"release": true
},
"hooks": {
"before:init": [
"yarn"
],
"after:release": "yarn release:update:turtle-cli-example"
}
}
+273
View File
@@ -7,11 +7,278 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
- Updated SDK 40 Android, iOS, and client tarballs for patch release.
# [0.20.6] - 2021-01-25
- Update tarballs for SDK 40 patch release (3e345dd)
# [0.20.5] - 2020-12-23
### Changed
- Updated SDK 40 Android tarball to fix `expo-location` background permissions on Android <9.
# [0.20.4] - 2020-12-17
### Changed
- Updated SDK 40 iOS tarball to fix `expo-notifications` not emitting initial notification response.
# [0.20.3] - 2020-12-10
### Fixed
- Verify jq installation before proceeding with release ([#281](https://github.com/expo/turtle/pull/281)).
- Fixed the iOS build when running offline and user lacks elevated permissions.
# [0.20.2] - 2020-12-09
### Changed
- Updated SDK 40 Android tarball to fix `expo-notifications` installation identifier changing as a bug.
# [0.20.1] - 2020-12-08
### Changed
- Update SDK 40 iOS and Android tarballs for release
# [0.20.0] - 2020-11-30
- Add SDK 40 tarballs in preparation for SDK 40 beta
# [0.19.1] - 2020-11-19
### Fixed
- Fixed the iOS build using Xcode 12.1 by runnig `xcrun simctl list` before the build phase.
- Rebuild iOS tarballs (SDK 36, 37, 38, 39, Ad-Hoc Client) with Xcode 12.1 containing iOS 14 image fix.
# [0.19.0] - 2020-11-13
### Changed
- Rebuild iOS tarballs (SDK 36, 37, 38, 39, Ad-Hoc Client) with Xcode 12.1.
# [0.18.9] - 2020-11-09
### Fixed
- Updated xdl to 58.0.20 to fix an issue with updates.checkAutomatically not being applied properly to SDK 39 Android apps.
# [0.18.8] - 2020-10-27
### Fixed
- Fix issues with Reanimated v2 in Android SDK 39 tarball.
# [0.18.7] - 2020-10-23
### Fixed
- Fix issue with updates in self-hosted Android apps ([#10746](https://github.com/expo/expo/issues/10746)) in the SDK 39 tarball
# [0.18.6] - 2020-10-22
### Fixed
- Fix issues with notifications ([10624](https://github.com/expo/expo/pull/10624) and [10608](https://github.com/expo/expo/pull/10608)) in the Android SDK 39 tarball.
# [0.18.5] - 2020-10-07
### Fixed
- Always add expo-notifications for SDK >= 39 projects with android.enableDangerousExperimentalLeanBuilds enabled.
# [0.18.4] - 2020-10-06
### Fixed
- Fixed an issue with notifications ([expo/expo#10562](https://github.com/expo/expo/issues/10562)) in the Android SDK 39 tarball.
# [0.18.3] - 2020-10-03
### Fixed
- Update @expo/xdl to fix regression in SDK <= 39 splash
# [0.18.2] - 2020-10-03
### Fixed
- Updated SDK 39 Android tarball.
- Updated SDK 39 iOS tarball.
- Updated iOS client tarball.
- Update @expo/config and @expo/xdl. Temporarily bring in type definitions for color-string and xcode.
## [0.18.1] - 2020-09-22
### Fixed
- Fix building apps using SDK 39 for Android.
## [0.18.0] - 2020-09-21
### Added
- Added iOS and Android shell apps for SDK 39.
### Removed
- Dropped support for SDK 35.
## [0.17.3] - 2020-09-14
### Added
- Added gradle 6.2 to `turtle-android-base`
- Added `ANDROID_NDK_HOME` in `turtle-android-base`
### Changed
- Upgraded XDL so it processes root `build.gradle` of Android shell apps too
## [0.17.2] - 2020-08-06
### Changed
- Updated iOS shell app for SDK 38 with fixed integer tagging in expo-gl for iOS 14. ([#245](https://github.com/expo/turtle/pull/245))
## [0.17.1] - 2020-08-05
### Changed
- Updated Android shell app for SDK 38 with `targetSdkVersion` bumped to 29. ([#244](https://github.com/expo/turtle/pull/244))
## [0.17.0] - 2020-07-16
### Added
- `--gradle-args` option for `turtle build:android` which makes it possible to specify custom Gradle arguments.
### Changed
- Gradle Wrapper doesn't print when dots when the appropriate version of Gradle is being downloaded.
## [0.16.2] - 2020-07-01
### Added
- Added `--allow-non-https-public-url` to allow bypass of protocol validation on `--public-url`.
- Added support for dynamic configs (`app.config.ts`, `app.config.js`).
## [0.16.0] - 2020-06-25
### Added
- Added iOS shell app for Expo SDK38.
- Added Android shell app for SDK 38.
### Removed
- Dropped support for SDK 34.
## [0.15.1] - 2020-06-22
### Changed
- Configure Turtle to use the Redis CA certificate.
### Fixed
- Fix announcing supported SDK versions.
## [0.15.0] - 2020-06-02
### Changed
- Updated `@expo/xdl` to 57.9.13 (added \*.bak files clean-up when building .ipa).
## [0.14.12] - 2020-05-14
### Changed
- Update iOS custom client shell app with various fixes.
## [0.14.11] - 2020-05-04
### Changed
- Update SDK 37 iOS shell app with various fixes.
## [0.14.10] - 2020-05-01
### Added
- support for "android.enableDangerousExperimentalLeanBuilds" in app.json.
## [0.14.9] - 2020-04-21
### Changed
- Updated `@expo/xdl` to 57.8.30 (scoped the build command so it only builds the `:app` Android sub-project and not all the sub-projects available, [PR](https://github.com/expo/expo-cli/pull/1937)).
## [0.14.8] - 2020-04-20
### Changed
- Updated `@expo/xdl` to 57.8.29 (removed call to `check-dynamic-macros-android.sh`, [PR](https://github.com/expo/expo-cli/pull/1933)).
## [0.14.7] - 2020-04-20
### Changed
- Turtle no longer installs all dependencies of shell apps projects — only the production dependencies are installed now.
- Updated `@expo/xdl` to 57.8.25 (fixed unintuitive `google-services.json` handling for SDK37+, [PR](https://github.com/expo/expo-cli/pull/1897)).
## [0.14.6] - 2020-04-09
### Changed
- Updated @expo/xdl to 57.8.17 (fixed downloading assets smaller than 10 bytes).
## [0.14.5] - 2020-04-06
### Changed
- Made @expo/config error more meaningful.
## [0.14.4] - 2020-04-06
### Fixed
- Determining SDK version for Expo apps using SDK >=37.
## [0.14.3] - 2020-04-03
### Fixed
- A fix for Android SDK 37 - `check-dynamic-macros-android.sh` doesn't use `jq` anymore.
## [0.14.1] - 2020-04-01
### Changed
- Updated iOS shell app for SDK 37 to remove unnecessary unimodules.
## [0.14.0] - 2020-03-31
### Added
- Added iOS shell app for SDK 37.
- Added Android shell app for SDK 37.
### Changed
- Updated iOS client shell app to support SDK 37.
- Replace `/` with `__` in the artifact filename to fix a strange bug with selecting APK file in Android Studio.
- Print currently using Java version if it's not 8.
### Removed
- Dropped support for SDK 33.
## [0.13.10] - 2020-03-09
### Added
@@ -22,12 +289,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Changed the way of installing NDK - it's installed with `sdkmanager` now.
- Upgraded NDK to 17.2.4988734.
- Upgraded Node.js version to 12.16.1.
### Fixed
- A bug where the `platform` field in logs wasn't set correctly when using a shortcut command.
- Removed all remaining instances of `UIWebView` in iOS app builds.
### Removed
- Dropped support for Node.js versions older than 10.
- Dropped support for building Expo SDK 31 and 32 apps.
## [0.13.9] - 2020-02-13
### Fixed
+1 -1
View File
@@ -8,7 +8,7 @@
## Setup
- Run `update-local-secrets` to populate the `.secrets*` files. You'll need to run this any time any secret changes (it shouldn't be very often).
- Run `EXPO_UNIVERSE_DIR=/path/to/universe/dir yarn secrets:init-private YOUR_SQS_NICKNAME`. Alternatively, you can create `.secrets.local-queue` file with the SQS queues' urls yourself (`AWS_SQS_OUT_QUEUE_URL`, `AWS_SQS_ANDROID_QUEUE_URL`, `AWS_SQS_ANDROID_PRIORITY_QUEUE_URL`, `AWS_SQS_IOS_QUEUE_URL`, `AWS_SQS_IOS_PRIORITY_QUEUE_URL`)
- Run `EXPO_UNIVERSE_DIR=/path/to/universe/dir yarn secrets:init-private YOUR_SQS_NICKNAME`. Alternatively, you can create `.secrets.local-queue` file with the SQS queues' urls yourself (`AWS_SQS_ANDROID_QUEUE_URL`, `AWS_SQS_ANDROID_PRIORITY_QUEUE_URL`, `AWS_SQS_IOS_QUEUE_URL`, `AWS_SQS_IOS_PRIORITY_QUEUE_URL`)
- Run `yarn set-workingdir:local` or `yarn set-workingdir:remote`:
- `:local` creates symlinks to the shell apps in `expo` repository (_unfortunately this is currently broken_)
- `:remote` downloads precompiled shell apps
+17 -18
View File
@@ -1,29 +1,28 @@
# see docker-base/Dockerfile to learn what's installed in the turtle-android-base image
FROM gcr.io/exponentjs/turtle-android-base:0.1.3
FROM gcr.io/exponentjs/turtle-android-base:0.5.0
ADD . /app/turtle
RUN mv /app/turtle/workingdir /app && \
for SDK_VERSION in `ls /app/workingdir/android/`; do \
echo "preparing $SDK_VERSION shell app" && \
cd /app/workingdir/android/$SDK_VERSION && \
if [ -f universe-package.json ]; then \
mv package.json exponent-package.json && \
mv universe-package.json package.json && \
yarn install && \
mv package.json universe-package.json && \
mv exponent-package.json package.json; \
else \
yarn install; \
fi \
; done && \
mv /app/workingdir /app/turtle
WORKDIR /app/turtle
RUN ./scripts/fetchRemoteTarballs.sh android
RUN ln -s /app/turtle/workingdir /app/workingdir && \
for SDK_VERSION in `ls /app/workingdir/android/`; do \
echo "preparing $SDK_VERSION shell app" && \
cd /app/workingdir/android/$SDK_VERSION && \
mv packages non-workspace-packages && \
# Keep in sync with src/bin/setup/android/index.ts#_installNodeModules
# --prod requires --ignore-scripts (otherwise
# expo-yarn-workspaces errors as missing)
yarn install --ignore-scripts --prod && \
mv non-workspace-packages packages ; \
done
ENV NODE_ENV "production"
ENV TURTLE_WORKING_DIR_PATH /app/turtle/workingdir/
WORKDIR /app/turtle
ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf
ADD redislabs_ca.pem /var/run/config/redislabs-tls/redislabs_ca.pem
CMD ["/usr/bin/supervisord"]
+1 -1
View File
@@ -21,7 +21,7 @@ You can use it both on your CI and your private computer.
## Installation
[Installation instructions and documentation here.](https://docs.expo.io/versions/latest/distribution/turtle-cli)
[Installation instructions and documentation here.](https://docs.expo.io/distribution/turtle-cli/)
## Usage example
+1
View File
@@ -0,0 +1 @@
configureAndroidSdk.sh
+14 -1
View File
@@ -32,7 +32,7 @@ RUN dpkg --add-architecture i386 && \
apt-get clean
ENV NPM_CONFIG_LOGLEVEL warn
ENV NODE_VERSION 8.12.0
ENV NODE_VERSION 12.16.1
RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \
&& tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 \
@@ -57,10 +57,23 @@ ENV PATH ${ANDROID_HOME}/build-tools/28.0.3/:${PATH}
ADD configureAndroidSdk.sh /tmp/configureAndroidSdk.sh
RUN /tmp/configureAndroidSdk.sh --install-all-platforms
ENV ANDROID_NDK_HOME /usr/local/android-sdk-linux/ndk/17.2.4988734
# Support Gradle
ENV TERM dumb
# Install gradle 6.2
RUN wget https://services.gradle.org/distributions/gradle-6.2-all.zip
RUN unzip -qq gradle-6.2-all.zip
RUN cp -r gradle-6.2 /usr/local
RUN mkdir -p /root/.gradle/wrapper/dists/gradle-6.2-all/dvufqs6kielxeao781pmk5huj
RUN mv gradle-6.2-all.zip /root/.gradle/wrapper/dists/gradle-6.2-all/dvufqs6kielxeao781pmk5huj
RUN mv gradle-6.2 /root/.gradle/wrapper/dists/gradle-6.2-all/dvufqs6kielxeao781pmk5huj
RUN touch /root/.gradle/wrapper/dists/gradle-6.2-all/dvufqs6kielxeao781pmk5huj/gradle-6.2-all.zip.ok
RUN touch /root/.gradle/wrapper/dists/gradle-6.2-all/dvufqs6kielxeao781pmk5huj/gradle-6.2-all.zip.lck
RUN chmod 755 /root/.gradle/wrapper/dists/gradle-6.2-all/dvufqs6kielxeao781pmk5huj/gradle-6.2/bin/gradle
# Install gradle 5.6.3
RUN wget https://services.gradle.org/distributions/gradle-5.6.3-all.zip
RUN unzip -qq gradle-5.6.3-all.zip
+4 -7
View File
@@ -88,11 +88,6 @@ spec:
secretKeyRef:
name: turtle-js-config
key: aws_sqs_android_priority_queue_url
- name: AWS_SQS_OUT_QUEUE_URL
valueFrom:
secretKeyRef:
name: turtle-js-config
key: aws_sqs_out_queue_url
- name: AWS_CLOUDWATCH_REGION
valueFrom:
secretKeyRef:
@@ -149,9 +144,11 @@ spec:
- name: DISABLE_DEX_MAX_HEAP
value: "true"
- name: JAVA_OPTS
value: '-Xms2048m -XX:+HeapDumpOnOutOfMemoryError -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:+UseG1GC'
value: '-Xms2048m -Xmx8192m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseG1GC'
- name: GRADLE_OPTS
value: '-Dorg.gradle.parallel=true -Dorg.gradle.configureondemand=true -Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-Xms2048m -XX:+HeapDumpOnOutOfMemoryError -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:+UseG1GC"'
value: '-Dorg.gradle.parallel=true -Dorg.gradle.configureondemand=true -Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-Xms2048m -Xmx8192m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseG1GC"'
- name: REDIS_CA_CERTIFICATE
value: '/var/run/config/redislabs-tls/redislabs_ca.pem'
resources:
requests:
memory: "8192Mi"
+1 -1
View File
@@ -1,5 +1,5 @@
self: super:
{
nodejs = super.nodejs-8_x;
nodejs = super.nodejs-12_x;
}
+87 -21
View File
@@ -2,11 +2,78 @@ with (import ./default.nix {});
let
ndk = androidenv.androidndk_17c.override { fullNDK = true; };
ndk_root = "${ndk}/libexec/${ndk.name}";
sdk_path = if stdenv.isDarwin
then "/Library/Android/sdk"
else "/Android/Sdk"; # intentional Capital S
# These expressions can be deleted when react native depends on version of
# ndk present in nixpkgs.
os = if stdenv.system == "x86_64-linux" then "linux"
else if stdenv.system == "x86_64-darwin" then "macosx" else throw "unsupported system architecture: ${stdenv.system}";
ndk_17c_src = if stdenv.isDarwin then fetchurl {
url = http://dl.google.com/android/repository/android-ndk-r17c-darwin-x86_64.zip;
sha256 = "11iyxgqp017fchn54kkns9mrax73m73xm5wgis266dsq2g36dn73";
} else fetchurl {
url = https://dl.google.com/android/repository/android-ndk-r17c-linux-x86_64.zip;
sha256 = "12b5h5p8b2ia38825dnnacn7b47c0inpys8jp82r42iks3dilm1z";
};
ndk_runtime_paths = lib.makeBinPath [ coreutils file findutils gawk gnugrep gnused jdk python3 which ]; #+ ":${platform-tools}/platform-tools";
ndk = stdenv.mkDerivation {
name = "ndk-17c";
src = ndk_17c_src;
buildInputs = [ unzip autoPatchelfHook makeWrapper python2 ] ++ lib.optional (os == "linux") [ glibc stdenv.cc.cc ncurses5 zlib libcxx.out ];
unpackPhase = ''
mkdir extractedzip
cd extractedzip
unpackFile "$src"
if [ "$(find . -mindepth 1 -maxdepth 1 -type d | wc -l)" -eq 1 ]
then
cd "$(find . -mindepth 1 -maxdepth 1 -type d)"
fi
sourceRoot="$PWD"
'';
installPhase = ''
packageBaseDir=$out/libexec/android-sdk/ndk-bundle
mkdir -p $packageBaseDir
cd $packageBaseDir
cp -av $sourceRoot/* .
'' + lib.optionalString (os == "linux") ''
patchShebangs .
wrapProgram $(pwd)/build/tools/make_standalone_toolchain.py --prefix PATH : "${ndk_runtime_paths}"
rm -rf docs tests
# Patch the executables of the toolchains, but not the libraries -- they are needed for crosscompiling
addAutoPatchelfSearchPath $out/libexec/android-sdk/ndk-bundle/toolchains/renderscript/prebuilt/linux-x86_64/lib64
find toolchains -type d -name bin | while read dir
do
autoPatchelf "$dir"
done
# fix ineffective PROGDIR / MYNDKDIR determination
for i in ndk-build
do
sed -i -e 's|^PROGDIR=`dirname $0`|PROGDIR=`dirname $(readlink -f $(which $0))`|' $i
done
# Patch executables
autoPatchelf prebuilt/linux-x86_64
# wrap
for i in ndk-build
do
wrapProgram "$(pwd)/$i" --prefix PATH : "${ndk_runtime_paths}"
done
# make some executables available in PATH
mkdir -p $out/bin
for i in ndk-build
do
ln -sf ../../libexec/android-sdk/ndk-bundle/$i $out/bin/$i
done
'';
dontStrip = true;
dontPatchELF = true;
dontAutoPatchelf = true;
noAuditTmpdir = true;
};
ndkRoot = "${ndk}/libexec/android-sdk/ndk-bundle";
sdk = androidenv.androidPkgs_9_0.androidsdk;
sdk_path = if stdenv.isDarwin
then "/Library/Android/sdk"
else "/Android/Sdk"; # intentional Capital S
in
@@ -23,28 +90,27 @@ mkShell rec {
nativeBuildInputs = [
awscli
curl
fastlane
git
nodejs-8_x
nodejs
openjdk8
yarn
];
passthru = { inherit ndk; };
passthru = { inherit ndk ndkRoot; };
shellHook = ''
${./install-ndk-17c.sh} ${ndk} ${ndk_root}
yes | ${androidenv.androidsdk_9_0}/bin/sdkmanager --licenses --sdk_root="$ANDROID_SDK_ROOT"
yes | ${androidenv.androidsdk_9_0}/bin/sdkmanager --sdk_root="$ANDROID_SDK_ROOT" "platforms;android-28" | grep -v =
yes | ${androidenv.androidsdk_9_0}/bin/sdkmanager --sdk_root="$ANDROID_SDK_ROOT" "build-tools;28.0.3" | grep -v =
${lib.optionalString stdenv.isLinux ''
for dep in lib lib64; do
if [ -L /$dep ] || [ ! -e /$dep ]; then
echo "Creating /$dep"
ln -s ${stdenv.cc.libc}/$dep /$dep
else
echo "Using existing /$dep"
fi
done
''}
${./install-ndk-17c.sh} ${ndk} ${ndkRoot}
# grep -v = should clean up build logs, see https://stackoverflow.com/a/52464819/1123156
yes | ${sdk}/bin/sdkmanager --sdk_root="$ANDROID_SDK_ROOT" "build-tools;28.0.3" | grep -v =
'' + lib.optionalString stdenv.isLinux ''
for dep in lib lib64; do
if [ -L /$dep ] || [ ! -e /$dep ]; then
echo "Creating /$dep"
ln -s ${stdenv.cc.libc}/$dep /$dep
else
echo "Using existing /$dep"
fi
done
'';
}
+3 -3
View File
@@ -1,7 +1,7 @@
{
"url": "https://github.com/NixOS/nixpkgs-channels.git",
"rev": "80738ed9dc0ce48d7796baed5364eef8072c794d",
"date": "2018-11-17T11:18:10+01:00",
"sha256": "0anmvr6b47gbbyl9v2fn86mfkcwgpbd5lf0yf3drgm8pbv57c1dc",
"rev": "42f0be81ae05a8fe6d6e8e7f1c28652e7746e046",
"date": "2020-03-01T07:21:40-03:00",
"sha256": "1rxb5kmghkzazqcv4d8yczdiv2srs4r7apx4idc276lcikm0hdmf",
"fetchSubmodules": false
}
+44 -14
View File
@@ -1,6 +1,6 @@
{
"name": "turtle-cli",
"version": "0.13.10",
"version": "0.20.7",
"description": "The command-line tool for building standalone Expo apps",
"preferGlobal": true,
"scripts": {
@@ -55,7 +55,7 @@
"react-native"
],
"engines": {
"node": ">=8"
"node": ">=10"
},
"author": "Expo <[email protected]>",
"license": "MIT",
@@ -67,14 +67,20 @@
"registry": "https://registry.npmjs.org/"
},
"devDependencies": {
"@expo/babel-preset-cli": "^0.1.3",
"@expo/babel-preset-cli": "^0.2.18",
"@types/color-string": "^1.5.0",
"@types/decompress": "^4.2.3",
"@types/fs-extra": "^5.0.4",
"@types/ioredis": "^4.16.6",
"@types/jest": "^23.3.9",
"@types/probe-image-size": "^5.0.1",
"@types/latest-version": "^4.0.1",
"@types/joi": "^13.4.3",
"@types/lodash": "^4.14.129",
"@types/node-forge": "^0.8.6",
"@types/npm-package-arg": "^6.1.0",
"@types/progress": "^2.0.1",
"@types/ncp": "^2.0.1",
"@types/raven": "^2.5.1",
"@types/request": "^2.47.1",
"@types/request-promise": "^4.1.44",
@@ -84,29 +90,40 @@
"@types/uuid": "^3.4.3",
"@types/webpack": "^4.32.1",
"@types/webpack-dev-server": "^3.1.7",
"@types/url-join": "^4.0.0",
"@types/which": "^1.3.1",
"husky": "^1.3.1",
"jest": "^23.6.0",
"jest": "^26.1.0",
"lint-staged": "^8.1.5",
"nock": "^10.0.1",
"nodemon": "^1.18.11",
"nodemon": "^2.0.2",
"release-it": "^12.3.4",
"rimraf": "^2.6.2",
"ts-jest": "^23.10.4",
"ts-jest": "^26.1.2",
"ts-node": "^8.0.3",
"ts-transformer-imports": "^0.4.1",
"tsconfig-paths": "^3.8.0",
"tslint": "^5.10.0",
"tslint-eslint-rules": "^5.4.0",
"ttypescript": "^1.5.6",
"typescript": "^3.4.2"
"typescript": "^3.9.5"
},
"dependencies": {
"@expo/spawn-async": "^1.4.2",
"@expo/xdl": "57.4.0",
"@google-cloud/logging-bunyan": "^0.9.5",
"@expo/bunyan": "4.0.0",
"@expo/config": "~3.3.9",
"@expo/spawn-async": "~1.5.0",
"@expo/plist": "0.0.11",
"@expo/json-file": "8.2.26",
"@google-cloud/logging-bunyan": "^2.0.3",
"async-retry": "^1.2.1",
"aws-sdk": "^2.226.1",
"axios": "0.21.1",
"ncp": "2.0.0",
"minimatch": "3.0.4",
"indent-string": "3.2.0",
"pascal-case": "2.0.1",
"node-forge": "0.7.6",
"glob": "7.1.6",
"bunyan": "^1.8.12",
"bunyan-debug-stream": "^1.0.8",
"bunyan-sentry-stream": "^1.2.1",
@@ -115,26 +132,39 @@
"decompress": "^4.2.0",
"dogapi": "^2.8.3",
"fs-extra": "^6.0.0",
"ioredis": "^3.2.2",
"ioredis": "^4.17.3",
"is-semver": "^1.0.8",
"joi": "^13.2.0",
"latest-version": "5.1.0",
"lodash": "^4.17.11",
"p-map": "3.0.0",
"p-retry": "4.1.0",
"probe-image-size": "^6.0.0",
"p-timeout": "3.1.0",
"package-json": "6.4.0",
"progress": "^2.0.0",
"prompts": "^2.3.2",
"raven": "^2.6.2",
"request": "^2.88.0",
"request-progress": "^3.0.0",
"request-promise": "^4.2.5",
"replace-string": "1.1.0",
"rimraf": "^2.6.2",
"semver": "^6.0.0",
"sharp": "0.22.1",
"sharp": "0.24.1",
"source-map-support": "^0.5.6",
"tar": "^4.4.6",
"url-join": "4.0.0",
"uuid": "^3.2.1",
"which": "^1.3.1"
"which": "^1.3.1",
"xcode": "^2.1.0",
"xmldom": "0.1.27"
},
"optionalDependencies": {
"@expo/traveling-fastlane-darwin": "1.11.4"
},
"volta": {
"node": "8.15.1"
"node": "12.16.1",
"yarn": "1.22.0"
}
}
+1
View File
@@ -0,0 +1 @@
this is just a placeholder to simplify deployments
+1 -1
View File
@@ -14,7 +14,7 @@ PLATFORM=$1
yarn
yarn run build
if [ "$PLATFORM" = "android" ]; then
$ROOT_DIR/scripts/android/fetchRemoteAndroidTarball.sh
echo "shell apps will be fetched when building a Docker image"
elif [ "$PLATFORM" = "ios" ]; then
$ROOT_DIR/scripts/ios/fetchRemoteIosTarball.sh
fi
+1 -3
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
if [ -z "$EXPO_UNIVERSE_DIR" ]; then
echo "You need to specify EXPO_UNIVERSE_DIR to use this script. Alternatively you can create .secrets.local-queue file yourself with AWS_SQS_ANDROID_QUEUE_URL, AWS_SQS_IOS_QUEUE_URL and AWS_SQS_OUT_QUEUE_URL variables."
echo "You need to specify EXPO_UNIVERSE_DIR to use this script. Alternatively you can create .secrets.local-queue file yourself with AWS_SQS_ANDROID_QUEUE_URL and AWS_SQS_IOS_QUEUE_URL variables."
exit 1
fi
@@ -17,13 +17,11 @@ ANDROID_NORMAL=`cd $TERRAFORM_DIR; terraform state show module.turtle_queues_loc
ANDROID_PRIORITY=`cd $TERRAFORM_DIR; terraform state show module.turtle_queues_local_$1.aws_sqs_queue.jobs_android_in_priority | head -1 | cut -d"=" -f2 | xargs`
IOS_NORMAL=`cd $TERRAFORM_DIR; terraform state show module.turtle_queues_local_$1.aws_sqs_queue.jobs_ios_in | head -1 | cut -d"=" -f2 | xargs`
IOS_PRIORITY=`cd $TERRAFORM_DIR; terraform state show module.turtle_queues_local_$1.aws_sqs_queue.jobs_ios_in_priority | head -1 | cut -d"=" -f2 | xargs`
OUT=`cd $TERRAFORM_DIR; terraform state show module.turtle_queues_local_$1.aws_sqs_queue.jobs_out | head -1 | cut -d"=" -f2 | xargs`
cat << EOF > $TURTLE_DIR/.secrets.local-queue
AWS_SQS_ANDROID_QUEUE_URL="$ANDROID_NORMAL"
AWS_SQS_ANDROID_PRIORITY_QUEUE_URL="$ANDROID_PRIORITY"
AWS_SQS_IOS_QUEUE_URL="$IOS_NORMAL"
AWS_SQS_IOS_PRIORITY_QUEUE_URL="$IOS_PRIORITY"
AWS_SQS_OUT_QUEUE_URL="$OUT"
EOF
+6
View File
@@ -2,6 +2,12 @@
set -eo pipefail
if ! command -v jq &> /dev/null
then
echo "jq is not installed and is required by the release script. Install it through homebrew or your package manager of choice."
exit
fi
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. && pwd )"
if [[ -z "$GITHUB_TOKEN" || -z "$CIRCLE_API_USER_TOKEN" ]]; then
+6
View File
@@ -2,6 +2,12 @@
set -eo pipefail
if ! command -v jq &> /dev/null
then
echo "jq is not installed and is required by the release script. Install it through homebrew or your package manager of choice."
exit
fi
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. && pwd )"
$ROOT_DIR/node_modules/.bin/release-it -c $ROOT_DIR/.release-it.beta.json --preRelease=beta
+1 -1
View File
@@ -7,7 +7,7 @@ DOWNLOAD_DIR="${EXPO_DOWNLOAD_DIR:-$HOME/Downloads}"
mkdir -p $DOWNLOAD_DIR
if [ ! -f "$ROOT_DIR/.secrets.local-queue" ]; then
echo "You need to run \"yarn secrets:init-private [SQS_NAME]\" or create the .secrets.local-queue file yourself with AWS_SQS_ANDROID_QUEUE_URL, AWS_SQS_ANDROID_PRIORITY_QUEUE_URL, AWS_SQS_IOS_QUEUE_URL, AWS_SQS_IOS_PRIORITY_QUEUE_URL and AWS_SQS_OUT_QUEUE_URL variables."
echo "You need to run \"yarn secrets:init-private [SQS_NAME]\" or create the .secrets.local-queue file yourself with AWS_SQS_ANDROID_QUEUE_URL, AWS_SQS_ANDROID_PRIORITY_QUEUE_URL, AWS_SQS_IOS_QUEUE_URL, and AWS_SQS_IOS_PRIORITY_QUEUE_URL variables."
exit 1
fi
+6 -1
View File
@@ -2,6 +2,8 @@
set -ueo pipefail
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../.. && pwd )"
export NODE_ENV=test
export ENVIRONMENT="development"
@@ -11,7 +13,6 @@ export AWS_SQS_ANDROID_QUEUE_URL="https://sqs.us-west-2.amazonaws.com/2742511416
export AWS_SQS_ANDROID_PRIORITY_QUEUE_URL="https://sqs.us-west-2.amazonaws.com/274251141632/turtle_jobs_local_dominik_android_in_priority.fifo"
export AWS_SQS_IOS_QUEUE_URL="https://sqs.us-west-2.amazonaws.com/274251141632/turtle_jobs_local_dominik_ios_in.fifo"
export AWS_SQS_IOS_PRIORITY_QUEUE_URL="https://sqs.us-west-2.amazonaws.com/274251141632/turtle_jobs_local_dominik_ios_in_priority.fifo"
export AWS_SQS_OUT_QUEUE_URL="https://sqs.us-west-2.amazonaws.com/274251141632/turtle_jobs_local_dominik_out.fifo"
export AWS_SQS_REGION="aws.west2"
export AWS_S3_BUCKET="exp-shell-app-assets"
export AWS_S3_REGION="us-west-1"
@@ -24,4 +25,8 @@ export REDIS_CONFIG_URL="noop"
export DATADOG_DISABLED="true"
export TURTLE_SDK_VERSIONS_SECRET_TOKEN="noop"
pushd $ROOT_DIR/workingdir/android/${SDK_VERSION:-sdk39} >/dev/null 2>&1
yarn
popd >/dev/null 2>&1
yarn test:smoke:android
+1 -2
View File
@@ -9,7 +9,6 @@ export AWS_SQS_ANDROID_QUEUE_URL="https://sqs.us-west-2.amazonaws.com/2742511416
export AWS_SQS_ANDROID_PRIORITY_QUEUE_URL="https://sqs.us-west-2.amazonaws.com/274251141632/turtle_jobs_local_dominik_android_in_priority.fifo"
export AWS_SQS_IOS_QUEUE_URL="https://sqs.us-west-2.amazonaws.com/274251141632/turtle_jobs_local_dominik_ios_in.fifo"
export AWS_SQS_IOS_PRIORITY_QUEUE_URL="https://sqs.us-west-2.amazonaws.com/274251141632/turtle_jobs_local_dominik_ios_in_priority.fifo"
export AWS_SQS_OUT_QUEUE_URL="https://sqs.us-west-2.amazonaws.com/274251141632/turtle_jobs_local_dominik_out.fifo"
export AWS_SQS_REGION="aws.west2"
export AWS_S3_BUCKET="exp-shell-app-assets"
export AWS_S3_REGION="us-west-1"
@@ -23,6 +22,6 @@ export DATADOG_DISABLED="true"
export TURTLE_SDK_VERSIONS_SECRET_TOKEN="noop"
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../.. && pwd )"
SDK_VERSION=sdk35 $ROOT_DIR/scripts/ios/fetchRemoteIosTarball.sh
$ROOT_DIR/scripts/ios/fetchRemoteIosTarball.sh
yarn test:smoke:ios
-1
View File
@@ -9,7 +9,6 @@ export AWS_SQS_IOS_QUEUE_URL="noop"
export AWS_SQS_ANDROID_QUEUE_URL="noop"
export AWS_SQS_IOS_PRIORITY_QUEUE_URL="noop"
export AWS_SQS_ANDROID_PRIORITY_QUEUE_URL="noop"
export AWS_SQS_OUT_QUEUE_URL="noop"
export AWS_ACCESS_KEY_ID="noop"
export AWS_SECRET_ACCESS_KEY="noop"
export AWS_SQS_REGION="noop"
+6
View File
@@ -2,6 +2,12 @@
set -eo pipefail
if ! command -v jq &> /dev/null
then
echo "jq is not installed and is required by the release script. Install it through homebrew or your package manager of choice."
exit
fi
DEPLOY_ENDPOINT_URL="https://circleci.com/api/v1.1/project/github/expo/turtle-cli-example/tree/updates-do-not-remove-me"
curl -X POST \
-1
View File
@@ -1 +0,0 @@
s3://exp-artifacts/android-shell-builder-89b2d24c86737d5a489c6a18467e31b2f9ce9005.tar.gz
-1
View File
@@ -1 +0,0 @@
s3://exp-artifacts/android-shell-builder-f796aaffa0b5715079b2950faf26c2ff4e53e4c0.tar.gz
-1
View File
@@ -1 +0,0 @@
s3://exp-artifacts/android-shell-builder-aebd669d6573b0b3c802871d94cdb8b4116678d2.tar.gz
-1
View File
@@ -1 +0,0 @@
s3://exp-artifacts/android-shell-builder-a8e204610e5712391336b378f47962bbb0c04164.tar.gz
-1
View File
@@ -1 +0,0 @@
s3://exp-artifacts/android-shell-builder-7ce098f40cc82a2f61fed9f1f515d695a83c55b2.tar.gz
+1
View File
@@ -0,0 +1 @@
s3://exp-artifacts/android-shell-builder-3cf3cf0707925322bcd667d5ba79120136f9afd8.tar.gz
+1
View File
@@ -0,0 +1 @@
s3://exp-artifacts/android-shell-builder-6cde8e00cd7bdf7a933cd8aad7f8e86981ea68a2.tar.gz
+1
View File
@@ -0,0 +1 @@
s3://exp-artifacts/android-shell-builder-d292dcd0cc277ab665957244a8b15b9981debd29.tar.gz
+1
View File
@@ -0,0 +1 @@
s3://exp-artifacts/android-shell-builder-277393d97877f56ba3639ab153c69f109d248436.tar.gz
+1 -1
View File
@@ -1 +1 @@
s3://exp-artifacts/ios-expo-client-33560c83d858e509e71150d4163836d2bfcae2b6.tar.gz
s3://exp-artifacts/ios-expo-client-dd6b6b4840c7a99725f1ec9a9a3970de91e90b1d.tar.gz
-1
View File
@@ -1 +0,0 @@
s3://exp-artifacts/ios-shell-builder-sdk-latest-55848298c7332f7586c4281fa691a4ca31548532.tar.gz
-1
View File
@@ -1 +0,0 @@
s3://exp-artifacts/ios-shell-builder-sdk-latest-edd02214dd84368c197df32a2d30a901d6c766ff.tar.gz
-1
View File
@@ -1 +0,0 @@
s3://exp-artifacts/ios-shell-builder-sdk-latest-36b57e8ebb96aa8dce286c89bd56e8708eca819d.tar.gz
-1
View File
@@ -1 +0,0 @@
s3://exp-artifacts/ios-shell-builder-sdk-latest-651588ff3445a5d87b3a5b81ec2977c02b22f3a2.tar.gz
-1
View File
@@ -1 +0,0 @@
s3://exp-artifacts/ios-shell-builder-sdk-latest-0115c48ddac4f63e5215541dff804871ef8c1e03.tar.gz
+1 -1
View File
@@ -1 +1 @@
s3://exp-artifacts/ios-shell-builder-sdk-latest-661a51216c2241dcfdd930517968cd1d0e0ee237.tar.gz
s3://exp-artifacts/ios-shell-builder-sdk-latest-0983415327f49592d81f0bd3dc8c46a3572c19b0.tar.gz
+1
View File
@@ -0,0 +1 @@
s3://exp-artifacts/ios-shell-builder-sdk-latest-df407aadb7208fc389564aed400c39263294eb76.tar.gz
+1
View File
@@ -0,0 +1 @@
s3://exp-artifacts/ios-shell-builder-sdk-latest-ba6ec1974977bebf8fd2db22a1c87f6a0b36ffa5.tar.gz
+1
View File
@@ -0,0 +1 @@
s3://exp-artifacts/ios-shell-builder-sdk-latest-4a9a038998f6be13e8a2900a95afbb9f96dd023d.tar.gz
+1
View File
@@ -0,0 +1 @@
s3://exp-artifacts/ios-shell-builder-sdk-latest-dd6b6b4840c7a99725f1ec9a9a3970de91e90b1d.tar.gz
@@ -1 +1 @@
[{"scope":"https://sqs.us-west-2.amazonaws.com:443","method":"POST","path":"/","body":"Action=ReceiveMessage&MaxNumberOfMessages=1&QueueUrl=https%3A%2F%2Fsqs.us-west-2.amazonaws.com%2F274251141632%2Fturtle_jobs_local_dominik_android_in_priority.fifo&Version=2012-11-05&VisibilityTimeout=30","status":200,"response":"<?xml version=\"1.0\"?><ReceiveMessageResponse xmlns=\"http://queue.amazonaws.com/doc/2012-11-05/\"><ReceiveMessageResult><Message><MessageId>fc2fe53d-1447-4304-90e0-60b025ac9687</MessageId><ReceiptHandle>AQEBcOA9S4yhL3ZCaho9Cv+XVqJEbhOaaWJTsOvBD9SOa/NK/248s0+yI9bHro5Ti9WJrnD3H65SdK9eOETFeS/QDaaCMTYkxjvH/1DrSJt2rAptgItmxl8F6N3iDYLqplOQjmautdjCWYXrCLxMDihMHEjcvWNAq0XLAAjlQJvtm5Z8Vji5xXKJP3IpQOV2DvhS/Cqriteaqe6NW5xKwgKHOC52IVTPMSHiJ0ERUf55agntOOJJ7Za7vHdTr+Zjrxl6yVFWKC/cpwYI00OKGj4bArud0buiaD0rtjszLmcPgcwADRsmhfG65p3gLwIwjfclHqSLlmcuY3c+xsu/5VM1YA==</ReceiptHandle><MD5OfBody>c9e8a99bf73407dfa26a2cb81103c26a</MD5OfBody><Body>{&quot;id&quot;:&quot;b9f9f814-5603-4dd5-929d-c9eed756c591&quot;,&quot;experienceId&quot;:&quot;531b2db0-4b14-11e9-92d6-95aebd1034a3&quot;,&quot;experienceName&quot;:&quot;@dsokal-local/turtle-cli-example&quot;,&quot;platform&quot;:&quot;android&quot;,&quot;config&quot;:{&quot;releaseChannel&quot;:&quot;default&quot;},&quot;status&quot;:&quot;sent-to-queue&quot;,&quot;sdkVersion&quot;:&quot;32.0.0&quot;,&quot;accountId&quot;:&quot;4c44c9d8-3cb6-4980-8505-ca0637cf3165&quot;,&quot;priority&quot;:&quot;high&quot;,&quot;credentials&quot;:{&quot;keystore&quot;:&quot;/u3+7QAAAAIAAAABAAAAAQAscWdyemIydGhiYzFzYjJuaGJjOTBkeGowYmd1dHkyeHBsd3Y0eXcxd2JndT0AAAFpycAadgAABQIwggT+MA4GCisGAQQBKgIRAQEFAASCBOrpcy5jViAnKMlnwuvGQ2qa5UcYfuJQwaa48a4oEcvZlrPUUvQSi1T/ZOVpWc8bhiAD8xvTbTh0w1B26K4bPrbrchQGyubs5o3tZU94I+1yMR//nITj4srlUPipX7kr2KdGDqfLfS4EwK8FXACyXx3YxC30STovgtOjTctGUQRzD2iQmu9UmlCAl4szItY2vn+j51VJBpjV9SWXrWpEOmH6hkq7xlHFhbr00FpJXnzON6ifg7ymMIUbkG2nLC3VGCVTAqWBsOgEnUExMOKTedl6Rdzze5sP9CmzUk4aUpgZK1CHjvY03/RztuFky85ODEfSLrk3zBnegQgg0x54RQq1ji+/s5IyPslfpZbcVsTM1KBLEstfCkhZT8xjCZeUxD44U1UxcMlXRYsWtpHv5gfG/4vvV9xQ+pqzuCD43DLiTrqUFw9VzIzXjU7L9CXNGN0DtcmTI5usoKhLZPYgnpT546H4rnZkPzxYs3HXd+tyBmqFTWbvoRiFI2njeaMu0/RZMR17VKjv1u7rITpi7xjwX8cxPvxHLxoDyLL/0vxu45qfmH9ScOWw0QAxQ6RybMhZuZYXuHCERrJ4DLgXNqX8yDjba/C4ioF4nl4cL1S3JtUUE8aRaB6KKQaXP2Fxj+mww3eqetWBuCBD0yBHVscqCZfePh3b1hotMaVZvu/VrxkFL+BbnOkeSinwhkHB2sLFW3wzE5NQHbMi3chaHavC0jxFfaqf8aARub+5I/0+tqI3Crj46EdcxBMpPVa82HAYLkM8pSL8Tjs15bHg+v5suU+DEAymFPauDfEOIzbAJYdBmyrLiL5HBBSM39TdjdpXm1TOdBBtpOlROpJJsOpd3HRIqBF6yHyyRSrPZ5b5k42KCbMheRREXssqZoyPtZWT8aUdi9SnwhZm/fhNPVie1F7GjfsWi5U6OLpSHk2J6GOiwBFk5AXXoe4LNqcAMwYng5a23xEyAJ2JQ4sV5Hb8asNOfVjKvwLSKhRkG1wa+zsku2B0wFa7czX3r/u+NsEfOSbgo8ICya8itu8nlaoCtol/484Ab7NHiPJpF1qeZDB5n57+aODG7rjpBXJLvB0BTI4x9bPOEEzEu6cUEo6pvVIYGb5wTfgKVZVv5pA40x61/OicbG9dR8W6co/MfCDA0BMREzxO6djh8aSphR8Wd3jFYw1MI+PzCllnD3L4/6ZTc7R4sa9EUIfIxIFp7hw48HFO6I9uhp79lQySZ+EcEFFsvMK1hRGR6lfgX8ZWqgnJP1fx0n7PXyzFQvCEsw6GEesu6IVco39vNs1WL//FhhGf+HU2/Jq7wFOjN4yQtU/h2CEG5fv/aKGswoMv2Kqiihd4LjpxQlQHlaOXjp5QnBVMl6/8QVvX50JieabW3uXmcbOGnQ8qAOyg4OCgPzJmShifOeLuDPUQIvG4Tm7514lPZJ1aGFF9tj/zEBjxJfs7N30lUG+TfcPeFQDYfwmUZED2nZgsDdNQhkkucIf53Zgly9tKzXodRdAqwSv9qAeX69nbC2Db9J//E7CaDMLgm/Ij/w11MVlikMYv0FE95PdJ/vLbWPzEF1OwxXtutlg2TPksdSU7Cl7oJNk4B++fekquRmjPGzb8EEVIsTwmzZ77LOnre/F9Zy6nGX5mGCzhnYsBux6cRaDdwcYZ6UDm2PO88c5LEiIuAAAAAQAFWC41MDkAAANhMIIDXTCCAkWgAwIBAgIEHWp77zANBgkqhkiG9w0BAQsFADBfMQswCQYDVQQGEwJVUzEJMAcGA1UECBMAMQkwBwYDVQQHEwAxCTAHBgNVBAoTADEJMAcGA1UECxMAMSQwIgYDVQQDExtjb20uZXhwby50dXJ0bGUuY2xpLmV4YW1wbGUwHhcNMTkwMzI5MTQwMDAzWhcNNDYwODE0MTQwMDAzWjBfMQswCQYDVQQGEwJVUzEJMAcGA1UECBMAMQkwBwYDVQQHEwAxCTAHBgNVBAoTADEJMAcGA1UECxMAMSQwIgYDVQQDExtjb20uZXhwby50dXJ0bGUuY2xpLmV4YW1wbGUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCw5E26XXa9AHihXC2gDfA9Wi4kHOhLiC5D6D1iS3Ftc+UCgg1d4pEzVB1o5O81IhWyIdTINkmpZ/qgDi1DCWXEgFHSisHFWWisXy/Ab2zRSPkE0GsDlnNvq2wObLzhEnLyALZ57+5EjQRCQJlzbO3kCFPhf/hT4hnVrsF+nnObkiEnUPCGLebHYqzk6lvMQ2XERzTyIovHD+TvfbIpKWOjSeZeEQ/9DI6Yo9bkZ4rRs9Z1vX1UTMtvEEg/T9oyCY0uE5h6yz49eH3Q2M27DqYEC3VaDhSBSELnItfSBnay/6vaQSlEzB+FGW6Jt9rTDQ1tMayUGQKvxhXi+08NHm7vAgMBAAGjITAfMB0GA1UdDgQWBBQiidnk1c5N5F4Aeg/EEPiuJO6ApDANBgkqhkiG9w0BAQsFAAOCAQEAkPbJQpnfoZehkPPNOHvyFl5S/POROColqo4OwfaYF0LmFfhMOPi3B2iuEXDPc/lVliuhQ+b+kD+pQnqlcDxWXEP8ZJETFjVSMLAeZ43MoTs22DBKh6sMYrO7MyjZbIwMMALmnfniHQe58gV7ot0sgBCs0bN3hICpqHXzZn6QSLxW1F9W5/52XFEwl+6zwTKnphZPNBhOCPQ/Z6cCEmodrKD48YeEOu+laojg3TZhVEF8Wf6TdcHjgyaT2IRPF+J6aD2K9ZazLFN/tvz0j5+1EPYtm1l6iX9RMFg0GtbRngXcIhuPXrcNuThF5/c2dL13JNYtMHUe3AAOfkycMNVjeTDkzLXZiULCDIisCnPuJQ9cRz7N&quot;,&quot;keyPassword&quot;:&quot;fb7409988d78459c826cf2a438cb3a33&quot;,&quot;keystoreAlias&quot;:&quot;QGRzb2thbC1sb2NhbC90dXJ0bGUtY2xpLWV4YW1wbGU=&quot;,&quot;keystorePassword&quot;:&quot;80c3583b33b84a1d91e5cf33b2421d7c&quot;},&quot;manifest&quot;:{&quot;android&quot;:{&quot;package&quot;:&quot;com.expo.turtle.cli.example&quot;},&quot;bundledAssets&quot;:[&quot;asset_3a2ba31570920eeb9b1d217cabe58315.ttf&quot;,&quot;asset_744ce60078c17d86006dd0edabcd59a7.ttf&quot;,&qLine truncated
[{"scope":"https://sqs.us-west-2.amazonaws.com:443","method":"POST","path":"/","body":"Action=ReceiveMessage&MaxNumberOfMessages=1&QueueUrl=https%3A%2F%2Fsqs.us-west-2.amazonaws.com%2F274251141632%2Fturtle_jobs_local_dominik_android_in.fifo&Version=2012-11-05&VisibilityTimeout=30","status":200,"response":"<?xml version=\"1.0\"?><ReceiveMessageResponse xmlns=\"http://queue.amazonaws.com/doc/2012-11-05/\"><ReceiveMessageResult/><ResponseMetadata><RequestId>8de5bfc7-bc8e-5ee3-9e04-e787ff880c47</RequestId></ResponseMetadata></ReceiveMessageResponse>","rawHeaders":["x-amzn-RequestId","8de5bfc7-bc8e-5ee3-9e04-e787ff880c47","Date","Tue, 01 Dec 2020 13:10:35 GMT","Content-Type","text/xml","Content-Length","240"]},{"scope":"https://sqs.us-west-2.amazonaws.com:443","method":"POST","path":"/","body":"Action=ReceiveMessage&MaxNumberOfMessages=1&QueueUrl=https%3A%2F%2Fsqs.us-west-2.amazonaws.com%2F274251141632%2Fturtle_jobs_local_dominik_android_in_priority.fifo&Version=2012-11-05&VisibilityTimeout=30","status":200,"response":"<?xml version=\"1.0\"?><ReceiveMessageResponse xmlns=\"http://queue.amazonaws.com/doc/2012-11-05/\"><ReceiveMessageResult/><ResponseMetadata><RequestId>0bb998bb-3156-5159-b16f-c0fb725a5d65</RequestId></ResponseMetadata></ReceiveMessageResponse>","rawHeaders":["x-amzn-RequestId","0bb998bb-3156-5159-b16f-c0fb725a5d65","Date","Tue, 01 Dec 2020 13:10:41 GMT","Content-Type","text/xml","Content-Length","240"]},{"scope":"https://sqs.us-west-2.amazonaws.com:443","method":"POST","path":"/","body":"Action=ReceiveMessage&MaxNumberOfMessages=1&QueueUrl=https%3A%2F%2Fsqs.us-west-2.amazonaws.com%2F274251141632%2Fturtle_jobs_local_dominik_android_in.fifo&Version=2012-11-05&VisibilityTimeout=30","status":200,"response":"<?xml version=\"1.0\"?><ReceiveMessageResponse xmlns=\"http://queue.amazonaws.com/doc/2012-11-05/\"><ReceiveMessageResult/><ResponseMetadata><RequestId>feef69fc-27a3-5af5-83af-31bc64b1b9d7</RequestId></ResponseMetadata></ReceiveMessageResponse>","rawHeaders":["x-amzn-RequestId","feef69fc-27a3-5af5-83af-31bc64b1b9d7","Date","Tue, 01 Dec 2020 13:10:47 GMT","Content-Type","text/xml","Content-Length","240"]},{"scope":"https://sqs.us-west-2.amazonaws.com:443","method":"POST","path":"/","body":"Action=ReceiveMessage&MaxNumberOfMessages=1&QueueUrl=https%3A%2F%2Fsqs.us-west-2.amazonaws.com%2F274251141632%2Fturtle_jobs_local_dominik_android_in_priority.fifo&Version=2012-11-05&VisibilityTimeout=30","status":200,"response":"<?xml version=\"1.0\"?><ReceiveMessageResponse xmlns=\"http://queue.amazonaws.com/doc/2012-11-05/\"><ReceiveMessageResult><Message><MessageId>f39aaec9-47e0-4d02-bdb7-cf467fe2ea19</MessageId><ReceiptHandle>AQEBBI8nzAywIPCH57h1Iptt39uq60E5dzlj+Er50gtGqH+esoJ6iFdxoPDxvtD0xfT0qlyKSqlmoBDkQwh36tqsfqdT5FcFF8ejmPMRVIE8hexofzEbacxxw+3cBfgra2EFAik49TJbMT5pwxyaf42y+qwyWKOZ5N62VzRgGtnpj5ilNw1dt0lUzCdsfhCu7sne+dfJ8oMpbuy6T+ttoEYUS6VVKmv8f1BzuujHoKMy0kJip8r3zFoaigWE2p1bpFby9b9oBFTFT1ycD618YTu+Un5S9Q7Q6/nqJ7RPM2BfK2iPxBMk+UWmGfJ/otX11Zc0p8qx/MyKuYY/480Zta//xQ==</ReceiptHandle><MD5OfBody>1942fb5be12b59fc93b8052cf960f7d8</MD5OfBody><Body>{&quot;id&quot;:&quot;686530e4-c025-4a01-b84b-041e6d4f7fb3&quot;,&quot;experienceId&quot;:&quot;4d928c1c-5be9-4380-8fd5-48a6a4805839&quot;,&quot;experienceName&quot;:&quot;@testtest2/sdk-39-test&quot;,&quot;platform&quot;:&quot;android&quot;,&quot;config&quot;:{&quot;releaseChannel&quot;:&quot;default&quot;,&quot;buildType&quot;:&quot;apk&quot;},&quot;status&quot;:&quot;sent-to-queue&quot;,&quot;sdkVersion&quot;:&quot;39.0.0&quot;,&quot;accountId&quot;:&quot;1ecd48ee-e393-4f6b-9f77-311f2e0d2b39&quot;,&quot;priority&quot;:&quot;high&quot;,&quot;credentials&quot;:{&quot;keystore&quot;:&quot;/u3+7QAAAAIAAAABAAAAAQAgcWhybGMzcjB6eG4wbWk5enpnc3Rtemt0ZGd2emRhPT0AAAF2HlYoCQAABQEwggT9MA4GCisGAQQBKgIRAQEFAASCBOmzIBnRnHGBLgRUOJ1GGYiLjktnTeq/GXR/h4KZSSQ67PoiJqJnhrHLvj35Sr1swSL78q4j52IRV/a1mFbqQT4JFFy1ZdH2XgKUptY+kVc+ZrBI/awC8akIeYofWmKTNcS0Bc9IDT1VwIzwxxRrlnK/36Gh2m1vRuwVUdBChHjB4SHgC91F8wB0opY+RmiRhZqQevd8PBvZyqKenR5IWgZDXhsUYvvby4U4zMzvEgV3zNv7YGYM1Bb2ehJ8HdsW6O/58zFL3ufJ3+H2VonLxSn9YayninHoqkyMP40/mmnaFPz5jNItDkCQIeuudgQc8mrZlv4X0lM2ZjT4ZJDLdN4FCXV5iYDe4hopF8iF+DZmhMaZ1xFJ57boEaZ+WUcwsTkKOawusOGqW2JsvZbDMehOYLc8aqM2t28PrdYf3c7zspJALi6+tar2mwN66TX/AteeJRAk3r7HAiYPyle5gOffGgpmy0klLb5MEStkLQNNNsVMLJ7XSYrewzI6jXyAbMVc6PzbiVnCRPtoSy0TMUD7qQWMUGdePL1jxDlwhOVS3jgwOwHIFhUaLBbQOPROm1bF4hY3p25+LHFu954aDsYC3JlT6k9EOKIacKbJThq14r2Lb4EekfQlYTO/yst6ncVJcawWHYS1f93xWUlIjcpFnqJrLq2QVQfhafPWJmTS3K0lcYgFpfxvoU8RVn+ySaLOiy9J86l5YPmtpH/nFqr6BkqROy6dXps5x+D9vi3jVfYlYHnmqHxq7vyX5X+IMIMLvJ28SviuMKWb8Ikqmm7FSzlewJfF4xy/NLgQrQY6VxUahy92PZf3uR02ENolnj5nPSnh/B1FnIfrG46xFqlPg8imzen7hjKk1yXrdUjOT4WcjLdD/K/heVVHKUnsn3QCBt6eOgB8MpG9XzGRD+PAwloklASQx8iVSD67EauU2y1yayf4lNaQzdfnF3iFXSF25BU9XLJIRTtdRsTwmLRuLTmQcctLYD8hQCDQ2/njZtTkdY/AJeVlm44CdDaTLJpP8mVVscAOgH/S0DPi/oGGie8AYeKr8ZmBO1lQSN6l2LBJcAq2fh6AaUF5By21lT9FfR9KQd5WM87iUZk41nBIHQXcQSSt7H+vETEfm/8T9tOOwY5dMyf5QAYNCZuBoIFNCr0MOxe/Dcrsvd46KVbftR4HsJsQl53MnZoh4eLine truncated
Binary file not shown.
+1 -2
View File
@@ -17,8 +17,7 @@ jest.mock('../builders/utils/uploader.ts', () => ({
async function performSmokeTest(recording: string) {
jest.setTimeout(60 * 60 * 1000);
// @ts-ignore
const fixtureExists = await fs.exists(recording);
const fixtureExists = await fs.pathExists(recording);
if (fixtureExists) {
logger.info('Fixture exists, test will use existing one.');
+1 -1
View File
@@ -136,7 +136,7 @@ function _addEmptyMetrics(metrics: IMetric[]) {
acc.add(i.MetricName);
}
return acc;
}, new Set());
}, new Set<string>());
const nonEmptyMetrics = _.omitBy(state.registeredMetrics, ({ addEmpty }) => !addEmpty);
const toAdd = _.difference(Object.keys(nonEmptyMetrics), Array.from(seenMetrics));
+4 -4
View File
@@ -19,10 +19,10 @@ export default function calculateStatistics(metrics: IMetric[]) {
});
}
result.StatisticValues.Maximum = Math.max(result.StatisticValues.Maximum, i.Value);
result.StatisticValues.Minimum = Math.min(result.StatisticValues.Minimum, i.Value);
result.StatisticValues.SampleCount += 1;
result.StatisticValues.Sum += i.Value;
result!.StatisticValues.Maximum = Math.max(result!.StatisticValues.Maximum, i.Value);
result!.StatisticValues.Minimum = Math.min(result!.StatisticValues.Minimum, i.Value);
result!.StatisticValues.SampleCount += 1;
result!.StatisticValues.Sum += i.Value;
return result;
}, null);
return [reduced];
+1 -18
View File
@@ -2,9 +2,8 @@ import retry from 'async-retry';
import AWS from 'aws-sdk';
import _ from 'lodash';
import { OUTPUT_QUEUE_URL, QUEUE_URL } from 'turtle/aws/utils';
import { QUEUE_URL } from 'turtle/aws/utils';
import config from 'turtle/config';
import { JOB_UPDATE_TYPE } from 'turtle/constants/build';
import logger from 'turtle/logger';
import { getCurrentJobId } from 'turtle/turtleContext';
@@ -73,19 +72,3 @@ export function changeMessageVisibilityRecurring(priority: string, receiptHandle
}
}, (VISIBILITY_TIMEOUT_SEC * 1000) / 3);
}
export async function sendMessage(jobId: string, status: JOB_UPDATE_TYPE, data = {}) {
const params = {
MessageBody: JSON.stringify({ jobId, status, ...data }),
QueueUrl: OUTPUT_QUEUE_URL(),
DelaySeconds: 0,
MessageGroupId: jobId,
};
try {
return await retry(async () => {
return await sqs.sendMessage(params).promise();
});
} catch (err) {
logger.error({ err }, `Error sending SQS message: ${JSON.stringify(params)}}`);
}
}
-1
View File
@@ -1,4 +1,3 @@
import config from 'turtle/config';
export const QUEUE_URL = (priority: string) => (config.sqs.queues as any)[priority][config.platform];
export const OUTPUT_QUEUE_URL = () => config.sqs.queues.out;
+5
View File
@@ -29,6 +29,11 @@ export default (program: any, setCommonCommandOptions: any) => {
/^(debug|release)$/i,
'release',
)
.option(
'--gradle-args <gradle-args>',
'optional arguments passed to gradle, make sure to surround them with double quotes'
+ ' (e.g.: --gradle-args "--stacktrace --debug")',
)
.description(
'Build a standalone APK or App Bundle for your project, either signed and ready for submission to'
+ ' the Google Play Store or in debug mode.',
+6 -1
View File
@@ -15,7 +15,12 @@ function setCommonCommandOptions(cmd: any) {
.option('-o --output <output-file-path>', 'output file path')
.option(
'--public-url <url>',
'the URL of an externally hosted manifest (for self-hosted apps), only HTTPS URLs are supported!',
'the URL of an externally hosted manifest (for self-hosted apps), only HTTPS URLs are supported unless '
+ '--allow-non-https-public-url is also set!',
)
.option(
'--allow-non-https-public-url',
'allows non-HTTPS URLs in --public-url; this should only be used when building an unpublished application',
)
.option(
'--release-channel <channel-name>',
+31 -14
View File
@@ -1,19 +1,27 @@
import path from 'path';
import { LoggerDetach, ModuleVersion } from '@expo/xdl';
import program, { Command } from 'commander';
import fs from 'fs-extra';
import { LoggerDetach, ModuleVersion } from '../xdl';
import * as commands from 'turtle/bin/commands';
import logger from 'turtle/logger';
const { name, version } = JSON.parse(fs.readFileSync(path.join(__dirname, '../../package.json'), 'utf-8'));
const { name, version } = JSON.parse(
fs.readFileSync(path.join(__dirname, '../../package.json'), 'utf-8'),
);
const ModuleVersionChecker = ModuleVersion.createModuleVersionChecker(name, version);
const ModuleVersionChecker = ModuleVersion.createModuleVersionChecker(
name,
version,
);
// @ts-ignore: Type mismatch
LoggerDetach.configure(logger);
Command.prototype.asyncAction = function asyncAction(asyncFn: (...asyncFnArgs: any[]) => void): Command {
Command.prototype.asyncAction = function asyncAction(
asyncFn: (...asyncFnArgs: any[]) => void,
): Command {
return this.action(async (...args) => {
try {
await checkForUpdateAsync();
@@ -33,19 +41,24 @@ export function run(programName: string) {
async function runAsync(programName: string) {
program.version(version);
Object.values(commands).forEach((command) => registerCommand(program, command));
Object.values(commands).forEach((command) =>
registerCommand(program, command),
);
program.parse(process.argv);
const subCommand = process.argv[2];
if (subCommand) {
const commandNames = program.commands.reduce((acc: string[], command: any) => {
acc.push(command._name);
const alias = command._alias;
if (alias) {
acc.push(alias);
}
return acc;
}, []);
const commandNames = program.commands.reduce(
(acc: string[], command: any) => {
acc.push(command._name);
const alias = command._alias;
if (alias) {
acc.push(alias);
}
return acc;
},
[],
);
if (!commandNames.includes(subCommand)) {
logger.error(
`"${subCommand}" is not an ${programName} command. See "${programName} --help" for the full list of commands.`,
@@ -59,7 +72,11 @@ async function runAsync(programName: string) {
const registerCommand = (prog: any, command: any) => command(prog);
async function checkForUpdateAsync() {
const { updateIsAvailable, current, latest } = await ModuleVersionChecker.checkAsync();
const {
updateIsAvailable,
current,
latest,
} = await ModuleVersionChecker.checkAsync();
if (updateIsAvailable) {
logger.warn(
`There is a new version of ${name} available (${latest}).
+4 -2
View File
@@ -1,9 +1,9 @@
import path from 'path';
import util from 'util';
import { ExponentTools } from '@expo/xdl';
import fs from 'fs-extra';
import _which from 'which';
import { ExponentTools } from '../../../xdl';
import ensureAndroidSDKIsPresent from 'turtle/bin/setup/android/sdk';
import { checkSystem, ensureShellAppIsPresent } from 'turtle/bin/setup/utils/common';
@@ -101,7 +101,9 @@ async function _shellAppPostDownloadAction(sdkVersion: string, workingdir: strin
async function _installNodeModules(cwd: string) {
l.info(`installing dependencies in ${cwd} directory...`);
const command = await _shouldUseYarnOrNpm();
await ExponentTools.spawnAsyncThrowError(command, ['install'], {
// Keep in sync with /Dockerfile
// --prod requires --ignore-scripts (otherwise expo-yarn-workspaces errors as missing)
await ExponentTools.spawnAsyncThrowError(command, ['install', '--ignore-scripts', '--production'], {
pipeToLogger: true,
loggerFields: LOGGER_FIELDS,
cwd,
+2 -1
View File
@@ -1,9 +1,9 @@
import os from 'os';
import path from 'path';
import { ExponentTools } from '@expo/xdl';
import decompress from 'decompress';
import fs from 'fs-extra';
import { ExponentTools } from '../../../xdl';
import * as utils from 'turtle/bin/setup/utils/common';
import download from 'turtle/bin/setup/utils/downloader';
@@ -67,6 +67,7 @@ function _createEnvVars(androidSdkDir: string) {
return {
ANDROID_HOME: androidSdkDir,
ANDROID_SDK: androidSdkDir,
ANDROID_NDK_HOME: path.join(androidSdkDir, 'ndk/17.2.4988734'),
};
}
+1 -1
View File
@@ -3,7 +3,7 @@ import trim from 'lodash/trim';
import path from 'path';
import semver from 'semver';
import { ExponentTools } from '@expo/xdl';
import { ExponentTools } from '../../xdl';
import { checkSystem, ensureShellAppIsPresent } from 'turtle/bin/setup/utils/common';
import { IToolDefinition } from 'turtle/bin/setup/utils/toolsDetector';
+2 -2
View File
@@ -1,8 +1,8 @@
import path from 'path';
import { ExponentTools } from '@expo/xdl';
import fs from 'fs-extra';
import tar from 'tar';
import { ExponentTools } from '../../../xdl';
import download from 'turtle/bin/setup/utils/downloader';
import { ensureToolsAreInstalled, IToolDefinition } from 'turtle/bin/setup/utils/toolsDetector';
@@ -64,7 +64,7 @@ export function formatArtifactDownloadPath(uri: string) {
async function _readShellAppTarballS3Uri(sdkVersion: string, formatters: IShellAppFormaters) {
const sdkMajorVersion = ExponentTools.parseSdkMajorVersion(sdkVersion);
const filePath = formatters.formatShellAppTarballUriPath(sdkMajorVersion);
const filePath = formatters.formatShellAppTarballUriPath(String(sdkMajorVersion));
const data = await fs.readFile(filePath, 'utf8');
return data.trim();
}
+35 -14
View File
@@ -1,8 +1,9 @@
import _url from 'url';
import { ExponentTools } from '@expo/xdl';
import { ConfigError, getExpoSDKVersion, ProjectConfig } from '@expo/config';
import _ from 'lodash';
import uuid from 'uuid';
import { ExponentTools } from '../../xdl';
import { ErrorWithCommandHelp } from 'turtle/bin/commands/ErrorWithCommandHelp';
import { ErrorWithProgramHelp } from 'turtle/bin/commands/ErrorWithProgramHelp';
@@ -56,28 +57,29 @@ export function createBuilderAction({
);
}
if (cmd.publicUrl) {
if (cmd.publicUrl && !cmd.allowNonHttpsPublicUrl) {
const parsedPublicUrl = _url.parse(cmd.publicUrl);
if (parsedPublicUrl.protocol !== 'https:') {
throw new ErrorWithCommandHelp('--public-url is invalid - only HTTPS urls are supported');
}
}
const projectAbsoluteDir = ProjectUtils.resolveAbsoluteDir(projectDirArg);
const args = {
releaseChannel: cmd.releaseChannel || 'default',
buildType: cmd.type,
buildMode: cmd.mode,
username: userData.username || 'anonymous',
projectDir: ProjectUtils.resolveAbsoluteDir(projectDirArg),
projectDir: projectAbsoluteDir,
publicUrl: cmd.publicUrl,
};
const appJSON = await ProjectUtils.loadAppJSON(projectDirArg, cmd.config);
const sdkVersion = _.get(appJSON, 'expo.sdkVersion');
const projectConfig = await ProjectUtils.getConfig(projectDirArg, cmd.config);
const sdkVersion = getExpoSDKVersionSafely(projectAbsoluteDir, projectConfig);
await setup(platform, sdkVersion);
const credentials = await prepareCredentials(cmd);
const rawJob = {
...await buildJobObject(platform, appJSON, args, credentials),
...await buildJobObject(cmd, platform, projectConfig, args, credentials, sdkVersion),
...cmd.buildDir && { fakeUploadDir: ProjectUtils.resolveAbsoluteDir(cmd.buildDir) },
...cmd.output && { fakeUploadBuildPath: ProjectUtils.resolveAbsoluteDir(cmd.output) },
};
@@ -95,34 +97,53 @@ export function createBuilderAction({
};
}
function getExpoSDKVersionSafely(projectDir: string, projectConfig: ProjectConfig) {
try {
return getExpoSDKVersion(projectDir, projectConfig.exp);
} catch (err) {
if (err instanceof ConfigError) {
throw new Error(
'Couldn\'t find the `expo` library in your project\'s dependencies.'
+ ' Have you run \'yarn install\' or \'npm install\' for your project?',
);
} else {
throw err;
}
}
}
const buildJobObject = async (
cmd: any,
platform: 'android' | 'ios',
appJSON: any,
projectConfig: ProjectConfig,
{ releaseChannel, buildType, buildMode, username, publicUrl, projectDir }: any,
credentials: any,
sdkVersion: string,
) => {
const experienceName = `@${_.get(appJSON, 'expo.owner', username)}/${_.get(appJSON, 'expo.slug')}`;
const owner = projectConfig.exp.owner || username;
const experienceName = `@${owner}/${projectConfig.exp.slug}`;
const job = {
config: {
..._.get(appJSON, `expo.${platform}.config`, {}),
...(projectConfig.exp?.[platform]?.config || {}),
buildType,
...(platform === 'android' ? { buildMode } : {}),
releaseChannel,
...(platform === 'ios' ? { bundleIdentifier: _.get(appJSON, 'expo.ios.bundleIdentifier') } : {}),
...(platform === 'android' ? { androidPackage: _.get(appJSON, 'expo.android.package') } : {}),
publicUrl,
...(platform === 'android' && cmd.gradleArgs ? { gradleArgs: cmd.gradleArgs.split(' ') } : {}),
...(platform === 'android' ? { buildMode } : {}),
...(platform === 'android' ? { androidPackage: projectConfig.exp?.android?.package } : {}),
...(platform === 'ios' ? { bundleIdentifier: projectConfig.exp?.ios?.bundleIdentifier } : {}),
},
id: uuid.v4(),
platform,
projectDir,
sdkVersion: _.get(appJSON, 'expo.sdkVersion'),
sdkVersion,
experienceName,
...(credentials && { credentials }),
};
const url = getExperienceUrl(job.experienceName, job.config.publicUrl);
const manifest = await ExponentTools.getManifestAsync(url, {
'Exponent-SDK-Version': _.get(appJSON, 'expo.sdkVersion'),
'Exponent-SDK-Version': sdkVersion,
'Exponent-Platform': platform,
'Expo-Release-Channel': releaseChannel,
'Accept': 'application/expo+json,application/json',
+11 -13
View File
@@ -1,20 +1,18 @@
import fs from 'fs-extra';
import path from 'path';
export async function loadAppJSON(projectDirArg: string, config: string | null) {
let appJSONPath;
import { getConfig as getProjectConfig, setCustomConfigPath } from '@expo/config';
import fs from 'fs-extra';
export async function getConfig(projectDir: string, config: string | null) {
projectDir = resolveAbsoluteDir(projectDir);
if (config) {
appJSONPath = resolveAbsoluteDir(config);
} else {
const projectDir = resolveAbsoluteDir(projectDirArg);
appJSONPath = path.join(projectDir, 'app.json');
}
const appJSONExists = await fs.pathExists(appJSONPath);
if (!appJSONExists) {
throw new Error(`Couldn't find app.json.`);
} else {
return require(appJSONPath);
const pathToConfig = path.resolve(process.cwd(), config);
if (!await fs.pathExists(pathToConfig)) {
throw new Error(`File at provided config path does not exist: ${pathToConfig}`);
}
setCustomConfigPath(projectDir, pathToConfig);
}
return await getProjectConfig(projectDir, {});
}
export const resolveAbsoluteDir = (dir: string) => {
+18 -12
View File
@@ -1,9 +1,9 @@
import path from 'path';
import { AndroidShellApp, ImageUtils } from '@expo/xdl';
import { AndroidShellApp, ImageUtils } from '../xdl';
import fs from 'fs-extra';
import _ from 'lodash';
import semver from 'semver';
import { ANDROID_BUILD_TYPES } from 'turtle/constants';
import uuidv4 from 'uuid/v4';
@@ -11,7 +11,7 @@ import getOrCreateCredentials from 'turtle/builders/utils/android/credentials';
import { formatShellAppDirectory } from 'turtle/builders/utils/android/workingdir';
import * as commonUtils from 'turtle/builders/utils/common';
import * as imageHelpers from 'turtle/builders/utils/image';
import { resolveExplicitOptIn } from 'turtle/builders/utils/unimodules';
import { resolveExplicitOptIn, resolveNativeModules } from 'turtle/builders/utils/unimodules';
import { uploadBuildToS3 } from 'turtle/builders/utils/uploader';
import { ensureCanBuildSdkVersion } from 'turtle/builders/utils/version';
import config from 'turtle/config';
@@ -35,8 +35,8 @@ export default async function buildAndroid(jobData: IJob): Promise<IJobResult> {
...config.builder.fakeUpload && {
fakeUploadBuildPath:
jobData.fakeUploadBuildPath
? jobData.fakeUploadBuildPath
: path.join(jobData.fakeUploadDir || config.directories.fakeUploadDir, fakeUploadFilename),
? jobData.fakeUploadBuildPath
: path.join(jobData.fakeUploadDir || config.directories.fakeUploadDir, fakeUploadFilename),
},
});
@@ -73,15 +73,20 @@ async function runShellAppBuilder(
const sdkVersion = _.get(manifest, 'sdkVersion', sdkVersionFromJob);
const workingDir = formatShellAppDirectory({ sdkVersion });
// (2019-07-31) We are explicitly choosing to disable this option until we have more
// infrastructure/tooling built around optional modules and OTA updates, as right now it's
// very easy for developers to break apps in production with optional modules.
// Default behaviour:
// - load all modules except [expo-branch]
// - load expo-branch only if present in package.json dependencies
//
// to enable full resolver switch resolveExplicitOptIn to resolveNativeModules
// Behaviour with "enableDangerousExperimentalLeanBuilds" flag enabled
// - add unimodules from `manifest.dependencies` (project package.json dependecies)
// - add unimodules from react-native-unimodules package.json
// - add unimodules from expo package package.json
// - add recusively all dependecies of already added unimodules
logger.info({ buildPhase: 'resolve native modules' }, 'Resolving universal modules dependencies');
const enabledModules = semver.satisfies(sdkVersion, '>= 33.0.0')
? await resolveExplicitOptIn(workingDir, _.get(manifest, 'dependencies'))
: null;
const packageJsonDependecies = _.get(manifest, 'dependencies');
const enabledModules = _.get(manifest, 'android.enableDangerousExperimentalLeanBuilds')
? await resolveNativeModules(workingDir, sdkVersion, packageJsonDependecies)
: await resolveExplicitOptIn(workingDir, packageJsonDependecies);
try {
await AndroidShellApp.createAndroidShellAppAsync({
@@ -99,6 +104,7 @@ async function runShellAppBuilder(
modules: enabledModules,
buildType: jobData.config.buildType,
buildMode: jobData.config.buildMode,
gradleArgs: jobData.config.gradleArgs,
});
} catch (err) {
commonUtils.logErrorOnce(err);
+1 -1
View File
@@ -1,5 +1,5 @@
import { IosIPABuilder as createIPABuilder } from '@expo/xdl';
import _ from 'lodash';
import { IosIPABuilder as createIPABuilder } from '../../xdl';
import { IContext } from 'turtle/builders/ios/context';
import { logErrorOnce } from 'turtle/builders/utils/common';
+1 -1
View File
@@ -1,7 +1,7 @@
import * as path from 'path';
import { ExponentTools, IosShellApp } from '@expo/xdl';
import { v4 as uuidv4 } from 'uuid';
import { ExponentTools, IosShellApp } from '../../xdl';
import { formatShellAppDirectory } from 'turtle/builders/utils/ios/workingdir';
import config from 'turtle/config';
+8
View File
@@ -1,6 +1,7 @@
import fs from 'fs-extra';
import pick from 'lodash/pick';
import spawnAsync from '@expo/spawn-async';
import buildArchive from 'turtle/builders/ios/archive';
import { createBuilderContext, IContext } from 'turtle/builders/ios/context';
import buildSimulator from 'turtle/builders/ios/simulator';
@@ -51,6 +52,13 @@ async function initBuilder(ctx: IContext) {
await fs.ensureDir(dir);
await fs.chmod(dir, 0o755);
}
if (config.builder.mode === 'online') {
await spawnAsync('sudo', ['xcrun', 'simctl', 'list']);
} else {
// sudo not needed for CLI builds
await spawnAsync('xcrun', ['simctl', 'list']);
}
}
async function cleanup(ctx: IContext) {
+2 -5
View File
@@ -5,11 +5,10 @@ import fs from 'fs-extra';
import get from 'lodash/get';
import uuidv4 from 'uuid/v4';
import * as sqs from 'turtle/aws/sqs';
import { UPDATE_CREDENTIALS } from 'turtle/constants/build';
import { IAndroidCredentials, IJob } from 'turtle/job';
import logger from 'turtle/logger';
import { isOffline } from 'turtle/turtleContext';
import { sendCredentialsUpdate } from 'turtle/utils/www';
async function getOrCreateCredentials(jobData: IJob): Promise<IAndroidCredentials> {
if (!jobData.credentials) {
@@ -50,9 +49,7 @@ async function getOrCreateCredentials(jobData: IJob): Promise<IAndroidCredential
l.info(`Key password: ${credentials.keyPassword}`);
l.info(`Please keep these credentials safe`);
} else {
await sqs.sendMessage(jobData.id, UPDATE_CREDENTIALS, {
...credentials,
});
await sendCredentialsUpdate(jobData.id, 'android', credentials);
l.info('Keystore sent to storage successfully');
}
await fs.unlink(keystoreFilename);
+1 -1
View File
@@ -1,6 +1,6 @@
import path from 'path';
import { ExponentTools } from '@expo/xdl';
import { ExponentTools } from '../../../xdl';
import { IShellAppDirectoryConfig } from 'turtle/builders/utils/workingdir';
import config from 'turtle/config';
+3 -4
View File
@@ -1,15 +1,14 @@
import path from 'path';
import spawnAsync from '@expo/spawn-async';
import { IosCodeSigning } from '@expo/xdl';
import fs from 'fs-extra';
import { IosCodeSigning } from '../../../xdl';
import * as sqs from 'turtle/aws/sqs';
import BuildError, { BuildErrorReason } from 'turtle/builders/BuildError';
import { UPDATE_CREDENTIALS } from 'turtle/constants/build';
import { IJob } from 'turtle/job';
import logger from 'turtle/logger';
import { isOffline } from 'turtle/turtleContext';
import { sendCredentialsUpdate } from 'turtle/utils/www';
// tslint:disable-next-line:no-var-requires
const travelingFastlane = process.platform === 'darwin' ? require('@expo/traveling-fastlane-darwin')() : null;
@@ -64,7 +63,7 @@ async function prepareAdHocBuildCredentials(job: IJob) {
await fs.writeFile(provisioningProfilePath, Buffer.from(credentials.provisioningProfile, 'base64'));
logger.info(`Saved provisioning profile to ${provisioningProfilePath}`);
} else {
await sqs.sendMessage(job.id, UPDATE_CREDENTIALS, {
await sendCredentialsUpdate(job.id, 'ios', {
provisioningProfileId: credentials.provisioningProfileId,
provisioningProfile: credentials.provisioningProfile,
});
+1 -1
View File
@@ -1,4 +1,4 @@
import { IosKeychain } from '@expo/xdl';
import { IosKeychain } from '../../../xdl';
import { IContext } from 'turtle/builders/ios/context';
import * as fileUtils from 'turtle/builders/utils/file';
+1 -1
View File
@@ -1,9 +1,9 @@
import path from 'path';
import util from 'util';
import { ImageUtils, IosShellApp } from '@expo/xdl';
import copy from 'copy';
import _ from 'lodash';
import { ImageUtils, IosShellApp } from '../../../xdl';
import { IContext } from 'turtle/builders/ios/context';
import * as commonUtils from 'turtle/builders/utils/common';
+1 -1
View File
@@ -1,6 +1,6 @@
import path from 'path';
import { ExponentTools } from '@expo/xdl';
import { ExponentTools } from '../../../xdl';
import { IShellAppDirectoryConfig } from 'turtle/builders/utils/workingdir';
import config from 'turtle/config';
+74 -19
View File
@@ -4,6 +4,7 @@ import keys from 'lodash/keys';
import merge from 'lodash/merge';
import values from 'lodash/values';
import path from 'path';
import semver from 'semver';
import logger from 'turtle/logger';
export interface IUnimoduleEntry {
@@ -19,21 +20,37 @@ interface IPackageInfo {
dependencies: string[];
}
export async function resolveExplicitOptIn(workingdir: string, packages?: string[]): Promise<IUnimoduleEntry[]> {
export async function resolveExplicitOptIn(
workingdir: string,
packages?: string[],
): Promise<IUnimoduleEntry[]> {
const resolver = new Resolver(workingdir);
await resolver.init();
const optionalModules = ['expo-branch'];
resolver.addAll();
const modules = packages
? resolver.getModules().filter((mod) => !optionalModules.includes(mod.name) || packages.includes(mod.name))
: resolver.getModules().filter((mod) => !optionalModules.includes(mod.name));
? resolver
.getModules()
.filter(
(mod) =>
!optionalModules.includes(mod.name) || packages.includes(mod.name),
)
: resolver
.getModules()
.filter((mod) => !optionalModules.includes(mod.name));
modules.forEach(({ name, version }) => { logger.info(`Adding ${name}:${version}`); });
modules.forEach(({ name, version }) => {
logger.info(`Adding ${name}:${version}`);
});
return modules;
}
export async function resolveNativeModules(workingdir: string, packages?: string[]): Promise<IUnimoduleEntry[]> {
export async function resolveNativeModules(
workingdir: string,
sdkVersion: string,
packages?: string[],
): Promise<IUnimoduleEntry[]> {
const resolver = new Resolver(workingdir);
await resolver.init();
@@ -41,6 +58,13 @@ export async function resolveNativeModules(workingdir: string, packages?: string
resolver.addAll();
} else {
const corePackages = await readCorePackages(workingdir);
// expo-notifications is required for shell apps in SDK >= 39
// https://github.com/expo/expo/issues/10569
if (semver.gte(sdkVersion, '39.0.0')) {
resolver.addModule('expo-notifications');
}
for (const pkg of corePackages) {
if (resolver.isUnimodule(pkg)) {
resolver.addModule(pkg);
@@ -53,17 +77,36 @@ export async function resolveNativeModules(workingdir: string, packages?: string
}
}
const modules = resolver.getModules();
modules.forEach(({ name, version }) => { logger.info(`Adding ${name}:${version}`); });
modules.forEach(({ name, version }) => {
logger.info(`Adding ${name}:${version}`);
});
return modules;
}
async function readCorePackages(workingdir: string) {
const pkgJsonPath = path.join(workingdir, 'node_modules', 'react-native-unimodules', 'package.json');
const expoPkgJsonPath = path.join(workingdir, 'packages', 'expo', 'package.json');
if (await fs.pathExists(pkgJsonPath) && await fs.pathExists(expoPkgJsonPath)) {
const pkgJsonPath = path.join(
workingdir,
'node_modules',
'react-native-unimodules',
'package.json',
);
const expoPkgJsonPath = path.join(
workingdir,
'packages',
'expo',
'package.json',
);
if (
(await fs.pathExists(pkgJsonPath)) &&
(await fs.pathExists(expoPkgJsonPath))
) {
const packageJson = JSON.parse(await fs.readFile(pkgJsonPath, 'utf-8'));
const expoPackageJson = JSON.parse(await fs.readFile(expoPkgJsonPath, 'utf-8'));
return keys(packageJson.dependencies).concat(keys(expoPackageJson.dependencies));
const expoPackageJson = JSON.parse(
await fs.readFile(expoPkgJsonPath, 'utf-8'),
);
return keys(packageJson.dependencies).concat(
keys(expoPackageJson.dependencies),
);
} else {
logger.warn('No core packages detected');
return [];
@@ -76,7 +119,7 @@ interface IDependencyInfo {
class Resolver {
private workingdir: string;
private modulesMap: {[key: string]: IUnimoduleEntry};
private modulesMap: { [key: string]: IUnimoduleEntry };
private dependencyMap: IDependencyInfo;
constructor(workingdir: string) {
@@ -108,7 +151,7 @@ class Resolver {
}
public getModules(): IUnimoduleEntry[] {
return values(this.modulesMap);
return values(this.modulesMap);
}
private async resolveModule(moduleName: string) {
@@ -127,7 +170,9 @@ class Resolver {
}
}
async function generateDependenciesInfo(workingdir: string): Promise<IDependencyInfo> {
async function generateDependenciesInfo(
workingdir: string,
): Promise<IDependencyInfo> {
const dir = await fs.readdir(path.join(workingdir, 'packages'));
const map: IDependencyInfo = {};
@@ -140,7 +185,9 @@ async function generateDependenciesInfo(workingdir: string): Promise<IDependency
}
// handle @unimodules directory
const unimodulesDir = await fs.readdir(path.join(workingdir, 'packages', '@unimodules'));
const unimodulesDir = await fs.readdir(
path.join(workingdir, 'packages', '@unimodules'),
);
for (const pkgName of unimodulesDir) {
const pkg = await getPackage(workingdir, path.join('@unimodules', pkgName));
if (pkg) {
@@ -155,19 +202,27 @@ async function generateDependenciesInfo(workingdir: string): Promise<IDependency
return map;
}
async function getPackage(workingdir: string, pkgName: string): Promise<IPackageInfo | null> {
async function getPackage(
workingdir: string,
pkgName: string,
): Promise<IPackageInfo | null> {
const pkgPath = path.join(workingdir, 'packages', pkgName);
const isAndroid = await fs.pathExists(path.join(pkgPath, 'android'));
const isIos = await fs.pathExists(path.join(pkgPath, 'ios'));
const isUnimodule = await fs.pathExists(path.join(pkgPath, 'unimodule.json'));
const hasPackageJson = await fs.pathExists(path.join(pkgPath, 'package.json'));
const hasPackageJson = await fs.pathExists(
path.join(pkgPath, 'package.json'),
);
if (!isUnimodule || !hasPackageJson || (!isAndroid && !isIos)) {
return null;
}
const packageJson = JSON.parse(await fs.readFile(path.join(pkgPath, 'package.json'), 'utf-8'));
const packageJson = JSON.parse(
await fs.readFile(path.join(pkgPath, 'package.json'), 'utf-8'),
);
const pkgDeps = merge({}, // reading everything to make sure
const pkgDeps = merge(
{}, // reading everything to make sure
packageJson.dependencies,
packageJson.peerDependencies,
packageJson.unimodulePeerDependencies,
+1 -1
View File
@@ -1,6 +1,6 @@
import { ExponentTools } from '@expo/xdl';
import fs from 'fs-extra';
import path from 'path';
import { ExponentTools } from '../../xdl';
import config from 'turtle/config';
import { IJob } from 'turtle/job';
+18 -5
View File
@@ -1,3 +1,4 @@
import fs from 'fs';
import os from 'os';
import path from 'path';
@@ -28,7 +29,6 @@ export default {
ios: env('AWS_SQS_IOS_PRIORITY_QUEUE_URL'),
android: env('AWS_SQS_ANDROID_PRIORITY_QUEUE_URL'),
},
out: env('AWS_SQS_OUT_QUEUE_URL'),
},
},
cloudwatch: {
@@ -44,8 +44,17 @@ export default {
intervalMs: env('DATADOG_INTERVAL_MS', 5 * 60 * 1000),
},
redis: {
url: env('REDIS_URL'),
configUrl: env('REDIS_CONFIG_URL'),
main: {
url: env('REDIS_URL'),
caCertificate: envTransform(
'REDIS_CA_CERTIFICATE',
null,
(caCertificate: string) => caCertificate && fs.readFileSync(caCertificate),
),
},
turtle: {
url: env('REDIS_CONFIG_URL'),
},
},
logger: {
level: env('LOGGER_LEVEL', 'info'),
@@ -81,7 +90,7 @@ export default {
androidDependenciesDir: env(
'TURTLE_ANDROID_DEPENDENCIES_DIR',
path.join(os.homedir(), '.turtle/androidDependencies'),
),
),
tempS3LogsDir: env('TURTLE_TEMP_S3_LOGS_DIR', '/tmp/logs'),
fakeUploadDir: envOptional('TURTLE_FAKE_UPLOAD_DIR'),
temporaryFilesRoot: env(
@@ -90,6 +99,10 @@ export default {
),
},
www: {
sdkVersionsSecretToken: env('TURTLE_SDK_VERSIONS_SECRET_TOKEN'),
secretToken: env('TURTLE_SDK_VERSIONS_SECRET_TOKEN'),
},
leader: {
redisKey: env('LEADER_REDIS_KEY', 'turtle-v1:leader'),
redisKeyTTLSec: envNum('LEADER_REDIS_KEY_TTL', 30),
},
};
+1
View File
@@ -15,6 +15,7 @@ export interface IJob {
// android
androidPackage?: string;
buildMode?: ANDROID_BUILD_MODES;
gradleArgs?: string[];
};
credentials: {
// android
+34 -16
View File
@@ -10,8 +10,9 @@ import logger from 'turtle/logger';
import * as buildDurationMetric from 'turtle/metrics/buildDuration';
import * as buildStatusMetric from 'turtle/metrics/buildStatus';
import { checkShouldExit, setCurrentJobId, turtleVersion } from 'turtle/turtleContext';
import { getPriorities } from 'turtle/utils/priorities';
import { getPriorities, labelConfiguration, TurtleMode } from 'turtle/utils/priorities';
import * as redis from 'turtle/utils/redis';
import { sendBuildStatusUpdate } from 'turtle/utils/www';
import { sanitizeJob } from 'turtle/validator';
function _maybeExit() {
@@ -22,8 +23,8 @@ function _maybeExit() {
}
export async function doJob() {
const jobData = await getJob();
await processJob(jobData);
const { job, turtleMode } = await getJob();
await processJob(job, turtleMode);
_maybeExit();
}
@@ -34,6 +35,7 @@ export async function getJob() {
try {
let job = null;
const priorities = await getPriorities();
const turtleMode = labelConfiguration(priorities);
for (const priority of priorities) {
job = await sqs.receiveMessage(priority);
_maybeExit();
@@ -44,7 +46,7 @@ export async function getJob() {
}
_maybeExit();
if (job !== null) {
return job;
return { job, turtleMode };
}
} catch (err) {
logger.error({ err }, 'Error at receiving messages');
@@ -52,7 +54,7 @@ export async function getJob() {
}
}
async function processJob(jobData: any) {
async function processJob(jobData: any, turtleMode: TurtleMode) {
const receiptHandle = jobData.ReceiptHandle;
const { priority } = jobData;
@@ -72,7 +74,8 @@ async function processJob(jobData: any) {
logger.error({ err, ...rawJob && { buildJobId: rawJob.id } }, 'The build job is invalid');
// send message only if we've managed to parse the job json
if (rawJob) {
await sqs.sendMessage(rawJob.id, BUILD.JOB_STATES.ERRORED, {
await sendBuildStatusUpdate(rawJob.id, {
status: BUILD.JOB_STATES.ERRORED,
turtleVersion,
buildDuration: 0,
reason: 'The build job is invalid',
@@ -92,7 +95,7 @@ async function processJob(jobData: any) {
let buildFailed = false;
const buildType = _.get(job, 'config.buildType', 'default');
try {
const status = await build(job);
const status = await build(job, turtleMode);
buildStatusMetric.add(buildType, priority, status);
buildFailed = !status;
} catch (err) {
@@ -127,7 +130,7 @@ async function processJob(jobData: any) {
function failAfterMaxJobTime(priority: string, receiptHandle: string, job: any) {
return setTimeout(async () => {
try {
sqs.sendMessage(job.id, BUILD.JOB_STATES.ERRORED, { turtleVersion });
sendBuildStatusUpdate(job.id, { status: BUILD.JOB_STATES.ERRORED, turtleVersion });
await deleteMessage(priority, receiptHandle);
} finally {
logger.error('Build timed out. Going to terminate turtle agent.');
@@ -137,20 +140,33 @@ function failAfterMaxJobTime(priority: string, receiptHandle: string, job: any)
}, config.builder.maxJobTimeMs);
}
async function build(job: any) {
async function build(job: any, turtleMode: TurtleMode) {
const startTimestamp = Date.now();
const s3Url = await logger.initForJob(job);
const calculateBuildDuration = () => Math.ceil((Date.now() - startTimestamp) / 1000);
const commonPayload = {
logs: {
url: s3Url,
format: 'json',
},
extraData: {
turtleMode,
},
};
try {
await sqs.sendMessage(job.id, BUILD.JOB_STATES.IN_PROGRESS, {
logUrl: s3Url,
logFormat: 'json',
await sendBuildStatusUpdate(job.id, {
...commonPayload,
status: BUILD.JOB_STATES.IN_PROGRESS,
});
const result = await (builders as any)[job.platform](job);
const { artifactUrl } = await (builders as any)[job.platform](job);
const buildDuration = calculateBuildDuration();
sqs.sendMessage(job.id, BUILD.JOB_STATES.FINISHED, {
...result,
sendBuildStatusUpdate(job.id, {
...commonPayload,
artifacts: {
url: artifactUrl,
},
status: BUILD.JOB_STATES.FINISHED,
turtleVersion,
buildDuration,
});
@@ -162,7 +178,9 @@ async function build(job: any) {
if (err instanceof BuildError) {
reason = err.reason;
}
sqs.sendMessage(job.id, BUILD.JOB_STATES.ERRORED, {
sendBuildStatusUpdate(job.id, {
...commonPayload,
status: BUILD.JOB_STATES.ERRORED,
turtleVersion,
buildDuration,
...reason && { reason },
+1
View File
@@ -15,6 +15,7 @@ export default baseJobSchema.concat(
config: Joi.object().keys({
buildMode: Joi.string().valid(Object.values(ANDROID_BUILD_MODES)).default(ANDROID_BUILD_MODES.RELEASE),
buildType: Joi.string().valid(Object.values(ANDROID_BUILD_TYPES)).default(ANDROID_BUILD_TYPES.APK),
gradleArgs: Joi.array().items(Joi.string()),
}),
}),
);
+12 -12
View File
@@ -5,11 +5,11 @@ import take from 'lodash/take';
import logger from 'turtle/logger';
import { sendMetric } from 'turtle/metrics/datadog';
import { getReplicaCount } from 'turtle/utils/metadata';
import { getLabeledConfiguration, TurtleModeLabels } from 'turtle/utils/priorities';
import { getLabeledConfiguration, TurtleMode } from 'turtle/utils/priorities';
const createMetricName = () => `turtle.replicaCount`;
const createModeMetricName = (mode: TurtleModeLabels) => `${createMetricName()}.${mode}`;
const createModeTag = (mode: TurtleModeLabels) => `mode:${mode}`;
const createModeMetricName = (mode: TurtleMode) => `${createMetricName()}.${mode}`;
const createModeTag = (mode: TurtleMode) => `mode:${mode}`;
export default async function sendConfigToDatadog() {
let configuration;
@@ -30,28 +30,28 @@ export default async function sendConfigToDatadog() {
const metricName = createMetricName();
const normalReplicaCount = replicaCounts[TurtleModeLabels.Normal] || 0;
const highReplicaCount = replicaCounts[TurtleModeLabels.High] || 0;
const highOnlyReplicaCount = replicaCounts[TurtleModeLabels.HighOnly] || 0;
const normalReplicaCount = replicaCounts[TurtleMode.Normal] || 0;
const highReplicaCount = replicaCounts[TurtleMode.High] || 0;
const highOnlyReplicaCount = replicaCounts[TurtleMode.HighOnly] || 0;
const normalTag = createModeTag(TurtleModeLabels.Normal);
const normalMetricName = createModeMetricName(TurtleModeLabels.Normal);
const normalTag = createModeTag(TurtleMode.Normal);
const normalMetricName = createModeMetricName(TurtleMode.Normal);
logger.debug(
`Sending ${metricName}=${normalReplicaCount} (${normalTag}), ${normalMetricName}=${normalReplicaCount} to Datadog`,
);
await sendMetric(metricName, normalReplicaCount, [normalTag]);
await sendMetric(normalMetricName, normalReplicaCount);
const highTag = createModeTag(TurtleModeLabels.High);
const highMetricName = createModeMetricName(TurtleModeLabels.High);
const highTag = createModeTag(TurtleMode.High);
const highMetricName = createModeMetricName(TurtleMode.High);
logger.debug(
`Sending ${metricName}=${highReplicaCount} (${highTag}), ${highMetricName}=${highReplicaCount} to Datadog`,
);
await sendMetric(metricName, highReplicaCount, [highTag]);
await sendMetric(highMetricName, highReplicaCount);
const highOnlyTag = createModeTag(TurtleModeLabels.HighOnly);
const highOnlyMetricName = createModeMetricName(TurtleModeLabels.HighOnly);
const highOnlyTag = createModeTag(TurtleMode.HighOnly);
const highOnlyMetricName = createModeMetricName(TurtleMode.HighOnly);
logger.debug(
`Sending ${metricName}=${highOnlyReplicaCount} (${highOnlyTag}),`
+ ` ${highOnlyMetricName}=${highOnlyReplicaCount} to Datadog`,
+44 -7
View File
@@ -1,14 +1,25 @@
import { LoggerDetach } from '@expo/xdl';
import { LoggerDetach } from './xdl';
import { findSupportedSdkVersions } from 'turtle/builders/utils/version';
import config from 'turtle/config';
import { doJob } from 'turtle/jobManager';
import logger from 'turtle/logger';
import setup from 'turtle/setup';
import { checkShouldExit, setShouldExit, turtleVersion } from 'turtle/turtleContext';
import { setSupportedSdkVersions, setTurtleVersion } from 'turtle/utils/versions';
import {
checkShouldExit,
setShouldExit,
turtleVersion,
} from 'turtle/turtleContext';
import { synchronizeFailedUpdates } from 'turtle/updatesManager';
import Leader, { LeaderEvent } from 'turtle/utils/leader';
import {
setSupportedSdkVersions,
setTurtleVersion,
} from 'turtle/utils/versions';
process.on('unhandledRejection', (err) => logger.error({ err }, 'Unhandled promise rejection'));
process.on('unhandledRejection', (err) =>
logger.error({ err }, 'Unhandled promise rejection'),
);
function handleExit() {
if (checkShouldExit()) {
@@ -25,18 +36,23 @@ process.on('SIGINT', handleExit);
async function main() {
logger.info(
'Starting Turtle... '
+ `NODE_ENV=${config.env}, PLATFORM=${config.platform}, DEPLOYMENT_ENVIRONMENT=${config.deploymentEnv}`,
'Starting Turtle... ' +
`NODE_ENV=${config.env}, PLATFORM=${config.platform}, DEPLOYMENT_ENVIRONMENT=${config.deploymentEnv}`,
);
// @ts-ignore: Type mismatch
LoggerDetach.configure(logger);
if (setup[config.platform]) {
await setup[config.platform]();
}
await electLeaderAndSynchronize();
try {
await setTurtleVersion(turtleVersion);
logger.info(`Registered Turtle version (${turtleVersion}) in www`);
const sdkVersions = (await findSupportedSdkVersions(config.platform)).map((version) => `${version}.0.0`);
const sdkVersions = (await findSupportedSdkVersions(config.platform)).map(
(version) => `${version}.0.0`,
);
await setSupportedSdkVersions(config.platform, sdkVersions);
logger.info(`Registered supported SDK versions (${sdkVersions}) in www`);
} catch (err) {
@@ -52,6 +68,27 @@ async function main() {
}
}
async function electLeaderAndSynchronize() {
if (config.env === 'test') {
return;
}
const l = new Leader({
key: config.leader.redisKey,
id: config.hostname,
ttl: config.leader.redisKeyTTLSec,
});
let intervalId: NodeJS.Timeout;
l.on(LeaderEvent.elected, async () => {
intervalId = await synchronizeFailedUpdates();
});
l.on(LeaderEvent.revoked, () => {
if (intervalId) {
clearInterval(intervalId);
}
});
await l.elect();
}
main()
.then(() => logger.error('This should never happen...'))
.catch((err) => logger.error({ err }, 'Something went terribly wrong'))
-1
View File
@@ -4,7 +4,6 @@ declare module 'bunyan-sentry-stream';
declare module 'bunyan-debug-stream';
declare module 'copy';
declare module 'dogapi';
declare module 'ioredis';
declare module 'is-semver';
declare module 'request-progress';
declare module '@expo/xdl';
+472
View File
@@ -0,0 +1,472 @@
interface pbxFile {
basename: string;
lastKnownFileType?: string;
group?: string;
path?: string;
fileEncoding?: number;
defaultEncoding?: number;
sourceTree: string;
includeInIndex?: number;
explicitFileType?: unknown;
settings?: object;
uuid?: string;
fileRef: string;
target?: string;
}
declare module 'xcode' {
/**
* UUID that is a key to each fragment of PBXProject.
*/
type UUID = string;
/**
* if has following format `${UUID}_comment`
*/
type UUIDComment = string;
type XCObjectType =
| 'PBXBuildFile'
| 'PBXFileReference'
| 'PBXFrameworksBuildPhase'
| 'PBXGroup'
| 'PBXNativeTarget'
| 'PBXProject'
| 'PBXResourcesBuildPhase'
| 'PBXShellScriptBuildPhase'
| 'PBXSourcesBuildPhase'
| 'PBXVariantGroup'
| 'XCBuildConfiguration'
| 'XCConfigurationList';
type PBXFile = pbxFile;
interface PBXProject {
isa: 'PBXProject';
attributes: {
LastUpgradeCheck: number;
TargetAttributes: Record<
UUID,
{
CreatedOnToolsVersion?: string;
TestTargetID?: UUID;
LastSwiftMigration?: number;
ProvisioningStyle?: string;
} & Record<string, undefined | number | string>
>;
};
buildConfigurationList: UUID;
buildConfigurationList_comment: string;
compatibilityVersion: string;
developmentRegion: string;
hasScannedForEncodings: number;
knownRegions: string[];
mainGroup: UUID;
productRefGroup: UUID;
productRefGroup_comment: string;
projectDirPath: string;
projectRoot: string;
targets: Array<{
value: UUID;
comment: string;
}>;
}
interface PBXNativeTarget {
isa: 'PBXNativeTarget';
buildConfigurationList: UUID;
buildConfigurationList_comment: string;
buildPhases: Array<{
value: UUID;
comment: string;
}>;
buildRules: [];
dependencies: [];
name: string;
productName: string;
productReference: UUID;
productReference_comment: string;
productType: string;
}
interface PBXBuildFile {
isa: 'PBXBuildFile';
fileRef: UUID;
// "AppDelegate.m"
fileRef_comment: string;
}
interface XCConfigurationList {
isa: 'XCConfigurationList';
buildConfigurations: Array<{
value: UUID;
comment: string | 'Release' | 'Debug';
}>;
defaultConfigurationIsVisible: number;
defaultConfigurationName: string;
}
interface XCBuildConfiguration {
isa: 'XCBuildConfiguration';
baseConfigurationReference: UUID;
baseConfigurationReference_comment: string;
buildSettings: Record<string, string | undefined | number | Array<unknown>> & {
// '"$(TARGET_NAME)"',
PRODUCT_NAME?: string;
// '"io.expo.demo.$(PRODUCT_NAME:rfc1034identifier)"',
PRODUCT_BUNDLE_IDENTIFIER?: string;
PROVISIONING_PROFILE_SPECIFIER?: string;
// '"$(BUILT_PRODUCTS_DIR)/rni.app/rni"'
TEST_HOST?: any;
DEVELOPMENT_TEAM?: string;
CODE_SIGN_IDENTITY?: string;
CODE_SIGN_STYLE?: string;
// '"$(TEST_HOST)"'
BUNDLE_LOADER?: string;
GCC_PREPROCESSOR_DEFINITIONS?: Array<unknown>;
INFOPLIST_FILE?: string;
IPHONEOS_DEPLOYMENT_TARGET?: string;
LD_RUNPATH_SEARCH_PATHS?: string;
OTHER_LDFLAGS?: Array<unknown>;
ASSETCATALOG_COMPILER_APPICON_NAME?: string;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME?: string;
CLANG_ANALYZER_NONNULL?: string;
CLANG_WARN_DOCUMENTATION_COMMENTS?: string;
CLANG_WARN_INFINITE_RECURSION?: string;
CLANG_WARN_SUSPICIOUS_MOVE?: string;
DEBUG_INFORMATION_FORMAT?: string;
ENABLE_TESTABILITY?: string;
GCC_NO_COMMON_BLOCKS?: string;
// 'appletvos'
SDKROOT?: string;
TARGETED_DEVICE_FAMILY?: number | string;
// '10.0'
TVOS_DEPLOYMENT_TARGET?: string;
};
name: string;
}
type ProductType =
| 'com.apple.product-type.application'
| 'com.apple.product-type.app-extension'
| 'com.apple.product-type.bundle'
| 'com.apple.product-type.tool'
| 'com.apple.product-type.library.dynamic'
| 'com.apple.product-type.framework'
| 'com.apple.product-type.library.static'
| 'com.apple.product-type.bundle.unit-test'
| 'com.apple.product-type.application.watchapp'
| 'com.apple.product-type.application.watchapp2'
| 'com.apple.product-type.watchkit-extension'
| 'com.apple.product-type.watchkit2-extension';
interface PBXGroup {
isa: 'PBXGroup';
children: Array<{
value: UUID;
comment?: string;
}>;
name: string;
path?: string;
sourceTree: '"<group>"' | unknown;
}
export class XcodeProject {
/**
* `.pbxproj` file path.
*/
public filepath: string;
// Ex: '$(TARGET_NAME)'
public productName: string;
public hash: {
headComment: string;
project: {
archiveVersion: number;
objectVersion: number;
objects: {
[T in XCObjectType]: Record<
string,
{
isa: T;
name: string;
[key: string]: any;
}
>;
};
rootObject: string;
rootObject_comment: string;
};
};
constructor(pbxprojPath: string);
// ------------------------------------------------------------------------
//
// `.pbxproj` related operation - starting & ending point.
//
// ------------------------------------------------------------------------
/**
* First step to be executed while working with `.pbxproj` file.
*/
public parse(callback?: (err: Error | null, results?: string) => void): this;
public parseSync(): void;
/**
* @returns Content of .pbxproj file.
*/
public writeSync(options?: { omitEmptyValues?: boolean }): string;
public allUuids(): UUID[];
public generateUuid(): UUID;
public addPluginFile(path: unknown, opt: unknown): unknown;
public removePluginFile(path: unknown, opt: unknown): unknown;
public addProductFile(targetPath: unknown, opt: unknown): unknown;
public removeProductFile(path: unknown, opt: unknown): unknown;
public addSourceFile(path: string, opt: unknown, group: string): unknown;
public removeSourceFile(path: string, opt: unknown, group: string): unknown;
public addHeaderFile(path: string, opt: unknown, group: string): unknown;
public removeHeaderFile(path: string, opt: unknown, group: string): unknown;
public addResourceFile(path: string, opt: unknown, group: string): unknown;
public removeResourceFile(path: string, opt: unknown, group: string): unknown;
public addFramework(fpath: unknown, opt: unknown): unknown;
public removeFramework(fpath: unknown, opt: unknown): unknown;
public addCopyfile(fpath: unknown, opt: unknown): unknown;
public pbxCopyfilesBuildPhaseObj(target: unknown): unknown;
public addToPbxCopyfilesBuildPhase(file: unknown): void;
public removeCopyfile(fpath: unknown, opt: unknown): unknown;
public removeFromPbxCopyfilesBuildPhase(file: unknown): void;
public addStaticLibrary(path: unknown, opt: unknown): unknown;
/**
* Adds to `PBXBuildFile` section
*/
public addToPbxBuildFileSection(file: PBXFile): void;
public removeFromPbxBuildFileSection(file: unknown): void;
public addPbxGroup(
filePathsArray: string[],
name: string,
path: string,
sourceTree?: string,
): { uuid: UUID; pbxGroup: PBXGroup };
public removePbxGroup(groupName: unknown): void;
public addToPbxProjectSection(target: unknown): void;
public addToPbxNativeTargetSection(target: unknown): void;
public addToPbxFileReferenceSection(file: any): void;
public removeFromPbxFileReferenceSection(file: unknown): unknown;
public addToXcVersionGroupSection(file: unknown): void;
public addToPluginsPbxGroup(file: unknown): void;
public removeFromPluginsPbxGroup(file: unknown): unknown;
public addToResourcesPbxGroup(file: unknown): void;
public removeFromResourcesPbxGroup(file: unknown): unknown;
public addToFrameworksPbxGroup(file: unknown): void;
public removeFromFrameworksPbxGroup(file: unknown): unknown;
public addToPbxEmbedFrameworksBuildPhase(file: unknown): void;
public removeFromPbxEmbedFrameworksBuildPhase(file: unknown): void;
public addToProductsPbxGroup(file: unknown): void;
public removeFromProductsPbxGroup(file: unknown): unknown;
public addToPbxSourcesBuildPhase(file: unknown): void;
public removeFromPbxSourcesBuildPhase(file: unknown): void;
/**
* Adds to PBXResourcesBuildPhase` section
* @param resourcesBuildPhaseSectionKey Because there's might more than one `Resources` build phase we need to ensure file is placed under correct one.
*/
public addToPbxResourcesBuildPhase(file: PBXFile): void;
public removeFromPbxResourcesBuildPhase(file: unknown): void;
public addToPbxFrameworksBuildPhase(file: unknown): void;
public removeFromPbxFrameworksBuildPhase(file: unknown): void;
public addXCConfigurationList(
configurationObjectsArray: unknown,
defaultConfigurationName: unknown,
comment: unknown,
): {
uuid: unknown;
xcConfigurationList: {
isa: string;
buildConfigurations: Array<unknown>;
defaultConfigurationIsVisible: number;
defaultConfigurationName: unknown;
};
};
public addTargetDependency(
target: unknown,
dependencyTargets: unknown,
): {
uuid: unknown;
target: unknown;
};
public addBuildPhase(
filePathsArray: unknown,
buildPhaseType: unknown,
comment: unknown,
target: unknown,
optionsOrFolderType: unknown,
subfolderPath: unknown,
): {
uuid: unknown;
buildPhase: {
isa: unknown;
buildActionMask: number;
files: Array<unknown>;
runOnlyForDeploymentPostprocessing: number;
};
};
/**
* Retrieves main part describing PBXProjects that are available in `.pbxproj` file.
*/
public pbxProjectSection(): Record<UUID, PBXProject> & Record<UUIDComment, string>;
public pbxBuildFileSection(): Record<UUID, PBXBuildFile> & Record<UUIDComment, string>;
public pbxXCBuildConfigurationSection(): Record<UUID, XCBuildConfiguration> &
Record<UUIDComment, string>;
public pbxFileReferenceSection(): Record<UUID, PBXFile> & Record<UUIDComment, string>;
public pbxNativeTargetSection(): Record<UUID, PBXNativeTarget> & Record<UUIDComment, string>;
public xcVersionGroupSection(): unknown;
public pbxXCConfigurationList(): Record<UUID, XCConfigurationList> & Record<UUIDComment, string>;
public pbxGroupByName(name: string): PBXGroup | undefined;
/**
* @param targetName in most cases it's the name of the application
*/
public pbxTargetByName(targetName: string): PBXNativeTarget | undefined;
public findTargetKey(name: string): string;
public pbxItemByComment(name: string, pbxSectionName: unknown): unknown;
public pbxSourcesBuildPhaseObj(target: unknown): unknown;
public pbxResourcesBuildPhaseObj(target: unknown): unknown;
public pbxFrameworksBuildPhaseObj(target: unknown): unknown;
public pbxEmbedFrameworksBuildPhaseObj(target: unknown): unknown;
public buildPhase(group: unknown, target: unknown): string;
public buildPhaseObject(name: string, group: unknown, target: unknown): unknown;
public addBuildProperty(prop: unknown, value: unknown, build_name: unknown): void;
public removeBuildProperty(prop: unknown, build_name: unknown): void;
public updateBuildProperty(prop: string, value: unknown, build: string): void;
public updateProductName(name: string): void;
public removeFromFrameworkSearchPaths(file: unknown): void;
public addToFrameworkSearchPaths(file: unknown): void;
public removeFromLibrarySearchPaths(file: unknown): void;
public addToLibrarySearchPaths(file: unknown): void;
public removeFromHeaderSearchPaths(file: unknown): void;
public addToHeaderSearchPaths(file: unknown): void;
public addToOtherLinkerFlags(flag: unknown): void;
public removeFromOtherLinkerFlags(flag: unknown): void;
public addToBuildSettings(buildSetting: unknown, value: unknown): void;
public removeFromBuildSettings(buildSetting: unknown): void;
/**
* Checks whether there is a file with given `filePath` in the project.
*/
public hasFile(filePath: string): PBXFile | false;
public addTarget(
name: unknown,
type: unknown,
subfolder: unknown,
): {
uuid: unknown;
pbxNativeTarget: {
isa: string;
name: string;
productName: string;
productReference: unknown;
productType: string;
buildConfigurationList: unknown;
buildPhases: Array<unknown>;
buildRules: Array<unknown>;
dependencies: Array<unknown>;
};
};
/**
* Get First PBXProject that can be found in `.pbxproj` file.
*/
public getFirstProject(): { uuid: UUID; firstProject: PBXProject };
public getFirstTarget(): {
uuid: UUID;
firstTarget: unknown;
};
/**
* Retrieves PBXNativeTarget by the type
*/
public getTarget(productType: ProductType): { uuid: UUID; target: PBXNativeTarget } | null;
public addToPbxGroupType(file: unknown, groupKey: unknown, groupType: unknown): void;
public addToPbxVariantGroup(file: unknown, groupKey: unknown): void;
public addToPbxGroup(file: PBXFile, groupKey: UUID): void;
public pbxCreateGroupWithType(name: unknown, pathName: unknown, groupType: unknown): unknown;
public pbxCreateVariantGroup(name: unknown): unknown;
public pbxCreateGroup(name: string, pathName: string): UUID;
public removeFromPbxGroupAndType(file: unknown, groupKey: unknown, groupType: unknown): void;
public removeFromPbxGroup(file: unknown, groupKey: unknown): void;
public removeFromPbxVariantGroup(file: unknown, groupKey: unknown): void;
public getPBXGroupByKeyAndType(key: unknown, groupType: unknown): unknown;
/**
* @param groupKey UUID.
*/
public getPBXGroupByKey(groupKey: string): PBXGroup | undefined;
public getPBXVariantGroupByKey(key: unknown): unknown;
public findPBXGroupKeyAndType(criteria: unknown, groupType: unknown): string;
/**
* @param criteria Params that should be used to locate desired PBXGroup.
*/
public findPBXGroupKey(criteria: { name?: string; path?: string }): UUID | undefined;
public findPBXVariantGroupKey(criteria: unknown): string;
public addLocalizationVariantGroup(
name: unknown,
): {
uuid: unknown;
fileRef: unknown;
basename: unknown;
};
public addKnownRegion(name: string): void;
public removeKnownRegion(name: string): void;
public hasKnownRegion(name: string): boolean;
public getPBXObject(name: string): unknown;
/**
* - creates `PBXFile`
* - adds to `PBXFileReference` section
* - adds to `PBXGroup` or `PBXVariantGroup` if applicable
* @returns `null` if file is already in `pbxproj`.
*/
public addFile(
path: string,
group?: string,
opt?: {
plugin?: string;
target?: string;
variantGroup?: string;
lastKnownFileType?: string;
defaultEncoding?: 4;
customFramework?: true;
explicitFileType?: number;
weak?: true;
compilerFLags?: string;
embed?: boolean;
sign?: boolean;
},
): PBXFile | null;
public removeFile(path: unknown, group: unknown, opt: unknown): unknown;
public getBuildProperty(prop: unknown, build: unknown): unknown;
public getBuildConfigByName(name: unknown): object;
public addDataModelDocument(filePath: unknown, group: unknown, opt: unknown): unknown;
public addTargetAttribute(prop: unknown, value: unknown, target: unknown): void;
public removeTargetAttribute(prop: unknown, target: unknown): void;
}
export function project(projectPath: string): XcodeProject;
}
declare module 'xcode/lib/pbxFile' {
export default class PBXFile implements pbxFile {
public basename: string;
public lastKnownFileType?: string;
public group?: string;
public path?: string;
public fileEncoding?: number;
public defaultEncoding?: number;
public sourceTree: string;
public includeInIndex?: number;
public explicitFileType?: unknown;
public settings?: object;
public uuid?: string;
public fileRef: string;
public target?: string;
constructor(file: string);
}
}
+83
View File
@@ -0,0 +1,83 @@
import Redis from 'ioredis';
import chunk from 'lodash/chunk';
import config from 'turtle/config';
import { getRedisClient, RedisClient } from 'turtle/utils/redis';
import { sendBuildStatusUpdate, sendCredentialsUpdate } from 'turtle/utils/www';
const RETRY_COUNT = 5;
type UpdateType = 'build' | 'credentials';
interface IUpdate {
type: UpdateType;
buildId: string;
updateBody: any;
retried: number;
}
export async function saveUpdateFailure(buildId: string, type: UpdateType, updateBody: object): Promise<void> {
if (config.env === 'test') {
return;
}
const redis = await getRedisClient(RedisClient.Configuration) as Redis.Redis;
const update: IUpdate = {
type,
buildId,
updateBody,
retried: 0,
};
await redis.set(getFailedUpdateKey(buildId), JSON.stringify(update));
}
export async function synchronizeFailedUpdates(intervalMs = 3 * 60 * 1000): Promise<NodeJS.Timeout> {
try {
await _synchronizeFailedUpdates();
} catch (err) {
// don't do anything
}
return setInterval(() => _synchronizeFailedUpdates(), intervalMs);
}
async function _synchronizeFailedUpdates(): Promise<void> {
const redis = await getRedisClient(RedisClient.Configuration) as Redis.Redis;
const keys = await redis.keys(getFailedUpdateKey('*'));
const keyChunks = chunk(keys, 20);
for (const keyChunk of keyChunks) {
await Promise.all(keyChunk.map((key: string) => resendUpdateForKey(key)));
}
}
async function resendUpdateForKey(key: string): Promise<void> {
try {
const redis = await getRedisClient(RedisClient.Configuration) as Redis.Redis;
const updateRaw = await redis.get(key);
if (updateRaw) {
const update = JSON.parse(updateRaw) as IUpdate;
try {
await resendUpdateToWWW(update);
await redis.del(key);
} catch (err) {
update.retried += 1;
if (update.retried >= RETRY_COUNT) {
await redis.del(key);
} else {
await redis.set(key, JSON.stringify(update));
}
}
}
} catch (err) {
// don't do anything
}
}
async function resendUpdateToWWW(update: IUpdate): Promise<void> {
const { type, buildId, updateBody } = update;
if (type === 'build') {
await sendBuildStatusUpdate(buildId, updateBody);
} else if (type === 'credentials') {
const { platform, ...rest } = updateBody;
await sendCredentialsUpdate(buildId, platform, rest);
}
}
const getFailedUpdateKey = (buildId: string) => `${config.deploymentEnv}:failed-update:${buildId}`;
+164
View File
@@ -0,0 +1,164 @@
import { EventEmitter } from 'events';
import Redis from 'ioredis';
import { v4 as uuid } from 'uuid';
import { getRedisClient, RedisClient } from 'turtle/utils/redis';
interface ILeaderParams {
key: string;
id?: string;
ttl?: number;
wait?: number;
}
const RENEW_LEADER_SCRIPT = `
local leader_key = KEYS[1]
local leader_id = KEYS[2]
local leader_ttl = KEYS[3]
local current_leader
current_leader = redis.call("get", leader_key)
if (current_leader == leader_id) then
redis.call("pexpire", leader_key, leader_ttl)
return "ok"
else
return "you_are_not_the_leader"
end
`;
const STOP_BEING_LEADER_SCRIPT = `
local leader_key = KEYS[1]
local leader_id = KEYS[2]
local current_leader
current_leader = redis.call("get", leader_key)
if (current_leader == leader_id) then
redis.call("del", leader_key)
return "ok"
else
return "you_are_not_the_leader"
end
`;
interface IRedisCustom extends Redis.Redis {
renewLeader(key: string, id: string, ttl: number): Promise<string>;
stopBeingLeader(key: string, id: string): Promise<string>;
}
enum LeaderEvent {
elected = 'elected',
revoked = 'revoked',
error = 'error',
}
class Leader extends EventEmitter {
private key: string;
private id: string;
private ttl: number;
private wait: number;
private waitId?: NodeJS.Timeout;
private redisClientValue?: IRedisCustom;
private renewId?: NodeJS.Timeout;
private started = false;
constructor({ key, id, ttl = 30, wait = 1000 }: ILeaderParams) {
super();
this.key = key;
this.id = id || uuid();
this.ttl = ttl * 1000;
this.wait = wait;
}
public async elect(): Promise<void> {
if (!this.redisClientValue) {
await this.init();
}
if (!this.started) {
this.started = true;
}
try {
const res = await this.redisClient.set(this.key, this.id, 'PX', this.ttl, 'NX');
if (res === null) {
this.waitId = setTimeout(() => {
this.elect();
}, this.wait);
} else {
this.emit(LeaderEvent.elected);
this.renewId = setInterval(() => {
this.renew();
}, this.ttl / 2);
}
} catch (err) {
this.emit(LeaderEvent.error, err);
}
}
public async stop(): Promise<void> {
if (!this.started) {
throw new Error('You should start the election first!');
}
try {
const res = await this.redisClient.stopBeingLeader(this.key, this.id);
if (res === 'ok') {
this.emit(LeaderEvent.revoked);
}
if (this.renewId) {
clearInterval(this.renewId);
}
if (this.waitId) {
clearTimeout(this.waitId);
}
this.redisClientValue?.disconnect();
this.redisClientValue = undefined;
} catch (err) {
this.emit(LeaderEvent.error, err);
}
}
private get redisClient(): IRedisCustom {
if (!this.redisClientValue) {
throw new Error('Please run the init method first!');
}
return this.redisClientValue as IRedisCustom;
}
private async init(): Promise<void> {
if (this.redisClientValue) {
return;
}
this.redisClientValue = await getRedisClient(RedisClient.Configuration);
const redisClient = this.redisClient as IRedisCustom;
redisClient.defineCommand('renewLeader', {
numberOfKeys: 3,
lua: RENEW_LEADER_SCRIPT,
});
redisClient.defineCommand('stopBeingLeader', {
numberOfKeys: 2,
lua: STOP_BEING_LEADER_SCRIPT,
});
}
private async renew(): Promise<void> {
try {
const result = await this.redisClient.renewLeader(this.key, this.id, this.ttl);
if (result === 'you_are_not_the_leader') {
if (this.renewId) {
clearInterval(this.renewId);
}
this.waitId = setTimeout(() => {
this.elect();
}, this.wait);
this.emit(LeaderEvent.revoked);
}
} catch (err) {
this.emit(LeaderEvent.error, err);
}
}
}
export default Leader;
export { LeaderEvent };
+12 -10
View File
@@ -9,7 +9,7 @@ import { getRedisClient, RedisClient } from 'turtle/utils/redis';
export const NORMAL = 'normalPriority';
export const HIGH = 'highPriority';
export enum TurtleModeLabels {
export enum TurtleMode {
Normal = 'normal',
High = 'high',
HighOnly = 'highOnly',
@@ -100,13 +100,15 @@ async function getConfiguration(currentRedisClient: any) {
export async function getLabeledConfiguration(currentRedisClient?: any) {
const configuration = await getConfiguration(currentRedisClient);
return configuration.map((i: string[]) => {
if (isEqual(i, NORMAL_CONFIGURATION)) {
return TurtleModeLabels.Normal;
} else if (isEqual(i, HIGH_CONFIGURATION)) {
return TurtleModeLabels.High;
} else {
return TurtleModeLabels.HighOnly;
}
});
return configuration.map((i: string[]) => labelConfiguration(i));
}
export function labelConfiguration(configuration: string[]): TurtleMode {
if (isEqual(configuration, NORMAL_CONFIGURATION)) {
return TurtleMode.Normal;
} else if (isEqual(configuration, HIGH_CONFIGURATION)) {
return TurtleMode.High;
} else {
return TurtleMode.HighOnly;
}
}
+15 -6
View File
@@ -12,18 +12,27 @@ export enum RedisClient {
Configuration = 'REDIS_CLIENT_CONFIGURATION',
}
interface IClientConfig { [key: string]: string; }
interface IClientConfig {
[key: string]: {
url: string;
caCertificate?: string;
};
}
const clientToUrl: IClientConfig = {
[RedisClient.Subscriber]: config.redis.url,
[RedisClient.Default]: config.redis.url,
[RedisClient.Configuration]: config.redis.configUrl,
const clientConfigs: IClientConfig = {
[RedisClient.Subscriber]: config.redis.main,
[RedisClient.Default]: config.redis.main,
[RedisClient.Configuration]: config.redis.turtle,
};
export function connect(timeoutMs: number, type: string): Promise<any> {
return new Promise((resolve, reject) => {
const redisClient = new Redis(clientToUrl[type], {
const { url, caCertificate } = clientConfigs[type];
const redisClient = new Redis(url, {
maxRetriesPerRequest: 2,
...caCertificate && {
tls: { ca: caCertificate },
},
});
const timer = setTimeout(() => reject(new Error('Timeout at connecting to Redis')), timeoutMs);
redisClient.on('ready', () => {
+4 -4
View File
@@ -10,7 +10,7 @@ async function setSupportedSdkVersions(platform: string, sdkVersions: string[])
method: 'POST',
uri: href,
headers: {
'secret-token': config.www.sdkVersionsSecretToken,
'secret-token': config.www.secretToken,
},
body: {
platform,
@@ -26,7 +26,7 @@ async function setTurtleVersion(version: string) {
method: 'POST',
uri: href,
headers: {
'secret-token': config.www.sdkVersionsSecretToken,
'secret-token': config.www.secretToken,
},
body: {
version,
@@ -38,9 +38,9 @@ async function setTurtleVersion(version: string) {
function resolveWWWEndpoint() {
const currentEnv = config.deploymentEnv;
if (currentEnv === 'production') {
return 'https://expo.io';
return 'https://exp.host';
} else if (currentEnv === 'staging') {
return 'https://staging.expo.io';
return 'https://staging.exp.host';
} else {
return 'http://127.0.0.1:3000';
}
+56
View File
@@ -0,0 +1,56 @@
import { URL } from 'url';
import request from 'request-promise';
import config from 'turtle/config';
import { saveUpdateFailure } from 'turtle/updatesManager';
async function sendBuildStatusUpdate(buildId: string, updateParams: object) {
const { href } = new URL(`/--/api/v2/turtle-legacy-builds/${buildId}`, resolveWWWEndpoint());
try {
await request({
method: 'PUT',
uri: href,
headers: {
'secret-token': config.www.secretToken,
},
body: updateParams,
json: true,
});
} catch (err) {
await saveUpdateFailure(buildId, 'build', updateParams);
}
}
async function sendCredentialsUpdate(buildId: string, platform: 'android' | 'ios', updateParams: object) {
const { href } = new URL(`/--/api/v2/turtle-legacy-builds/${buildId}/credentials`, resolveWWWEndpoint());
try {
await request({
method: 'PUT',
uri: href,
headers: {
'secret-token': config.www.secretToken,
},
body: {
platform,
...updateParams,
},
json: true,
});
} catch (err) {
await saveUpdateFailure(buildId, 'credentials', updateParams);
}
}
function resolveWWWEndpoint() {
const currentEnv = config.deploymentEnv;
if (currentEnv === 'production') {
return 'https://exp.host';
} else if (currentEnv === 'staging') {
return 'https://staging.exp.host';
} else {
return 'http://127.0.0.1:3000';
}
}
export { sendBuildStatusUpdate, sendCredentialsUpdate };
+143
View File
@@ -0,0 +1,143 @@
import fs from 'fs-extra';
import os from 'os';
import path from 'path';
/*
A Cacher is used to wrap a fallible or expensive function and to memoize its results on disk
in case it either fails or we don't need fresh results very often. It stores objects in JSON, and
parses JSON from disk when returning an object.
It's constructed with a "refresher" callback which will be called for the results, a filename to use
for the cache, and an optional TTL and boostrap file. The TTL (in milliseconds) can be used to speed
up slow calls from the cache (for example checking npm published versions can be very slow). The
bootstrap file can be used to "seed" the cache with a particular value stored in a file.
If there is a problem calling the refresher function or in performing the cache's disk I/O, errors
will be stored in variables on the class. The only times Cacher will throw an exception are if it's
not possible to create the cache directory (usually weird home directory permissions), or if getAsync()
is called but no value can be provided. The latter will only occur if the refresher fails, no cache
is available on disk (i.e. this is the first call or it has been recently cleared), and bootstrapping
was not available (either a bootstrap file wasn't provided or reading/writing failed).
See src/__tests__/tools/FsCache-test.js for usage examples.
*/
class Cacher<T> {
public refresher: () => Promise<T>;
public filename: string;
public bootstrapFile?: string;
public ttlMilliseconds: number;
public readError?: any;
public writeError?: any;
constructor(
refresher: () => Promise<T>,
filename: string,
ttlMilliseconds?: number,
bootstrapFile?: string,
) {
this.refresher = refresher;
this.filename = path.join(getCacheDir(), filename);
this.ttlMilliseconds = ttlMilliseconds || 0;
this.bootstrapFile = bootstrapFile;
}
public async getAsync(): Promise<T> {
// Let user opt out of cache for debugging purposes
if (process.env.SKIP_CACHE) {
return await this.refresher();
}
let mtime: Date;
try {
const stats = await fs.stat(this.filename);
mtime = stats.mtime;
} catch (e) {
try {
await fs.mkdirp(getCacheDir());
if (this.bootstrapFile) {
const bootstrapContents = (
await fs.readFile(this.bootstrapFile)
).toString();
await fs.writeFile(this.filename, bootstrapContents, 'utf8');
}
} catch (e) {
// intentional no-op
}
mtime = new Date(1989, 10, 19);
}
let fromCache: T | null = null;
let failedRefresh = null;
// if mtime + ttl >= now, attempt to fetch the value, otherwise read from disk
// alternatively, if ttlMilliseconds is 0 we also update every time, regardless of the times.
// this is a workaround for the issue described in https://github.com/expo/expo-cli/issues/1683
if (
this.ttlMilliseconds === 0 ||
new Date().getTime() - mtime.getTime() > this.ttlMilliseconds
) {
try {
fromCache = await this.refresher();
try {
await fs.writeFile(this.filename, JSON.stringify(fromCache), 'utf8');
} catch (e) {
this.writeError = e;
// do nothing, if the refresh succeeded it'll be returned, if the persist failed we don't care
}
} catch (e) {
failedRefresh = e;
}
}
if (!fromCache) {
try {
fromCache = JSON.parse(await fs.readFile(this.filename, 'utf8'));
} catch (e) {
this.readError = e;
// if this fails then we've exhausted our options and it should remain null
}
}
if (fromCache) {
return fromCache;
} else {
if (failedRefresh) {
throw new Error(
`Unable to perform cache refresh for ${this.filename}: ${failedRefresh}`,
);
} else {
throw new Error(
`Unable to read ${this.filename}. ${this.readError || ''}`,
);
}
}
}
public async clearAsync(): Promise<void> {
try {
await fs.unlink(this.filename);
} catch (e) {
this.writeError = e;
}
}
}
function getCacheDir(): string {
const homeDir = os.homedir();
if (process.env.XDG_CACHE_HOME) {
return process.env.XDG_CACHE_HOME;
} else if (process.platform === 'win32') {
return path.join(homeDir, 'AppData', 'Local', 'Expo');
} else if (process.platform === 'darwin') {
// too many mac users have broken permissions on their ~/.cache directory
return path.join(homeDir, '.expo', 'cache');
} else {
return path.join(homeDir, '.cache', 'expo');
}
}
export { Cacher, getCacheDir };
+103
View File
@@ -0,0 +1,103 @@
import fs from 'fs';
import path from 'path';
import probeImageSize from 'probe-image-size';
import { spawnAsyncThrowError } from './detach/ExponentTools';
import LoggerDetach from './detach/Logger';
/**
* @param {string} projectDirname
* @param {string} basename
* @returns {} { width: number, height: number } image dimensions or null
*/
async function getImageDimensionsAsync(
projectDirname: string,
basename: string,
): Promise<{ width?: number; height?: number } | null> {
return await customGetImageDimensionsAsync(projectDirname, basename).catch(
() => null,
);
}
async function customGetImageDimensionsWithImageProbeAsync(
projectDirname: string,
basename: string,
): Promise<{ width: number; height: number }> {
const imagePath = path.resolve(projectDirname, basename);
const readStream = fs.createReadStream(imagePath);
const { width, height } = await probeImageSize(readStream);
readStream.destroy();
return { width, height };
}
let hasWarned = false;
async function resizeImageAsync(
iconSizePx: number,
iconFilename: string,
destinationIconPath: string,
) {
if (
process.platform !== 'darwin' &&
customResizeImageAsync === customResizeImageWithSipsAsync &&
!hasWarned
) {
LoggerDetach.warn('`sips` utility may or may not work outside of macOS');
hasWarned = true;
}
return customResizeImageAsync(iconSizePx, iconFilename, destinationIconPath);
}
async function customResizeImageWithSipsAsync(
iconSizePx: number,
iconFilename: string,
destinationIconPath: string,
) {
return spawnAsyncThrowError(
'sips',
['-Z', iconSizePx.toFixed(), iconFilename],
{
stdio: ['ignore', 'ignore', 'inherit'], // only stderr
cwd: destinationIconPath,
},
);
}
// Allow us to swap out the default implementations of image functions
let customResizeImageAsync = customResizeImageWithSipsAsync;
let customGetImageDimensionsAsync: (
dirname: string,
filename: string,
) => Promise<{
width?: number;
height?: number;
} | null> = customGetImageDimensionsWithImageProbeAsync;
// Allow users to provide an alternate implementation for our image resize function.
// This is used internally in order to use sharp instead of sips in standalone builder.
function setResizeImageFunction(
fn: (
iconSizePx: number,
iconFilename: string,
destinationIconPath: string,
) => Promise<any>,
) {
customResizeImageAsync = fn;
}
// Allow users to provide an alternate implementation for our image dimensions function.
// This is used internally in order to use sharp instead of sips in standalone builder.
function setGetImageDimensionsFunction(
fn: (
dirname: string,
filename: string,
) => Promise<{ width?: number; height?: number } | null>,
) {
customGetImageDimensionsAsync = fn;
}
export {
resizeImageAsync,
setResizeImageFunction,
setGetImageDimensionsFunction,
getImageDimensionsAsync,
};
+38
View File
@@ -0,0 +1,38 @@
import latestVersionAsync from 'latest-version';
import pTimeout from 'p-timeout';
import npmPackageJson from 'package-json';
import semver from 'semver';
import { Cacher } from './FsCache';
/** @deprecated just use the update-check npm package */
function createModuleVersionChecker(name: string, currentVersion: string) {
const UpdateCacher = new Cacher(
async () => {
const pkgJson = await pTimeout(
npmPackageJson(name, { version: currentVersion }),
2000,
);
return {
latestVersion: await pTimeout(latestVersionAsync(name), 2000),
deprecated: pkgJson.deprecated,
};
},
`${name}-updates.json`,
24 * 60 * 60 * 1000, // one day
);
async function checkAsync() {
const { latestVersion, deprecated } = await UpdateCacher.getAsync();
return {
updateIsAvailable: semver.gt(latestVersion, currentVersion),
latest: latestVersion,
current: currentVersion,
deprecated,
};
}
return { checkAsync };
}
export { createModuleVersionChecker };
+24
View File
@@ -0,0 +1,24 @@
export type ErrorCode = 'DIRECTORY_ALREADY_EXISTS' | 'INVALID_JSON';
const ERROR_PREFIX = 'Error: ';
export default class XDLError extends Error {
public readonly name = 'XDLError';
public code: string;
public isXDLError: true;
constructor(code: ErrorCode, message: string) {
super('');
// If e.toString() was called to get `message` we don't want it to look
// like "Error: Error:".
if (message.startsWith(ERROR_PREFIX)) {
message = message.substring(ERROR_PREFIX.length);
}
this.message = message;
this.code = code;
this.isXDLError = true;
}
}
+275
View File
@@ -0,0 +1,275 @@
import fs from 'fs-extra';
import { sync as globSync } from 'glob';
import path from 'path';
import logger from 'turtle/logger';
import { getImageDimensionsAsync, resizeImageAsync } from '../ImageUtils';
import {
regexFileAsync,
saveImageToPathAsync,
saveUrlToPathAsync,
spawnAsyncThrowError,
} from './ExponentTools';
import {
AnyStandaloneContext,
IStandaloneContextDataUser,
} from './StandaloneContext';
const iconScales = {
mdpi: 1,
hdpi: 1.5,
xhdpi: 2,
xxhdpi: 3,
xxxhdpi: 4,
};
async function regexFileInResSubfoldersAsync(
oldText: string,
newText: string,
resDirPath: string,
folderPrefix: string,
folderSuffix: string,
fileName: string,
) {
return Promise.all(
Object.keys(iconScales).map(async (key) => {
return regexFileAsync(
oldText,
newText,
path.join(resDirPath, `${folderPrefix}${key}${folderSuffix}`, fileName),
);
}),
);
}
let hasShownResizeErrorWindowsLinux = false;
async function resizeIconsAsync(
context: AnyStandaloneContext,
resPath: string,
prefix: string,
mdpiSize: number,
filename: string,
url: string,
isDetached: boolean,
) {
const baseImagePath = path.join(resPath, filename);
try {
if (isDetached) {
const data = context.data as IStandaloneContextDataUser;
await saveImageToPathAsync(data.projectPath, url, baseImagePath);
} else {
await saveUrlToPathAsync(url, baseImagePath);
}
} catch (e) {
throw new Error(`Failed to save icon file to disk. (${e})`);
}
await Promise.all(
Object.entries(iconScales).map(async ([folderSuffix, iconScale]) => {
// adaptive icons (mdpiSize 108) must be placed in a -v26 folder
const subdirectoryName = `${prefix}${folderSuffix}${
mdpiSize === 108 ? '-v26' : ''
}`;
const destinationPath = path.join(resPath, subdirectoryName);
await spawnAsyncThrowError('/bin/cp', [baseImagePath, filename], {
stdio: 'inherit',
cwd: destinationPath,
});
try {
await resizeImageAsync(mdpiSize * iconScale, filename, destinationPath);
} catch (e) {
// Turtle should be able to resize images, so if it fails we want it to throw.
// However, `sips` does not exist on Windows or Linux machines, so we expect
// resizing images to error on these OSes and want the detach process to continue anyway.
if (isDetached) {
if (!hasShownResizeErrorWindowsLinux) {
logger.warn(
'Failed to resize app icons. ' +
'Your full size icon will be copied to all android/app/src/main/res directories. ' +
'For best quality, we recommend providing downscaled versions.',
);
hasShownResizeErrorWindowsLinux = true;
}
} else {
throw new Error(`Failed to resize image: ${filename}. ${e}`);
}
}
// reject non-square icons
const dims = await getImageDimensionsAsync(destinationPath, filename);
if (!dims) {
// Again, only throw this error on Turtle -- we expect that this will fail
// for some detach users but we don't want this to stop the whole process.
if (!isDetached) {
throw new Error(`Unable to read the dimensions of ${filename}`);
}
} else if (dims.width !== dims.height) {
throw new Error(
`Android icons must be square, the dimensions of ${filename} are ${dims}`,
);
}
}),
);
await spawnAsyncThrowError('/bin/rm', [baseImagePath]);
}
async function createAndWriteIconsToPathAsync(
context: AnyStandaloneContext,
resPath: string,
isDetached: boolean,
) {
const manifest = context.config; // manifest or app.json
let iconUrl =
manifest.android && manifest.android.iconUrl
? manifest.android.iconUrl
: manifest.iconUrl;
let notificationIconUrl = manifest.notification
? manifest.notification.iconUrl
: null;
if (isDetached) {
// manifest is actually just app.json in this case, so iconUrl fields don't exist
iconUrl =
manifest.android && manifest.android.icon
? manifest.android.icon
: manifest.icon;
notificationIconUrl = manifest.notification
? manifest.notification.icon
: null;
}
let iconBackgroundUrl;
let iconBackgroundColor;
let iconForegroundUrl;
if (manifest.android && manifest.android.adaptiveIcon) {
iconBackgroundColor = manifest.android.adaptiveIcon.backgroundColor;
if (isDetached) {
iconForegroundUrl = manifest.android.adaptiveIcon.foregroundImage;
iconBackgroundUrl = manifest.android.adaptiveIcon.backgroundImage;
} else {
iconForegroundUrl = manifest.android.adaptiveIcon.foregroundImageUrl;
iconBackgroundUrl = manifest.android.adaptiveIcon.backgroundImageUrl;
}
}
if (iconUrl || iconForegroundUrl) {
// Android 7 and below icon
if (iconUrl) {
globSync('**/ic_launcher.png', {
cwd: resPath,
absolute: true,
}).forEach((filePath) => {
fs.removeSync(filePath);
});
await resizeIconsAsync(
context,
resPath,
'mipmap-',
48,
'ic_launcher.png',
iconUrl,
isDetached,
);
}
// Adaptive icon foreground image
if (iconForegroundUrl) {
globSync('**/ic_foreground.png', {
cwd: resPath,
absolute: true,
}).forEach((filePath) => {
fs.removeSync(filePath);
});
await resizeIconsAsync(
context,
resPath,
'mipmap-',
108,
'ic_foreground.png',
iconForegroundUrl,
isDetached,
);
} else {
// the OS's default method of coercing normal app icons to adaptive
// makes them look quite different from using an actual adaptive icon (with xml)
// so we need to support falling back to the old version on Android 8
globSync('**/mipmap-*-v26/*', {
cwd: resPath,
absolute: true,
dot: true,
}).forEach((filePath) => {
fs.removeSync(filePath);
});
try {
globSync('**/mipmap-*-v26', {
cwd: resPath,
absolute: true,
}).forEach((filePath) => {
fs.rmdirSync(filePath);
});
} catch (e) {
// we don't want the entire detach script to fail if node
// can't remove the directories for whatever reason.
// people can remove the directories themselves if they need
// so just fail silently here
}
}
}
// Adaptive icon background image or color
if (iconBackgroundUrl) {
await resizeIconsAsync(
context,
resPath,
'mipmap-',
108,
'ic_background.png',
iconBackgroundUrl,
isDetached,
);
await regexFileInResSubfoldersAsync(
'@color/iconBackground',
'@mipmap/ic_background',
resPath,
'mipmap-',
'-v26',
'ic_launcher.xml',
);
} else if (iconBackgroundColor) {
await regexFileAsync(
'"iconBackground">#FFFFFF',
`"iconBackground">${iconBackgroundColor}`,
path.join(resPath, 'values', 'colors.xml'),
);
}
// Remove Expo client notification icon resources
globSync('**/shell_notification_icon.png', {
cwd: resPath,
absolute: true,
}).forEach((filePath) => {
fs.removeSync(filePath);
});
// Add provided notification icon resources, falling back
// to the app icon if no `notification.icon` is provided
await resizeIconsAsync(
context,
resPath,
'drawable-',
24,
'shell_notification_icon.png',
notificationIconUrl ?? iconUrl,
isDetached,
);
}
export { createAndWriteIconsToPathAsync };
+42
View File
@@ -0,0 +1,42 @@
export default function renderIntentFilters(intentFilters: any) {
// returns an array of <intent-filter> tags:
// [
// `<intent-filter>
// <data android:scheme="exp"/>
// <data android:scheme="exps"/>
//
// <action android:name="android.intent.action.VIEW"/>
//
// <category android:name="android.intent.category.DEFAULT"/>
// <category android:name="android.intent.category.BROWSABLE"/>
// </intent-filter>`,
// ...
// ]
return intentFilters.map((intentFilter: any) => {
const autoVerify = intentFilter.autoVerify ? ' android:autoVerify="true"' : '';
return `<intent-filter${autoVerify}>
${renderIntentFilterData(intentFilter.data)}
<action android:name="android.intent.action.${intentFilter.action}"/>
${renderIntentFilterCategory(intentFilter.category)}
</intent-filter>`;
});
}
function renderIntentFilterDatumEntries(datum: any) {
return Object.entries(datum)
.map((entry) => `android:${entry[0]}="${entry[1]}"`)
.join(' ');
}
function renderIntentFilterData(data: any) {
return (Array.isArray(data) ? data : [data])
.map((datum) => `<data ${renderIntentFilterDatumEntries(datum)}/>`)
.join('\n');
}
function renderIntentFilterCategory(category: any) {
return (Array.isArray(category) ? category : [category])
.map((cat) => `<category android:name="android.intent.category.${cat}"/>`)
.join('\n');
}
File diff suppressed because it is too large. Load diff
+76
View File
@@ -0,0 +1,76 @@
import fs from 'fs-extra';
import pMap from 'p-map';
import pRetry from 'p-retry';
import path from 'path';
import logger from 'turtle/logger';
import url from 'url';
import urlJoin from 'url-join';
import { saveUrlToPathAsync } from './ExponentTools';
import { AnyStandaloneContext } from './StandaloneContext';
const EXPO_DOMAINS = ['expo.io', 'exp.host', 'expo.test', 'localhost'];
export const DEFAULT_CDN_HOST = 'https://d1wp6m56sqw74a.cloudfront.net';
export const ASSETS_DIR_DEFAULT_URL = `${DEFAULT_CDN_HOST}/~assets`;
type UrlResolver = (hash: string) => string;
export async function bundleAsync(
context: any,
assets: string[],
dest: string,
exportUrl?: string | null,
) {
if (!assets) {
return;
}
await fs.ensureDir(dest);
const urlResolver = createAssetsUrlResolver(context, exportUrl);
await pMap(assets, (asset) => downloadAssetAsync(urlResolver, dest, asset), {
concurrency: 5,
});
}
async function downloadAssetAsync(
urlResolver: UrlResolver,
dest: string,
asset: string,
) {
const extensionIndex = asset.lastIndexOf('.');
const prefixLength = 'asset_'.length;
const hash =
extensionIndex >= 0
? asset.substring(prefixLength, extensionIndex)
: asset.substring(prefixLength);
logger.info(urlResolver(hash));
await pRetry(
() => saveUrlToPathAsync(urlResolver(hash), path.join(dest, asset)),
{ retries: 3 },
);
}
function createAssetsUrlResolver(
context: AnyStandaloneContext,
exportUrl?: string | null,
): UrlResolver {
let assetsDirUrl = exportUrl ? `${exportUrl}/assets` : ASSETS_DIR_DEFAULT_URL;
if (context && context.published && context.published.url) {
const { assetUrlOverride = './assets' } = context.config;
const publishedUrl = context.published.url;
const { hostname } = url.parse(publishedUrl);
if (hostname == null) {
throw new Error(
`Could not resolve asset URLs relative to "${publishedUrl}". Published URL must be an absolute URL.`,
);
}
const maybeExpoDomain = hostname.split('.').slice(-2).join('.');
if (!EXPO_DOMAINS.includes(maybeExpoDomain)) {
assetsDirUrl = url.resolve(publishedUrl, assetUrlOverride);
}
}
return (hash) => urlJoin(assetsDirUrl, hash);
}
+565
View File
@@ -0,0 +1,565 @@
// Set EXPO_VIEW_DIR to universe/exponent to test locally
import { findConfigFile, getConfig } from '@expo/config';
import JsonFile from '@expo/json-file';
import spawnAsync from '@expo/spawn-async';
import fs from 'fs-extra';
import { sync as globSync } from 'glob';
import isPlainObject from 'lodash/isPlainObject';
import path from 'path';
import process from 'process';
import prompts from 'prompts';
import rimraf from 'rimraf';
import uuid from 'uuid';
import { Versions, EmbeddedAssets, UrlUtils, UserManager, Api } from '@expo/xdl';
import XDLError from '../XDLError';
import * as AndroidShellApp from './AndroidShellApp';
import * as AssetBundle from './AssetBundle';
import { isDirectory, regexFileAsync, rimrafDontThrow } from './ExponentTools';
import * as IosNSBundle from './IosNSBundle';
import * as IosPlist from './IosPlist';
import * as IosWorkspace from './IosWorkspace';
import logger from './Logger';
import StandaloneBuildFlags from './StandaloneBuildFlags';
import StandaloneContext from './StandaloneContext';
import installPackagesAsync from './installPackagesAsync';
const SERVICE_CONTEXT_PROJECT_NAME = 'exponent-view-template';
async function yesnoAsync(message) {
const { ok } = await prompts({
type: 'confirm',
name: 'ok',
initial: true,
message,
});
return ok;
}
export async function detachAsync(projectRoot, options = {}) {
const originalLogger = logger.loggerObj;
logger.configure({
trace: options.verbose ? console.trace.bind(console) : () => {},
debug: options.verbose ? console.debug.bind(console) : () => {},
info: options.verbose ? console.info.bind(console) : () => {},
warn: console.warn.bind(console),
error: console.error.bind(console),
fatal: console.error.bind(console),
});
try {
return await _detachAsync(projectRoot, options);
} finally {
logger.configure(originalLogger);
}
}
async function _detachAsync(projectRoot, options) {
const user = await UserManager.ensureLoggedInAsync();
if (!user) {
throw new Error('Internal error -- somehow detach is being run in offline mode.');
}
const username = user.username;
const { configName, configPath, configNamespace } = findConfigFile(projectRoot);
let { exp } = getConfig(projectRoot);
const experienceName = `@${username}/${exp.slug}`;
const experienceUrl = `exp://exp.host/${experienceName}`;
// Check to make sure project isn't fully detached already
const hasIosDirectory = isDirectory(path.join(projectRoot, 'ios'));
const hasAndroidDirectory = isDirectory(path.join(projectRoot, 'android'));
if (hasIosDirectory && hasAndroidDirectory) {
throw new XDLError(
'DIRECTORY_ALREADY_EXISTS',
'Error detaching. `ios` and `android` directories already exist.'
);
}
// Project was already detached on Windows or Linux
if (!hasIosDirectory && hasAndroidDirectory && process.platform === 'darwin') {
const response = await yesnoAsync(
`This will add an Xcode project and leave your existing Android project alone. Enter 'yes' to continue:`
);
if (!response) {
logger.info('Exiting...');
return false;
}
}
if (hasIosDirectory && !hasAndroidDirectory) {
throw new Error('`ios` directory already exists. Please remove it and try again.');
}
logger.info('Validating project manifest...');
if (!exp.name) {
throw new Error(`${configName} is missing \`name\``);
}
if (!exp.sdkVersion) {
throw new Error(`${configName} is missing \`sdkVersion\``);
}
if (!Versions.gteSdkVersion(exp, '25.0.0')) {
throw new Error(
`The app must be updated to SDK 25.0.0 or newer to be compatible with this tool.`
);
}
const versions = await Versions.versionsAsync();
let sdkVersionConfig = versions.sdkVersions[exp.sdkVersion];
if (
!sdkVersionConfig ||
(!sdkVersionConfig.androidExpoViewUrl && !sdkVersionConfig.iosExpoViewUrl)
) {
if (process.env.EXPO_VIEW_DIR) {
logger.warn(
`Detaching is not supported for SDK ${exp.sdkVersion}; ignoring this because you provided EXPO_VIEW_DIR`
);
sdkVersionConfig = {};
} else {
throw new Error(`Detaching is not supported for SDK version ${exp.sdkVersion}`);
}
}
exp.isDetached = true;
if (!exp.detach) {
exp.detach = {};
}
const detachedUUID = uuid.v4().replace(/-/g, '');
const generatedScheme = `exp${detachedUUID}`;
if (!exp.detach.scheme && !Versions.gteSdkVersion(exp, '27.0.0')) {
// set this for legacy purposes
exp.detach.scheme = generatedScheme;
}
const linkingWarning = `You have not specified a custom scheme for deep linking. A default value of ${generatedScheme} will be used. You can change this later by following the instructions in this guide: https://docs.expo.io/workflow/linking/`;
if (!exp.scheme) {
logger.info(linkingWarning);
exp.scheme = generatedScheme;
} else if (Array.isArray(exp.scheme) && exp.scheme.length === 0) {
logger.info(linkingWarning);
exp.scheme.push(generatedScheme);
}
const expoDirectory = path.join(projectRoot, '.expo-source');
fs.mkdirpSync(expoDirectory);
const context = StandaloneContext.createUserContext(projectRoot, exp, experienceUrl);
// iOS
let isIosSupported = true;
if (process.platform !== 'darwin') {
if (options && options.force) {
logger.warn(
`You are not running macOS, but have provided the --force option, so we will attempt to generate an iOS project anyway. This might fail.`
);
} else {
logger.warn(`Skipping iOS because you are not running macOS.`);
isIosSupported = false;
}
}
if (!hasIosDirectory && isIosSupported && sdkVersionConfig.iosExpoViewUrl) {
if (!exp.ios) {
exp.ios = {};
}
if (!exp.ios.bundleIdentifier) {
logger.info(
`You'll need to specify an iOS bundle identifier. See: https://docs.expo.io/versions/latest/config/app/#ios`
);
const { iosBundleIdentifier } = await prompts({
type: 'text',
name: 'iosBundleIdentifier',
message: 'What would you like your iOS bundle identifier to be?',
validate: value => /^[a-zA-Z][a-zA-Z0-9\-.]+$/.test(value),
});
exp.ios.bundleIdentifier = iosBundleIdentifier;
}
await detachIOSAsync(context);
exp = IosWorkspace.addDetachedConfigToExp(exp, context);
exp.detach.iosExpoViewUrl = sdkVersionConfig.iosExpoViewUrl;
}
// Android
if (!hasAndroidDirectory && sdkVersionConfig.androidExpoViewUrl) {
if (!exp.android) {
exp.android = {};
}
if (!exp.android.package) {
logger.info(
`You'll need to specify an Android package name. See: https://docs.expo.io/versions/latest/config/app/#android`
);
const { androidPackage } = await prompts({
type: 'text',
name: 'androidPackage',
message: 'What would you like your Android package name to be?',
validate: value =>
/^[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z][a-zA-Z0-9_]*)+$/.test(value)
? true
: "Invalid format of Android package name (only alphanumeric characters, '.' and '_' are allowed, and each '.' must be followed by a letter)",
});
exp.android.package = androidPackage;
}
const androidDirectory = path.join(expoDirectory, 'android');
rimraf.sync(androidDirectory);
fs.mkdirpSync(androidDirectory);
await detachAndroidAsync(context, sdkVersionConfig.androidExpoViewUrl);
exp = AndroidShellApp.addDetachedConfigToExp(exp, context);
exp.detach.androidExpoViewUrl = sdkVersionConfig.androidExpoViewUrl;
}
logger.info('Writing ExpoKit configuration...');
// if we're writing to app.json, we need to place the configuration under the expo key
const config = configNamespace ? { [configNamespace]: exp } : exp;
await fs.writeFile(configPath, JSON.stringify(config, null, 2));
const packagesToInstall = [];
const nodeModulesPath = exp.nodeModulesPath
? path.resolve(projectRoot, exp.nodeModulesPath)
: projectRoot;
if (sdkVersionConfig && sdkVersionConfig.expoReactNativeTag) {
packagesToInstall.push(
`react-native@https://github.com/expo/react-native/archive/${sdkVersionConfig.expoReactNativeTag}.tar.gz`
);
} else if (process.env.EXPO_VIEW_DIR) {
// ignore, using test directory
} else {
throw new Error(`Expo's fork of react-native does not support this SDK version.`);
}
// Add expokitNpmPackage if it is supported. Was added before SDK 29.
if (process.env.EXPO_VIEW_DIR) {
logger.info(`Linking 'expokit' package...`);
await spawnAsync('yarn', ['link'], {
cwd: path.join(process.env.EXPO_VIEW_DIR, 'expokit-npm-package'),
});
await spawnAsync('yarn', ['link', 'expokit'], {
cwd: nodeModulesPath,
});
} else if (sdkVersionConfig.expokitNpmPackage) {
packagesToInstall.push(sdkVersionConfig.expokitNpmPackage);
}
if (sdkVersionConfig) {
const { packagesToInstallWhenEjecting } = sdkVersionConfig;
if (isPlainObject(packagesToInstallWhenEjecting)) {
Object.keys(packagesToInstallWhenEjecting).forEach(packageName => {
packagesToInstall.push(`${packageName}@${packagesToInstallWhenEjecting[packageName]}`);
});
}
}
if (packagesToInstall.length) {
await installPackagesAsync(projectRoot, packagesToInstall, {
packageManager: options.packageManager,
});
}
return true;
}
/**
* Create a detached Expo iOS app pointing at the given project.
*/
async function detachIOSAsync(context) {
await IosWorkspace.createDetachedAsync(context);
logger.info('Configuring iOS project...');
await IosNSBundle.configureAsync(context);
logger.info(`iOS detach is complete!`);
}
async function detachAndroidAsync(context, expoViewUrl) {
if (context.type !== 'user') {
throw new Error(`detachAndroidAsync only supports user standalone contexts`);
}
logger.info('Moving Android project files...');
const androidProjectDirectory = path.join(context.data.projectPath, 'android');
let tmpExpoDirectory;
if (process.env.EXPO_VIEW_DIR) {
// Only for testing
await AndroidShellApp.copyInitialShellAppFilesAsync(
path.join(process.env.EXPO_VIEW_DIR, 'android'),
androidProjectDirectory,
true,
context.data.exp.sdkVersion
);
} else {
tmpExpoDirectory = path.join(context.data.projectPath, 'temp-android-directory');
fs.mkdirpSync(tmpExpoDirectory);
logger.info('Downloading Android code...');
await Api.downloadAsync(expoViewUrl, tmpExpoDirectory, { extract: true });
await AndroidShellApp.copyInitialShellAppFilesAsync(
tmpExpoDirectory,
androidProjectDirectory,
true,
context.data.exp.sdkVersion
);
}
logger.info('Updating Android app...');
await AndroidShellApp.runShellAppModificationsAsync(context, context.data.exp.sdkVersion);
// Clean up
logger.info('Cleaning up Android...');
if (!process.env.EXPO_VIEW_DIR) {
rimrafDontThrow(tmpExpoDirectory);
}
logger.info('Android detach is complete!\n');
}
async function ensureBuildConstantsExistsIOSAsync(configFilePath) {
// EXBuildConstants is included in newer ExpoKit projects.
// create it if it doesn't exist.
const doesBuildConstantsExist = fs.existsSync(
path.join(configFilePath, 'EXBuildConstants.plist')
);
if (!doesBuildConstantsExist) {
await IosPlist.createBlankAsync(configFilePath, 'EXBuildConstants');
logger.info('Created `EXBuildConstants.plist` because it did not exist yet');
}
}
async function _getIosExpoKitVersionThrowErrorAsync(iosProjectDirectory) {
let expoKitVersion = '';
const podfileLockPath = path.join(iosProjectDirectory, 'Podfile.lock');
try {
const podfileLock = await fs.readFile(podfileLockPath, 'utf8');
const expoKitVersionRegex = /ExpoKit\/Core\W?\(([0-9.]+)\)/gi;
const match = expoKitVersionRegex.exec(podfileLock);
expoKitVersion = match[1];
} catch (e) {
throw new Error(
`Unable to read ExpoKit version from Podfile.lock. Make sure your project depends on ExpoKit. (${e})`
);
}
return expoKitVersion;
}
async function readNullableConfigJsonAsync(projectDir) {
try {
return getConfig(projectDir);
} catch {
return null;
}
}
async function prepareDetachedBuildIosAsync(projectDir, args) {
const config = await readNullableConfigJsonAsync(projectDir);
if (config && config.exp.name !== SERVICE_CONTEXT_PROJECT_NAME) {
return prepareDetachedUserContextIosAsync(projectDir, config.exp, args);
} else {
return prepareDetachedServiceContextIosAsync(projectDir, args);
}
}
async function prepareDetachedServiceContextIosAsync(projectDir, args) {
// service context
// TODO: very brittle hack: the paths here are hard coded to match the single workspace
// path generated inside IosShellApp. When we support more than one path, this needs to
// be smarter.
const expoRootDir = path.join(projectDir, '..', '..');
const workspaceSourcePath = path.join(projectDir, 'ios');
const buildFlags = StandaloneBuildFlags.createIos('Release', { workspaceSourcePath });
const context = StandaloneContext.createServiceContext(
expoRootDir,
null,
null,
null,
/* testEnvironment */ 'none',
buildFlags,
null,
null
);
const { iosProjectDirectory, supportingDirectory } = IosWorkspace.getPaths(context);
const expoKitVersion = await _getIosExpoKitVersionThrowErrorAsync(iosProjectDirectory);
// use prod api keys if available
const prodApiKeys = await _readDefaultApiKeysAsync(
path.join(context.data.expoSourcePath, '__internal__', 'keys.json')
);
const { exp } = getConfig(expoRootDir, { skipSDKVersionRequirement: true });
await IosPlist.modifyAsync(supportingDirectory, 'EXBuildConstants', constantsConfig => {
// verify that we are actually in a service context and not a misconfigured project
const contextType = constantsConfig.STANDALONE_CONTEXT_TYPE;
if (contextType !== 'service') {
throw new Error(
'Unable to configure a project which has no app.json and also no STANDALONE_CONTEXT_TYPE.'
);
}
constantsConfig.EXPO_RUNTIME_VERSION = expoKitVersion;
constantsConfig.API_SERVER_ENDPOINT =
process.env.ENVIRONMENT === 'staging'
? 'https://staging.exp.host/--/api/v2/'
: 'https://exp.host/--/api/v2/';
if (prodApiKeys) {
constantsConfig.DEFAULT_API_KEYS = prodApiKeys;
}
if (exp && exp.sdkVersion) {
constantsConfig.TEMPORARY_SDK_VERSION = exp.sdkVersion;
}
return constantsConfig;
});
}
async function _readDefaultApiKeysAsync(jsonFilePath) {
if (fs.existsSync(jsonFilePath)) {
const keys = {};
const allKeys = await new JsonFile(jsonFilePath).readAsync();
const validKeys = ['AMPLITUDE_KEY', 'GOOGLE_MAPS_IOS_API_KEY'];
for (const key in allKeys) {
if (allKeys.hasOwnProperty(key) && validKeys.includes(key)) {
keys[key] = allKeys[key];
}
}
return keys;
}
return null;
}
async function prepareDetachedUserContextIosAsync(projectDir, exp, args) {
const context = StandaloneContext.createUserContext(projectDir, exp);
const { iosProjectDirectory, supportingDirectory } = IosWorkspace.getPaths(context);
logger.info(`Preparing iOS build at ${iosProjectDirectory}...`);
// These files cause @providesModule naming collisions
// but are not available until after `pod install` has run.
const podsDirectory = path.join(iosProjectDirectory, 'Pods');
if (!isDirectory(podsDirectory)) {
throw new Error(`Can't find directory ${podsDirectory}, make sure you've run pod install.`);
}
const rnPodDirectory = path.join(podsDirectory, 'React');
if (isDirectory(rnPodDirectory)) {
const rnFilesToDelete = globSync('**/*.@(js|json)', {
absolute: true,
cwd: rnPodDirectory,
});
if (rnFilesToDelete) {
for (let i = 0; i < rnFilesToDelete.length; i++) {
await fs.unlink(rnFilesToDelete[i]);
}
}
}
// insert expo development url into iOS config
if (!args.skipXcodeConfig) {
// populate EXPO_RUNTIME_VERSION from ExpoKit pod version
const expoKitVersion = await _getIosExpoKitVersionThrowErrorAsync(iosProjectDirectory);
// populate development url
const devUrl = await UrlUtils.constructManifestUrlAsync(projectDir);
// populate default api keys
const defaultApiKeys = await _readDefaultApiKeysAsync(
path.join(podsDirectory, 'ExpoKit', 'template-files', 'keys.json')
);
await ensureBuildConstantsExistsIOSAsync(supportingDirectory);
await IosPlist.modifyAsync(supportingDirectory, 'EXBuildConstants', constantsConfig => {
constantsConfig.developmentUrl = devUrl;
constantsConfig.EXPO_RUNTIME_VERSION = expoKitVersion;
if (defaultApiKeys) {
constantsConfig.DEFAULT_API_KEYS = defaultApiKeys;
}
if (exp.sdkVersion) {
constantsConfig.TEMPORARY_SDK_VERSION = exp.sdkVersion;
}
return constantsConfig;
});
}
}
export async function prepareDetachedBuildAsync(projectDir, args) {
if (args.platform === 'ios') {
await prepareDetachedBuildIosAsync(projectDir, args);
} else {
const expoBuildConstantsMatches = globSync('android/**/DetachBuildConstants.java', {
absolute: true,
cwd: projectDir,
});
if (expoBuildConstantsMatches && expoBuildConstantsMatches.length) {
const expoBuildConstants = expoBuildConstantsMatches[0];
const devUrl = await UrlUtils.constructManifestUrlAsync(projectDir);
await regexFileAsync(
/DEVELOPMENT_URL = "[^"]*";/,
`DEVELOPMENT_URL = "${devUrl}";`,
expoBuildConstants
);
}
}
}
// args.dest: string,
// This is the path where assets will be copied to. It should be
// `$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH` on iOS
// (see `exponent-view-template.xcodeproj/project.pbxproj` for an example)
// and `$buildDir/intermediates/assets/$targetPath` on Android (see
// `android/app/expo.gradle` for an example).
export async function bundleAssetsAsync(projectDir, args) {
const options = await readNullableConfigJsonAsync(projectDir);
if (!options || options.exp.name === SERVICE_CONTEXT_PROJECT_NAME) {
// Don't run assets bundling for the service context.
return;
}
const { exp } = options;
const bundledManifestPath = EmbeddedAssets.getEmbeddedManifestPath(
args.platform,
projectDir,
exp
);
if (!bundledManifestPath) {
logger.warn(
`Skipped assets bundling because the '${args.platform}.publishManifestPath' key is not specified in the app manifest.`
);
return;
}
let manifest;
try {
manifest = JSON.parse(await fs.readFile(bundledManifestPath, 'utf8'));
} catch (ex) {
throw new Error(
`Error reading the manifest file. Make sure the path '${bundledManifestPath}' is correct.\n\nError: ${ex.message}`
);
}
if (!manifest || !Object.keys(manifest).length) {
throw new Error(`The manifest at '${bundledManifestPath}' was empty or invalid.`);
}
await AssetBundle.bundleAsync(null, manifest.bundledAssets, args.dest, getExportUrl(manifest));
}
/**
* This function extracts the exported public URL that is set in the manifest
* when the developer runs `expo export --public-url x`. We use this to ensure
* that we fetch the resources from the appropriate place when doing builds
* against self-hosted apps.
*/
function getExportUrl(manifest) {
const { bundleUrl } = manifest;
if (bundleUrl.includes(AssetBundle.DEFAULT_CDN_HOST)) {
return null;
}
try {
const bundleUrlParts = bundleUrl.split('/');
return bundleUrlParts.slice(0, bundleUrlParts.length - 2).join('/');
} catch (e) {
throw Error(
`Expected bundleUrl to be of the format https://domain/bundles/bundle-hash-id, ${bundleUrl} does not follow this format.`
);
}
}
+297
View File
@@ -0,0 +1,297 @@
import { ExpoConfig, Platform } from '@expo/config';
import spawnAsyncQuiet, { SpawnOptions, SpawnResult } from '@expo/spawn-async';
import axios from 'axios';
import fs from 'fs-extra';
import isObject from 'lodash/isObject';
import path from 'path';
import { Readable } from 'stream';
import XDLError from '../XDLError';
import LoggerDetach, { Logger, pipeOutputToLogger } from './Logger';
function getManifestFileNameForSdkVersion(sdkVersion: string) {
if (parseSdkMajorVersion(sdkVersion) < 39) {
return 'shell-app-manifest.json';
} else {
return 'app.manifest';
}
}
function getBundleFileNameForSdkVersion(sdkVersion: string) {
if (parseSdkMajorVersion(sdkVersion) < 39) {
return 'shell-app.bundle';
} else {
return 'app.bundle';
}
}
function parseSdkMajorVersion(expSdkVersion: string) {
// We assume that the unversioned SDK is the latest
if (expSdkVersion === 'UNVERSIONED') {
return Infinity;
}
let sdkMajorVersion = 0;
try {
const versionComponents = expSdkVersion
.split('.')
.map((num) => parseInt(num, 10));
sdkMajorVersion = versionComponents[0];
} catch {
sdkMajorVersion = 0;
}
return sdkMajorVersion;
}
async function saveUrlToPathAsync(
url: string,
filePath: string,
timeout = 20000,
) {
const response = await axios.get(url, { responseType: 'stream', timeout });
return new Promise((resolve, reject) => {
const stream = fs.createWriteStream(filePath);
stream.on('close', resolve);
stream.on('error', reject);
response.data.on('error', reject).pipe(stream);
});
}
async function saveImageToPathAsync(
projectRoot: string,
pathOrURL: string,
outPath: string,
) {
const localPath = path.resolve(projectRoot, pathOrURL);
if (fs.existsSync(localPath)) {
await fs.copy(localPath, outPath);
} else {
await saveUrlToPathAsync(pathOrURL, outPath, 0);
}
}
async function getManifestAsync(url: string, headers: any, options: any = {}) {
const buildPhaseLogger =
options.logger ||
LoggerDetach.withFields({ buildPhase: 'reading manifest' });
let response;
try {
response = await _retryPromise(() =>
axios.get(url.replace('exp://', 'http://'), { headers }),
);
} catch (err) {
buildPhaseLogger.error(err);
throw new Error('Failed to fetch manifest from www');
}
buildPhaseLogger.info(
'Using manifest:',
JSON.stringify(response.data, null, 2),
);
return response.data;
}
async function _retryPromise<T>(
fn: (...args: any[]) => T,
retries = 5,
): Promise<T> {
try {
return await fn();
} catch (err) {
if (retries-- > 0) {
return await _retryPromise(fn, retries);
} else {
throw err;
}
}
}
export type AsyncSpawnOptions = SpawnOptions & {
loggerFields?: any;
pipeToLogger?: boolean | { stdout?: boolean; stderr?: boolean };
stdoutOnly?: boolean;
loggerLineTransformer?: (line: any) => any;
};
async function spawnAsyncThrowError(
command: string,
args: string[],
options: AsyncSpawnOptions = {
stdio: 'inherit',
cwd: process.cwd(),
},
): Promise<SpawnResult> {
const { pipeToLogger } = options;
if (pipeToLogger) {
options.stdio = 'pipe';
options.cwd = options.cwd || process.cwd();
}
const promise = spawnAsyncQuiet(command, args, options);
if (pipeToLogger && promise.child) {
const streams: { stdout?: Readable | null; stderr?: Readable | null } = {};
if (pipeToLogger === true || pipeToLogger.stdout) {
streams.stdout = promise.child.stdout;
}
if (pipeToLogger === true || pipeToLogger.stderr) {
streams.stderr = promise.child.stderr;
}
pipeOutputToLogger(streams, options.loggerFields, options);
}
return promise;
}
async function spawnAsync(
command: string,
args: string[],
options: SpawnOptions,
): Promise<SpawnResult | void> {
try {
return await spawnAsyncThrowError(command, args, options);
} catch (e) {
LoggerDetach.error(e.message);
}
}
function createSpawner(buildPhase: string, logger?: Logger) {
return (command: string, ...args: any[]) => {
const lastArg = args[args.length - 1];
const optionsFromArg = isObject(lastArg) ? args.pop() : {};
const options = { ...optionsFromArg, pipeToLogger: true };
if (buildPhase) {
options.loggerFields = options.loggerFields ? options.loggerFields : {};
options.loggerFields = { ...options.loggerFields, buildPhase };
}
if (logger) {
logger.info('Executing command:', command, ...args);
}
return spawnAsyncThrowError(command, args, options);
};
}
async function transformFileContentsAsync(
filename: string,
transform: (input: string) => string | null,
) {
const fileString = await fs.readFile(filename, 'utf8');
const newFileString = transform(fileString);
if (newFileString !== null) {
await fs.writeFile(filename, newFileString);
}
}
function manifestUsesSplashApi(manifest: ExpoConfig, platform: Platform) {
if (platform === 'ios') {
return manifest.splash || (manifest.ios && manifest.ios.splash);
}
if (platform === 'android') {
return manifest.splash || (manifest.android && manifest.android.splash);
}
return false;
}
function rimrafDontThrow(directory: string) {
fs.removeSync(directory);
}
async function removeIfExists(file: string) {
await fs.remove(file);
}
function isDirectory(dir: string) {
try {
if (fs.statSync(dir).isDirectory()) {
return true;
}
return false;
} catch (e) {
return false;
}
}
interface ILocaleMap {
[lang: string]: any;
}
async function getResolvedLocalesAsync(
projectRoot: string,
exp: ExpoConfig,
): Promise<ILocaleMap> {
const locales: ILocaleMap = {};
if (exp.locales !== undefined) {
for (const [lang, localePath] of Object.entries(exp.locales)) {
const s = await fs.readFile(
path.resolve(projectRoot, localePath as string),
'utf8',
);
try {
locales[lang] = JSON.parse(s);
} catch (e) {
throw new XDLError('INVALID_JSON', JSON.stringify(e));
}
}
}
return locales;
}
async function regexFileAsync(
regex: RegExp | string,
replace: string,
filename: string,
): Promise<void> {
const file = await fs.readFile(filename);
const fileString = file.toString();
await fs.writeFile(filename, fileString.replace(regex, replace));
}
// Matches sed /d behavior
async function deleteLinesInFileAsync(
startRegex: RegExp | string,
endRegex: RegExp | string,
filename: string,
): Promise<void> {
const file = await fs.readFile(filename);
const fileString = file.toString();
const lines = fileString.split(/\r?\n/);
const filteredLines = [];
let inDeleteRange = false;
for (const line of lines) {
if (line.match(startRegex)) {
inDeleteRange = true;
}
if (!inDeleteRange) {
filteredLines.push(line);
}
if (inDeleteRange && line.match(endRegex)) {
inDeleteRange = false;
}
}
await fs.writeFile(filename, filteredLines.join('\n'));
}
export {
isDirectory,
parseSdkMajorVersion,
saveUrlToPathAsync,
saveImageToPathAsync,
getManifestAsync,
rimrafDontThrow,
removeIfExists,
spawnAsyncThrowError,
spawnAsync,
transformFileContentsAsync,
manifestUsesSplashApi,
getResolvedLocalesAsync,
regexFileAsync,
deleteLinesInFileAsync,
createSpawner,
getManifestFileNameForSdkVersion,
getBundleFileNameForSdkVersion,
};
+71
View File
@@ -0,0 +1,71 @@
import fs from 'fs-extra';
import path from 'path';
import { parseSdkMajorVersion, spawnAsyncThrowError } from './ExponentTools';
import * as IosIcons from './IosIcons';
import { AnyStandaloneContext, StandaloneContextService } from './StandaloneContext';
/**
* Compile a .car file from the icons in a manifest.
*/
async function buildAssetArchiveAsync(
context: AnyStandaloneContext,
destinationCARPath: string,
intermediatesDirectory: string,
) {
if (!(context instanceof StandaloneContextService)) {
throw new Error('buildAssetArchive is only supported for service standalone contexts.');
}
const { data } = context;
fs.mkdirpSync(intermediatesDirectory);
// copy expoSourceRoot/.../Images.xcassets into intermediates
await spawnAsyncThrowError(
'/bin/cp',
[
'-R',
path.join(data.expoSourcePath, 'Exponent', 'Images.xcassets'),
path.join(intermediatesDirectory, 'Images.xcassets'),
],
{
stdio: 'inherit',
},
);
// make the new xcassets contain the project's icon
await IosIcons.createAndWriteIconsToPathAsync(
context,
path.join(intermediatesDirectory, 'Images.xcassets', 'AppIcon.appiconset'),
);
const sdkMajorVersion = parseSdkMajorVersion(data.manifest.sdkVersion);
const deploymentTarget = sdkMajorVersion > 40 ? '11.0' : '10.0'; // SDK41 drops support for iOS 10.0
// compile asset archive
// prettier-ignore
const xcrunargs = [
'actool',
'--minimum-deployment-target', deploymentTarget,
'--platform', 'iphoneos',
'--app-icon', 'AppIcon',
'--output-partial-info-plist', 'assetcatalog_generated_info.plist',
'--compress-pngs',
'--enable-on-demand-resources', 'YES',
'--product-type', 'com.apple.product-type.application',
'--target-device', 'iphone',
'--target-device', 'ipad',
'--compile', path.relative(intermediatesDirectory, destinationCARPath),
'Images.xcassets',
];
/*
* Note: if you want to debug issues with `actool`, try changing to stdio: 'inherit'.
* In both success and failure cases, actool will write an enormous .plist to stdout
* which may contain the key `com.apple.actool.errors`. Great work Apple
*/
await spawnAsyncThrowError('xcrun', xcrunargs, {
stdio: ['ignore', 'ignore', 'inherit'], // only stderr
cwd: intermediatesDirectory,
});
}
export { buildAssetArchiveAsync };
+343
View File
@@ -0,0 +1,343 @@
import plist from '@expo/plist';
import crypto from 'crypto';
import fs from 'fs-extra';
import { sync as globSync } from 'glob';
import omit from 'lodash/omit';
import minimatch from 'minimatch';
import path from 'path';
import { spawnAsyncThrowError } from './ExponentTools';
import { findP12CertSerialNumber, getP12CertFingerprint } from './PKCS12Utils';
async function ensureCertificateValid({ certPath, certPassword, teamID }) {
const certData = await fs.readFile(certPath);
const fingerprint = getP12CertFingerprint(certData, certPassword);
const identities = await _findIdentitiesByTeamID(teamID);
const isValid = identities.indexOf(fingerprint) !== -1;
if (!isValid) {
throw new Error(`codesign ident not present in find-identity: ${fingerprint}\n${identities}`);
}
return fingerprint;
}
async function _findIdentitiesByTeamID(teamID) {
const { output } = await spawnAsyncThrowError(
'security',
['find-identity', '-v', '-s', `(${teamID})`],
{
stdio: 'pipe',
}
);
return output.join('');
}
function validateProvisioningProfile(plistData, { distCertFingerprint, bundleIdentifier }) {
_ensureDeveloperCertificateIsValid(plistData, distCertFingerprint);
_ensureBundleIdentifierIsValid(plistData, bundleIdentifier);
}
function _ensureDeveloperCertificateIsValid(plistData, distCertFingerprint) {
const devCertBase64 = plistData.DeveloperCertificates[0];
const devCertFingerprint = _genDerCertFingerprint(devCertBase64);
if (devCertFingerprint !== distCertFingerprint) {
throw new Error(
'validateProvisioningProfile: provisioning profile is not associated with uploaded distribution certificate'
);
}
}
function _genDerCertFingerprint(certBase64) {
const certBuffer = Buffer.from(certBase64, 'base64');
return crypto.createHash('sha1').update(certBuffer).digest('hex').toUpperCase();
}
function _ensureBundleIdentifierIsValid(plistData, expectedBundleIdentifier) {
const actualApplicationIdentifier = plistData.Entitlements['application-identifier'];
const actualBundleIdentifier = /\.(.+)/.exec(actualApplicationIdentifier)[1];
if (!minimatch(expectedBundleIdentifier, actualBundleIdentifier)) {
throw new Error(
`validateProvisioningProfile: wrong bundleIdentifier found in provisioning profile; expected: ${expectedBundleIdentifier}, found (in provisioning profile): ${actualBundleIdentifier}`
);
}
}
async function writeExportOptionsPlistFile(plistPath, data) {
const toWrite = createExportOptionsPlist(data);
await fs.writeFile(plistPath, toWrite);
}
const createExportOptionsPlist = ({
bundleIdentifier,
provisioningProfileUUID,
exportMethod,
teamID,
}) => {
const disableBitcodeCompiling = `<key>uploadBitcode</key>
<false/>
<key>compileBitcode</key>
<false/>
<key>uploadSymbols</key>
<false/>`;
return `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>${exportMethod}</string>
<key>teamID</key>
<string>${teamID}</string>
<key>provisioningProfiles</key>
<dict>
<key>${bundleIdentifier}</key>
<string>${provisioningProfileUUID}</string>
</dict>
${exportMethod === 'ad-hoc' || exportMethod === 'enterprise' ? disableBitcodeCompiling : ''}
</dict>
</plist>`;
};
async function buildIPA(
{
ipaPath,
workspacePath,
archivePath,
codeSignIdentity,
exportOptionsPlistPath,
plistData,
keychainPath,
exportMethod,
},
credentials,
client = false
) {
if (client) {
await spawnAsyncThrowError(
'xcodebuild',
[
'-exportArchive',
'-archivePath',
archivePath,
'-exportOptionsPlist',
exportOptionsPlistPath,
'-exportPath',
path.Dir(ipaPath),
`OTHER_CODE_SIGN_FLAGS="--keychain ${keychainPath}"`,
],
{
env: { ...process.env, CI: 1 },
}
);
} else {
await runFastlane(
credentials,
[
'gym',
'-n',
path.basename(ipaPath),
'--workspace',
workspacePath,
'--archive_path',
archivePath,
'--skip_build_archive',
'true',
'-i',
codeSignIdentity,
'--export_options',
exportOptionsPlistPath,
'--export_method',
exportMethod,
'--export_xcargs',
`OTHER_CODE_SIGN_FLAGS="--keychain ${keychainPath}"`,
'-o',
path.dirname(ipaPath),
'--verbose',
],
{ buildPhase: 'building and signing IPA' }
);
}
}
const resolveExportMethod = plistData => {
if (plistData.ProvisionedDevices) {
return 'ad-hoc';
} else if (plistData.ProvisionsAllDevices === true) {
return 'enterprise';
} else {
return 'app-store';
}
};
const entitlementTransferRules = [
'com.apple.developer.associated-domains',
'com.apple.developer.healthkit',
'com.apple.developer.homekit',
'com.apple.developer.icloud-container-identifiers',
'com.apple.developer.icloud-services',
'com.apple.developer.in-app-payments',
'com.apple.developer.networking.vpn.api',
'com.apple.developer.ubiquity-container-identifiers',
'com.apple.developer.ubiquity-kvstore-identifier',
'com.apple.external-accessory.wireless-configuration',
'com.apple.security.application-groups',
'inter-app-audio',
'keychain-access-groups',
];
const blacklistedEntitlementKeysWithoutICloud = [
'com.apple.developer.icloud-container-environment',
'com.apple.developer.icloud-container-identifiers',
'com.apple.developer.icloud-services',
'com.apple.developer.ubiquity-container-identifiers',
'com.apple.developer.ubiquity-kvstore-identifier',
];
const blacklistedEntitlementKeys = [
'com.apple.developer.icloud-container-development-container-identifiers',
'com.apple.developer.restricted-resource-mode',
'inter-app-audio',
'com.apple.developer.homekit',
'com.apple.developer.healthkit',
'com.apple.developer.in-app-payments',
'com.apple.developer.maps',
'com.apple.external-accessory.wireless-configuration',
];
const icloudContainerEnvKey = 'com.apple.developer.icloud-container-environment';
async function createEntitlementsFile({
generatedEntitlementsPath,
plistData,
archivePath,
manifest,
}) {
const decodedProvisioningProfileEntitlements = plistData.Entitlements;
const entitlementsPaths = globSync('Products/Applications/*.app/*.entitlements', {
absolute: true,
cwd: archivePath,
});
if (entitlementsPaths.length === 0) {
throw new Error("Didn't find any generated entitlements file in archive.");
} else if (entitlementsPaths.length !== 1) {
throw new Error('Found more than one entitlements file.');
}
const archiveEntitlementsPath = entitlementsPaths[0];
const archiveEntitlementsRaw = await fs.readFile(archiveEntitlementsPath, 'utf8');
let archiveEntitlementsData;
try {
archiveEntitlementsData = plist.parse(archiveEntitlementsRaw);
} catch (error) {
throw new Error(`Error when parsing plist: ${error.message}`);
}
const entitlements = { ...decodedProvisioningProfileEntitlements };
entitlementTransferRules.forEach(rule => {
if (rule in archiveEntitlementsData) {
entitlements[rule] = archiveEntitlementsData[rule];
}
});
let generatedEntitlements = omit(entitlements, blacklistedEntitlementKeys);
if (!manifest.ios.usesIcloudStorage) {
generatedEntitlements = omit(generatedEntitlements, blacklistedEntitlementKeysWithoutICloud);
} else {
const ubiquityKvKey = 'com.apple.developer.ubiquity-kvstore-identifier';
if (generatedEntitlements[ubiquityKvKey]) {
const teamId = generatedEntitlements[ubiquityKvKey].split('.')[0];
generatedEntitlements[ubiquityKvKey] = `${teamId}.${manifest.ios.bundleIdentifier}`;
}
generatedEntitlements['com.apple.developer.icloud-services'] = ['CloudDocuments'];
}
if (!manifest.ios.associatedDomains) {
generatedEntitlements = omit(generatedEntitlements, 'com.apple.developer.associated-domains');
}
if (!manifest.ios.usesAppleSignIn) {
generatedEntitlements = omit(generatedEntitlements, 'com.apple.developer.applesignin');
}
if (generatedEntitlements[icloudContainerEnvKey]) {
const envs = generatedEntitlements[icloudContainerEnvKey].filter(i => i === 'Production');
generatedEntitlements[icloudContainerEnvKey] = envs;
}
const generatedEntitlementsPlistData = plist.build(generatedEntitlements);
await fs.writeFile(generatedEntitlementsPath, generatedEntitlementsPlistData, {
mode: 0o755,
});
const { output } = await spawnAsyncThrowError(
'/usr/libexec/PlistBuddy',
['-x', '-c', 'Print', generatedEntitlementsPath],
{
stdio: 'pipe',
}
);
const plistDataReformatted = output.join('');
await fs.writeFile(generatedEntitlementsPath, plistDataReformatted, {
mode: 0o755,
});
}
async function resignIPA(
{
codeSignIdentity,
entitlementsPath,
provisioningProfilePath,
sourceIpaPath,
destIpaPath,
keychainPath,
},
credentials
) {
await spawnAsyncThrowError('cp', ['-rf', sourceIpaPath, destIpaPath]);
await runFastlane(
credentials,
[
'sigh',
'resign',
'--verbose',
'--entitlements',
entitlementsPath,
'--signing_identity',
codeSignIdentity,
'--keychain_path',
keychainPath,
'--provisioning_profile',
provisioningProfilePath,
destIpaPath,
],
{ buildPhase: 'building and signing IPA' }
);
}
async function runFastlane({ teamID }, fastlaneArgs, loggerFields) {
const fastlaneEnvVars = {
FASTLANE_SKIP_UPDATE_CHECK: 1,
FASTLANE_DISABLE_COLORS: 1,
FASTLANE_TEAM_ID: teamID,
CI: 1,
LC_ALL: 'en_US.UTF-8',
};
await spawnAsyncThrowError('fastlane', fastlaneArgs, {
env: {
...process.env,
...fastlaneEnvVars,
},
pipeToLogger: true,
dontShowStdout: false,
loggerFields,
});
}
export {
ensureCertificateValid,
findP12CertSerialNumber,
validateProvisioningProfile,
writeExportOptionsPlistFile,
buildIPA,
resolveExportMethod,
createEntitlementsFile,
resignIPA,
};
Loaded 100 of 127 files, more files were not shown because too many files have changed in this diff. Show more