mirror of
https://github.com/expo/turtle.git
synced 2026-11-14 19:12:55 -10:00
Compare commits
302
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12d2c04211 | ||
|
|
38abc1b915 | ||
|
|
6f6aec53bb | ||
|
|
c126e9d5cf | ||
|
|
fd8e110f38 | ||
|
|
91545a2726 | ||
|
|
18f58cfc87 | ||
|
|
5db06fa07b | ||
|
|
4faf23de16 | ||
|
|
f432a14d2f | ||
|
|
e957ea0b13 | ||
|
|
259dc4827c | ||
|
|
aaea6f80c0 | ||
|
|
2ce4f9f923 | ||
|
|
9cd489a297 | ||
|
|
06f10977aa | ||
|
|
9ba1302bfa | ||
|
|
a166a789fa | ||
|
|
377a8fbcf9 | ||
|
|
e3d685e416 | ||
|
|
2ac41fa82d | ||
|
|
32683d082b | ||
|
|
d629cd439b | ||
|
|
293e49fd00 | ||
|
|
5563d16bda | ||
|
|
6c5209e88f | ||
|
|
54c73dba8e | ||
|
|
81892b8c22 | ||
|
|
cfd704d4b6 | ||
|
|
dd79348228 | ||
|
|
c0eaa0de4f | ||
|
|
fa8576a36b | ||
|
|
ac25927326 | ||
|
|
2a23a4c97f | ||
|
|
42ed532f00 | ||
|
|
68f9d4c7d1 | ||
|
|
c5e0206d29 | ||
|
|
a8ddba34ac | ||
|
|
65f2f9fc67 | ||
|
|
5138ab57e8 | ||
|
|
5f066d14ee | ||
|
|
b307604177 | ||
|
|
6bdcd744df | ||
|
|
9447341b84 | ||
|
|
817653f01d | ||
|
|
eb0f2f5918 | ||
|
|
ba4b53b41a | ||
|
|
ba7b4a1968 | ||
|
|
3cb449f7ff | ||
|
|
b6ba977746 | ||
|
|
1155e26727 | ||
|
|
75ead4d6a1 | ||
|
|
7d5b092adc | ||
|
|
b644f15e43 | ||
|
|
18631f6482 | ||
|
|
85e2408f0c | ||
|
|
e9897054f3 | ||
|
|
6ae5eb1ab2 | ||
|
|
a32799a584 | ||
|
|
6f86b4ac57 | ||
|
|
9f07dbedb5 | ||
|
|
3e579ceeba | ||
|
|
a2913c28bf | ||
|
|
a0f9810320 | ||
|
|
74a3739b6e | ||
|
|
2c36c89ed4 | ||
|
|
099afed72c | ||
|
|
36d1d75544 | ||
|
|
70eca74b9c | ||
|
|
01137526c4 | ||
|
|
4972744a87 | ||
|
|
cbd11f2f4e | ||
|
|
fdd76085c1 | ||
|
|
daedefbca8 | ||
|
|
e7da1a0193 | ||
|
|
85cc6d1b9f | ||
|
|
07679dfbdc | ||
|
|
070485dd09 | ||
|
|
bf3e1feac9 | ||
|
|
fcba536698 | ||
|
|
e77f05ea1d | ||
|
|
819be0056c | ||
|
|
0a3faaf975 | ||
|
|
c38b1b4089 | ||
|
|
5c5de300a6 | ||
|
|
6efa267a1f | ||
|
|
81b7d8d911 | ||
|
|
95a48861e0 | ||
|
|
2bb14a67b6 | ||
|
|
5a1f48335f | ||
|
|
2dd89d2c08 | ||
|
|
5f9d98b1dc | ||
|
|
02833e211d | ||
|
|
ba4f2cc05a | ||
|
|
7f9b7a17d4 | ||
|
|
821e648d67 | ||
|
|
54a6e1910c | ||
|
|
688f970a1a | ||
|
|
9c666d90b4 | ||
|
|
4f351a047f | ||
|
|
7caa13bdda | ||
|
|
1f266f7b72 | ||
|
|
edfa2dbb94 | ||
|
|
1d5075d898 | ||
|
|
64147f0cf7 | ||
|
|
688a961513 | ||
|
|
19ed88150a | ||
|
|
e988fb282e | ||
|
|
16103cebf9 | ||
|
|
be14dca375 | ||
|
|
bf24c86399 | ||
|
|
7fb1e57a40 | ||
|
|
d6fcc6d881 | ||
|
|
525ddf6f04 | ||
|
|
f0416d131d | ||
|
|
2fdeea268c | ||
|
|
a11ed9198c | ||
|
|
2da016e4ce | ||
|
|
8278520474 | ||
|
|
6ab9d99d7c | ||
|
|
c8ad765d5d | ||
|
|
1834f323ce | ||
|
|
8e261a8827 | ||
|
|
d0033c2df1 | ||
|
|
63b7879608 | ||
|
|
cf57eceb6e | ||
|
|
5058cbe8e5 | ||
|
|
4804a3453c | ||
|
|
1d773f35cf | ||
|
|
3daa678540 | ||
|
|
616331b47b | ||
|
|
0b9ab78453 | ||
|
|
3e345ddaf8 | ||
|
|
4866c06a02 | ||
|
|
c36723d96c | ||
|
|
28b0266ba2 | ||
|
|
84a19ee261 | ||
|
|
8f3be65326 | ||
|
|
5d539a1bb2 | ||
|
|
833c9c1de5 | ||
|
|
ce74ab3161 | ||
|
|
62df247645 | ||
|
|
9bc4d75e9b | ||
|
|
b4d4b8a6c3 | ||
|
|
88d75c7581 | ||
|
|
03be505cd0 | ||
|
|
05568676ee | ||
|
|
903e44bd29 | ||
|
|
7697542b44 | ||
|
|
3baf4bcade | ||
|
|
c7e98c5858 | ||
|
|
fc48d27e42 | ||
|
|
fdc702f273 | ||
|
|
9fda74dfa4 | ||
|
|
6bab5f71ef | ||
|
|
3f1e9ce910 | ||
|
|
8fb54f3f27 | ||
|
|
069ef7e1c9 | ||
|
|
c0a742fa21 | ||
|
|
fca72875dc | ||
|
|
15ed26d4cd | ||
|
|
4c7af801f1 | ||
|
|
5012ec669d | ||
|
|
8b77a48b82 | ||
|
|
c6946eca25 | ||
|
|
9627ecb80c | ||
|
|
48c78f386a | ||
|
|
0dc251e023 | ||
|
|
d984061134 | ||
|
|
ff6401ba6b | ||
|
|
b443760699 | ||
|
|
0f0e86d17f | ||
|
|
f6697c0029 | ||
|
|
22f802164d | ||
|
|
aaa6e61061 | ||
|
|
e532e0270c | ||
|
|
bc0718ca7d | ||
|
|
bf63dcea70 | ||
|
|
9551c8773d | ||
|
|
470ff609fd | ||
|
|
addba74b9d | ||
|
|
b63e9e3f34 | ||
|
|
25aaa849f1 | ||
|
|
edc712d820 | ||
|
|
23c3e3509c | ||
|
|
406a3be4f1 | ||
|
|
dd60721270 | ||
|
|
469ead8df8 | ||
|
|
aa0ce81e98 | ||
|
|
dccccb7716 | ||
|
|
57f8404b6d | ||
|
|
ba7309bc4b | ||
|
|
4aec3d5ba7 | ||
|
|
d2eb447ebc | ||
|
|
f177cf4d7f | ||
|
|
59a181dee0 | ||
|
|
f4bf860a9a | ||
|
|
932958ad46 | ||
|
|
2a54b4578a | ||
|
|
7e234d09a3 | ||
|
|
5b22c351bf | ||
|
|
e2020f1ab4 | ||
|
|
c935e53e50 | ||
|
|
14e681f35f | ||
|
|
d3a7ccb582 | ||
|
|
62478de14a | ||
|
|
6594089779 | ||
|
|
11c5d3ee02 | ||
|
|
99b7ac6660 | ||
|
|
46fe34ed9c | ||
|
|
423fc8bbf5 | ||
|
|
4c8408a46b | ||
|
|
032d7c8b1f | ||
|
|
b2a0b3ce14 | ||
|
|
1ee922763e | ||
|
|
c31cd379c1 | ||
|
|
67754eba2a | ||
|
|
351fed00df | ||
|
|
487032b11d | ||
|
|
042dd2ccab | ||
|
|
99ae0d1cea | ||
|
|
ad2c87163b | ||
|
|
b4b9cf362e | ||
|
|
7ea4dac986 | ||
|
|
cd8da71711 | ||
|
|
2a2a0f39e0 | ||
|
|
fbabcdf521 | ||
|
|
0803811226 | ||
|
|
0976a642e1 | ||
|
|
16bd4fe7b6 | ||
|
|
3ccd705943 | ||
|
|
11cc4421dd | ||
|
|
32f5a0bb37 | ||
|
|
61a1906e01 | ||
|
|
19a17231b3 | ||
|
|
98c03bc8a2 | ||
|
|
83ab2539c1 | ||
|
|
064619e1ae | ||
|
|
b7fe01b758 | ||
|
|
6583b1a1db | ||
|
|
f24081cb91 | ||
|
|
4e719a200b | ||
|
|
0b13494402 | ||
|
|
0ca26a40aa | ||
|
|
f171913bac | ||
|
|
b47ee91117 | ||
|
|
77cb28ce66 | ||
|
|
7a2453cf53 | ||
|
|
924908905f | ||
|
|
798b4acca6 | ||
|
|
2303b44dd2 | ||
|
|
c204e0bef2 | ||
|
|
0918d8299e | ||
|
|
3543acfb26 | ||
|
|
42b6ff634c | ||
|
|
fcd42b272f | ||
|
|
ecaef3a91d | ||
|
|
413e6a564d | ||
|
|
ac27332151 | ||
|
|
72744f58ec | ||
|
|
96af4f753d | ||
|
|
4059c6f354 | ||
|
|
b48f89054b | ||
|
|
7361f4af52 | ||
|
|
41b48f0c66 | ||
|
|
56b3011d25 | ||
|
|
ef6f9e3c5d | ||
|
|
0302a5f71b | ||
|
|
abb604b3b5 | ||
|
|
f87dcc6972 | ||
|
|
fb27531805 | ||
|
|
b307e0ed7f | ||
|
|
9bfa7c5674 | ||
|
|
0fcade4a1f | ||
|
|
df4b38711a | ||
|
|
a2b5aa2934 | ||
|
|
556e0758e7 | ||
|
|
762c6f0538 | ||
|
|
f549695e07 | ||
|
|
1e8868e190 | ||
|
|
93df019bbc | ||
|
|
5541daa6ec | ||
|
|
22d78bf6fc | ||
|
|
4c724289d7 | ||
|
|
c5a44dfb67 | ||
|
|
8bbdc55932 | ||
|
|
80233c5736 | ||
|
|
5a2b8c47f4 | ||
|
|
ab9391d672 | ||
|
|
e95a6f49ff | ||
|
|
d662cd47b6 | ||
|
|
ce5de0963b | ||
|
|
8f717c6c2e | ||
|
|
905b55b7a4 | ||
|
|
4588281ffa | ||
|
|
bc13f12052 | ||
|
|
63d3e82cd7 | ||
|
|
b2f8fdd342 | ||
|
|
4d9b3bdee9 | ||
|
|
15c165be26 | ||
|
|
f63e34ace3 | ||
|
|
e4ec82d1db |
No files matched your search
+69
-19
@@ -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:
|
||||
@@ -255,8 +307,6 @@ workflows:
|
||||
tests:
|
||||
jobs:
|
||||
- unit_tests
|
||||
- ios_smoke_tests
|
||||
- android_smoke_tests
|
||||
deploy:
|
||||
jobs:
|
||||
- android_staging_approve_deploy:
|
||||
|
||||
@@ -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,10 +1,9 @@
|
||||
---
|
||||
name: "\U0001F41B Bug Report"
|
||||
about: You want to report a reproducible bug or regression in turtle-cli.
|
||||
title: ''
|
||||
labels: 'bug'
|
||||
assignees: ''
|
||||
|
||||
title: ""
|
||||
labels: "bug"
|
||||
assignees: ""
|
||||
---
|
||||
|
||||
<!-- Thanks for helping expo! Before you submit your issue, please make sure you followed our checklist and check the appropriate boxes by putting an x in the [ ]: [x] -->
|
||||
@@ -13,14 +12,16 @@ assignees: ''
|
||||
|
||||
- [ ] Updated turtle-cli to the latest version (`yarn global add turtle-cli` or `npm install --global turtle-cli`).
|
||||
- [ ] I read the [Contribution Guidelines](https://github.com/expo/turtle/blob/master/CONTRIBUTING.md).
|
||||
- [ ] I read [docs.expo.io](https://docs.expo.io) (Managed Workflow > Distributing Your App).
|
||||
- [ ] I read [docs.expo.dev](https://docs.expo.dev) (Managed Workflow > Distributing Your App).
|
||||
- [ ] I searched for [existing GitHub issues](https://github.com/expo/turtle/issues).
|
||||
- [ ] **I enclosed the complete output when running turtle, including the stack trace and command used.**
|
||||
|
||||
### Issue Description
|
||||
|
||||
<!-- Please include what's happening, expected behavior, and any relevant code samples -->
|
||||
|
||||
##### Command executed
|
||||
|
||||
<!-- The command you executed on the command line that resulted in an error -->
|
||||
|
||||
##### Complete output when running turtle, including the stack trace and command used
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
---
|
||||
name: "\U00002753 Questions and discussions"
|
||||
about: You have a question about turtle-cli or want to discuss some aspects of turtle-cli.
|
||||
title: ''
|
||||
labels: 'question'
|
||||
assignees: ''
|
||||
|
||||
title: ""
|
||||
labels: "question"
|
||||
assignees: ""
|
||||
---
|
||||
|
||||
### Question Checklist
|
||||
|
||||
- [ ] I read the [Contribution Guidelines](https://github.com/expo/turtle/blob/master/CONTRIBUTING.md).
|
||||
- [ ] I read [docs.expo.io](https://docs.expo.io) (Managed Workflow > Distributing Your App).
|
||||
- [ ] I read [docs.expo.dev](https://docs.expo.dev) (Managed Workflow > Distributing Your App).
|
||||
- [ ] I searched for [existing GitHub issues](https://github.com/expo/turtle/issues).
|
||||
|
||||
### Question Subject
|
||||
|
||||
<!-- What command do you have a question about? -->
|
||||
<!-- Is this a question about documentation? -->
|
||||
|
||||
#### Question Description
|
||||
|
||||
<!-- Please include expected behavior and any relevant code samples with your question if possible -->
|
||||
@@ -2,9 +2,11 @@ node_modules
|
||||
yarn-error.log
|
||||
google-cloud-credentials.json
|
||||
|
||||
/build/
|
||||
/workingdir/*
|
||||
/artifacts/*
|
||||
.history
|
||||
.vscode/
|
||||
|
||||
shell.apk
|
||||
.secrets*
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
"release": true
|
||||
},
|
||||
"hooks": {
|
||||
"before:init": [
|
||||
"yarn"
|
||||
],
|
||||
"after:release": "yarn release:update:turtle-cli-example"
|
||||
}
|
||||
}
|
||||
+396
@@ -7,11 +7,401 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## Unreleased
|
||||
|
||||
- Swap out Cloudfront CDN for `classic-assets.eascdn.net`. [#375](https://github.com/expo/turtle/pull/375)
|
||||
|
||||
# [0.24.3] - 2021-12-29
|
||||
|
||||
- Update ios sdk 44 shell tarball with [orientation lock fix](https://github.com/expo/expo/pull/15715)
|
||||
|
||||
# [0.24.2] - 2021-12-16
|
||||
|
||||
- Update Android shell tarball for SDK 44.
|
||||
|
||||
# [0.24.1] - 2021-12-15
|
||||
|
||||
- Update iOS and Android tarballs for SDK 44 RC. [#369](https://github.com/expo/turtle/pull/369).
|
||||
|
||||
# [0.24.0] - 2021-12-10
|
||||
|
||||
- Update iOS and Android tarballs for SDK 44 beta.
|
||||
- Add detection for Expo modules using `expo-module.config.json`, the successor to `unimodule.json`. [#368](https://github.com/expo/turtle/pull/368).
|
||||
- Redirect google bintray url to localhost. [#361](https://github.com/expo/turtle/pull/361)
|
||||
|
||||
# [0.23.6] - 2021-12-08
|
||||
|
||||
- Update android shell tarballs for bintray error fix. [#363](https://github.com/expo/turtle/pull/363)
|
||||
- Update AWS SDK. [#365](https://github.com/expo/turtle/pull/365)
|
||||
|
||||
# [0.23.5] - 2021-11-12
|
||||
|
||||
- Update iOS SDK 43 tarball with expo-updates fix for [#14967](https://github.com/expo/expo/issues/14967)
|
||||
|
||||
# [0.23.4] - 2021-11-09
|
||||
|
||||
- Update Android SDK 43 tarball with expo-updates fix for [#15112](https://github.com/expo/expo/issues/15112)
|
||||
|
||||
# [0.23.3] - 2021-11-04
|
||||
|
||||
- Update iOS and Android SDK 43 tarballs with expo-updates fixes for [#14930](https://github.com/expo/expo/issues/14930)
|
||||
|
||||
# [0.23.2] - 2021-10-29
|
||||
|
||||
- Update Android SDK 43 shell app with proguard fix
|
||||
|
||||
# [0.23.1] - 2021-10-20
|
||||
|
||||
- Add iOS and Android tarballs for SDK 43
|
||||
|
||||
# [0.23.0] - 2021-10-07
|
||||
|
||||
- Add iOS and Android beta tarballs for SDK 43
|
||||
- Bump xdl to fix Android shell app for SDK 43
|
||||
|
||||
# [0.22.6] - 2021-10-01
|
||||
|
||||
- add `ACCESS_MEDIA_LOCATION` to blacklist for android permissions
|
||||
- disable automatic versioning in Xcode 13
|
||||
|
||||
# [0.22.5] - 2021-09-09
|
||||
|
||||
- Fix s3 logger stream close crash.
|
||||
- Update Android tarballs SDK 42, 41, 40, and 39 to include location workaround.
|
||||
- Update Android tarball to include a local assets fix on SDK 42.
|
||||
|
||||
# [0.22.4] - 2021-07-27
|
||||
|
||||
- Update iOS and Android tarballs for SDK 42.
|
||||
|
||||
# [0.22.3] - 2021-07-02
|
||||
|
||||
- Update Android tarball for SDK 42.
|
||||
|
||||
# [0.22.1] - 2021-06-29
|
||||
|
||||
- Update iOS and Android beta tarballs for SDK 42.
|
||||
|
||||
# [0.22.0] - 2021-06-22
|
||||
|
||||
- Add iOS and Android beta tarballs for SDK 42.
|
||||
|
||||
# [0.21.9] - 2021-06-15
|
||||
|
||||
- Update `sharp` package, fixes support for M1 macs.
|
||||
|
||||
# [0.21.8] - 2021-05-25
|
||||
|
||||
- Update Android SDK41 tarball.
|
||||
|
||||
# [0.21.7] - 2021-05-21
|
||||
|
||||
- Update iOS SDK41 tarball.
|
||||
- Update Android SDK41 tarball.
|
||||
|
||||
# [0.21.6] - 2021-04-22
|
||||
|
||||
- Update iOS SDK41 tarball.
|
||||
- Update Android SDK41 tarball.
|
||||
|
||||
# [0.21.5] - 2021-04-15
|
||||
|
||||
- Revert iOS client tarball for SDK 41, use the SDK 40 tarball. No longer supporting this feature in SDK 41+.
|
||||
- Update Android SDK 41 tarball.
|
||||
|
||||
# [0.21.4] - 2021-04-13
|
||||
|
||||
- Update iOS client tarball for SDK 41.
|
||||
|
||||
# [0.21.3] - 2021-04-13
|
||||
|
||||
- Update SDK 41 tarball for iOS and Android.
|
||||
|
||||
# [0.21.2] - 2021-04-07
|
||||
|
||||
- Update SDK 41 beta tarball for Android.
|
||||
|
||||
# [0.21.1] - 2021-04-01
|
||||
|
||||
- Update SDK 41 beta tarball for iOS.
|
||||
|
||||
# [0.21.0] - 2021-03-29
|
||||
|
||||
- Add SDK 41 beta tarballs.
|
||||
- Bump @expo/xdl to 59.1.0.
|
||||
|
||||
# [0.20.7] - 2021-01-26
|
||||
|
||||
- Remove Go suffix from android app name
|
||||
|
||||
# [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 +412,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
@@ -4,4 +4,4 @@ The Expo team is committed to fostering an open and welcoming environment.
|
||||
|
||||
**Our Community Guidelines can be found here:**
|
||||
|
||||
https://expo.io/guidelines
|
||||
https://expo.dev/guidelines
|
||||
+9
-2
@@ -1,30 +1,37 @@
|
||||
# Contributing to Turtle CLI
|
||||
|
||||
## How to contribute
|
||||
|
||||
You can contribute to Turtle CLI in various ways, including:
|
||||
|
||||
- [Reporting bugs or issues](https://github.com/expo/turtle/issues/new) on GitHub. Please make sure to fill in all the details suggested by the template to make sure the issue can be addressed as quickly as possible.
|
||||
- [Submitting improvements to the documentation](https://github.com/expo/expo/tree/master/docs). Updates, enhancements, new guides, spelling fixes…
|
||||
- Helping other people on [Expo Forums](https://forums.expo.io/) and on [Expo Developers Slack](http://slack.expo.io).
|
||||
- Helping other people on [Expo Forums](https://forums.expo.dev/) and on [Expo Developers Discord](http://chat.expo.dev).
|
||||
- Looking at existing [issues](https://github.com/expo/turtle/issues) and adding more information, particularly helping to reproduce the issues.
|
||||
- [Submitting a pull request](#submitting-a-pull-request) with a bug fix or an improvement.
|
||||
|
||||
## Turtle CLI repository
|
||||
|
||||
### Codebase
|
||||
|
||||
This repository contains the codebase for the `turtle-cli` NPM package. The same codebase is used to run standalone app builders on the Expo servers.
|
||||
|
||||
### Branches
|
||||
|
||||
The `master` branch of the repository should be kept releasable at any time. This way we can continuously release fixes and improvements without costly managing of different branches and issues will be noticed and fixed quickly. This also ensures other contributors can check out the latest version from GitHub and work on it with minimal disruption from other features in progress.
|
||||
|
||||
## Submitting a pull request
|
||||
|
||||
To submit a pull request:
|
||||
|
||||
1. Fork the [repository](https://github.com/expo/turtle) and create a feature branch. (Existing contributors can create feature branches without forking. Prefix the branch name with `@your-github-username/`.)
|
||||
2. Write the description of your pull request. Make sure to include a test plan and test your changes.
|
||||
3. Make sure all tests pass on CircleCI.
|
||||
4. Wait for a review and adjust the code if necessary.
|
||||
|
||||
## Publishing a release
|
||||
|
||||
- Make sure you have set `GITHUB_TOKEN` and `CIRCLE_API_USER_TOKEN` environment variables in `.envrc.local` file. If you don't have the file, run `cp .envrc.local.example .envrc.local` and edit the file.
|
||||
- To release a new version of `turtle-cli`, run `yarn release` command.
|
||||
- If you wish to release a new *beta* version of `turtle-cli`, run `yarn release:beta` instead.
|
||||
- If you wish to release a new _beta_ version of `turtle-cli`, run `yarn release:beta` instead.
|
||||
- Update the [changelog](CHANGELOG.md).
|
||||
+1
-1
@@ -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
|
||||
|
||||
+18
-18
@@ -1,29 +1,29 @@
|
||||
# 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.6.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 package.json copy_package.json && \
|
||||
jq '.workspaces.packages = ["packages/expo", "packages/expo-modules-autolinking"]' copy_package.json > package.json && \
|
||||
rm -f copy_package.json && \
|
||||
# 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 ; \
|
||||
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"]
|
||||
@@ -6,8 +6,8 @@
|
||||
[](https://npmjs.com/package/turtle-cli)
|
||||
[](https://github.com/expo/turtle/blob/master/LICENSE)
|
||||
|
||||
[](http://slack.expo.io)
|
||||
[](https://forums.expo.io/)
|
||||
[](http://chat.expo.dev)
|
||||
[](https://forums.expo.dev/)
|
||||
|
||||
<hr />
|
||||
|
||||
@@ -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.dev/distribution/turtle-cli/)
|
||||
|
||||
## Usage example
|
||||
|
||||
@@ -29,13 +29,13 @@ See the [expo/turtle-cli-example](https://github.com/expo/turtle-cli-example) re
|
||||
|
||||
## Do you need help?
|
||||
|
||||
- Make sure you've read [the Expo Docs](https://docs.expo.io/), especially [Building Standalone Apps on Your CI
|
||||
](https://docs.expo.io/versions/latest/distribution/turtle-cli) and [Building Standalone Apps](https://docs.expo.io/versions/latest/distribution/building-standalone-apps) guides.
|
||||
- Make sure you've read [the Expo Docs](https://docs.expo.dev/), especially [Building Standalone Apps on Your CI
|
||||
](https://docs.expo.dev/versions/latest/distribution/turtle-cli) and [Building Standalone Apps](https://docs.expo.dev/versions/latest/distribution/building-standalone-apps) guides.
|
||||
- Search for existing GitHub issues [in this repository](https://github.com/expo/turtle/issues) and in [expo/expo](https://github.com/expo/expo/issues) repository.
|
||||
- Ask for help in **one** of the following ways:
|
||||
* create [a GitHub issue](https://github.com/expo/turtle/issues/new).
|
||||
* create a new topic on [Expo Forums](https://forums.expo.io/).
|
||||
* ask a question on [Expo Developers Slack](http://slack.expo.io).
|
||||
- create [a GitHub issue](https://github.com/expo/turtle/issues/new).
|
||||
- create a new topic on the [Expo Forums](https://forums.expo.dev/).
|
||||
- connect with the community on the [Expo Developers Discord](http://chat.expo.dev).
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const nock_1 = __importDefault(require("nock"));
|
||||
const config_1 = __importDefault(require("../config"));
|
||||
const constants_1 = require("../constants");
|
||||
const jobManager = __importStar(require("../jobManager"));
|
||||
const logger_1 = __importDefault(require("../logger"));
|
||||
jest.mock('../builders/utils/uploader.ts', () => ({
|
||||
uploadBuildToS3: jest.fn(() => {
|
||||
logger_1.default.debug('Faking uploading build');
|
||||
return 'legit_path';
|
||||
}),
|
||||
}));
|
||||
async function performSmokeTest(recording) {
|
||||
jest.setTimeout(60 * 60 * 1000);
|
||||
// @ts-ignore
|
||||
const fixtureExists = await fs_extra_1.default.exists(recording);
|
||||
if (fixtureExists) {
|
||||
logger_1.default.info('Fixture exists, test will use existing one.');
|
||||
nock_1.default.load(recording);
|
||||
mockLogs();
|
||||
mockSQS();
|
||||
logger_1.default.info('Loading fixture');
|
||||
}
|
||||
else {
|
||||
nock_1.default.recorder.rec({
|
||||
dont_print: true,
|
||||
output_objects: true,
|
||||
enable_reqheaders_recording: false,
|
||||
});
|
||||
}
|
||||
await jobManager.doJob();
|
||||
if (!fixtureExists) {
|
||||
await fs_extra_1.default.writeFile(recording, JSON.stringify(nock_1.default.recorder.play()));
|
||||
}
|
||||
}
|
||||
function mockLogs() {
|
||||
/*
|
||||
Match log push messages. Seperate matcher, because it needs `persist` option
|
||||
due to fact that it's being called variable amount times.
|
||||
*/
|
||||
return nock_1.default('https://exp-shell-app-assets.s3.us-west-1.amazonaws.com')
|
||||
.persist()
|
||||
.put((uri) => {
|
||||
return uri.indexOf('/logs') >= 0;
|
||||
})
|
||||
.reply(200);
|
||||
}
|
||||
function mockSQS() {
|
||||
return nock_1.default('https://sqs.us-west-2.amazonaws.com')
|
||||
.persist()
|
||||
.post(() => true)
|
||||
.reply(200);
|
||||
}
|
||||
function mockFinish() {
|
||||
// A separate matcher for the final request to ensure build was completed successfully
|
||||
return nock_1.default('https://sqs.us-west-2.amazonaws.com:443')
|
||||
.post('/', (body) => {
|
||||
const keys = Object.keys(body);
|
||||
if (keys.includes('MessageBody')) {
|
||||
const mb = JSON.parse(body.MessageBody);
|
||||
if (mb.status === 'finished') {
|
||||
return true;
|
||||
}
|
||||
else if (mb.status === 'errored') {
|
||||
fail('Build ended with error');
|
||||
}
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.reply(200);
|
||||
}
|
||||
async function testPlatform(platform) {
|
||||
process.env.PLATFORM = platform;
|
||||
const utils = require('turtle/aws/utils');
|
||||
utils.QUEUE_URL = jest.fn((priority) => {
|
||||
return config_1.default.sqs.queues[priority][platform];
|
||||
});
|
||||
nock_1.default.cleanAll();
|
||||
nock_1.default.enableNetConnect();
|
||||
const finishMock = mockFinish();
|
||||
const fixtureLocation = `src/__smoke__/fixtures/${platform}/recording.json`;
|
||||
await performSmokeTest(fixtureLocation);
|
||||
expect(finishMock.isDone());
|
||||
nock_1.default.disableNetConnect();
|
||||
}
|
||||
test('Android builds', async () => {
|
||||
await testPlatform(constants_1.PLATFORMS.ANDROID);
|
||||
});
|
||||
test('iOS builds', async () => {
|
||||
await testPlatform(constants_1.PLATFORMS.IOS);
|
||||
});
|
||||
//# sourceMappingURL=smoke.test.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"smoke.test.js","sourceRoot":"","sources":["../../src/__smoke__/smoke.test.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wDAA0B;AAE1B,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C;IAEH,cAAI,CAAC,QAAQ,EAAE,CAAC;IAChB,cAAI,CAAC,gBAAgB,EAAE,CAAC;IAExB,MAAM,UAAU,GAAG,UAAU,EAAE,CAAC;IAChC,MAAM,eAAe,GAAG,0BAA0B,QAAQ,iBAAiB,CAAC;IAC5E,MAAM,gBAAgB,CAAC,eAAe,CAAC,CAAC;IACxC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5B,cAAI,CAAC,iBAAiB,EAAE,CAAC;AAC3B,CAAC;AAED,IAAI,CAAC,gBAAgB,EAAE,KAAK,IAAI,EAAE;IAChC,MAAM,YAAY,CAAC,qBAAS,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE;IAC5B,MAAM,YAAY,CAAC,qBAAS,CAAC,GAAG,CAAC,CAAC;AACpC,CAAC,CAAC,CAAC","sourcesContent":["import fs from 'fs-extra';\n\nimport nock from 'nock';\n\nimport config from 'turtle/config';\nimport { PLATFORMS } from 'turtle/constants';\nimport * as jobManager from 'turtle/jobManager';\nimport logger from 'turtle/logger';\n\njest.mock('../builders/utils/uploader.ts', () => ({\n uploadBuildToS3: jest.fn(() => {\n logger.debug('Faking uploading build');\n return 'legit_path';\n }),\n}));\n\nasync function performSmokeTest(recording: string) {\n jest.setTimeout(60 * 60 * 1000);\n\n // @ts-ignore\n const fixtureExists = await fs.exists(recording);\n if (fixtureExists) {\n logger.info('Fixture exists, test will use existing one.');\n\n nock.load(recording);\n mockLogs();\n mockSQS();\n logger.info('Loading fixture');\n } else {\n nock.recorder.rec({\n dont_print: true,\n output_objects: true,\n enable_reqheaders_recording: false,\n });\n }\n\n await jobManager.doJob();\n if (!fixtureExists) {\n await fs.writeFile(recording, JSON.stringify(nock.recorder.play()));\n }\n}\n\nfunction mockLogs() {\n /*\n Match log push messages. Seperate matcher, because it needs `persist` option\n due to fact that it's being called variable amount times.\n */\n return nock('https://exp-shell-app-assets.s3.us-west-1.amazonaws.com')\n .persist()\n .put((uri: string) => {\n return uri.indexOf('/logs') >= 0;\n })\n .reply(200);\n}\n\nfunction mockSQS() {\n return nock('https://sqs.us-west-2.amazonaws.com')\n .persist()\n .post(() => true)\n .reply(200);\n}\n\nfunction mockFinish() {\n // A separate matcher for the final request to ensure build was completed successfully\n\n return nock('https://sqs.us-west-2.amazonaws.com:443')\n .post('/', (body: any) => {\n const keys = Object.keys(body);\n if (keys.includes('MessageBody')) {\n const mb = JSON.parse(body.MessageBody);\n if (mb.status === 'finished') {\n return true;\n } else if (mb.status === 'errored') {\n fail('Build ended with error');\n }\n }\n return false;\n })\n .reply(200);\n}\n\nasync function testPlatform(platform: string) {\n process.env.PLATFORM = platform;\n\n const utils = require('turtle/aws/Line truncated
|
||||
@@ -1,14 +0,0 @@
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const context = __importStar(require("../turtleContext"));
|
||||
test('Initially should not exit', () => {
|
||||
expect(context.checkShouldExit()).toBe(false);
|
||||
});
|
||||
//# sourceMappingURL=turtleContext.test.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"turtleContext.test.js","sourceRoot":"","sources":["../../src/__tests__/turtleContext.test.ts"],"names":[],"mappings":";;;;;;;;;AAAA,0DAAgD;AAEhD,IAAI,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACrC,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC,CAAC,CAAC","sourcesContent":["import * as context from 'turtle/turtleContext';\n\ntest('Initially should not exit', () => {\n expect(context.checkShouldExit()).toBe(false);\n});\n"]}
|
||||
@@ -1,21 +0,0 @@
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const validator = __importStar(require("../validator"));
|
||||
const testValidator = (fixturePath) => {
|
||||
const data = require(fixturePath);
|
||||
expect(() => validator.sanitizeJob(data)).not.toThrow();
|
||||
};
|
||||
test('Passes valid manifest for Android', () => {
|
||||
testValidator('turtle/__tests__/fixtures/androidJob.json');
|
||||
});
|
||||
test('Passes valid manifest for ios', () => {
|
||||
testValidator('turtle/__tests__/fixtures/iosJob.json');
|
||||
});
|
||||
//# sourceMappingURL=validator.test.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"validator.test.js","sourceRoot":"","sources":["../../src/__tests__/validator.test.ts"],"names":[],"mappings":";;;;;;;;;AAAA,wDAA8C;AAE9C,MAAM,aAAa,GAAG,CAAC,WAAmB,EAAE,EAAE;IAC5C,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAClC,MAAM,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;AAC1D,CAAC,CAAC;AAEF,IAAI,CAAC,mCAAmC,EAAE,GAAG,EAAE;IAC7C,aAAa,CAAC,2CAA2C,CAAC,CAAC;AAC7D,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,+BAA+B,EAAE,GAAG,EAAE;IACzC,aAAa,CAAC,uCAAuC,CAAC,CAAC;AACzD,CAAC,CAAC,CAAC","sourcesContent":["import * as validator from 'turtle/validator';\n\nconst testValidator = (fixturePath: string) => {\n const data = require(fixturePath);\n expect(() => validator.sanitizeJob(data)).not.toThrow();\n};\n\ntest('Passes valid manifest for Android', () => {\n testValidator('turtle/__tests__/fixtures/androidJob.json');\n});\n\ntest('Passes valid manifest for ios', () => {\n testValidator('turtle/__tests__/fixtures/iosJob.json');\n});\n"]}
|
||||
@@ -1,5 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.EXTRA_DIMENSIONS = Symbol('Extra Dimensions');
|
||||
exports.GROUP_HASH = Symbol('Group Hash');
|
||||
//# sourceMappingURL=constants.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/aws/cloudwatch/constants.ts"],"names":[],"mappings":";;AAAa,QAAA,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAC9C,QAAA,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC","sourcesContent":["export const EXTRA_DIMENSIONS = Symbol('Extra Dimensions');\nexport const GROUP_HASH = Symbol('Group Hash');\n"]}
|
||||
@@ -1,44 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const config_1 = __importDefault(require("../../config"));
|
||||
exports.TYPE_DIMENSIONS = (type) => [
|
||||
[
|
||||
{ Name: 'env', Value: config_1.default.deploymentEnv },
|
||||
{ Name: 'platform', Value: config_1.default.platform },
|
||||
{ Name: 'type', Value: type },
|
||||
],
|
||||
[
|
||||
{ Name: 'env', Value: config_1.default.deploymentEnv },
|
||||
{ Name: 'platform', Value: config_1.default.platform },
|
||||
{ Name: 'type', Value: type },
|
||||
{ Name: 'host', Value: config_1.default.hostname },
|
||||
],
|
||||
];
|
||||
exports.PRIORITY_DIMENSIONS = (type, priority) => [
|
||||
[
|
||||
{ Name: 'env', Value: config_1.default.deploymentEnv },
|
||||
{ Name: 'platform', Value: config_1.default.platform },
|
||||
{ Name: 'priority', Value: priority },
|
||||
],
|
||||
[
|
||||
{ Name: 'env', Value: config_1.default.deploymentEnv },
|
||||
{ Name: 'platform', Value: config_1.default.platform },
|
||||
{ Name: 'type', Value: type },
|
||||
],
|
||||
[
|
||||
{ Name: 'env', Value: config_1.default.deploymentEnv },
|
||||
{ Name: 'platform', Value: config_1.default.platform },
|
||||
{ Name: 'type', Value: type },
|
||||
{ Name: 'priority', Value: priority },
|
||||
],
|
||||
[
|
||||
{ Name: 'env', Value: config_1.default.deploymentEnv },
|
||||
{ Name: 'platform', Value: config_1.default.platform },
|
||||
{ Name: 'type', Value: type },
|
||||
{ Name: 'host', Value: config_1.default.hostname },
|
||||
],
|
||||
];
|
||||
//# sourceMappingURL=dimensions.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"dimensions.js","sourceRoot":"","sources":["../../../src/aws/cloudwatch/dimensions.ts"],"names":[],"mappings":";;;;;AAAA,0DAAmC;AAEtB,QAAA,eAAe,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC;IAC/C;QACE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAM,CAAC,aAAa,EAAE;QAC5C,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,gBAAM,CAAC,QAAQ,EAAE;QAC5C,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE;KAC9B;IACD;QACE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAM,CAAC,aAAa,EAAE;QAC5C,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,gBAAM,CAAC,QAAQ,EAAE;QAC5C,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE;QAC7B,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAM,CAAC,QAAQ,EAAE;KACzC;CACF,CAAC;AAEW,QAAA,mBAAmB,GAAG,CAAC,IAAY,EAAE,QAAgB,EAAE,EAAE,CAAC;IACrE;QACE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAM,CAAC,aAAa,EAAE;QAC5C,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,gBAAM,CAAC,QAAQ,EAAE;QAC5C,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE;KACtC;IACD;QACE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAM,CAAC,aAAa,EAAE;QAC5C,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,gBAAM,CAAC,QAAQ,EAAE;QAC5C,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE;KAC9B;IACD;QACE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAM,CAAC,aAAa,EAAE;QAC5C,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,gBAAM,CAAC,QAAQ,EAAE;QAC5C,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE;QAC7B,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE;KACtC;IACD;QACE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAM,CAAC,aAAa,EAAE;QAC5C,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,gBAAM,CAAC,QAAQ,EAAE;QAC5C,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE;QAC7B,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAM,CAAC,QAAQ,EAAE;KACzC;CACF,CAAC","sourcesContent":["import config from 'turtle/config';\n\nexport const TYPE_DIMENSIONS = (type: string) => [\n [\n { Name: 'env', Value: config.deploymentEnv },\n { Name: 'platform', Value: config.platform },\n { Name: 'type', Value: type },\n ],\n [\n { Name: 'env', Value: config.deploymentEnv },\n { Name: 'platform', Value: config.platform },\n { Name: 'type', Value: type },\n { Name: 'host', Value: config.hostname },\n ],\n];\n\nexport const PRIORITY_DIMENSIONS = (type: string, priority: string) => [\n [\n { Name: 'env', Value: config.deploymentEnv },\n { Name: 'platform', Value: config.platform },\n { Name: 'priority', Value: priority },\n ],\n [\n { Name: 'env', Value: config.deploymentEnv },\n { Name: 'platform', Value: config.platform },\n { Name: 'type', Value: type },\n ],\n [\n { Name: 'env', Value: config.deploymentEnv },\n { Name: 'platform', Value: config.platform },\n { Name: 'type', Value: type },\n { Name: 'priority', Value: priority },\n ],\n [\n { Name: 'env', Value: config.deploymentEnv },\n { Name: 'platform', Value: config.platform },\n { Name: 'type', Value: type },\n { Name: 'host', Value: config.hostname },\n ],\n];\n"]}
|
||||
@@ -1,138 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const aws_sdk_1 = __importDefault(require("aws-sdk"));
|
||||
const lodash_1 = __importDefault(require("lodash"));
|
||||
const constants_1 = require("./constants");
|
||||
const statistics_1 = __importDefault(require("./statistics"));
|
||||
const config_1 = __importDefault(require("../../config"));
|
||||
const logger_1 = __importDefault(require("../../logger"));
|
||||
const SUCCESS_SUFFIX = '.success';
|
||||
const FAIL_SUFFIX = '.fail';
|
||||
const CHUNK_SIZE = 20;
|
||||
const state = {
|
||||
metrics: [],
|
||||
registeredMetrics: {},
|
||||
intervalId: null,
|
||||
};
|
||||
const cloudWatch = new aws_sdk_1.default.CloudWatch({
|
||||
apiVersion: '2010-08-01',
|
||||
region: config_1.default.cloudwatch.region,
|
||||
accessKeyId: config_1.default.aws.accessKeyId,
|
||||
secretAccessKey: config_1.default.aws.secretAccessKey,
|
||||
});
|
||||
function init() {
|
||||
if (config_1.default.cloudwatch.disabled) {
|
||||
return;
|
||||
}
|
||||
state.intervalId = setInterval(_dumpMetrics, config_1.default.cloudwatch.intervalMs);
|
||||
}
|
||||
exports.init = init;
|
||||
function addMetricData({ name, value, success = true, explicitName = false, extraDimensions = [], }) {
|
||||
if (config_1.default.cloudwatch.disabled) {
|
||||
return;
|
||||
}
|
||||
const metricName = explicitName ? name : _createMetricName(name, success);
|
||||
const registeredMetric = state.registeredMetrics[metricName];
|
||||
if (!registeredMetric) {
|
||||
return;
|
||||
}
|
||||
const { unit } = registeredMetric;
|
||||
const metric = {
|
||||
MetricName: metricName,
|
||||
Unit: unit,
|
||||
Value: value,
|
||||
Timestamp: new Date(),
|
||||
[constants_1.EXTRA_DIMENSIONS]: extraDimensions,
|
||||
[constants_1.GROUP_HASH]: _calculateGroupHash(metricName, extraDimensions),
|
||||
};
|
||||
state.metrics.push(metric);
|
||||
}
|
||||
exports.addMetricData = addMetricData;
|
||||
function registerMetric({ metricName, unit, reducer, dimensions = [], statistics = false, addEmpty = true, explicitName = false, }) {
|
||||
if (config_1.default.cloudwatch.disabled) {
|
||||
return;
|
||||
}
|
||||
const successMetricName = _createMetricName(metricName, true, explicitName);
|
||||
state.registeredMetrics[successMetricName] = { unit, statistics, reducer, addEmpty, dimensions };
|
||||
if (!explicitName) {
|
||||
const failMetricName = _createMetricName(metricName, false);
|
||||
state.registeredMetrics[failMetricName] = { unit, statistics, reducer, addEmpty, dimensions };
|
||||
}
|
||||
}
|
||||
exports.registerMetric = registerMetric;
|
||||
function _createMetricName(name, success, explicitName) {
|
||||
if (explicitName) {
|
||||
return name;
|
||||
}
|
||||
else {
|
||||
const suffix = success ? SUCCESS_SUFFIX : FAIL_SUFFIX;
|
||||
return `${name}${suffix}`;
|
||||
}
|
||||
}
|
||||
function _calculateGroupHash(metricName, extraDimensions) {
|
||||
const dimString = lodash_1.default.flatten(extraDimensions)
|
||||
.map(({ Name, Value }) => `,${Name}:${Value}`)
|
||||
.join('');
|
||||
return `${metricName}${dimString}`;
|
||||
}
|
||||
function _dumpMetrics() {
|
||||
if (!state.metrics.length && Object.keys(state.registeredMetrics).length < 0) {
|
||||
// empty metrics list, skipping
|
||||
return;
|
||||
}
|
||||
logger_1.default.trace('[cloudwatch] lenghts for state.metrics=%d, state.registeredMetrics=%d', state.metrics.length, Object.keys(state.registeredMetrics).length);
|
||||
_addEmptyMetrics(state.metrics);
|
||||
const formattedMetrics = _formatMetrics(state.metrics);
|
||||
_pushMetrics(formattedMetrics);
|
||||
state.metrics = [];
|
||||
}
|
||||
function _addEmptyMetrics(metrics) {
|
||||
const seenMetrics = metrics.reduce((acc, i) => {
|
||||
if (!acc.has(i.MetricName)) {
|
||||
acc.add(i.MetricName);
|
||||
}
|
||||
return acc;
|
||||
}, new Set());
|
||||
const nonEmptyMetrics = lodash_1.default.omitBy(state.registeredMetrics, ({ addEmpty }) => !addEmpty);
|
||||
const toAdd = lodash_1.default.difference(Object.keys(nonEmptyMetrics), Array.from(seenMetrics));
|
||||
toAdd.forEach((name) => addMetricData({ name, value: 0, explicitName: true }));
|
||||
}
|
||||
function _formatMetrics(metrics) {
|
||||
const reducedMetrics = _reduceMetrics(metrics);
|
||||
const metricsWithDimensions = reducedMetrics.map((metric) => {
|
||||
const { dimensions } = state.registeredMetrics[metric.MetricName];
|
||||
const joinedDimensions = [...dimensions, ...metric[constants_1.EXTRA_DIMENSIONS]];
|
||||
return joinedDimensions.map((i) => Object.assign({}, metric, { Dimensions: i }));
|
||||
});
|
||||
const metricData = lodash_1.default.flatten(metricsWithDimensions);
|
||||
const chunks = lodash_1.default.chunk(metricData, CHUNK_SIZE);
|
||||
return chunks.map((chunk) => ({
|
||||
Namespace: config_1.default.cloudwatch.namespace,
|
||||
MetricData: chunk,
|
||||
}));
|
||||
}
|
||||
function _reduceMetrics(metrics) {
|
||||
const grouped = lodash_1.default.groupBy(metrics, constants_1.GROUP_HASH);
|
||||
return lodash_1.default.reduce(grouped, (acc, val) => {
|
||||
const { MetricName: key } = val[0];
|
||||
const { reducer, statistics } = state.registeredMetrics[key];
|
||||
const reduced = reducer ? reducer(val) : val;
|
||||
const withStats = statistics ? statistics_1.default(reduced) : reduced;
|
||||
acc.push(...withStats);
|
||||
return acc;
|
||||
}, []);
|
||||
}
|
||||
function _pushMetrics(metrics) {
|
||||
logger_1.default.trace('[cloudwatch] pushing metrics', JSON.stringify(metrics, null, '\t'));
|
||||
metrics.forEach((metricsChunk) => {
|
||||
cloudWatch.putMetricData(metricsChunk, (err) => {
|
||||
if (err) {
|
||||
logger_1.default.warn({ err }, '[cloudwatch]');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/aws/cloudwatch/index.ts"],"names":[],"mappings":";;;;;AAAA,sDAA0B;AAC1B,oDAAuB;AAEvB,2CAA+E;AAC/E,8DAAmE;AAQnE,0DAAmC;AACnC,0DAAmC;AAUnC,MAAM,cAAc,GAAG,UAAU,CAAC;AAClC,MAAM,WAAW,GAAG,OAAO,CAAC;AAC5B,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB,MAAM,KAAK,GAAW;IACpB,OAAO,EAAE,EAAE;IACX,iBAAiB,EAAE,EAAE;IACrB,UAAU,EAAE,IAAI;CACjB,CAAC;AAEF,MAAM,UAAU,GAAG,IAAI,iBAAG,CAAC,UAAU,CAAC;IACpC,UAAU,EAAE,YAAY;IACxB,MAAM,EAAE,gBAAM,CAAC,UAAU,CAAC,MAAM;IAChC,WAAW,EAAE,gBAAM,CAAC,GAAG,CAAC,WAAW;IACnC,eAAe,EAAE,gBAAM,CAAC,GAAG,CAAC,eAAe;CAC5C,CAAC,CAAC;AAEH,SAAgB,IAAI;IAClB,IAAI,gBAAM,CAAC,UAAU,CAAC,QAAQ,EAAE;QAC9B,OAAO;KACR;IAED,KAAK,CAAC,UAAU,GAAG,WAAW,CAAC,YAAY,EAAE,gBAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AAC7E,CAAC;A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,CAAC,CAAC;QACvB,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAAE,CACH,CAAC;AACJ,CAALine truncated
|
||||
@@ -1,29 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function sum(metrics) {
|
||||
if (metrics.length === 0) {
|
||||
return [];
|
||||
}
|
||||
const reduced = metrics.reduce((acc, i) => {
|
||||
let result = acc;
|
||||
if (!result) {
|
||||
result = { ...i };
|
||||
}
|
||||
else {
|
||||
result.Value += i.Value;
|
||||
}
|
||||
return result;
|
||||
}, null);
|
||||
return [reduced];
|
||||
}
|
||||
exports.sum = sum;
|
||||
function avg(metrics) {
|
||||
if (!metrics.length) {
|
||||
return [];
|
||||
}
|
||||
const metric = sum(metrics)[0];
|
||||
metric.Value = metric.Value / metrics.length;
|
||||
return [metric];
|
||||
}
|
||||
exports.avg = avg;
|
||||
//# sourceMappingURL=reducers.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"reducers.js","sourceRoot":"","sources":["../../../src/aws/cloudwatch/reducers.ts"],"names":[],"mappings":";;AAEA,SAAgB,GAAG,CAAC,OAAkB;IACpC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;QACxB,OAAO,EAAE,CAAC;KACX;IACD,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAmB,EAAE,CAAU,EAAE,EAAE;QACjE,IAAI,MAAM,GAAG,GAAG,CAAC;QACjB,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;SACnB;aAAM;YACL,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC;SACzB;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,EAAE,IAAI,CAAC,CAAC;IACT,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC;AAdD,kBAcC;AAED,SAAgB,GAAG,CAAC,OAAkB;IACpC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QACnB,OAAO,EAAE,CAAC;KACX;IAED,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAY,CAAC;IAC1C,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC;IAC7C,OAAO,CAAC,MAAM,CAAC,CAAC;AAClB,CAAC;AARD,kBAQC","sourcesContent":["import { IMetric } from 'turtle/aws/cloudwatch/types';\n\nexport function sum(metrics: IMetric[]) {\n if (metrics.length === 0) {\n return [];\n }\n const reduced = metrics.reduce((acc: IMetric | null, i: IMetric) => {\n let result = acc;\n if (!result) {\n result = { ...i };\n } else {\n result.Value += i.Value;\n }\n return result;\n }, null);\n return [reduced];\n}\n\nexport function avg(metrics: IMetric[]) {\n if (!metrics.length) {\n return [];\n }\n\n const metric = sum(metrics)[0] as IMetric;\n metric.Value = metric.Value / metrics.length;\n return [metric];\n}\n"]}
|
||||
@@ -1,29 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function calculateStatistics(metrics) {
|
||||
if (!metrics.length) {
|
||||
return [];
|
||||
}
|
||||
const reduced = metrics.reduce((acc, i) => {
|
||||
let result = acc;
|
||||
if (!result) {
|
||||
result = Object.assign({}, i, {
|
||||
StatisticValues: {
|
||||
Maximum: -Infinity,
|
||||
Minimum: Infinity,
|
||||
SampleCount: 0,
|
||||
Sum: 0.0,
|
||||
},
|
||||
Value: undefined,
|
||||
});
|
||||
}
|
||||
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];
|
||||
}
|
||||
exports.default = calculateStatistics;
|
||||
//# sourceMappingURL=statistics.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"statistics.js","sourceRoot":"","sources":["../../../src/aws/cloudwatch/statistics.ts"],"names":[],"mappings":";;AAEA,SAAwB,mBAAmB,CAAC,OAAkB;IAC5D,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QACnB,OAAO,EAAE,CAAC;KACX;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAA2B,EAAE,CAAU,EAAE,EAAE;QACzE,IAAI,MAAM,GAAG,GAAG,CAAC;QACjB,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,EAAE;gBAC5B,eAAe,EAAE;oBACf,OAAO,EAAE,CAAC,QAAQ;oBAClB,OAAO,EAAE,QAAQ;oBACjB,WAAW,EAAE,CAAC;oBACd,GAAG,EAAE,GAAG;iBACT;gBACD,KAAK,EAAE,SAAS;aACjB,CAAC,CAAC;SACJ;QAED,MAAM,CAAC,eAAe,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;QACnF,MAAM,CAAC,eAAe,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;QACnF,MAAM,CAAC,eAAe,CAAC,WAAW,IAAI,CAAC,CAAC;QACxC,MAAM,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,CAAC,KAAK,CAAC;QACtC,OAAO,MAAM,CAAC;IAChB,CAAC,EAAE,IAAI,CAAC,CAAC;IACT,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC;AA1BD,sCA0BC","sourcesContent":["import { IMetric, MetricWithStats } from 'turtle/aws/cloudwatch/types';\n\nexport default function calculateStatistics(metrics: IMetric[]) {\n if (!metrics.length) {\n return [];\n }\n\n const reduced = metrics.reduce((acc: MetricWithStats | null, i: IMetric) => {\n let result = acc;\n if (!result) {\n result = Object.assign({}, i, {\n StatisticValues: {\n Maximum: -Infinity,\n Minimum: Infinity,\n SampleCount: 0,\n Sum: 0.0,\n },\n Value: undefined,\n });\n }\n\n result.StatisticValues.Maximum = Math.max(result.StatisticValues.Maximum, i.Value);\n result.StatisticValues.Minimum = Math.min(result.StatisticValues.Minimum, i.Value);\n result.StatisticValues.SampleCount += 1;\n result.StatisticValues.Sum += i.Value;\n return result;\n }, null);\n return [reduced];\n}\n"]}
|
||||
@@ -1,4 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const constants_1 = require("./constants");
|
||||
//# sourceMappingURL=types.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/aws/cloudwatch/types.ts"],"names":[],"mappings":";;AAAA,2CAA+E","sourcesContent":["import { EXTRA_DIMENSIONS, GROUP_HASH } from 'turtle/aws/cloudwatch/constants';\n\nexport interface IMetric {\n MetricName: string;\n Unit: string;\n Value: number;\n Timestamp: Date;\n StatisticValues?: {\n Maximum: number;\n Minimum: number;\n SampleCount: number;\n Sum: number;\n };\n [EXTRA_DIMENSIONS]: any;\n [GROUP_HASH]: string;\n}\n\nexport type MetricWithStats = {\n StatisticValues: {\n Maximum: number;\n Minimum: number;\n SampleCount: number;\n Sum: number;\n },\n} & IMetric;\n\nexport interface IMetricData {\n name: string;\n value: number;\n success?: boolean;\n explicitName?: boolean;\n extraDimensions?: any;\n}\n\nexport interface IMetricConfiguration {\n unit: string;\n statistics?: boolean;\n reducer?: any;\n addEmpty?: boolean;\n dimensions?: any;\n}\n\nexport type MetricRegistrationObject = { metricName: string, explicitName?: boolean } & IMetricConfiguration;\n\nexport interface IMetricsChunk {\n Namespace: string;\n MetricData: IMetric[];\n}\n"]}
|
||||
@@ -1,25 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const aws_sdk_1 = __importDefault(require("aws-sdk"));
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const lodash_1 = __importDefault(require("lodash"));
|
||||
const config_1 = __importDefault(require("../config"));
|
||||
const s3 = new aws_sdk_1.default.S3({
|
||||
...lodash_1.default.pick(config_1.default.aws, ['accessKeyId', 'secretAccessKey']),
|
||||
...lodash_1.default.pick(config_1.default.s3, ['region']),
|
||||
});
|
||||
exports.default = s3;
|
||||
async function uploadFile({ bucketName = config_1.default.s3.bucket, key, srcPath }) {
|
||||
return await s3
|
||||
.upload({
|
||||
Bucket: bucketName,
|
||||
Key: key,
|
||||
Body: fs_extra_1.default.createReadStream(srcPath),
|
||||
})
|
||||
.promise();
|
||||
}
|
||||
exports.uploadFile = uploadFile;
|
||||
//# sourceMappingURL=s3.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"s3.js","sourceRoot":"","sources":["../../src/aws/s3.ts"],"names":[],"mappings":";;;;;AAAA,sDAA0B;AAC1B,wDAA0B;AAC1B,oDAAuB;AAEvB,uDAAmC;AAQnC,MAAM,EAAE,GAAG,IAAI,iBAAG,CAAC,EAAE,CAAC;IACpB,GAAG,gBAAC,CAAC,IAAI,CAAC,gBAAM,CAAC,GAAG,EAAE,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC;IACzD,GAAG,gBAAC,CAAC,IAAI,CAAC,gBAAM,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC;CACjC,CAAC,CAAC;AAEH,kBAAe,EAAE,CAAC;AAEX,KAAK,UAAU,UAAU,CAAC,EAAE,UAAU,GAAG,gBAAM,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAqB;IACjG,OAAO,MAAM,EAAE;SACZ,MAAM,CAAC;QACN,MAAM,EAAE,UAAU;QAClB,GAAG,EAAE,GAAG;QACR,IAAI,EAAE,kBAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC;KACnC,CAAC;SACD,OAAO,EAAE,CAAC;AACf,CAAC;AARD,gCAQC","sourcesContent":["import AWS from 'aws-sdk';\nimport fs from 'fs-extra';\nimport _ from 'lodash';\n\nimport config from 'turtle/config';\n\ninterface IFileUploadParams {\n bucketName?: string;\n key: string;\n srcPath: string;\n}\n\nconst s3 = new AWS.S3({\n ..._.pick(config.aws, ['accessKeyId', 'secretAccessKey']),\n ..._.pick(config.s3, ['region']),\n});\n\nexport default s3;\n\nexport async function uploadFile({ bucketName = config.s3.bucket, key, srcPath }: IFileUploadParams) {\n return await s3\n .upload({\n Bucket: bucketName,\n Key: key,\n Body: fs.createReadStream(srcPath),\n })\n .promise();\n}\n"]}
|
||||
@@ -1,95 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const async_retry_1 = __importDefault(require("async-retry"));
|
||||
const aws_sdk_1 = __importDefault(require("aws-sdk"));
|
||||
const lodash_1 = __importDefault(require("lodash"));
|
||||
const utils_1 = require("./utils");
|
||||
const config_1 = __importDefault(require("../config"));
|
||||
const logger_1 = __importDefault(require("../logger"));
|
||||
const turtleContext_1 = require("../turtleContext");
|
||||
const sqs = new aws_sdk_1.default.SQS({
|
||||
apiVersion: '2012-11-05',
|
||||
...lodash_1.default.pick(config_1.default.aws, ['accessKeyId', 'secretAccessKey']),
|
||||
...lodash_1.default.pick(config_1.default.sqs, ['region']),
|
||||
});
|
||||
const VISIBILITY_TIMEOUT_SEC = 30;
|
||||
async function receiveMessage(priority) {
|
||||
const params = {
|
||||
MaxNumberOfMessages: 1,
|
||||
QueueUrl: utils_1.QUEUE_URL(priority),
|
||||
VisibilityTimeout: VISIBILITY_TIMEOUT_SEC,
|
||||
};
|
||||
return await async_retry_1.default(() => {
|
||||
return sqs
|
||||
.receiveMessage(params)
|
||||
.promise()
|
||||
.then((data) => {
|
||||
if (data.Messages) {
|
||||
logger_1.default.info(`Received a message`);
|
||||
return data.Messages[0];
|
||||
}
|
||||
else {
|
||||
logger_1.default.debug(`No messages received [${priority}]`);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
logger_1.default.error({ err }, 'Receive error');
|
||||
throw err;
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.receiveMessage = receiveMessage;
|
||||
async function deleteMessage(priority, receiptHandle) {
|
||||
const params = {
|
||||
QueueUrl: utils_1.QUEUE_URL(priority),
|
||||
ReceiptHandle: receiptHandle,
|
||||
};
|
||||
return await async_retry_1.default(() => {
|
||||
return sqs.deleteMessage(params).promise();
|
||||
});
|
||||
}
|
||||
exports.deleteMessage = deleteMessage;
|
||||
async function changeMessageVisibility(priority, receiptHandle) {
|
||||
const params = {
|
||||
QueueUrl: utils_1.QUEUE_URL(priority),
|
||||
ReceiptHandle: receiptHandle,
|
||||
VisibilityTimeout: VISIBILITY_TIMEOUT_SEC,
|
||||
};
|
||||
return sqs.changeMessageVisibility(params).promise();
|
||||
}
|
||||
exports.changeMessageVisibility = changeMessageVisibility;
|
||||
// Every VISIBILITY_TIMEOUT_SEC / 3 seconds we are telling AWS SQS
|
||||
// that we're still processing the message, so it does not
|
||||
// send the build job to another turtle agent
|
||||
function changeMessageVisibilityRecurring(priority, receiptHandle, jobId) {
|
||||
return setInterval(() => {
|
||||
if (turtleContext_1.getCurrentJobId() === jobId) {
|
||||
changeMessageVisibility(priority, receiptHandle).catch((err) => {
|
||||
logger_1.default.warn({ err }, 'Error at change msg visibility');
|
||||
});
|
||||
}
|
||||
}, (VISIBILITY_TIMEOUT_SEC * 1000) / 3);
|
||||
}
|
||||
exports.changeMessageVisibilityRecurring = changeMessageVisibilityRecurring;
|
||||
async function sendMessage(jobId, status, data = {}) {
|
||||
const params = {
|
||||
MessageBody: JSON.stringify({ jobId, status, ...data }),
|
||||
QueueUrl: utils_1.OUTPUT_QUEUE_URL(),
|
||||
DelaySeconds: 0,
|
||||
MessageGroupId: jobId,
|
||||
};
|
||||
try {
|
||||
return await async_retry_1.default(async () => {
|
||||
return await sqs.sendMessage(params).promise();
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
logger_1.default.error({ err }, `Error sending SQS message: ${JSON.stringify(params)}}`);
|
||||
}
|
||||
}
|
||||
exports.sendMessage = sendMessage;
|
||||
//# sourceMappingURL=sqs.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"sqs.js","sourceRoot":"","sources":["../../src/aws/sqs.ts"],"names":[],"mappings":";;;;;AAAA,8DAAgC;AAChC,sDAA0B;AAC1B,oDAAuB;AAEvB,mCAA+D;AAC/D,uDAAmC;AAEnC,uDAAmC;AACnC,oDAAuD;AAEvD,MAAM,GAAG,GAAG,IAAI,iBAAG,CAAC,GAAG,CAAC;IACtB,UAAU,EAAE,YAAY;IACxB,GAAG,gBAAC,CAAC,IAAI,CAAC,gBAAM,CAAC,GAAG,EAAE,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC;IACzD,GAAG,gBAAC,CAAC,IAAI,CAAC,gBAAM,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAE3B,KAAK,UAAU,cAAc,CAAC,QAAgB;IACnD,MAAM,MAAM,GAAG;QACb,mBAAmB,EAAE,CAAC;QACtB,QAAQ,EAAE,iBAAS,CAAC,QAAQ,CAAC;QAC7B,iBAAiB,EAAE,sBAAsB;KAC1C,CAAC;IACF,OAAO,MAAM,qBAAK,CAAC,GAAG,EAAE;QACtB,OAAO,GAAG;aACP,cAAc,CAAC,MAAM,CAAC;aACtB,OAAO,EAAE;aACT,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;YACb,IAAI,IAAI,CAAC,QAAQ,EAAE;gBAC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E;YAC/B,uBAAuB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBAC7D,gBAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,gCAAgC,CAAC,CAAC;YACzD,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,EAAE,CAAC,sBAAsB,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1C,CAAC;AARD,4EAQC;AAEM,KAAK,UAAU,WAAW,CAAC,KAAa,EAAE,MAAuB,EAAE,IAAI,GAAG,EAAE;IACjF,MAAM,MAAM,GAAG;QACb,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC;QACvD,QAAQ,EAAE,wBAAgB,EAAE;QAC5B,YAAY,EAAE,CAAC;QACf,cAAc,EAAE,KAAK;KACtB,CAAC;IACF,IAAI;QACF,OAAO,MAAM,qBAAK,CAAC,KAAK,IAAI,EAAE;YAC5B,OAAO,MAAM,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC;QACjD,CAAC,CAAC,CAAC;KACJ;IAAC,OAAO,GAAG,EAAE;QACZ,gBAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,8BAA8B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;KAChF;AACH,CAAC;AAdD,kCAcC","sourcesContent":["import retry from 'async-retry';\nimport AWS from 'aws-sdk';\nimport _ from 'lodash';\n\nimport { OUTPUT_QUEUE_URL, QUEUE_URL } from 'turtle/aws/utils';\nimport config from 'turtle/config';\nimport { JOB_UPDATE_TYPE } from 'turtle/constants/build';\nimport logger from 'turtle/logger';\nimport { getCurrentJobId } from 'turtle/turtleContext';\n\nconst sqs = new AWS.SQS({\n apiVersion: '2012-11-05',\n ..._.pick(config.aws, ['accessKeyId', 'secretAccessKey']),\n ..._.pick(config.sqs, ['region']),\n});\n\nconst VISIBILITY_TIMEOUT_SEC = 30;\n\nexport async function receiveMessage(priority: string) {\n const params = {\n MaxNumberOfMessages: 1,\n QueueUrl: QUEUE_URL(priority),\n VisibilityTimeout: VISIBILITY_TIMEOUT_SEC,\n };\n return await retry(() => {\n return sqs\n .receiveMessage(params)\n .promise()\n .then((data) => {\n if (data.Messages) {\n logger.info(`Received a message`);\n return data.Messages[0];\n } else {\n logger.debug(`No messages received [${priority}]`);\n return null;\n }\n })\n .catch((err) => {\n logger.error({ err }, 'Receive error');\n throw err;\n });\n });\n}\n\nexport async function deleteMessage(priority: string, receiptHandle: string) {\n const params = {\n QueueUrl: QUEUE_URL(priority),\n ReceiptHandle: receiptHandle,\n };\n return await retry(() => {\n return sqs.deleteMessage(params).promise();\n });\n}\n\nexport async function changeMessageVisibility(priority: string, receiptHandle: string) {\n const params = {\n QueueUrl: QUEUE_URL(priority),\n ReceiptHandle: receiptHandle,\n VisibilityTimeout: VISIBILITY_TIMEOUT_SEC,\n };\n return sqs.changeMessageVisibility(params).promise();\n}\n\n// Every VISIBILITY_TIMEOUT_SEC / 3 seconds we are telling AWS SQS\n// that we're still processing the message, so it does not\n// send the build job to another turtle agent\nexport function changeMessageVisibilityRecurring(priority: string, receiptHandle: string, jobId: string) {\n return setInterval(() => {\n if (getCurrentJobId() === jobId) {\n changeMessageVisibility(priority, receiptHandle).catch((err) => {\n logger.warn({ err }, 'Error at change msg visibility');\n });\n }\n }, (VISIBILITY_TIMEOUT_SEC * 1000) / 3);\n}\n\nexport async function sendMessagLine truncated
|
||||
@@ -1,9 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const config_1 = __importDefault(require("../config"));
|
||||
exports.QUEUE_URL = (priority) => config_1.default.sqs.queues[priority][config_1.default.platform];
|
||||
exports.OUTPUT_QUEUE_URL = () => config_1.default.sqs.queues.out;
|
||||
//# sourceMappingURL=utils.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/aws/utils.ts"],"names":[],"mappings":";;;;;AAAA,uDAAmC;AAEtB,QAAA,SAAS,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAE,gBAAM,CAAC,GAAG,CAAC,MAAc,CAAC,QAAQ,CAAC,CAAC,gBAAM,CAAC,QAAQ,CAAC,CAAC;AACxF,QAAA,gBAAgB,GAAG,GAAG,EAAE,CAAC,gBAAM,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC","sourcesContent":["import config from 'turtle/config';\n\nexport const QUEUE_URL = (priority: string) => (config.sqs.queues as any)[priority][config.platform];\nexport const OUTPUT_QUEUE_URL = () => config.sqs.queues.out;\n"]}
|
||||
@@ -1,6 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
class ErrorWithCommandHelp extends Error {
|
||||
}
|
||||
exports.ErrorWithCommandHelp = ErrorWithCommandHelp;
|
||||
//# sourceMappingURL=ErrorWithCommandHelp.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"ErrorWithCommandHelp.js","sourceRoot":"","sources":["../../../src/bin/commands/ErrorWithCommandHelp.ts"],"names":[],"mappings":";;AAAA,MAAa,oBAAqB,SAAQ,KAAK;CAC9C;AADD,oDACC","sourcesContent":["export class ErrorWithCommandHelp extends Error {\n}\n"]}
|
||||
@@ -1,6 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
class ErrorWithProgramHelp extends Error {
|
||||
}
|
||||
exports.ErrorWithProgramHelp = ErrorWithProgramHelp;
|
||||
//# sourceMappingURL=ErrorWithProgramHelp.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"ErrorWithProgramHelp.js","sourceRoot":"","sources":["../../../src/bin/commands/ErrorWithProgramHelp.ts"],"names":[],"mappings":";;AAAA,MAAa,oBAAqB,SAAQ,KAAK;CAC9C;AADD,oDACC","sourcesContent":["export class ErrorWithProgramHelp extends Error {\n}\n"]}
|
||||
@@ -1,55 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const ErrorWithCommandHelp_1 = require("../ErrorWithCommandHelp");
|
||||
const builder_1 = require("../../utils/builder");
|
||||
const android_1 = __importDefault(require("../../../builders/android"));
|
||||
const constants_1 = require("../../../constants");
|
||||
exports.default = (program, setCommonCommandOptions) => {
|
||||
const command = program.command('build:android [project-dir]');
|
||||
setCommonCommandOptions(command);
|
||||
command
|
||||
.alias('ba')
|
||||
.option('--keystore-path <app.jks>', 'path to your Keystore (please provide Keystore password and Key password as EXPO_ANDROID_KEYSTORE_PASSWORD'
|
||||
+ ' and EXPO_ANDROID_KEY_PASSWORD env variables)')
|
||||
.option('--keystore-alias <alias>', 'keystore Alias')
|
||||
.option('-t --type <build>', 'type of build: app-bundle|apk', /^(app-bundle|apk)$/i, 'app-bundle')
|
||||
.option('-m --mode <build>', 'type of build: debug|release', /^(debug|release)$/i, 'release')
|
||||
.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.')
|
||||
.asyncAction(builder_1.createBuilderAction({
|
||||
program,
|
||||
command,
|
||||
prepareCredentials,
|
||||
builder: android_1.default,
|
||||
platform: constants_1.PLATFORMS.ANDROID,
|
||||
os: ['darwin', 'linux'],
|
||||
}));
|
||||
};
|
||||
const prepareCredentials = async (cmd) => {
|
||||
const { keystorePath, keystoreAlias } = cmd;
|
||||
const keystorePassword = process.env.EXPO_ANDROID_KEYSTORE_PASSWORD;
|
||||
const keyPassword = process.env.EXPO_ANDROID_KEY_PASSWORD;
|
||||
const someCredentialsExist = keystorePath || keystoreAlias || keystorePassword || keyPassword;
|
||||
const credentialsExist = keystorePath && keystoreAlias && keystorePassword && keyPassword;
|
||||
if (!credentialsExist) {
|
||||
if (someCredentialsExist) {
|
||||
throw new ErrorWithCommandHelp_1.ErrorWithCommandHelp('Please provide all required credentials - Keystore (with password), Keystore alias and Key password');
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return {
|
||||
keystore: (await fs_extra_1.default.readFile(keystorePath)).toString('base64'),
|
||||
keystoreAlias,
|
||||
keystorePassword,
|
||||
keyPassword,
|
||||
};
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=android.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"android.js","sourceRoot":"","sources":["../../../../src/bin/commands/build/android.ts"],"names":[],"mappings":";;;;;AAAA,wDAA0B;AAG1B,kEAAgF;AAChF,iDAA+D;AAC/D,wEAA8C;AAC9C,kDAA6C;AAE7C,kBAAe,CAAC,OAAY,EAAE,uBAA4B,EAAE,EAAE;IAC5D,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC;IAC/D,uBAAuB,CAAC,OAAO,CAAC,CAAC;IACjC,OAAO;SACJ,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CACL,2BAA2B,EAC3B,4GAA4G;UAC1G,+CAA+C,CAClD;SACA,MAAM,CAAC,0BAA0B,EAAE,gBAAgB,CAAC;SACpD,MAAM,CACL,mBAAmB,EACnB,+BAA+B,EAC/B,qBAAqB,EACrB,YAAY,CACb;SACA,MAAM,CACL,mBAAmB,EACnB,8BAA8B,EAC9B,oBAAoB,EACpB,SAAS,CACV;SACA,WAAW,CACV,kGAAkG;UAChG,0CAA0C,CAC7C;SACA,WAAW,CACV,6BAAmB,CAAC;QAClB,OAAO;QACP,OAAO;QACP,kBAAkB;QAClB,OAAO,EAAP,iBAAO;QACP,QAAQ,EAAE,qBAAS,CAAC,OAAO;QAC3B,EAAE,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;KACxB,CAAC,CACH,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,KAAK,EAAE,GAAQ,EAAE,EAAE;IAC5C,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,GAAG,CAAC;IAC5C,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC;IACpE,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC;IAE1D,MAAM,oBAAoB,GAAG,YAAY,IAAI,aAAa,IAAI,gBAAgB,IAAI,WAAW,CAAC;IAC9F,MAAM,gBAAgB,GAAG,YAAY,IAAI,aAAa,IAAI,gBAAgB,IAAI,WAAW,CAAC;IAC1F,IAAI,CAAC,gBAAgB,EAAE;QACrB,IAAI,oBAAoB,EAAE;YACxB,MAAM,IAAI,2CAAoB,CAC5B,qGAAqG,CACtG,CAAC;SACH;aAAM;YACL,OAAO,IAAI,CAAC;SACb;KACF;SAAM;QACL,OAAO;YACL,QAAQ,EAAE,CAAC,MAAM,kBAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAC9D,aAAa;YACb,gBAAgB;YAChB,WAAW;SACZ,CAAC;KACH;AACH,CAAC,CAAC","sourcesContent":["import fs from 'fs-extra';\nimport _ from 'lodash';\n\nimport { ErrorWithCommandHelp } from 'turtle/bin/commands/ErrorWithCommandHelp';\nimport { createBuilderAction } from 'turtle/bin/utils/builder';\nimport builder from 'turtle/builders/android';\nimport { PLATFORMS } from 'turtle/constants';\n\nexport default (program: any, setCommonCommandOptions: any) => {\n const command = program.command('build:android [project-dir]');\n setCommonCommandOptions(command);\n command\n .alias('ba')\n .option(\n '--keystore-path <app.jks>',\n 'path to your Keystore (please provide Keystore password and Key password as EXPO_ANDROID_KEYSTORE_PASSWORD'\n + ' and EXPO_ANDROID_KEY_PASSWORD env variables)',\n )\n .option('--keystore-alias <alias>', 'keystore Alias')\n .option(\n '-t --type <build>',\n 'type of build: app-bundle|apk',\n /^(app-bundle|apk)$/i,\n 'app-bundle',\n )\n .option(\n '-m --mode <build>',\n 'type of build: debug|release',\n /^(debug|release)$/i,\n 'release',\n )\n .description(\n 'Build a standalone APK or App Bundle for your project, either signed and ready for submission to'\n + ' the Google Play Store or in debug mode.',\n )\n .asyncAction(\n createBuilderAction({\n program,\n command,\n prepareCredentials,\n builder,\n platform: PLATFORMS.ANDROID,\n os: ['darwin', 'linux'],\n }),\n );\n};\n\nconst prepareCredentials = async (cmd: any) => {\n const { keystorePath, keystoreAlias } = cmd;\n const keystorePassword = process.env.EXPO_ANDROID_KEYSTORE_PASSWORD;\n const keyPassword = process.env.EXPO_ANDROID_KEY_PASSWORD;\n\n const someCredentialsExist = keystorePath || keystoreAlias || keystorePassword || keyPassword;\n const credentialsExist = keystorePath && keystoreAlias && keystorePassword && keyPassword;\n if (!credentialsExist) {\n if (someCredentialsExist) {\n throw new ErrorWithCommandHelp(\n 'Please provide all required credentials - Keystore (with password), Keystore alias and Key password',\n );\n } else {\n return null;\n }\n } else {\n return {\n keystore: (await fs.readFile(keystorePath)).toString('base64'),\n keystoreAlias,\n keystorePassword,\n keyPassword,\n };\n }\n};\n"]}
|
||||
@@ -1,27 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const android_1 = __importDefault(require("./android"));
|
||||
const ios_1 = __importDefault(require("./ios"));
|
||||
function createCommand(builder) {
|
||||
return (program) => {
|
||||
return builder(program, setCommonCommandOptions);
|
||||
};
|
||||
}
|
||||
function setCommonCommandOptions(cmd) {
|
||||
cmd
|
||||
.option('-u --username <username>', 'username (you can also set EXPO_USERNAME env variable)')
|
||||
.option('-p --password <password>', 'password (you can also set EXPO_PASSWORD env variable)')
|
||||
.option('-d --build-dir <build-dir>', 'directory for build artifact (default: `~/expo-apps`)')
|
||||
.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!')
|
||||
.option('--release-channel <channel-name>', 'pull from specified release channel (default: default)')
|
||||
.option('-c --config <config-file>', 'specify a path to app.json');
|
||||
}
|
||||
exports.default = {
|
||||
ios: createCommand(ios_1.default),
|
||||
android: createCommand(android_1.default),
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/bin/commands/build/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA4E;AAC5E,gDAAoE;AAEpE,SAAS,aAAa,CAAC,OAAY;IACjC,OAAO,CAAC,OAAY,EAAE,EAAE;QACtB,OAAO,OAAO,CAAC,OAAO,EAAE,uBAAuB,CAAC,CAAC;IACnD,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,uBAAuB,CAAC,GAAQ;IACvC,GAAG;SACA,MAAM,CAAC,0BAA0B,EAAE,wDAAwD,CAAC;SAC5F,MAAM,CAAC,0BAA0B,EAAE,wDAAwD,CAAC;SAC5F,MAAM,CAAC,4BAA4B,EAAE,uDAAuD,CAAC;SAC7F,MAAM,CAAC,gCAAgC,EAAE,kBAAkB,CAAC;SAC5D,MAAM,CACL,oBAAoB,EACpB,iGAAiG,CAClG;SACA,MAAM,CACL,kCAAkC,EAClC,wDAAwD,CACzD;SACA,MAAM,CAAC,2BAA2B,EAAE,4BAA4B,CAAC,CAAC;AACvE,CAAC;AAED,kBAAe;IACb,GAAG,EAAE,aAAa,CAAC,aAAQ,CAAC;IAC5B,OAAO,EAAE,aAAa,CAAC,iBAAY,CAAC;CACrC,CAAC","sourcesContent":["import { default as buildAndroid } from 'turtle/bin/commands/build/android';\nimport { default as buildIOS } from 'turtle/bin/commands/build/ios';\n\nfunction createCommand(builder: any) {\n return (program: any) => {\n return builder(program, setCommonCommandOptions);\n };\n}\n\nfunction setCommonCommandOptions(cmd: any) {\n cmd\n .option('-u --username <username>', 'username (you can also set EXPO_USERNAME env variable)')\n .option('-p --password <password>', 'password (you can also set EXPO_PASSWORD env variable)')\n .option('-d --build-dir <build-dir>', 'directory for build artifact (default: `~/expo-apps`)')\n .option('-o --output <output-file-path>', 'output file path')\n .option(\n '--public-url <url>',\n 'the URL of an externally hosted manifest (for self-hosted apps), only HTTPS URLs are supported!',\n )\n .option(\n '--release-channel <channel-name>',\n 'pull from specified release channel (default: default)',\n )\n .option('-c --config <config-file>', 'specify a path to app.json');\n}\n\nexport default {\n ios: createCommand(buildIOS),\n android: createCommand(buildAndroid),\n};\n"]}
|
||||
@@ -1,48 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const ErrorWithCommandHelp_1 = require("../ErrorWithCommandHelp");
|
||||
const builder_1 = require("../../utils/builder");
|
||||
const ios_1 = __importDefault(require("../../../builders/ios"));
|
||||
const constants_1 = require("../../../constants");
|
||||
exports.default = (program, setCommonCommandOptions) => {
|
||||
const command = program.command('build:ios [project-dir]');
|
||||
setCommonCommandOptions(command);
|
||||
command
|
||||
.alias('bi')
|
||||
.option('-t --type <build>', 'type of build: archive|simulator', /^(archive|simulator)$/i, 'archive')
|
||||
.option('--team-id <apple-teamId>', 'Apple Team ID')
|
||||
.option('--dist-p12-path <dist.p12>', 'path to your Distribution Certificate P12 (please provide password as EXPO_IOS_DIST_P12_PASSWORD env variable)')
|
||||
.option('--provisioning-profile-path <.mobileprovision>', 'path to your Provisioning Profile')
|
||||
.description('Build a standalone IPA for your project, signed and ready for submission to the Apple App Store.')
|
||||
.asyncAction(builder_1.createBuilderAction({
|
||||
program,
|
||||
command,
|
||||
prepareCredentials,
|
||||
builder: ios_1.default,
|
||||
platform: constants_1.PLATFORMS.IOS,
|
||||
os: 'darwin',
|
||||
}));
|
||||
};
|
||||
const prepareCredentials = async (cmd) => {
|
||||
if (cmd.type !== constants_1.IOS_BUILD_TYPES.ARCHIVE) {
|
||||
return null;
|
||||
}
|
||||
const { teamId, distP12Path, provisioningProfilePath } = cmd;
|
||||
const certPassword = process.env.EXPO_IOS_DIST_P12_PASSWORD;
|
||||
const credentialsExist = teamId && distP12Path && certPassword && provisioningProfilePath;
|
||||
if (!credentialsExist) {
|
||||
throw new ErrorWithCommandHelp_1.ErrorWithCommandHelp('Please provide all required credentials'
|
||||
+ '- Apple Team ID, Distribution Certificate P12 (with password) and Provisioning Profile');
|
||||
}
|
||||
return {
|
||||
teamId,
|
||||
certP12: (await fs_extra_1.default.readFile(distP12Path)).toString('base64'),
|
||||
certPassword,
|
||||
provisioningProfile: (await fs_extra_1.default.readFile(provisioningProfilePath)).toString('base64'),
|
||||
};
|
||||
};
|
||||
//# sourceMappingURL=ios.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"ios.js","sourceRoot":"","sources":["../../../../src/bin/commands/build/ios.ts"],"names":[],"mappings":";;;;;AAAA,wDAA0B;AAG1B,kEAAgF;AAChF,iDAA+D;AAC/D,gEAA0C;AAC1C,kDAA8D;AAE9D,kBAAe,CAAC,OAAY,EAAE,uBAA4B,EAAE,EAAE;IAC5D,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAC3D,uBAAuB,CAAC,OAAO,CAAC,CAAC;IACjC,OAAO;SACJ,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CACL,mBAAmB,EACnB,kCAAkC,EAClC,wBAAwB,EACxB,SAAS,CACV;SACA,MAAM,CAAC,0BAA0B,EAAE,eAAe,CAAC;SACnD,MAAM,CACL,4BAA4B,EAC5B,gHAAgH,CACjH;SACA,MAAM,CAAC,gDAAgD,EAAE,mCAAmC,CAAC;SAC7F,WAAW,CACV,kGAAkG,CACnG;SACA,WAAW,CACV,6BAAmB,CAAC;QAClB,OAAO;QACP,OAAO;QACP,kBAAkB;QAClB,OAAO,EAAP,aAAO;QACP,QAAQ,EAAE,qBAAS,CAAC,GAAG;QACvB,EAAE,EAAE,QAAQ;KACb,CAAC,CACH,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,KAAK,EAAE,GAAQ,EAAE,EAAE;IAC5C,IAAI,GAAG,CAAC,IAAI,KAAK,2BAAe,CAAC,OAAO,EAAE;QACxC,OAAO,IAAI,CAAC;KACb;IAED,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,uBAAuB,EAAE,GAAG,GAAG,CAAC;IAC7D,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC;IAE5D,MAAM,gBAAgB,GACpB,MAAM,IAAI,WAAW,IAAI,YAAY,IAAI,uBAAuB,CAAC;IAEnE,IAAI,CAAC,gBAAgB,EAAE;QACrB,MAAM,IAAI,2CAAoB,CAC5B,yCAAyC;cACvC,wFAAwF,CAC3F,CAAC;KACH;IAED,OAAO;QACL,MAAM;QACN,OAAO,EAAE,CAAC,MAAM,kBAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC5D,YAAY;QACZ,mBAAmB,EAAE,CAAC,MAAM,kBAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;KACrF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import fs from 'fs-extra';\nimport _ from 'lodash';\n\nimport { ErrorWithCommandHelp } from 'turtle/bin/commands/ErrorWithCommandHelp';\nimport { createBuilderAction } from 'turtle/bin/utils/builder';\nimport builder from 'turtle/builders/ios';\nimport { IOS_BUILD_TYPES, PLATFORMS } from 'turtle/constants';\n\nexport default (program: any, setCommonCommandOptions: any) => {\n const command = program.command('build:ios [project-dir]');\n setCommonCommandOptions(command);\n command\n .alias('bi')\n .option(\n '-t --type <build>',\n 'type of build: archive|simulator',\n /^(archive|simulator)$/i,\n 'archive',\n )\n .option('--team-id <apple-teamId>', 'Apple Team ID')\n .option(\n '--dist-p12-path <dist.p12>',\n 'path to your Distribution Certificate P12 (please provide password as EXPO_IOS_DIST_P12_PASSWORD env variable)',\n )\n .option('--provisioning-profile-path <.mobileprovision>', 'path to your Provisioning Profile')\n .description(\n 'Build a standalone IPA for your project, signed and ready for submission to the Apple App Store.',\n )\n .asyncAction(\n createBuilderAction({\n program,\n command,\n prepareCredentials,\n builder,\n platform: PLATFORMS.IOS,\n os: 'darwin',\n }),\n );\n};\n\nconst prepareCredentials = async (cmd: any) => {\n if (cmd.type !== IOS_BUILD_TYPES.ARCHIVE) {\n return null;\n }\n\n const { teamId, distP12Path, provisioningProfilePath } = cmd;\n const certPassword = process.env.EXPO_IOS_DIST_P12_PASSWORD;\n\n const credentialsExist =\n teamId && distP12Path && certPassword && provisioningProfilePath;\n\n if (!credentialsExist) {\n throw new ErrorWithCommandHelp(\n 'Please provide all required credentials'\n + '- Apple Team ID, Distribution Certificate P12 (with password) and Provisioning Profile',\n );\n }\n\n return {\n teamId,\n certP12: (await fs.readFile(distP12Path)).toString('base64'),\n certPassword,\n provisioningProfile: (await fs.readFile(provisioningProfilePath)).toString('base64'),\n };\n};\n"]}
|
||||
@@ -1,12 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const build_1 = __importDefault(require("./build"));
|
||||
const setup_1 = __importDefault(require("./setup"));
|
||||
exports.setupIOS = setup_1.default.ios;
|
||||
exports.setupAndroid = setup_1.default.android;
|
||||
exports.buildIOS = build_1.default.ios;
|
||||
exports.buildAndroid = build_1.default.android;
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bin/commands/index.ts"],"names":[],"mappings":";;;;;AAAA,oDAAiD;AACjD,oDAA8C;AAEjC,QAAA,QAAQ,GAAG,eAAK,CAAC,GAAG,CAAC;AACrB,QAAA,YAAY,GAAG,eAAK,CAAC,OAAO,CAAC;AAE7B,QAAA,QAAQ,GAAG,eAAQ,CAAC,GAAG,CAAC;AACxB,QAAA,YAAY,GAAG,eAAQ,CAAC,OAAO,CAAC","sourcesContent":["import builders from 'turtle/bin/commands/build';\nimport setup from 'turtle/bin/commands/setup';\n\nexport const setupIOS = setup.ios;\nexport const setupAndroid = setup.android;\n\nexport const buildIOS = builders.ios;\nexport const buildAndroid = builders.android;\n"]}
|
||||
@@ -1,48 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const lodash_1 = __importDefault(require("lodash"));
|
||||
const ErrorWithCommandHelp_1 = require("./ErrorWithCommandHelp");
|
||||
const ErrorWithProgramHelp_1 = require("./ErrorWithProgramHelp");
|
||||
const setup_1 = __importDefault(require("../setup/setup"));
|
||||
const constants_1 = require("../../constants");
|
||||
const logger_1 = __importDefault(require("../../logger"));
|
||||
const l = logger_1.default.child({ buildPhase: 'setting up environment' });
|
||||
function createSetupCommand(platform, os) {
|
||||
return (program) => {
|
||||
const command = program.command(`setup:${platform}`);
|
||||
const platformFirstLetter = platform[0];
|
||||
command
|
||||
.alias(`s${platformFirstLetter}`)
|
||||
.description(`Setup environment for building ${lodash_1.default.capitalize(platform)} standalone apps.`)
|
||||
.option('--sdk-version <sdk-version>', 'version of Expo SDK shell app to download (optional)')
|
||||
.asyncAction(async (cmd) => await setupAction(program, cmd, platform, os));
|
||||
};
|
||||
}
|
||||
async function setupAction(program, cmd, platform, os) {
|
||||
try {
|
||||
if (os && process.platform !== os) {
|
||||
throw new Error('We don\'t support running standalone app builds for this platform on your operating system');
|
||||
}
|
||||
const { sdkVersion } = cmd;
|
||||
await setup_1.default(platform, sdkVersion);
|
||||
l.info('it\'s all set!');
|
||||
}
|
||||
catch (err) {
|
||||
logger_1.default.error({ err }, `Failed to setup environment for ${platform} builds`);
|
||||
if (err instanceof ErrorWithCommandHelp_1.ErrorWithCommandHelp) {
|
||||
cmd.help();
|
||||
}
|
||||
else if (err instanceof ErrorWithProgramHelp_1.ErrorWithProgramHelp) {
|
||||
program.help();
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
exports.default = {
|
||||
ios: createSetupCommand(constants_1.PLATFORMS.IOS, 'darwin'),
|
||||
android: createSetupCommand(constants_1.PLATFORMS.ANDROID),
|
||||
};
|
||||
//# sourceMappingURL=setup.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/bin/commands/setup.ts"],"names":[],"mappings":";;;;;AAAA,oDAAuB;AAEvB,iEAAgF;AAChF,iEAAgF;AAChF,2DAA2C;AAC3C,+CAA6C;AAC7C,0DAAmC;AAEnC,MAAM,CAAC,GAAG,gBAAM,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,wBAAwB,EAAE,CAAC,CAAC;AAEjE,SAAS,kBAAkB,CAAC,QAAgB,EAAE,EAAW;IACvD,OAAO,CAAC,OAAY,EAAE,EAAE;QACtB,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,QAAQ,EAAE,CAAC,CAAC;QACrD,MAAM,mBAAmB,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QACxC,OAAO;aACJ,KAAK,CAAC,IAAI,mBAAmB,EAAE,CAAC;aAChC,WAAW,CAAC,kCAAkC,gBAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,mBAAmB,CAAC;aACxF,MAAM,CACL,6BAA6B,EAC7B,sDAAsD,CACvD;aACA,WAAW,CAAC,KAAK,EAAE,GAAQ,EAAE,EAAE,CAAC,MAAM,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;IACpF,CAAC,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,WAAW,CAAC,OAAY,EAAE,GAAQ,EAAE,QAAgB,EAAE,EAAW;IAC9E,IAAI;QACF,IAAI,EAAE,IAAI,OAAO,CAAC,QAAQ,KAAK,EAAE,EAAE;YACjC,MAAM,IAAI,KAAK,CAAC,4FAA4F,CAAC,CAAC;SAC/G;QAED,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC;QAC3B,MAAM,eAAK,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QAClC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;KAC1B;IAAC,OAAO,GAAG,EAAE;QACZ,gBAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,mCAAmC,QAAQ,SAAS,CAAC,CAAC;QAC5E,IAAI,GAAG,YAAY,2CAAoB,EAAE;YACvC,GAAG,CAAC,IAAI,EAAE,CAAC;SACZ;aAAM,IAAI,GAAG,YAAY,2CAAoB,EAAE;YAC9C,OAAO,CAAC,IAAI,EAAE,CAAC;SAChB;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC;AAED,kBAAe;IACb,GAAG,EAAE,kBAAkB,CAAC,qBAAS,CAAC,GAAG,EAAE,QAAQ,CAAC;IAChD,OAAO,EAAE,kBAAkB,CAAC,qBAAS,CAAC,OAAO,CAAC;CAC/C,CAAC","sourcesContent":["import _ from 'lodash';\n\nimport { ErrorWithCommandHelp } from 'turtle/bin/commands/ErrorWithCommandHelp';\nimport { ErrorWithProgramHelp } from 'turtle/bin/commands/ErrorWithProgramHelp';\nimport setup from 'turtle/bin/setup/setup';\nimport { PLATFORMS } from 'turtle/constants';\nimport logger from 'turtle/logger';\n\nconst l = logger.child({ buildPhase: 'setting up environment' });\n\nfunction createSetupCommand(platform: string, os?: string) {\n return (program: any) => {\n const command = program.command(`setup:${platform}`);\n const platformFirstLetter = platform[0];\n command\n .alias(`s${platformFirstLetter}`)\n .description(`Setup environment for building ${_.capitalize(platform)} standalone apps.`)\n .option(\n '--sdk-version <sdk-version>',\n 'version of Expo SDK shell app to download (optional)',\n )\n .asyncAction(async (cmd: any) => await setupAction(program, cmd, platform, os));\n };\n}\n\nasync function setupAction(program: any, cmd: any, platform: string, os?: string) {\n try {\n if (os && process.platform !== os) {\n throw new Error('We don\\'t support running standalone app builds for this platform on your operating system');\n }\n\n const { sdkVersion } = cmd;\n await setup(platform, sdkVersion);\n l.info('it\\'s all set!');\n } catch (err) {\n logger.error({ err }, `Failed to setup environment for ${platform} builds`);\n if (err instanceof ErrorWithCommandHelp) {\n cmd.help();\n } else if (err instanceof ErrorWithProgramHelp) {\n program.help();\n }\n process.exit(1);\n }\n}\n\nexport default {\n ios: createSetupCommand(PLATFORMS.IOS, 'darwin'),\n android: createSetupCommand(PLATFORMS.ANDROID),\n};\n"]}
|
||||
@@ -1,53 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const os_1 = __importDefault(require("os"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const lodash_1 = __importDefault(require("lodash"));
|
||||
const env_1 = require("../utils/env");
|
||||
const resolveEnv = () => {
|
||||
if (env_1.env('EXPO_LOCAL', '0') === '1') {
|
||||
return 'local';
|
||||
}
|
||||
else if (env_1.env('EXPO_STAGING', '0') === '1') {
|
||||
return 'staging';
|
||||
}
|
||||
else {
|
||||
return 'production';
|
||||
}
|
||||
};
|
||||
const currentEnv = resolveEnv();
|
||||
const isLocal = (envName) => envName === 'local';
|
||||
const isStaging = (envName) => envName === 'staging';
|
||||
const apiConfig = {
|
||||
protocol: 'https',
|
||||
hostname: 'exp.host',
|
||||
port: 443,
|
||||
};
|
||||
if (isStaging(currentEnv)) {
|
||||
apiConfig.hostname = 'staging.exp.host';
|
||||
}
|
||||
else if (isLocal(currentEnv)) {
|
||||
apiConfig.protocol = 'http';
|
||||
apiConfig.hostname = 'localhost';
|
||||
apiConfig.port = 3000;
|
||||
}
|
||||
const OFFLINE_ENV_VARS = {
|
||||
TURTLE_MODE: 'offline',
|
||||
API_PROTOCOL: apiConfig.protocol,
|
||||
API_HOSTNAME: apiConfig.hostname,
|
||||
API_PORT: apiConfig.port,
|
||||
TURTLE_FAKE_UPLOAD: '1',
|
||||
TURTLE_FAKE_UPLOAD_DIR: path_1.default.join(os_1.default.homedir(), 'expo-apps'),
|
||||
TURTLE_WORKING_DIR_PATH: path_1.default.join(os_1.default.homedir(), '.turtle/workingdir'),
|
||||
EXPO_SKIP_SOURCING: '1',
|
||||
};
|
||||
function initOfflineEnv() {
|
||||
lodash_1.default.map(OFFLINE_ENV_VARS, (val, key) => {
|
||||
process.env[key] = String(val);
|
||||
});
|
||||
}
|
||||
exports.initOfflineEnv = initOfflineEnv;
|
||||
//# sourceMappingURL=env.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/bin/env.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,oDAAuB;AAEvB,sCAAuC;AAEvC,MAAM,UAAU,GAAG,GAAG,EAAE;IACtB,IAAI,SAAG,CAAC,YAAY,EAAE,GAAG,CAAC,KAAK,GAAG,EAAE;QAClC,OAAO,OAAO,CAAC;KAChB;SAAM,IAAI,SAAG,CAAC,cAAc,EAAE,GAAG,CAAC,KAAK,GAAG,EAAE;QAC3C,OAAO,SAAS,CAAC;KAClB;SAAM;QACL,OAAO,YAAY,CAAC;KACrB;AACH,CAAC,CAAC;AAEF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path from 'path';\n\nimport _ from 'lodash';\n\nimport { env } from 'turtle/utils/env';\n\nconst resolveEnv = () => {\n if (env('EXPO_LOCAL', '0') === '1') {\n return 'local';\n } else if (env('EXPO_STAGING', '0') === '1') {\n return 'staging';\n } else {\n return 'production';\n }\n};\n\nconst currentEnv = resolveEnv();\nconst isLocal = (envName: string) => envName === 'local';\nconst isStaging = (envName: string) => envName === 'staging';\n\nconst apiConfig = {\n protocol: 'https',\n hostname: 'exp.host',\n port: 443,\n};\n\nif (isStaging(currentEnv)) {\n apiConfig.hostname = 'staging.exp.host';\n} else if (isLocal(currentEnv)) {\n apiConfig.protocol = 'http';\n apiConfig.hostname = 'localhost';\n apiConfig.port = 3000;\n}\n\nconst OFFLINE_ENV_VARS = {\n TURTLE_MODE: 'offline',\n API_PROTOCOL: apiConfig.protocol,\n API_HOSTNAME: apiConfig.hostname,\n API_PORT: apiConfig.port,\n TURTLE_FAKE_UPLOAD: '1',\n TURTLE_FAKE_UPLOAD_DIR: path.join(os.homedir(), 'expo-apps'),\n TURTLE_WORKING_DIR_PATH: path.join(os.homedir(), '.turtle/workingdir'),\n EXPO_SKIP_SOURCING: '1',\n};\n\nexport function initOfflineEnv() {\n _.map(OFFLINE_ENV_VARS, (val, key) => {\n process.env[key] = String(val);\n });\n}\n"]}
|
||||
@@ -1,71 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const xdl_1 = require("@expo/xdl");
|
||||
const commander_1 = __importStar(require("commander"));
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const commands = __importStar(require("./commands"));
|
||||
const logger_1 = __importDefault(require("../logger"));
|
||||
const { name, version } = JSON.parse(fs_extra_1.default.readFileSync(path_1.default.join(__dirname, '../../package.json'), 'utf-8'));
|
||||
const ModuleVersionChecker = xdl_1.ModuleVersion.createModuleVersionChecker(name, version);
|
||||
xdl_1.LoggerDetach.configure(logger_1.default);
|
||||
commander_1.Command.prototype.asyncAction = function asyncAction(asyncFn) {
|
||||
return this.action(async (...args) => {
|
||||
try {
|
||||
await checkForUpdateAsync();
|
||||
}
|
||||
catch (err) {
|
||||
logger_1.default.warn({ err }, 'Failed to check for turtle-cli update.');
|
||||
}
|
||||
return await asyncFn(...args);
|
||||
});
|
||||
};
|
||||
function run(programName) {
|
||||
runAsync(programName).catch((err) => {
|
||||
logger_1.default.error({ err }, 'Uncaught Error');
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
exports.run = run;
|
||||
async function runAsync(programName) {
|
||||
commander_1.default.version(version);
|
||||
Object.values(commands).forEach((command) => registerCommand(commander_1.default, command));
|
||||
commander_1.default.parse(process.argv);
|
||||
const subCommand = process.argv[2];
|
||||
if (subCommand) {
|
||||
const commandNames = commander_1.default.commands.reduce((acc, command) => {
|
||||
acc.push(command._name);
|
||||
const alias = command._alias;
|
||||
if (alias) {
|
||||
acc.push(alias);
|
||||
}
|
||||
return acc;
|
||||
}, []);
|
||||
if (!commandNames.includes(subCommand)) {
|
||||
logger_1.default.error(`"${subCommand}" is not an ${programName} command. See "${programName} --help" for the full list of commands.`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
commander_1.default.help();
|
||||
}
|
||||
}
|
||||
const registerCommand = (prog, command) => command(prog);
|
||||
async function checkForUpdateAsync() {
|
||||
const { updateIsAvailable, current, latest } = await ModuleVersionChecker.checkAsync();
|
||||
if (updateIsAvailable) {
|
||||
logger_1.default.warn(`There is a new version of ${name} available (${latest}).
|
||||
You are currently using ${name} ${current}
|
||||
Run \`npm install -g ${name}\` to get the latest version`);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAAwB;AAExB,mCAAwD;AACxD,uDAA6C;AAC7C,wDAA0B;AAE1B,qDAAgD;AAChD,uDAAmC;AAEnC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;AAE3G,MAAM,oBAAoB,GAAG,mBAAa,CAAC,0BAA0B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAErF,kBAAY,CAAC,SAAS,CAAC,gBAAM,CAAC,CAAC;AAE/B,mBAAO,CAAC,SAAS,CAAC,WAAW,GAAG,SAAS,WAAW,CAAC,OAAwC;IAC3F,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE;QACnC,IAAI;YACF,MAAM,mBAAmB,EAAE,CAAC;SAC7B;QAAC,OAAO,GAAG,EAAE;YACZ,gBAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,wCAAwC,CAAC,CAAC;SAChE;QACD,OAAO,MAAM,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,SAAgB,GAAG,CAAC,WAAmB;IACrC,QAAQ,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QAClC,gBAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,gBAAgB,CAAC,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,C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AI,CACT,6BAA6B,IAAI,eAAe,MAAM;0BAClC,IAAI,IAAI,OAAO;uBAClB,IAAI,8BAA8B,CACpD,CAAC;KACH;AACH,CAAC","sourcesContent":["import path from 'path';\n\nimport { LoggerDetach, ModuleVersion } from '@expo/xdl';\nimport program, { Command } from 'commander';\nimport fs from 'fs-extra';\n\nimport * as commands from 'turtle/bin/commands';\nimport logger from 'turtle/logger';\n\nconst { name, version } = JSON.parse(fs.readFileSync(path.join(__dirname, '../../package.json'), 'utf-8'));\n\nconst ModuleVersionChecker = ModuleVersion.createModuleVersionChecker(name, version);\n\nLoggerDetach.configure(logger);\n\nCommand.prototype.asyncAction = function asyncAction(asyncFn: (...asyncFnArgs: any[]) => void): Command {\n return this.action(async (...args) => {\n try {\n await checkForUpdateAsync();\n } catch (err) {\n logger.warn({ err }, 'Failed to check for turtle-cli update.');\n }\n return await asyncFn(...args);\n });\n};\n\nexport function run(programName: string) {\n runAsync(programName).catch((err) => {\n logger.error({ err }, 'Uncaught Error');\n process.exit(1);\n });\n}\n\nasync function runAsync(programName: string) {\n program.version(version);\n Object.values(commands).forEach((command) => registerCommand(program, command));\n program.parse(process.argv);\n\n const subCommand = process.argv[2];\n if (subCommand) {\n const commandNames = program.commands.reduce((acc: string[], command: any) => {\n acc.push(command._name);\n const alias = command._alias;\n if (alias) {\n acc.push(alias);\n }\n return acc;\n }, []);\n if (!commandNames.includes(subCommand)) {\n logger.error(\n `\"${subCommand}\" is not an ${programName} command. See \"${programName} --help\" for the full list of commands.`,\n );\n }\n } else {\n program.help();\n }\n}\n\nconst registerCommand = (prog: any, command: any) => command(prog);\n\nasync function checkForUpdateAsync() {\n const { updateIsAvailable, current, latest } = await ModuleVersionChecker.checkAsync();\n if (updateIsAvailable) {\n logger.warn(\n `There is a new version of ${name} available (${latest}).\nYou are currently using ${name} ${current}\nRun \\`npm install -g ${name}\\` to get the latest version`,\n );\n }\n}\n"]}
|
||||
@@ -1,116 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const util_1 = __importDefault(require("util"));
|
||||
const xdl_1 = require("@expo/xdl");
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const which_1 = __importDefault(require("which"));
|
||||
const sdk_1 = __importDefault(require("./sdk"));
|
||||
const common_1 = require("../utils/common");
|
||||
const workingdir_1 = require("../../../builders/utils/android/workingdir");
|
||||
const config_1 = __importDefault(require("../../../config"));
|
||||
const constants_1 = require("../../../constants");
|
||||
const logger_1 = __importDefault(require("../../../logger"));
|
||||
const which = util_1.default.promisify(which_1.default);
|
||||
const JAVA_REQUIRED_VERSION = 8;
|
||||
const REQUIRED_TOOLS = [
|
||||
{
|
||||
command: 'bash',
|
||||
missingDescription: 'Please install bash',
|
||||
},
|
||||
{
|
||||
command: 'javac',
|
||||
missingDescription: `Please install JDK 8 - keep in mind that other versions are not supported by Android`,
|
||||
testFn: async () => {
|
||||
const { status, stdout, stderr } = await xdl_1.ExponentTools.spawnAsyncThrowError('java', ['-version'], { stdio: 'pipe' });
|
||||
if (stdout.match(/no java runtime present/i)) {
|
||||
return false;
|
||||
}
|
||||
const matchResult = stderr.match(/.*version "(.*)"/);
|
||||
if (matchResult) {
|
||||
const [, currentFullJavaVersion] = matchResult;
|
||||
const javaMajorVersionPosition = currentFullJavaVersion.startsWith('1.') ? 1 : 0;
|
||||
const javaMajorVersion = Number(currentFullJavaVersion.split('.')[javaMajorVersionPosition]);
|
||||
if (javaMajorVersion !== JAVA_REQUIRED_VERSION) {
|
||||
throw new Error(`You're on Java ${currentFullJavaVersion}, please install version ${JAVA_REQUIRED_VERSION}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
logger_1.default.warn(`Couldn't find Java version number, assuming you're on Java ${JAVA_REQUIRED_VERSION}...`);
|
||||
}
|
||||
return status === 0;
|
||||
},
|
||||
},
|
||||
];
|
||||
const LOGGER_FIELDS = { buildPhase: 'setting up environment' };
|
||||
const l = logger_1.default.child(LOGGER_FIELDS);
|
||||
async function setup(sdkVersion) {
|
||||
await common_1.checkSystem(REQUIRED_TOOLS);
|
||||
await prepareAndroidEnv();
|
||||
if (sdkVersion) {
|
||||
await common_1.ensureShellAppIsPresent(sdkVersion, { formatShellAppDirectory: workingdir_1.formatShellAppDirectory, formatShellAppTarballUriPath }, _shellAppPostDownloadAction);
|
||||
}
|
||||
}
|
||||
exports.default = setup;
|
||||
async function prepareAndroidEnv() {
|
||||
await fs_extra_1.default.ensureDir(config_1.default.directories.androidDependenciesDir);
|
||||
const sdkConfig = await sdk_1.default();
|
||||
_setEnvVars(sdkConfig.envVars);
|
||||
_alterPath(sdkConfig.path);
|
||||
}
|
||||
function formatShellAppTarballUriPath(sdkMajorVersion) {
|
||||
return path_1.default.join(config_1.default.directories.shellTarballsDir, constants_1.PLATFORMS.ANDROID, `sdk${sdkMajorVersion}`);
|
||||
}
|
||||
async function _shellAppPostDownloadAction(sdkVersion, workingdir) {
|
||||
const inWorkingdir = (filename) => path_1.default.join(workingdir, filename);
|
||||
if (await fs_extra_1.default.pathExists(inWorkingdir('universe-package.json'))) {
|
||||
// legacy shell app built from universe
|
||||
await fs_extra_1.default.move(inWorkingdir('package.json'), inWorkingdir('exponent-package.json'));
|
||||
await fs_extra_1.default.move(inWorkingdir('universe-package.json'), inWorkingdir('package.json'));
|
||||
await _installNodeModules(workingdir);
|
||||
await fs_extra_1.default.move(inWorkingdir('package.json'), inWorkingdir('universe-package.json'));
|
||||
await fs_extra_1.default.move(inWorkingdir('exponent-package.json'), inWorkingdir('package.json'));
|
||||
}
|
||||
else {
|
||||
// new shell app built from expo or not
|
||||
await _installNodeModules(workingdir);
|
||||
}
|
||||
// TODO: remove this after making sure that we don't need node_modules in tools-public for older sdks
|
||||
if (xdl_1.ExponentTools.parseSdkMajorVersion(sdkVersion) < 33) {
|
||||
const toolsPublicDir = path_1.default.join(workingdir, 'tools-public');
|
||||
await _installNodeModules(toolsPublicDir);
|
||||
}
|
||||
}
|
||||
async function _installNodeModules(cwd) {
|
||||
l.info(`installing dependencies in ${cwd} directory...`);
|
||||
const command = await _shouldUseYarnOrNpm();
|
||||
await xdl_1.ExponentTools.spawnAsyncThrowError(command, ['install'], {
|
||||
pipeToLogger: true,
|
||||
loggerFields: LOGGER_FIELDS,
|
||||
cwd,
|
||||
});
|
||||
l.info('dependencies installed!');
|
||||
}
|
||||
async function _shouldUseYarnOrNpm() {
|
||||
try {
|
||||
await which('yarn');
|
||||
return 'yarn';
|
||||
}
|
||||
catch (err) {
|
||||
return 'npm';
|
||||
}
|
||||
}
|
||||
function _setEnvVars(envVars) {
|
||||
Object
|
||||
.entries(envVars)
|
||||
.forEach(([key, value]) => process.env[key] = value);
|
||||
}
|
||||
function _alterPath(newPaths) {
|
||||
const currentPaths = process.env.PATH ? process.env.PATH.split(':') : [];
|
||||
const paths = [...newPaths, ...currentPaths];
|
||||
process.env.PATH = paths.join(':');
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/bin/setup/android/index.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AACxB,gDAAwB;AAExB,mCAA0C;AAC1C,wDAA0B;AAC1B,kDAA2B;AAE3B,gDAAqE;AACrE,4CAAqF;AAErF,2EAAmF;AACnF,6DAAmC;AACnC,kDAA6C;AAC7C,6DAAmC;AAEnC,MAAM,KAAK,GAAG,cAAI,CAAC,SAAS,CAAC,eAAM,CAAC,CAAC;AACrC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAChC,MAAM,cAAc,GAAsB;IACxC;QACE,OAAO,EAAE,MAAM;QACf,kBAAkB,EAAE,qBAAqB;KAC1C;IACD;QACE,OAAO,EAAE,OAAO;QAChB,kBAAkB,EAChB,sFAAsF;QACxF,MAAM,EA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O,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACzE,MAAM,KAAK,GAAG,CAAC,GAAG,QAAQ,EAAE,GAAG,YAAY,CAAC,CAAC;IAC7C,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC","sourcesContent":["import path from 'path';\nimport util from 'util';\n\nimport { ExponentTools } from '@expo/xdl';\nimport fs from 'fs-extra';\nimport _which from 'which';\n\nimport ensureAndroidSDKIsPresent from 'turtle/bin/setup/android/sdk';\nimport { checkSystem, ensureShellAppIsPresent } from 'turtle/bin/setup/utils/common';\nimport { IToolDefinition } from 'turtle/bin/setup/utils/toolsDetector';\nimport { formatShellAppDirectory } from 'turtle/builders/utils/android/workingdir';\nimport config from 'turtle/config';\nimport { PLATFORMS } from 'turtle/constants';\nimport logger from 'turtle/logger';\n\nconst which = util.promisify(_which);\nconst JAVA_REQUIRED_VERSION = 8;\nconst REQUIRED_TOOLS: IToolDefinition[] = [\n {\n command: 'bash',\n missingDescription: 'Please install bash',\n },\n {\n command: 'javac',\n missingDescription:\n `Please install JDK 8 - keep in mind that other versions are not supported by Android`,\n testFn: async () => {\n const { status, stdout, stderr } = await ExponentTools.spawnAsyncThrowError(\n 'java',\n ['-version'],\n { stdio: 'pipe' },\n Line truncated
|
||||
@@ -1,87 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const os_1 = __importDefault(require("os"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const xdl_1 = require("@expo/xdl");
|
||||
const decompress_1 = __importDefault(require("decompress"));
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const utils = __importStar(require("../utils/common"));
|
||||
const downloader_1 = __importDefault(require("../utils/downloader"));
|
||||
const config_1 = __importDefault(require("../../../config"));
|
||||
const logger_1 = __importDefault(require("../../../logger"));
|
||||
const ANDROID_SDK_URL = 'https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip';
|
||||
const LOGGER_FIELDS = { buildPhase: 'setting up environment' };
|
||||
const l = logger_1.default.child(LOGGER_FIELDS);
|
||||
async function ensureAndroidSDKIsPresent() {
|
||||
const androidSdkDir = path_1.default.join(config_1.default.directories.androidDependenciesDir, 'sdk');
|
||||
await utils.removeDirectoryUnlessReady(androidSdkDir);
|
||||
if (!(await fs_extra_1.default.pathExists(androidSdkDir))) {
|
||||
await fs_extra_1.default.ensureDir(androidSdkDir);
|
||||
const androidSdkDownloadPath = utils.formatArtifactDownloadPath(ANDROID_SDK_URL);
|
||||
try {
|
||||
l.info('Downloading Android SDK');
|
||||
await fs_extra_1.default.ensureDir(config_1.default.directories.artifactsDir);
|
||||
await downloader_1.default(ANDROID_SDK_URL, androidSdkDownloadPath);
|
||||
await fs_extra_1.default.ensureDir(androidSdkDir);
|
||||
l.info('Decompressing Android SDK');
|
||||
await decompress_1.default(androidSdkDownloadPath, androidSdkDir);
|
||||
await fs_extra_1.default.remove(androidSdkDownloadPath);
|
||||
l.info('Configuring Android SDK, this may take a while');
|
||||
await _configureSdk(androidSdkDir);
|
||||
await utils.markDirectoryAsReady(androidSdkDir);
|
||||
l.info('Android SDK installed and configured successfully');
|
||||
}
|
||||
catch (err) {
|
||||
await fs_extra_1.default.remove(androidSdkDir);
|
||||
throw err;
|
||||
}
|
||||
finally {
|
||||
await fs_extra_1.default.remove(androidSdkDownloadPath);
|
||||
}
|
||||
}
|
||||
return {
|
||||
envVars: _createEnvVars(androidSdkDir),
|
||||
path: _createPaths(androidSdkDir),
|
||||
};
|
||||
}
|
||||
exports.default = ensureAndroidSDKIsPresent;
|
||||
async function _configureSdk(androidSdkDir) {
|
||||
// prevents warnings about missing repo config
|
||||
const androidRepositoriesCfgPath = path_1.default.join(os_1.default.homedir(), '.android/repositories.cfg');
|
||||
await fs_extra_1.default.ensureFile(androidRepositoriesCfgPath);
|
||||
await xdl_1.ExponentTools.spawnAsyncThrowError('./configureAndroidSdk.sh', [], {
|
||||
pipeToLogger: true,
|
||||
loggerFields: LOGGER_FIELDS,
|
||||
cwd: path_1.default.join(config_1.default.directories.rootDir, 'scripts/android'),
|
||||
env: {
|
||||
...process.env,
|
||||
ANDROID_HOME: androidSdkDir,
|
||||
ANDROID_SDK: androidSdkDir,
|
||||
},
|
||||
});
|
||||
}
|
||||
function _createEnvVars(androidSdkDir) {
|
||||
return {
|
||||
ANDROID_HOME: androidSdkDir,
|
||||
ANDROID_SDK: androidSdkDir,
|
||||
};
|
||||
}
|
||||
function _createPaths(androidSdkDir) {
|
||||
return [
|
||||
path_1.default.join(androidSdkDir, 'platform-tools'),
|
||||
path_1.default.join(androidSdkDir, 'tools'),
|
||||
path_1.default.join(androidSdkDir, 'tools/bin'),
|
||||
path_1.default.join(androidSdkDir, 'build-tools/28.0.3'),
|
||||
];
|
||||
}
|
||||
//# sourceMappingURL=sdk.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../../../src/bin/setup/android/sdk.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,mCAA0C;AAC1C,4DAAoC;AACpC,wDAA0B;AAE1B,uDAAuD;AACvD,qEAAyD;AACzD,6DAAmC;AACnC,6DAAmC;AAEnC,MAAM,eAAe,GAAG,sEAAsE,CAAC;AAE/F,MAAM,aAAa,GAAG,EAAE,UAAU,EAAE,wBAAwB,EAAE,CAAC;AAC/D,MAAM,CAAC,G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sB,CAAC,CAAC;SACzC;KACF;IACD,OAAO;QACL,OAAO,EAAE,cAAc,CAAC,aAAa,CAAC;QACtC,IAAI,EAAE,YAAY,CAAC,aAAa,CAAC;KAClC,CAAC;AACJ,CAAC;AA9BD,4CA8BC;AAED,KAAK,UAAU,aAAa,CAAC,aAAqB;IAChD,8CAA8C;IAC9C,MAAM,0BAA0B,GAAG,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,2BAA2B,CAAC,CAAC;IACxF,MAAM,kBAAE,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC;IAChD,MAAM,mBAAa,CAAC,oBAAoB,CAAC,0BAA0B,EAAE,EAAE,EAAE;QACvE,YAAY,EAAE,IAAI;QAClB,YAAY,EAAE,aAAa;QAC3B,GAAG,EAAE,cAAI,CAAC,IAAI,CAAC,gBAAM,CAAC,WAAW,CAAC,OAAO,EAAE,iBAAiB,CAAC;QAC7D,GAAG,EAAE;YACH,GAAG,OAAO,CAAC,GAAG;YACd,YAAY,EAAE,aAAa;YAC3B,WAAW,EAAE,aAAa;SAC3B;KACF,CAAC,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CAAC,aAAqB;IAC3C,OAAO;QACL,YAAY,EAAE,aAAa;QAC3B,WAAW,EAAE,aAAa;KAC3B,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,aAAqB;IACzC,OAAO;QACL,cAAI,CAAC,IAAI,CAAC,aAAa,EAAE,gBAAgB,CAAC;QAC1C,cAAI,CAAC,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC;QACjC,cAAI,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC;QACrC,cAAI,CAAC,IAAI,CAAC,aAAa,EAAE,oBAAoB,CAAC;KAC/C,CAAC;AACJ,CAAC","sourcesContent":["import os from 'os';\nimport path from 'path';\n\nimport { ExponentTools } from '@expo/xdl';\nimport decompress from 'decompress';\nimport fs from 'fs-extra';\n\nimport * as utils from 'turtle/bin/setup/utils/common';\nimport download from 'turtle/bin/setup/utils/downloader';\nimport config from 'turtle/config';\nimport logger from 'turtle/logger';\n\nconst ANDROID_SDK_URL = 'https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip';\n\nconst LOGGER_FIELDS = { buildPhase: 'setting up environment' };\nconst l = logger.child(LOGGER_FIELDS);\n\nexport default async function ensureAndroidSDKIsPresent() {\n const androidSdkDir = path.join(config.directories.androidDependenciesDir, 'sdk');\n await utils.removeDirectoryUnlessReady(androidSdkDir);\n if (!(await fs.pathExists(androidSdkDir))) {\n await fs.ensureDir(androidSdkDir);\n const androidSdkDownloadPath = utils.formatArtifactDownloadPath(ANDROID_SDK_URL);\n\n try {\n l.info('Downloading Android SDK');\n await fs.ensureDir(config.directories.artifactsDir);\n await download(ANDROID_SDK_URL, androidSdkDownloadPath);\n await fs.ensureDir(androidSdkDir);\n l.info('Decompressing Android SDK');\n await decompress(androidSdkDownloadPath, androidSdkDir);\n await fs.remove(androidSdkDownloadPath);\n l.info('Configuring Android SDK, this may take a while');\n await _configureSdk(androidSdkDir);\n await utils.markDirectoryAsReady(androidSdkDir);\n l.info('Android SDK installed and configured successfully');\n } catch (err) {\n await fs.remove(androidSdkDir);\n throw err;\n } finally {\n await fs.remove(androidSdkDownloadPath);\n }\n }\n return {\n envVars: _createEnvVars(androidSdkDir),\n path: _createPaths(androidSdkDir),\n };\n}\n\nasync function _configureSdk(androidSdkDir: string) {\n // prevents warnings about missing repo config\n const androidRepositoriesCfgPath = path.join(os.homedir(), '.android/repositories.cfg');\n await fs.ensureFile(androidRepositoriesCfgPath);\n await ExponentTools.spawnAsyncThrowError('./configureAndroidSdk.sh', [], {\n pipeToLogger: true,\n loggerFields: LOGGER_FIELDS,\n cwd: path.join(config.directories.rootDir, 'scripts/android'),\n env: {\n ...process.env,\n ANDROID_HOME: androidSdkDir,\n ANDROID_SDK: androidSdkDir,\n },\n });\n}\n\nfunction _createEnvVars(androidSdkDir: string) {\n return {\n ANDROID_HOME: androidSdkDir,\n ANDROID_SDK: androidSdkDir,\n };\n}\n\nfunction _createPaths(androidSdkDir: string) {\n return [\n path.join(androidSdkDir, 'platform-toLine truncated
|
||||
@@ -1,84 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const last_1 = __importDefault(require("lodash/last"));
|
||||
const trim_1 = __importDefault(require("lodash/trim"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const semver_1 = __importDefault(require("semver"));
|
||||
const xdl_1 = require("@expo/xdl");
|
||||
const common_1 = require("./utils/common");
|
||||
const workingdir_1 = require("../../builders/utils/ios/workingdir");
|
||||
const config_1 = __importDefault(require("../../config"));
|
||||
const constants_1 = require("../../constants");
|
||||
const logger_1 = __importDefault(require("../../logger"));
|
||||
const REQUIRED_TOOLS = [
|
||||
{
|
||||
command: 'bash',
|
||||
missingDescription: 'Please install bash',
|
||||
},
|
||||
{
|
||||
command: 'fastlane',
|
||||
missingDescription: 'Please check https://docs.fastlane.tools/getting-started/ios/setup/',
|
||||
versionCheckFn: async () => {
|
||||
const MINIMAL_VERSION = '2.99.0';
|
||||
const { stdout } = await xdl_1.ExponentTools.spawnAsyncThrowError('fastlane', ['--version'], { stdio: 'pipe', env: { ...process.env, FASTLANE_SKIP_UPDATE_CHECK: '1', LC_ALL: 'en_US.UTF-8' } });
|
||||
const fastlaneVersion = parseFastlaneVersion(stdout);
|
||||
if (fastlaneVersion && !semver_1.default.satisfies(fastlaneVersion, `>= ${MINIMAL_VERSION}`)) {
|
||||
throw new Error(`Your fastlane is on version ${fastlaneVersion}. Please upgrade it to at least ${MINIMAL_VERSION}.`);
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
command: 'xcode',
|
||||
missingDescription: 'Please ensure xcode is properly installed',
|
||||
testFn: async () => {
|
||||
const { status, stdout } = await xdl_1.ExponentTools.spawnAsyncThrowError('xcodebuild', ['-version'], { stdio: 'pipe' });
|
||||
if (stdout.match(/requires xcode/i)) {
|
||||
return false;
|
||||
}
|
||||
if (status !== 0) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
await xdl_1.ExponentTools.spawnAsyncThrowError('ibtool', ['--version'], { stdio: 'pipe' });
|
||||
}
|
||||
catch (err) {
|
||||
if (err.stderr) {
|
||||
const stderr = err.stderr.trim();
|
||||
if (stderr.match(/Agreeing to the Xcode\/iOS license/)) {
|
||||
logger_1.default.error('You have not accepted the Xcode license. Run \'sudo xcodebuild -runFirstLaunch\' to do so.');
|
||||
return false;
|
||||
}
|
||||
if (stderr.match(/The bundle is damaged or missing necessary resources/)) {
|
||||
logger_1.default.error('Make sure to install additional required components. Run \'sudo xcodebuild -runFirstLaunch\' to do so.');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
},
|
||||
];
|
||||
async function setup(sdkVersion) {
|
||||
await common_1.checkSystem(REQUIRED_TOOLS);
|
||||
if (sdkVersion) {
|
||||
await common_1.ensureShellAppIsPresent(sdkVersion, {
|
||||
formatShellAppDirectory: workingdir_1.formatShellAppDirectory,
|
||||
formatShellAppTarballUriPath,
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.default = setup;
|
||||
function formatShellAppTarballUriPath(sdkMajorVersion) {
|
||||
return path_1.default.join(config_1.default.directories.shellTarballsDir, constants_1.PLATFORMS.IOS, `sdk${sdkMajorVersion}`);
|
||||
}
|
||||
function parseFastlaneVersion(stdout) {
|
||||
const lastLine = last_1.default(trim_1.default(stdout).split('\n'));
|
||||
if (!lastLine) {
|
||||
return null;
|
||||
}
|
||||
return last_1.default(lastLine.split(' ')) || null;
|
||||
}
|
||||
//# sourceMappingURL=ios.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"ios.js","sourceRoot":"","sources":["../../../src/bin/setup/ios.ts"],"names":[],"mappings":";;;;;AAAA,uDAA+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I,CAAC;KACb;IACD,OAAO,cAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC;AAC3C,CAAC","sourcesContent":["import last from 'lodash/last';\nimport trim from 'lodash/trim';\nimport path from 'path';\nimport semver from 'semver';\n\nimport { ExponentTools } from '@expo/xdl';\n\nimport { checkSystem, ensureShellAppIsPresent } from 'turtle/bin/setup/utils/common';\nimport { IToolDefinition } from 'turtle/bin/setup/utils/toolsDetector';\nimport { formatShellAppDirectory } from 'turtle/builders/utils/ios/workingdir';\nimport config from 'turtle/config';\nimport { PLATFORMS } from 'turtle/constants';\nimport logger from 'turtle/logger';\n\nconst REQUIRED_TOOLS: IToolDefinition[] = [\n {\n command: 'bash',\n missingDescription: 'Please install bash',\n },\n {\n command: 'fastlane',\n missingDescription: 'Please check https://docs.fastlane.tools/getting-started/ios/setup/',\n versionCheckFn: async () => {\n const MINIMAL_VERSION = '2.99.0';\n\n const { stdout } = await ExponentTools.spawnAsyncThrowError(\n 'fastlane',\n ['--version'],\n { stdio: 'pipe', env: { ...process.env, FASTLANE_SKIP_UPDATE_CHECK: '1', LC_ALL: 'en_US.UTF-8' } },\n );\n const fastlaneVersion = parseFastlaneVersion(stdout);\n if (fastlaneVersion && !semver.satisfies(fastlaneVersion, `>= ${MINIMAL_VERSION}`)) {\n throw new Error(\n `Your fastlane is on version ${fastlaneVersion}. Please upgrade it to at least ${MINIMAL_VERSION}.`,\n );\n }\n },\n },\n {\n command: 'xcode',\n missingDescription: 'Please ensure xcode is properly installed',\n testFn: async () => {\n const { status, stdout } = await ExponentTools.spawnAsyncThrowError(\n 'xcodebuild',\n ['-version'],\n { stdio: 'pipe' },\n );\n if (stdout.match(/requires xcode/i)) {\n return false;\n }\n\n if (status !== 0) {\n return false;\n }\n\n try {\n await ExponentTools.spawnAsyncThrowError('ibtool', ['--version'], { stdio: 'pipe' });\n } catch (err) {\n if (err.stderr) {\n const stderr = err.stderr.trim();\n if (stderr.match(/Agreeing to the Xcode\\/iOS license/)) {\n logger.error('You have not accepted the Xcode license. Run \\'sudo xcodebuild -runFirstLaunch\\' to do so.');\n return false;\n }\n if (stderr.match(/The bundle is damaged or missing necessary resources/)) {\n logger.error(\n 'Make sure to install additional required components. Run \\'sudo xcodebuild -runFirstLaunch\\' to do so.',\n );\n return false;\n }\n }\n }\n\n return true;\n },\n },\n];\n\nexport dLine truncated
|
||||
@@ -1,25 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const is_semver_1 = __importDefault(require("is-semver"));
|
||||
const android_1 = __importDefault(require("./android"));
|
||||
const ios_1 = __importDefault(require("./ios"));
|
||||
const constants_1 = require("../../constants");
|
||||
async function setup(platform, sdkVersion) {
|
||||
if (sdkVersion && !is_semver_1.default(sdkVersion)) {
|
||||
throw new Error('SDK version is not valid.');
|
||||
}
|
||||
if (platform === constants_1.PLATFORMS.IOS) {
|
||||
return await ios_1.default(sdkVersion);
|
||||
}
|
||||
else if (platform === constants_1.PLATFORMS.ANDROID) {
|
||||
return await android_1.default(sdkVersion);
|
||||
}
|
||||
else {
|
||||
throw new Error('This should never happen :(');
|
||||
}
|
||||
}
|
||||
exports.default = setup;
|
||||
//# sourceMappingURL=setup.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/bin/setup/setup.ts"],"names":[],"mappings":";;;;;AAAA,0DAAiC;AAEjC,wDAAoD;AACpD,gDAA4C;AAC5C,+CAA6C;AAE9B,KAAK,UAAU,KAAK,CAAC,QAAgB,EAAE,UAAmB;IACvE,IAAI,UAAU,IAAI,CAAC,mBAAQ,CAAC,UAAU,CAAC,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;KAC9C;IAED,IAAI,QAAQ,KAAK,qBAAS,CAAC,GAAG,EAAE;QAC9B,OAAO,MAAM,aAAQ,CAAC,UAAU,CAAC,CAAC;KACnC;SAAM,IAAI,QAAQ,KAAK,qBAAS,CAAC,OAAO,EAAE;QACzC,OAAO,MAAM,iBAAY,CAAC,UAAU,CAAC,CAAC;KACvC;SAAM;QACL,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;KAChD;AACH,CAAC;AAZD,wBAYC","sourcesContent":["import isSemver from 'is-semver';\n\nimport setupAndroid from 'turtle/bin/setup/android';\nimport setupIos from 'turtle/bin/setup/ios';\nimport { PLATFORMS } from 'turtle/constants';\n\nexport default async function setup(platform: string, sdkVersion?: string) {\n if (sdkVersion && !isSemver(sdkVersion)) {\n throw new Error('SDK version is not valid.');\n }\n\n if (platform === PLATFORMS.IOS) {\n return await setupIos(sdkVersion);\n } else if (platform === PLATFORMS.ANDROID) {\n return await setupAndroid(sdkVersion);\n } else {\n throw new Error('This should never happen :(');\n }\n}\n"]}
|
||||
@@ -1,89 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const xdl_1 = require("@expo/xdl");
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const tar_1 = __importDefault(require("tar"));
|
||||
const downloader_1 = __importDefault(require("./downloader"));
|
||||
const toolsDetector_1 = require("./toolsDetector");
|
||||
const config_1 = __importDefault(require("../../../config"));
|
||||
const logger_1 = __importDefault(require("../../../logger"));
|
||||
const l = logger_1.default.child({ buildPhase: 'setting up environment' });
|
||||
async function checkSystem(requiredTools) {
|
||||
await toolsDetector_1.ensureToolsAreInstalled(requiredTools);
|
||||
}
|
||||
exports.checkSystem = checkSystem;
|
||||
async function ensureShellAppIsPresent(sdkVersion, formatters, postDownloadAction) {
|
||||
const workingdir = formatters.formatShellAppDirectory({ sdkVersion });
|
||||
const shellAppMetadata = await _readShellAppTarballS3Uri(sdkVersion, formatters);
|
||||
await removeDirectoryUnlessReady(workingdir, shellAppMetadata);
|
||||
if (await fs_extra_1.default.pathExists(workingdir)) {
|
||||
return;
|
||||
}
|
||||
l.info(`shell app for SDK ${sdkVersion} doesn't exist, downloading...`);
|
||||
await _downloadShellApp(sdkVersion, workingdir, formatters);
|
||||
if (postDownloadAction) {
|
||||
await postDownloadAction(sdkVersion, workingdir);
|
||||
}
|
||||
await markDirectoryAsReady(workingdir, shellAppMetadata);
|
||||
}
|
||||
exports.ensureShellAppIsPresent = ensureShellAppIsPresent;
|
||||
async function _downloadShellApp(sdkVersion, targetDirectory, formatters) {
|
||||
const shellAppTarballS3Uri = await _readShellAppTarballS3Uri(sdkVersion, formatters);
|
||||
const tarballDownloadTargetPath = formatArtifactDownloadPath(shellAppTarballS3Uri);
|
||||
await fs_extra_1.default.ensureDir(config_1.default.directories.artifactsDir);
|
||||
await downloader_1.default(shellAppTarballS3Uri, tarballDownloadTargetPath);
|
||||
l.info('shell app has been downloaded');
|
||||
await fs_extra_1.default.ensureDir(targetDirectory);
|
||||
l.info('extracting shell app (this may take a while)...');
|
||||
await tar_1.default.x({
|
||||
file: tarballDownloadTargetPath,
|
||||
C: targetDirectory,
|
||||
});
|
||||
l.info('shell app extracted');
|
||||
}
|
||||
function formatArtifactDownloadPath(uri) {
|
||||
const { base } = path_1.default.parse(uri);
|
||||
return path_1.default.join(config_1.default.directories.artifactsDir, base);
|
||||
}
|
||||
exports.formatArtifactDownloadPath = formatArtifactDownloadPath;
|
||||
async function _readShellAppTarballS3Uri(sdkVersion, formatters) {
|
||||
const sdkMajorVersion = xdl_1.ExponentTools.parseSdkMajorVersion(sdkVersion);
|
||||
const filePath = formatters.formatShellAppTarballUriPath(sdkMajorVersion);
|
||||
const data = await fs_extra_1.default.readFile(filePath, 'utf8');
|
||||
return data.trim();
|
||||
}
|
||||
async function removeDirectoryUnlessReady(dir, metadata) {
|
||||
const readyFilePath = path_1.default.join(dir, '.ready');
|
||||
const readyFileExists = await fs_extra_1.default.pathExists(readyFilePath);
|
||||
let shouldRemove = false;
|
||||
if (readyFileExists) {
|
||||
if (metadata !== undefined) {
|
||||
const readyFileContents = (await fs_extra_1.default.readFile(readyFilePath, 'utf-8')).trim();
|
||||
if (readyFileContents !== metadata) {
|
||||
shouldRemove = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
shouldRemove = true;
|
||||
}
|
||||
if (shouldRemove) {
|
||||
await fs_extra_1.default.remove(dir);
|
||||
}
|
||||
}
|
||||
exports.removeDirectoryUnlessReady = removeDirectoryUnlessReady;
|
||||
async function markDirectoryAsReady(dir, metadata) {
|
||||
const readyFilePath = path_1.default.join(dir, '.ready');
|
||||
if (metadata === undefined) {
|
||||
await fs_extra_1.default.open(readyFilePath, 'w');
|
||||
}
|
||||
else {
|
||||
await fs_extra_1.default.writeFile(readyFilePath, metadata);
|
||||
}
|
||||
}
|
||||
exports.markDirectoryAsReady = markDirectoryAsReady;
|
||||
//# sourceMappingURL=common.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/bin/setup/utils/common.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AAExB,mCAA0C;AAC1C,wDAA0B;AAC1B,8CAAsB;AAEtB,8DAAyD;AACzD,mDAAgG;AAEhG,6DAAmC;AACnC,6DAAmC;AAEnC,MAAM,CAAC,GAAG,gBAAM,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,wBAAwB,EAAE,CAAC,CAAC;AAS1D,KAAK,UAAU,WAAW,CAAC,aAAgC;IAChE,MAAM,uCAAuB,CAAC,aAAa,CAAC,CAAC;AAC/C,CAAC;AAFD,kCAEC;AAEM,KAAK,UAAU,uBAAuB,CAC3C,UAAkB,EAClB,UAA8B,EAC9B,kBAAuC;IAEvC,MAAM,UAAU,GAAG,UAAU,CAAC,uBAAuB,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,KAAK,UAAU,oBAAoB,CAAC,GAAW,EAAE,QAAiB;IACvE,MAAM,aAAa,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC/C,IAAI,QAAQ,KAAK,SAAS,EAAE;QAC1B,MAAM,kBAAE,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;KACnC;SAAM;QACL,MAAM,kBAAE,CAAC,SAAS,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;KAC7C;AACH,CAAC;AAPD,oDAOC","sourcesContent":["import path from 'path';\n\nimport { ExponentTools } from '@expo/xdl';\nimport fs from 'fs-extra';\nimport tar from 'tar';\n\nimport download from 'turtle/bin/setup/utils/downloader';\nimport { ensureToolsAreInstalled, IToolDefinition } from 'turtle/bin/setup/utils/toolsDetector';\nimport { IShellAppDirectoryConfig } from 'turtle/builders/utils/workingdir';\nimport config from 'turtle/config';\nimport logger from 'turtle/logger';\n\nconst l = logger.child({ buildPhase: 'setting up environment' });\n\ninterface IShellAppFormaters {\n formatShellAppDirectory: (config: IShellAppDirectoryConfig) => string;\n formatShellAppTarballUriPath: (sdkMajorVersion: string) => string;\n}\n\ntype PostDownloadAction = (sdkVersion: string, workingdir: string) => void;\n\nexport async function checkSystem(requiredTools: IToolDefinition[]) {\n await ensureToolsAreInstalled(requiredTools);\n}\n\nexport async function ensureShellAppIsPresent(\n sdkVersion: string,\n formatters: IShellAppFormaters,\n postDownloadAction?: PostDownloadAction,\n) {\n const workingdir = formatters.formatShellAppDirectory({ sdkVersion });\n const shellAppMetadata = await _readShellAppTarballS3Uri(sdkVersion, formatters);\n await removeDirectoryUnlessReady(workingdir, shellAppMetadata);\n if (await fs.pathExists(workingdir)) {\n return;\n }\n l.info(`shell app for SDK ${sdkVersion} doesn't exist, downloading...`);\n await _downloadShellApp(sdkVersion, workingdir, formatters);\n if (postDownloadAction) {\n await postDownloadAction(sdkVersion, workingdir);\n }\n await markDirectoryAsReady(workingdir, shellAppMetadata);\n}\n\nasync function _downloadShellApp(sdkVersion: string, targetDirectory: string, formatters: IShellAppFormaters) {\n const shellAppTarballS3Uri = await _readShellAppTarballS3Uri(sdkVersion, formatters);\n const tarballDownloadTargetPath = formatArtifactDownloadPath(shellAppTarballS3Uri);\n await fs.ensureDir(config.directories.artifactsDir);\n await download(shellAppTarballS3Uri, tarballDownloadTargetPath);\n l.info('shell app has been downloaded');\n await fs.ensureDir(targLine truncated
|
||||
@@ -1,49 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs_1 = __importDefault(require("fs"));
|
||||
const url_1 = require("url");
|
||||
const progress_1 = __importDefault(require("progress"));
|
||||
const request_1 = __importDefault(require("request"));
|
||||
const request_progress_1 = __importDefault(require("request-progress"));
|
||||
const S3_PROTOCOL = 's3:';
|
||||
const PROGRESS_BAR_CONFIG = {
|
||||
TEMPLATE: 'downloading [:bar] :percent :etas',
|
||||
BAR: {
|
||||
COMPLETE_CHAR: '=',
|
||||
INCOMPLETE_CHAR: ' ',
|
||||
WIDTH: 20,
|
||||
},
|
||||
};
|
||||
async function download(url, destPath) {
|
||||
const httpUrl = url.startsWith(S3_PROTOCOL) ? convertS3ToHttpsUrl(url) : url;
|
||||
let bar;
|
||||
return new Promise((res, rej) => {
|
||||
request_progress_1.default(request_1.default(httpUrl))
|
||||
.on('progress', (state) => {
|
||||
if (!bar) {
|
||||
bar = new progress_1.default(PROGRESS_BAR_CONFIG.TEMPLATE, {
|
||||
complete: PROGRESS_BAR_CONFIG.BAR.COMPLETE_CHAR,
|
||||
incomplete: PROGRESS_BAR_CONFIG.BAR.INCOMPLETE_CHAR,
|
||||
width: PROGRESS_BAR_CONFIG.BAR.WIDTH,
|
||||
total: state.size.total,
|
||||
});
|
||||
}
|
||||
bar.tick(state.size.transferred - bar.curr);
|
||||
})
|
||||
.on('error', (err) => rej(err))
|
||||
.on('end', () => res())
|
||||
.pipe(fs_1.default.createWriteStream(destPath));
|
||||
});
|
||||
}
|
||||
exports.default = download;
|
||||
function convertS3ToHttpsUrl(s3UrlRaw) {
|
||||
const { host: s3Bucket, pathname: s3Path, protocol } = new url_1.URL(s3UrlRaw);
|
||||
if (protocol !== S3_PROTOCOL) {
|
||||
throw new Error('Wrong S3 URL provided');
|
||||
}
|
||||
return `https://${s3Bucket}.s3.amazonaws.com${s3Path}`;
|
||||
}
|
||||
//# sourceMappingURL=downloader.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"downloader.js","sourceRoot":"","sources":["../../../../src/bin/setup/utils/downloader.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,6BAA0B;AAE1B,wDAAmC;AACnC,sDAA8B;AAC9B,wEAA+C;AAE/C,MAAM,WAAW,GAAG,KAAK,CAAC;AAC1B,MAAM,mBAAmB,GAAG;IAC1B,QAAQ,EAAE,mCAAmC;IAC7C,GAAG,EAAE;QACH,aAAa,EAAE,GAAG;QAClB,eAAe,EAAE,GAAG;QACpB,KAAK,EAAE,EAAE;KACV;CACF,CAAC;AAEa,KAAK,UAAU,QAAQ,CAAC,GAAW,EAAE,QAAgB;IAClE,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC7E,IAAI,GAAgB,CAAC;IAErB,OAAO,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC9B,0BAAe,CAAC,iBAAO,CAAC,OAAO,CAAC,CAAC;aAC9B,EAAE,CAAC,UAAU,EAAE,CAAC,KAAU,EAAE,EAAE;YAC3B,IAAI,CAAC,GAAG,EAAE;gBACR,GAAG,GAAG,IAAI,kBAAW,CAAC,mBAAmB,CAAC,QAAQ,EAAE;oBAClD,QAAQ,EAAE,mBAAmB,CAAC,GAAG,CAAC,aAAa;oBAC/C,UAAU,EAAE,mBAAmB,CAAC,GAAG,CAAC,eAAe;oBACnD,KAAK,EAAE,mBAAmB,CAAC,GAAG,CAAC,KAAK;oBACpC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK;iBACxB,CAAC,CAAC;aACJ;YACD,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,GAAI,GAAW,CAAC,IAAI,CAAC,CAAC;QACzD,CAAC,CAAC;aACD,EAAE,CAAC,OAAO,EAAE,CAAC,GAAU,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;aACrC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC;aACtB,IAAI,CAAC,YAAE,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC;AArBD,2BAqBC;AAED,SAAS,mBAAmB,CAAC,QAAgB;IAC3C,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,SAAG,CAAC,QAAQ,CAAC,CAAC;IACzE,IAAI,QAAQ,KAAK,WAAW,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAC1C;IACD,OAAO,WAAW,QAAQ,oBAAoB,MAAM,EAAE,CAAC;AACzD,CAAC","sourcesContent":["import fs from 'fs';\nimport { URL } from 'url';\n\nimport ProgressBar from 'progress';\nimport request from 'request';\nimport requestProgress from 'request-progress';\n\nconst S3_PROTOCOL = 's3:';\nconst PROGRESS_BAR_CONFIG = {\n TEMPLATE: 'downloading [:bar] :percent :etas',\n BAR: {\n COMPLETE_CHAR: '=',\n INCOMPLETE_CHAR: ' ',\n WIDTH: 20,\n },\n};\n\nexport default async function download(url: string, destPath: string) {\n const httpUrl = url.startsWith(S3_PROTOCOL) ? convertS3ToHttpsUrl(url) : url;\n let bar: ProgressBar;\n\n return new Promise((res, rej) => {\n requestProgress(request(httpUrl))\n .on('progress', (state: any) => {\n if (!bar) {\n bar = new ProgressBar(PROGRESS_BAR_CONFIG.TEMPLATE, {\n complete: PROGRESS_BAR_CONFIG.BAR.COMPLETE_CHAR,\n incomplete: PROGRESS_BAR_CONFIG.BAR.INCOMPLETE_CHAR,\n width: PROGRESS_BAR_CONFIG.BAR.WIDTH,\n total: state.size.total,\n });\n }\n bar.tick(state.size.transferred - (bar as any).curr);\n })\n .on('error', (err: Error) => rej(err))\n .on('end', () => res())\n .pipe(fs.createWriteStream(destPath));\n });\n}\n\nfunction convertS3ToHttpsUrl(s3UrlRaw: string) {\n const { host: s3Bucket, pathname: s3Path, protocol } = new URL(s3UrlRaw);\n if (protocol !== S3_PROTOCOL) {\n throw new Error('Wrong S3 URL provided');\n }\n return `https://${s3Bucket}.s3.amazonaws.com${s3Path}`;\n}\n"]}
|
||||
@@ -1,46 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const util_1 = __importDefault(require("util"));
|
||||
const which_1 = __importDefault(require("which"));
|
||||
const logger_1 = __importDefault(require("../../../logger"));
|
||||
const which = util_1.default.promisify(which_1.default);
|
||||
const l = logger_1.default.child({ buildPhase: 'setting up environment' });
|
||||
async function ensureToolsAreInstalled(tools) {
|
||||
let isAnyToolMissing = false;
|
||||
for (const { command, missingDescription, testFn, versionCheckFn } of tools) {
|
||||
try {
|
||||
if (testFn) {
|
||||
if (!await testFn()) {
|
||||
throw new Error('Required tool is not properly installed');
|
||||
}
|
||||
}
|
||||
else {
|
||||
await which(command);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
isAnyToolMissing = true;
|
||||
if (!testFn) {
|
||||
l.error({ err }, `${command} is missing in your $PATH`);
|
||||
}
|
||||
l.error({ err }, missingDescription);
|
||||
}
|
||||
if (versionCheckFn) {
|
||||
try {
|
||||
await versionCheckFn();
|
||||
}
|
||||
catch (err) {
|
||||
isAnyToolMissing = true;
|
||||
l.error({ err }, `wrong version of ${command} installed`);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isAnyToolMissing) {
|
||||
throw new Error('Tools required to perform standalone app build are missing. Please install them.');
|
||||
}
|
||||
}
|
||||
exports.ensureToolsAreInstalled = ensureToolsAreInstalled;
|
||||
//# sourceMappingURL=toolsDetector.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"toolsDetector.js","sourceRoot":"","sources":["../../../../src/bin/setup/utils/toolsDetector.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AACxB,kDAA2B;AAE3B,6DAAmC;AAEnC,MAAM,KAAK,GAAG,cAAI,CAAC,SAAS,CAAC,eAAM,CAAC,CAAC;AACrC,MAAM,CAAC,GAAG,gBAAM,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,wBAAwB,EAAE,CAAC,CAAC;AAS1D,KAAK,UAAU,uBAAuB,CAAC,KAAwB;IACpE,IAAI,gBAAgB,GAAG,KAAK,CAAC;IAC7B,KAAK,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,KAAK,EAAE;QAC3E,IAAI;YACF,IAAI,MAAM,EAAE;gBACV,IAAI,CAAC,MAAM,MAAM,EAAE,EAAE;oBACnB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;iBAC5D;aACF;iBAAM;gBACL,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;aACtB;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,gBAAgB,GAAG,IAAI,CAAC;YACxB,IAAI,CAAC,MAAM,EAAE;gBACX,CAAC,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,GAAG,OAAO,2BAA2B,CAAC,CAAC;aACzD;YACD,CAAC,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,kBAAkB,CAAC,CAAC;SACtC;QACD,IAAI,cAAc,EAAE;YAClB,IAAI;gBACF,MAAM,cAAc,EAAE,CAAC;aACxB;YAAC,OAAO,GAAG,EAAE;gBACZ,gBAAgB,GAAG,IAAI,CAAC;gBACxB,CAAC,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,oBAAoB,OAAO,YAAY,CAAC,CAAC;aAC3D;SACF;KACF;IACD,IAAI,gBAAgB,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,kFAAkF,CAAC,CAAC;KACrG;AACH,CAAC;AA9BD,0DA8BC","sourcesContent":["import util from 'util';\nimport _which from 'which';\n\nimport logger from 'turtle/logger';\n\nconst which = util.promisify(_which);\nconst l = logger.child({ buildPhase: 'setting up environment' });\n\nexport interface IToolDefinition {\n command: string;\n missingDescription: string;\n testFn?: () => Promise<boolean>;\n versionCheckFn?: () => void;\n}\n\nexport async function ensureToolsAreInstalled(tools: IToolDefinition[]) {\n let isAnyToolMissing = false;\n for (const { command, missingDescription, testFn, versionCheckFn } of tools) {\n try {\n if (testFn) {\n if (!await testFn()) {\n throw new Error('Required tool is not properly installed');\n }\n } else {\n await which(command);\n }\n } catch (err) {\n isAnyToolMissing = true;\n if (!testFn) {\n l.error({ err }, `${command} is missing in your $PATH`);\n }\n l.error({ err }, missingDescription);\n }\n if (versionCheckFn) {\n try {\n await versionCheckFn();\n } catch (err) {\n isAnyToolMissing = true;\n l.error({ err }, `wrong version of ${command} installed`);\n }\n }\n }\n if (isAnyToolMissing) {\n throw new Error('Tools required to perform standalone app build are missing. Please install them.');\n }\n}\n"]}
|
||||
@@ -1,123 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const url_1 = __importDefault(require("url"));
|
||||
const xdl_1 = require("@expo/xdl");
|
||||
const lodash_1 = __importDefault(require("lodash"));
|
||||
const uuid_1 = __importDefault(require("uuid"));
|
||||
const ErrorWithCommandHelp_1 = require("../commands/ErrorWithCommandHelp");
|
||||
const ErrorWithProgramHelp_1 = require("../commands/ErrorWithProgramHelp");
|
||||
const setup_1 = __importDefault(require("../setup/setup"));
|
||||
const ProjectUtils = __importStar(require("./project"));
|
||||
const UserUtils = __importStar(require("./user"));
|
||||
const common_1 = require("../../builders/utils/common");
|
||||
const logger_1 = __importDefault(require("../../logger"));
|
||||
const validator_1 = require("../../validator");
|
||||
function createBuilderAction({ program, command, prepareCredentials, builder, platform, os, }) {
|
||||
return async (projectDirArg, cmd) => {
|
||||
try {
|
||||
const osList = [];
|
||||
if (Array.isArray(os)) {
|
||||
osList.push(...os);
|
||||
}
|
||||
else {
|
||||
osList.push(os);
|
||||
}
|
||||
if (osList.length && !osList.includes(process.platform)) {
|
||||
throw new Error('We don\'t support running standalone app builds for this platform on your operating system');
|
||||
}
|
||||
if (cmd.buildDir && cmd.output) {
|
||||
throw new ErrorWithCommandHelp_1.ErrorWithCommandHelp('You can\'t provide both --build-dir and --output parameters, please choose one');
|
||||
}
|
||||
const userData = {
|
||||
username: cmd.username || process.env.EXPO_USERNAME,
|
||||
password: cmd.password || process.env.EXPO_PASSWORD,
|
||||
};
|
||||
if (userData.username || userData.password) {
|
||||
if (userData.username && userData.password) {
|
||||
await UserUtils.ensureUserLoggedIn(userData);
|
||||
}
|
||||
else {
|
||||
throw new ErrorWithCommandHelp_1.ErrorWithCommandHelp('You must provide both Expo username and password');
|
||||
}
|
||||
}
|
||||
else if (!cmd.publicUrl) {
|
||||
throw new ErrorWithCommandHelp_1.ErrorWithCommandHelp('You must provide your Expo username and password unless you specify --public-url to your project manifest.');
|
||||
}
|
||||
if (cmd.publicUrl) {
|
||||
const parsedPublicUrl = url_1.default.parse(cmd.publicUrl);
|
||||
if (parsedPublicUrl.protocol !== 'https:') {
|
||||
throw new ErrorWithCommandHelp_1.ErrorWithCommandHelp('--public-url is invalid - only HTTPS urls are supported');
|
||||
}
|
||||
}
|
||||
const args = {
|
||||
releaseChannel: cmd.releaseChannel || 'default',
|
||||
buildType: cmd.type,
|
||||
buildMode: cmd.mode,
|
||||
username: userData.username || 'anonymous',
|
||||
projectDir: ProjectUtils.resolveAbsoluteDir(projectDirArg),
|
||||
publicUrl: cmd.publicUrl,
|
||||
};
|
||||
const appJSON = await ProjectUtils.loadAppJSON(projectDirArg, cmd.config);
|
||||
const sdkVersion = lodash_1.default.get(appJSON, 'expo.sdkVersion');
|
||||
await setup_1.default(platform, sdkVersion);
|
||||
const credentials = await prepareCredentials(cmd);
|
||||
const rawJob = {
|
||||
...await buildJobObject(platform, appJSON, args, credentials),
|
||||
...cmd.buildDir && { fakeUploadDir: ProjectUtils.resolveAbsoluteDir(cmd.buildDir) },
|
||||
...cmd.output && { fakeUploadBuildPath: ProjectUtils.resolveAbsoluteDir(cmd.output) },
|
||||
};
|
||||
const job = await validator_1.sanitizeJob(rawJob);
|
||||
await builder(job);
|
||||
}
|
||||
catch (err) {
|
||||
logger_1.default.error({ err }, 'Failed to build standalone app');
|
||||
if (err instanceof ErrorWithCommandHelp_1.ErrorWithCommandHelp) {
|
||||
command.help();
|
||||
}
|
||||
else if (err instanceof ErrorWithProgramHelp_1.ErrorWithProgramHelp) {
|
||||
program.help();
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
}
|
||||
exports.createBuilderAction = createBuilderAction;
|
||||
const buildJobObject = async (platform, appJSON, { releaseChannel, buildType, buildMode, username, publicUrl, projectDir }, credentials) => {
|
||||
const experienceName = `@${lodash_1.default.get(appJSON, 'expo.owner', username)}/${lodash_1.default.get(appJSON, 'expo.slug')}`;
|
||||
const job = {
|
||||
config: {
|
||||
...lodash_1.default.get(appJSON, `expo.${platform}.config`, {}),
|
||||
buildType,
|
||||
...(platform === 'android' ? { buildMode } : {}),
|
||||
releaseChannel,
|
||||
...(platform === 'ios' ? { bundleIdentifier: lodash_1.default.get(appJSON, 'expo.ios.bundleIdentifier') } : {}),
|
||||
...(platform === 'android' ? { androidPackage: lodash_1.default.get(appJSON, 'expo.android.package') } : {}),
|
||||
publicUrl,
|
||||
},
|
||||
id: uuid_1.default.v4(),
|
||||
platform,
|
||||
projectDir,
|
||||
sdkVersion: lodash_1.default.get(appJSON, 'expo.sdkVersion'),
|
||||
experienceName,
|
||||
...(credentials && { credentials }),
|
||||
};
|
||||
const url = common_1.getExperienceUrl(job.experienceName, job.config.publicUrl);
|
||||
const manifest = await xdl_1.ExponentTools.getManifestAsync(url, {
|
||||
'Exponent-SDK-Version': lodash_1.default.get(appJSON, 'expo.sdkVersion'),
|
||||
'Exponent-Platform': platform,
|
||||
'Expo-Release-Channel': releaseChannel,
|
||||
'Accept': 'application/expo+json,application/json',
|
||||
});
|
||||
return { ...job, manifest };
|
||||
};
|
||||
//# sourceMappingURL=builder.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../../src/bin/utils/builder.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAAuB;AAEvB,mCAA0C;AAC1C,oDAAuB;AACvB,gDAAwB;AAExB,2EAAgF;AAChF,2EAAgF;AAChF,2DAA2C;AAC3C,wDAAyD;AACzD,kDAAmD;AACnD,wDAAgE;AAChE,0DAAmC;AACnC,+CAA+C;AAE/C,SAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,OAAO,EACP,kBAAkB,EAClB,OAAO,EACP,QAAQ,EACR,EAAE,GACE;IACJ,OAAO,KAAK,EAAE,aAAqB,EAAE,GAAQ,EAAE,EAAE;QAC/C,IAAI;Y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QACV,UAAU,EAAE,gBAAC,CAAC,GAAG,CAAC,OAAO,EAAE,iBAAiB,CAAC;QAC7C,cAAc;QACd,GAAG,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,CAAC;KACpC,CAAC;IACF,MAAM,GAAG,GAAG,yBAAgB,CAAC,GAAG,CAAC,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAEvE,MAAM,QAAQ,GAAG,MAAM,mBAAa,CAAC,gBAAgB,CAAC,GAAG,EAAE;QACzD,sBAAsB,EAAE,gBAAC,CAAC,GAAG,CAAC,OAAO,EAAE,iBAAiB,CAAC;QACzD,mBAAmB,EAAE,QAAQ;QAC7B,sBAAsB,EAAE,cAAc;QACtC,QAAQ,EAAE,wCAAwC;KACnD,CAAC,CAAC;IAEH,OAAO,EAAE,GAAG,GAAG,EAAE,QAAQ,EAAE,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["import _url from 'url';\n\nimport { ExponentTools } from '@expo/xdl';\nimport _ from 'lodash';\nimport uuid from 'uuid';\n\nimport { ErrorWithCommandHelp } from 'turtle/bin/commands/ErrorWithCommandHelp';\nimport { ErrorWithProgramHelp } from 'turtle/bin/commands/ErrorWithProgramHelp';\nimport setup from 'turtle/bin/setup/setup';\nimport * as ProjectUtils from 'turtle/bin/utils/project';\nimport * as UserUtils from 'turtle/bin/utils/user';\nimport { getExperienceUrl } from 'turtle/builders/utils/common';\nimport logger from 'turtle/logger';\nimport { sanitizeJob } from 'turtle/validator';\n\nexport function createBuilderAction({\n program,\n command,\n prepareCredentials,\n builder,\n platform,\n os,\n}: any) {\n return async (projectDirArg: string, cmd: any) => {\n try {\n const osList = [];\n if (Array.isArray(os)) {\n osList.push(...os);\n } else {\n osList.push(os);\n }\n if (osList.length && !osLiLine truncated
|
||||
@@ -1,35 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
async function loadAppJSON(projectDirArg, config) {
|
||||
let appJSONPath;
|
||||
if (config) {
|
||||
appJSONPath = exports.resolveAbsoluteDir(config);
|
||||
}
|
||||
else {
|
||||
const projectDir = exports.resolveAbsoluteDir(projectDirArg);
|
||||
appJSONPath = path_1.default.join(projectDir, 'app.json');
|
||||
}
|
||||
const appJSONExists = await fs_extra_1.default.pathExists(appJSONPath);
|
||||
if (!appJSONExists) {
|
||||
throw new Error(`Couldn't find app.json.`);
|
||||
}
|
||||
else {
|
||||
return require(appJSONPath);
|
||||
}
|
||||
}
|
||||
exports.loadAppJSON = loadAppJSON;
|
||||
exports.resolveAbsoluteDir = (dir) => {
|
||||
if (dir && path_1.default.isAbsolute(dir)) {
|
||||
return dir;
|
||||
}
|
||||
else {
|
||||
const cwd = process.env.INIT_CWD || process.cwd();
|
||||
return dir ? path_1.default.join(cwd, dir) : cwd;
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=project.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../../src/bin/utils/project.ts"],"names":[],"mappings":";;;;;AAAA,wDAA0B;AAC1B,gDAAwB;AAEjB,KAAK,UAAU,WAAW,CAAC,aAAqB,EAAE,MAAqB;IAC5E,IAAI,WAAW,CAAC;IAChB,IAAI,MAAM,EAAE;QACV,WAAW,GAAG,0BAAkB,CAAC,MAAM,CAAC,CAAC;KAC1C;SAAM;QACL,MAAM,UAAU,GAAG,0BAAkB,CAAC,aAAa,CAAC,CAAC;QACrD,WAAW,GAAG,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;KACjD;IACD,MAAM,aAAa,GAAG,MAAM,kBAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IACvD,IAAI,CAAC,aAAa,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;KAC5C;SAAM;QACL,OAAO,OAAO,CAAC,WAAW,CAAC,CAAC;KAC7B;AACH,CAAC;AAdD,kCAcC;AAEY,QAAA,kBAAkB,GAAG,CAAC,GAAW,EAAE,EAAE;IAChD,IAAI,GAAG,IAAI,cAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAC/B,OAAO,GAAG,CAAC;KACZ;SAAM;QACL,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAClD,OAAO,GAAG,CAAC,CAAC,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;KACxC;AACH,CAAC,CAAC","sourcesContent":["import fs from 'fs-extra';\nimport path from 'path';\n\nexport async function loadAppJSON(projectDirArg: string, config: string | null) {\n let appJSONPath;\n if (config) {\n appJSONPath = resolveAbsoluteDir(config);\n } else {\n const projectDir = resolveAbsoluteDir(projectDirArg);\n appJSONPath = path.join(projectDir, 'app.json');\n }\n const appJSONExists = await fs.pathExists(appJSONPath);\n if (!appJSONExists) {\n throw new Error(`Couldn't find app.json.`);\n } else {\n return require(appJSONPath);\n }\n}\n\nexport const resolveAbsoluteDir = (dir: string) => {\n if (dir && path.isAbsolute(dir)) {\n return dir;\n } else {\n const cwd = process.env.INIT_CWD || process.cwd();\n return dir ? path.join(cwd, dir) : cwd;\n }\n};\n"]}
|
||||
@@ -1,23 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const xdl_1 = require("@expo/xdl");
|
||||
const ErrorWithProgramHelp_1 = require("../commands/ErrorWithProgramHelp");
|
||||
async function ensureUserLoggedIn(userData) {
|
||||
const currentUser = await xdl_1.UserManager.getCurrentUserAsync();
|
||||
if (currentUser) {
|
||||
return currentUser;
|
||||
}
|
||||
else if (!userData.username || !userData.password) {
|
||||
throw new ErrorWithProgramHelp_1.ErrorWithProgramHelp('Please provide username and password');
|
||||
}
|
||||
else {
|
||||
try {
|
||||
return await xdl_1.UserManager.loginAsync('user-pass', userData);
|
||||
}
|
||||
catch (err) {
|
||||
throw new Error('Failed to log in with provided username and password');
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.ensureUserLoggedIn = ensureUserLoggedIn;
|
||||
//# sourceMappingURL=user.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../../src/bin/utils/user.ts"],"names":[],"mappings":";;AAAA,mCAAwC;AAExC,2EAAgF;AAOzE,KAAK,UAAU,kBAAkB,CAAC,QAAmB;IAC1D,MAAM,WAAW,GAAG,MAAM,iBAAW,CAAC,mBAAmB,EAAE,CAAC;IAC5D,IAAI,WAAW,EAAE;QACf,OAAO,WAAW,CAAC;KACpB;SAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;QACnD,MAAM,IAAI,2CAAoB,CAAC,sCAAsC,CAAC,CAAC;KACxE;SAAM;QACL,IAAI;YACF,OAAO,MAAM,iBAAW,CAAC,UAAU,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;SAC5D;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;SACzE;KACF;AACH,CAAC;AAbD,gDAaC","sourcesContent":["import { UserManager } from '@expo/xdl';\n\nimport { ErrorWithProgramHelp } from 'turtle/bin/commands/ErrorWithProgramHelp';\n\ninterface IUserData {\n username?: string;\n password?: string;\n}\n\nexport async function ensureUserLoggedIn(userData: IUserData) {\n const currentUser = await UserManager.getCurrentUserAsync();\n if (currentUser) {\n return currentUser;\n } else if (!userData.username || !userData.password) {\n throw new ErrorWithProgramHelp('Please provide username and password');\n } else {\n try {\n return await UserManager.loginAsync('user-pass', userData);\n } catch (err) {\n throw new Error('Failed to log in with provided username and password');\n }\n }\n}\n"]}
|
||||
@@ -1,17 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
class BuildError extends Error {
|
||||
constructor(reason, message) {
|
||||
super(message);
|
||||
this.name = 'BuildError';
|
||||
this.reason = reason;
|
||||
}
|
||||
}
|
||||
var BuildErrorReason;
|
||||
(function (BuildErrorReason) {
|
||||
BuildErrorReason["SESSION_EXPIRED"] = "session-expired";
|
||||
BuildErrorReason["PROVISIONING_PROFILE_MISSING"] = "provisioning-profile-missing";
|
||||
})(BuildErrorReason || (BuildErrorReason = {}));
|
||||
exports.BuildErrorReason = BuildErrorReason;
|
||||
exports.default = BuildError;
|
||||
//# sourceMappingURL=BuildError.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"BuildError.js","sourceRoot":"","sources":["../../src/builders/BuildError.ts"],"names":[],"mappings":";;AAAA,MAAM,UAAW,SAAQ,KAAK;IAG5B,YAAY,MAAwB,EAAE,OAAe;QACnD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED,IAAK,gBAGJ;AAHD,WAAK,gBAAgB;IACnB,uDAAmC,CAAA;IACnC,iFAA6D,CAAA;AAC/D,CAAC,EAHI,gBAAgB,KAAhB,gBAAgB,QAGpB;AAGQ,4CAAgB;AADzB,kBAAe,UAAU,CAAC","sourcesContent":["class BuildError extends Error {\n public reason: BuildErrorReason;\n\n constructor(reason: BuildErrorReason, message: string) {\n super(message);\n this.name = 'BuildError';\n this.reason = reason;\n }\n}\n\nenum BuildErrorReason {\n SESSION_EXPIRED = 'session-expired',\n PROVISIONING_PROFILE_MISSING = 'provisioning-profile-missing',\n}\n\nexport default BuildError;\nexport { BuildErrorReason };\n"]}
|
||||
@@ -1,108 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const xdl_1 = require("@expo/xdl");
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const lodash_1 = __importDefault(require("lodash"));
|
||||
const semver_1 = __importDefault(require("semver"));
|
||||
const constants_1 = require("../constants");
|
||||
const v4_1 = __importDefault(require("uuid/v4"));
|
||||
const credentials_1 = __importDefault(require("./utils/android/credentials"));
|
||||
const workingdir_1 = require("./utils/android/workingdir");
|
||||
const commonUtils = __importStar(require("./utils/common"));
|
||||
const imageHelpers = __importStar(require("./utils/image"));
|
||||
const unimodules_1 = require("./utils/unimodules");
|
||||
const uploader_1 = require("./utils/uploader");
|
||||
const version_1 = require("./utils/version");
|
||||
const config_1 = __importDefault(require("../config"));
|
||||
const logger_1 = __importDefault(require("../logger"));
|
||||
async function buildAndroid(jobData) {
|
||||
await version_1.ensureCanBuildSdkVersion(jobData);
|
||||
const credentials = await credentials_1.default(jobData);
|
||||
const outputFilePath = await runShellAppBuilder(jobData, credentials);
|
||||
const randomHex = v4_1.default().replace(/-/g, '');
|
||||
const s3FileExtension = jobData.config.buildType === constants_1.ANDROID_BUILD_TYPES.APP_BUNDLE ? 'aab' : 'apk';
|
||||
const s3Filename = `${jobData.experienceName}-${randomHex}-signed.${s3FileExtension}`;
|
||||
const s3FileKey = `android/${s3Filename}`;
|
||||
const fakeUploadFilename = s3Filename.replace('/', '__');
|
||||
const artifactUrl = await uploader_1.uploadBuildToS3({
|
||||
uploadPath: outputFilePath,
|
||||
s3FileKey,
|
||||
...config_1.default.builder.fakeUpload && {
|
||||
fakeUploadBuildPath: jobData.fakeUploadBuildPath
|
||||
? jobData.fakeUploadBuildPath
|
||||
: path_1.default.join(jobData.fakeUploadDir || config_1.default.directories.fakeUploadDir, fakeUploadFilename),
|
||||
},
|
||||
});
|
||||
return { artifactUrl };
|
||||
}
|
||||
exports.default = buildAndroid;
|
||||
async function runShellAppBuilder(jobData, credentials) {
|
||||
const { temporaryFilesRoot } = config_1.default.directories;
|
||||
await fs_extra_1.default.ensureDir(temporaryFilesRoot);
|
||||
const tempShellAppConfigPath = path_1.default.join(temporaryFilesRoot, `app-config-${jobData.id}.json`);
|
||||
const tempKeystorePath = path_1.default.join(temporaryFilesRoot, `keystore-${jobData.id}.jks`);
|
||||
const configJSON = JSON.stringify(jobData.config);
|
||||
await fs_extra_1.default.writeFile(tempShellAppConfigPath, configJSON, { mode: 0o644 });
|
||||
await fs_extra_1.default.writeFile(tempKeystorePath, Buffer.from(credentials.keystore, 'base64'), {
|
||||
mode: 0o600,
|
||||
});
|
||||
logger_1.default.info({ buildPhase: 'starting builder' }, 'Starting build process');
|
||||
logger_1.default.info({ buildPhase: 'icons setup' }, 'ImageUtils: setting image functions to alternative sharp implementations');
|
||||
xdl_1.ImageUtils.setResizeImageFunction(imageHelpers.resizeIconWithSharpAsync);
|
||||
xdl_1.ImageUtils.setGetImageDimensionsFunction(imageHelpers.getImageDimensionsWithSharpAsync);
|
||||
const fileExtension = jobData.config.buildType === constants_1.ANDROID_BUILD_TYPES.APP_BUNDLE ? 'aab' : 'apk';
|
||||
const outputFilePath = path_1.default.join(temporaryFilesRoot, `shell-signed-${jobData.id}.${fileExtension}`);
|
||||
const { config: jobConfig, manifest, sdkVersion: sdkVersionFromJob } = jobData;
|
||||
const sdkVersion = lodash_1.default.get(manifest, 'sdkVersion', sdkVersionFromJob);
|
||||
const workingDir = workingdir_1.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.
|
||||
//
|
||||
// to enable full resolver switch resolveExplicitOptIn to resolveNativeModules
|
||||
logger_1.default.info({ buildPhase: 'resolve native modules' }, 'Resolving universal modules dependencies');
|
||||
const enabledModules = semver_1.default.satisfies(sdkVersion, '>= 33.0.0')
|
||||
? await unimodules_1.resolveExplicitOptIn(workingDir, lodash_1.default.get(manifest, 'dependencies'))
|
||||
: null;
|
||||
try {
|
||||
await xdl_1.AndroidShellApp.createAndroidShellAppAsync({
|
||||
url: commonUtils.getExperienceUrl(jobData.experienceName, jobData.config.publicUrl),
|
||||
sdkVersion,
|
||||
keystore: tempKeystorePath,
|
||||
manifest,
|
||||
alias: credentials.keystoreAlias,
|
||||
keystorePassword: credentials.keystorePassword,
|
||||
keyPassword: credentials.keyPassword,
|
||||
privateConfigFile: tempShellAppConfigPath,
|
||||
releaseChannel: jobConfig.releaseChannel,
|
||||
workingDir,
|
||||
outputFile: outputFilePath,
|
||||
modules: enabledModules,
|
||||
buildType: jobData.config.buildType,
|
||||
buildMode: jobData.config.buildMode,
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
commonUtils.logErrorOnce(err);
|
||||
throw err;
|
||||
}
|
||||
finally {
|
||||
if (!config_1.default.builder.skipCleanup) {
|
||||
await fs_extra_1.default.unlink(tempShellAppConfigPath);
|
||||
await fs_extra_1.default.unlink(tempKeystorePath);
|
||||
}
|
||||
}
|
||||
return outputFilePath;
|
||||
}
|
||||
//# sourceMappingURL=android.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"android.js","sourceRoot":"","sources":["../../src/builders/android.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAAwB;AAExB,mCAAwD;AACxD,wDAA0B;AAC1B,oDAAuB;AACvB,oDAA4B;AAC5B,4CAAuD;AACvD,iDAA6B;AAE7B,8EAA+E;AAC/E,2DAAmF;AACnF,4DAA4D;AAC5D,4DAA4D;AAC5D,mDAAw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AAC,GAAG,CAAC,CAAC;QAC9B,MAAM,GAAG,CAAC;KACX;YAAS;QACR,IAAI,CAAC,gBAAM,CAAC,OAAO,CAAC,WAAW,EAAE;YAC/B,MAAM,kBAAE,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;YACxC,MAAM,kBAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;SACnC;KACF;IAED,OAAO,cAAc,CAAC;AACxB,CAAC","sourcesContent":["import path from 'path';\n\nimport { AndroidShellApp, ImageUtils } from '@expo/xdl';\nimport fs from 'fs-extra';\nimport _ from 'lodash';\nimport semver from 'semver';\nimport { ANDROID_BUILD_TYPES } from 'turtle/constants';\nimport uuidv4 from 'uuid/v4';\n\nimport getOrCreateCredentials from 'turtle/builders/utils/android/credentials';\nimport { formatShellAppDirectory } from 'turtle/builders/utils/android/workingdir';\nimport * as commonUtils from 'turtle/builders/utils/common';\nimport * as imageHelpers from 'turtle/builders/utils/image';\nimport { resolveExplicitOptIn } from 'turtle/builders/utils/unimodules';\nimport { uploadBuildToS3 } from 'turtle/builders/utils/uploader';\nimport { ensureCanBuildSdkVersion } from 'turtle/builders/utils/version';\nimport config from 'turtle/config';\nimport { IAndroidCredentials, IJob, IJobResult } from 'turtle/job';\nimport logger from 'turtle/logger';\n\nexport default async function buildAndroid(jobData: IJob): Promise<IJobResult> {\n await ensureCanBuildSdkVersion(jobData);\n const credentials = await getOrCreateCredentials(jobData);\n const outputFilePath = await runShellAppBuilder(jobData, credentials);\n\n const randomHex = uuidv4().replace(/-/g, '');\n const s3FileExtension = jobData.config.buildType === ANDROID_BUILD_TYPES.APP_BUNDLE ? 'aab' : 'apk';\n const s3Filename = `${jobLine truncated
|
||||
@@ -1,12 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const android_1 = __importDefault(require("./android"));
|
||||
const ios_1 = __importDefault(require("./ios"));
|
||||
exports.default = {
|
||||
ios: ios_1.default,
|
||||
android: android_1.default,
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/builders/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAAqC;AACrC,gDAA6B;AAE7B,kBAAe;IACb,GAAG,EAAE,aAAQ;IACb,OAAO,EAAE,iBAAY;CACtB,CAAC","sourcesContent":["import buildAndroid from './android';\nimport buildIOS from './ios';\n\nexport default {\n ios: buildIOS,\n android: buildAndroid,\n};\n"]}
|
||||
@@ -1,64 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const xdl_1 = require("@expo/xdl");
|
||||
const lodash_1 = __importDefault(require("lodash"));
|
||||
const common_1 = require("../utils/common");
|
||||
const fileUtils = __importStar(require("../utils/file"));
|
||||
const keychain = __importStar(require("../utils/ios/keychain"));
|
||||
const shellAppBuilder_1 = __importDefault(require("../utils/ios/shellAppBuilder"));
|
||||
const index_1 = __importDefault(require("../../logger/index"));
|
||||
async function buildArchive(ctx, job) {
|
||||
let keychainInfo;
|
||||
try {
|
||||
keychainInfo = await keychain.create(ctx);
|
||||
const { credentials } = job;
|
||||
const { certP12, certPassword } = credentials;
|
||||
await keychain.importCert(ctx, { keychainPath: keychainInfo.path, certP12, certPassword });
|
||||
const manifest = await shellAppBuilder_1.default(ctx, job);
|
||||
await buildAndSignIPA(ctx, job, keychainInfo.path, manifest);
|
||||
}
|
||||
catch (err) {
|
||||
common_1.logErrorOnce(err);
|
||||
throw err;
|
||||
}
|
||||
finally {
|
||||
if (keychainInfo) {
|
||||
await keychain.remove(ctx, keychainInfo.path);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.default = buildArchive;
|
||||
async function buildAndSignIPA(ctx, job, keychainPath, manifest) {
|
||||
const l = index_1.default.child({ buildPhase: 'building and signing IPA' });
|
||||
l.info('building and signing IPA');
|
||||
const { credentials: { provisioningProfile, certPassword, teamId }, config: { bundleIdentifier: bundleIdentifierFromConfig }, } = job;
|
||||
const bundleIdentifierFromManifest = lodash_1.default.get(manifest, 'ios.bundleIdentifier');
|
||||
const bundleIdentifier = bundleIdentifierFromConfig || bundleIdentifierFromManifest;
|
||||
const { provisioningProfilePath } = ctx;
|
||||
await fileUtils.writeBase64ToBinaryFile(provisioningProfilePath, provisioningProfile);
|
||||
l.info('saved provisioning profile to temporary path');
|
||||
const ipaBuilder = xdl_1.IosIPABuilder({
|
||||
keychainPath,
|
||||
provisioningProfilePath,
|
||||
appUUID: ctx.appUUID,
|
||||
certPath: ctx.tempCertPath,
|
||||
certPassword,
|
||||
teamID: teamId,
|
||||
bundleIdentifier,
|
||||
workspacePath: ctx.workspacePath,
|
||||
manifest,
|
||||
});
|
||||
await ipaBuilder.build();
|
||||
l.info(`done building and signing IPA`);
|
||||
}
|
||||
//# sourceMappingURL=archive.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"archive.js","sourceRoot":"","sources":["../../../src/builders/ios/archive.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAA8D;AAC9D,oDAAuB;AAGvB,4CAA4D;AAC5D,yDAAwD;AACxD,gEAA+D;AAC/D,mFAA2E;AAE3E,+DAAyC;AAE1B,KAAK,UAAU,YAAY,CAAC,GAAa,EAAE,GAAS;IACjE,IAAI,YAAY,CAAC;IACjB,IAAI;QACF,YAAY,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,G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;IACxC,MAAM,SAAS,CAAC,uBAAuB,CAAC,uBAAuB,EAAE,mBAA6B,CAAC,CAAC;IAChG,CAAC,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;IAEvD,MAAM,UAAU,GAAG,mBAAgB,CAAC;QAClC,YAAY;QACZ,uBAAuB;QACvB,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,QAAQ,EAAE,GAAG,CAAC,YAAY;QAC1B,YAAY;QACZ,MAAM,EAAE,MAAM;QACd,gBAAgB;QAChB,aAAa,EAAE,GAAG,CAAC,aAAa;QAChC,QAAQ;KACT,CAAC,CAAC;IACH,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC;IAEzB,CAAC,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["import { IosIPABuilder as createIPABuilder } from '@expo/xdl';\nimport _ from 'lodash';\n\nimport { IContext } from 'turtle/builders/ios/context';\nimport { logErrorOnce } from 'turtle/builders/utils/common';\nimport * as fileUtils from 'turtle/builders/utils/file';\nimport * as keychain from 'turtle/builders/utils/ios/keychain';\nimport runShellAppBuilder from 'turtle/builders/utils/ios/shellAppBuilder';\nimport { IJob } from 'turtle/job';\nimport logger from 'turtle/logger/index';\n\nexport default async function buildArchive(ctx: IContext, job: IJob) {\n let keychainInfo;\n try {\n keychainInfo = await keychain.create(ctx);\n const { credentials } = job;\n const { certP12, certPassword } = credentials as { certP12: string; certPassword: string };\n await keychain.importCert(ctx, { keychainPath: keychainInfo.path, certP12, certPassword });\n const manifest = await runShellAppBuilder(ctx, job);\n await buildAndSignIPA(ctx, job, keychainInfo.path, manifest);\n } catch (err) {\n logErrorOnce(err);\n throw err;\n } finally {\n if (keychainInfo) {\n await keychain.remove(ctx, keychainInfo.path);\n }\n }\n}\n\nasync function buildAndSignIPA(ctx: IContext, job: IJob, keychainPath: string, manifest: any) {\n const l = logger.child({ buildPhase: 'building and signing IPA' });\n l.info('building and signing IPA');\n\n const {\n credentials: { provisioningProfile, certPassword, teamId },\n config: { bundleIdentifier: bundleIdentifierFromConfig },\n } = job;\n\n const bundleIdentifierFromManifest = _.get(manifest, 'ios.bundleIdentifier');\n const bundleIdentifier = bundleIdentifierFromConfig || bundleIdentifierFromManifest;\n\n const { provisioningProfilePath } = ctx;\n await fileUtils.writeBase64ToBinaryFile(provisioningProfilePath, provisioningProfile as string);\n l.info('saved provisioning profile to temporary path');\n\n const ipaBuilder = createIPABuilder({\n keychainPath,\n provisioningProfilePath,\n appUUID: ctx.appUUID,\n certPath: ctx.tempCertPath,\n certPassword,\n teamID: teamId,\n bundleIdentifier,\n workspacePath: ctx.workspacePath,\n manifest,\n });\n await ipaBuilder.build();\n\n l.info(`done building and signing IPA`);\n}\n"]}
|
||||
@@ -1,79 +0,0 @@
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path = __importStar(require("path"));
|
||||
const xdl_1 = require("@expo/xdl");
|
||||
const uuid_1 = require("uuid");
|
||||
const workingdir_1 = require("../utils/ios/workingdir");
|
||||
const config_1 = __importDefault(require("../../config"));
|
||||
const index_1 = require("../../constants/index");
|
||||
const { EXPOKIT_APP, EXPONENT_APP } = xdl_1.IosShellApp;
|
||||
function createBuilderContext(job) {
|
||||
const { join } = path;
|
||||
const appUUID = uuid_1.v4();
|
||||
const { manifest: { sdkVersion: sdkVersionFromManifest = null, } = {}, sdkVersion: sdkVersionFromJob, config: { buildType }, } = job;
|
||||
const sdkVersion = sdkVersionFromJob || sdkVersionFromManifest;
|
||||
const workingDir = workingdir_1.formatShellAppDirectory({ sdkVersion, buildType: buildType });
|
||||
const majorSdkVersion = xdl_1.ExponentTools.parseSdkMajorVersion(sdkVersion);
|
||||
const context = {
|
||||
appDir: join(config_1.default.directories.temporaryFilesRoot, appUUID),
|
||||
appUUID,
|
||||
workingDir,
|
||||
};
|
||||
context.buildDir = join(context.appDir, 'build');
|
||||
context.provisioningProfileDir = join(context.appDir, 'provisioning');
|
||||
context.provisioningProfilePath = join(context.provisioningProfileDir, `${appUUID}.mobileprovision`);
|
||||
context.tempCertPath = join(context.appDir, 'cert.p12');
|
||||
context.baseArchiveDir = join(context.appDir, 'archive');
|
||||
if (buildType === index_1.IOS_BUILD_TYPES.CLIENT) {
|
||||
context.applicationFilesSrc = join(workingDir, 'expo-client-build', '**', '*');
|
||||
}
|
||||
else {
|
||||
context.applicationFilesSrc = join(workingDir, 'shellAppBase-builds', buildType, '**', '*');
|
||||
}
|
||||
if (buildType === index_1.IOS_BUILD_TYPES.ARCHIVE) {
|
||||
context.outputPath = join(context.appDir, 'archive.xcarchive');
|
||||
context.uploadPath = join(context.buildDir, 'archive.ipa');
|
||||
context.archiveDir = join(context.baseArchiveDir, 'Release', `${EXPOKIT_APP}.xcarchive`, 'Products', 'Applications', `${EXPOKIT_APP}.app`);
|
||||
if (majorSdkVersion >= 33) {
|
||||
context.workspacePath = path.join(workingDir, 'shellAppWorkspaces', 'default', 'ios', `${EXPOKIT_APP}.xcworkspace`);
|
||||
}
|
||||
else {
|
||||
context.workspacePath = path.join(workingDir, 'shellAppWorkspaces', 'ios', 'default', `${EXPOKIT_APP}.xcworkspace`);
|
||||
}
|
||||
}
|
||||
else if (buildType === index_1.IOS_BUILD_TYPES.CLIENT) {
|
||||
context.outputPath = join(context.appDir, 'archive.xcarchive');
|
||||
context.uploadPath = join(context.buildDir, 'archive.ipa');
|
||||
context.archiveDir = join(context.baseArchiveDir, `${EXPONENT_APP}.xcarchive`, 'Products', 'Applications', `${EXPONENT_APP}.app`);
|
||||
context.workspacePath = path.join(workingDir, 'ios', `${EXPONENT_APP}.xcworkspace`);
|
||||
}
|
||||
else if (buildType === index_1.IOS_BUILD_TYPES.SIMULATOR) {
|
||||
context.outputPath = join(context.appDir, 'archive.tar.gz');
|
||||
context.uploadPath = join(context.appDir, 'archive.tar.gz');
|
||||
context.archiveDir = join(context.baseArchiveDir, 'Release', `${EXPOKIT_APP}.app`);
|
||||
}
|
||||
const s3FileExtension = buildType === index_1.IOS_BUILD_TYPES.SIMULATOR ? 'tar.gz' : 'ipa';
|
||||
const s3Filename = `${job.experienceName}-${appUUID}-${buildType}.${s3FileExtension}`;
|
||||
if (config_1.default.builder.fakeUpload) {
|
||||
const fakeUploadFilename = s3Filename.replace('/', '__');
|
||||
context.fakeUploadBuildPath = job.fakeUploadBuildPath
|
||||
? job.fakeUploadBuildPath
|
||||
: join(job.fakeUploadDir || config_1.default.directories.fakeUploadDir, fakeUploadFilename);
|
||||
}
|
||||
else {
|
||||
context.s3FileKey = join(index_1.PLATFORMS.IOS, s3Filename);
|
||||
}
|
||||
return context;
|
||||
}
|
||||
exports.createBuilderContext = createBuilderContext;
|
||||
//# sourceMappingURL=context.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/builders/ios/context.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA6B;AAE7B,mCAAuD;AACvD,+BAAoC;AAEpC,wDAA+E;AAC/E,0DAAmC;AACnC,iDAAoE;AAqBpE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,iBAAW,CAAC;AAElD,SAAgB,oBAAoB,CAAC,GAAS;IAC5C,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IACtB,MAAM,OAAO,GAAG,SAAM,EAAE,CAAC;IACzB,MAAM,EACJ,QAAQ,EAAE,EACR,UAAU,EAAE,sBAAsB,GAAG,IAAI,GAC1C,GAAG,EAAE,EACN,UAAU,EAAE,iBAAiB,EAC7B,MAAM,EAAE,EAAE,SAAS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CAAC,OAAO,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;QAC5D,OAAO,CAAC,UAAU,GAAG,IAAI,CACvB,OAAO,CAAC,cAAc,EACtB,SAAS,EACT,GAAG,WAAW,MAAM,CACrB,CAAC;KACH;IAED,MAAM,eAAe,GAAG,SAAS,KAAK,uBAAe,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;IACnF,MAAM,UAAU,GAAG,GAAG,GAAG,CAAC,cAAc,IAAI,OAAO,IAAI,SAAS,IAAI,eAAe,EAAE,CAAC;IACtF,IAAI,gBAAM,CAAC,OAAO,CAAC,UAAU,EAAE;QAC7B,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACzD,OAAO,CAAC,mBAAmB,GAAG,GAAG,CAAC,mBAAmB;YACnD,CAAC,CAAC,GAAG,CAAC,mBAAmB;YACzB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,IAAI,gBAAM,CAAC,WAAW,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;KACrF;SAAM;QACL,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,iBAAS,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;KACrD;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAhHD,oDAgHC","sourcesContent":["import * as path from 'path';\n\nimport { ExponentTools, IosShellApp } from '@expo/xdl';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport { formatShellAppDirectory } from 'turtle/builders/utils/ios/workingdir';\nimport config from 'turtle/config';\nimport { IOS_BUILD_TYPES, PLATFORMS } from 'turtle/constants/index';\nimport { IJob } from 'turtle/job';\n\nexport interface IContext {\n appDir: string;\n appUUID: string;\n archiveDir: string;\n baseArchiveDir: string;\n buildDir: string;\n fakeUploadBuildPath?: string;\n outputPath: string;\n provisioningProfilePath: string;\n provisioningProfileDir: string;\n s3FileKey?: string;\n tempCertPath: string;\n uploadPath: string;\n workingDir: string;\n workspacePath: string;\n applicationFilesSrc: string;\n}\n\nconst { EXPOKIT_APP, EXPONENT_APP } = IosShellApp;\n\nexport function createBuilderContext(job: IJob): IContext {\n const { join } = path;\n const appUUID = uuidv4();\n const {\n manifest: {\n sdkVersion: sdkVersionFromManifest = null,\n } = {},\n sdkVersion: sdkVersionFromJob,\n config: { buildType },\n } = job;\n\n const sdkVersion = sdkVersionFromJob || sdkVersionFromManifest;\n const workingDir = formatShellAppDirectory({ sdkVersion, buildType: buildType! });\n const majorSdkVersion = ExponentTools.parseSdkMajorVersion(sdkVersion);\n\n const context: any = {\n appDir: join(config.directories.temporaryFilesRoot, appUUID),\n appUUID,\n workingDir,\n };\n context.buildDir = join(context.appDir, 'build');\n context.provisioningProfileDir = join(context.appDir, 'provisioning');\n context.provisioningProfilePath = join(\n context.prLine truncated
|
||||
@@ -1,62 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const pick_1 = __importDefault(require("lodash/pick"));
|
||||
const archive_1 = __importDefault(require("./archive"));
|
||||
const context_1 = require("./context");
|
||||
const simulator_1 = __importDefault(require("./simulator"));
|
||||
const common_1 = require("../utils/common");
|
||||
const adhocBuild_1 = __importDefault(require("../utils/ios/adhocBuild"));
|
||||
const uploader_1 = require("../utils/uploader");
|
||||
const version_1 = require("../utils/version");
|
||||
const config_1 = __importDefault(require("../../config"));
|
||||
const constants_1 = require("../../constants");
|
||||
async function iosBuilder(job) {
|
||||
if (job.config.buildType !== constants_1.IOS_BUILD_TYPES.CLIENT) {
|
||||
await version_1.ensureCanBuildSdkVersion(job);
|
||||
}
|
||||
const ctx = context_1.createBuilderContext(job);
|
||||
try {
|
||||
await initBuilder(ctx);
|
||||
const { buildType } = job.config;
|
||||
if (buildType === constants_1.IOS_BUILD_TYPES.CLIENT) {
|
||||
await adhocBuild_1.default(job);
|
||||
}
|
||||
if ([constants_1.IOS_BUILD_TYPES.ARCHIVE, constants_1.IOS_BUILD_TYPES.CLIENT].includes(buildType)) {
|
||||
await archive_1.default(ctx, job);
|
||||
}
|
||||
else if (buildType === constants_1.IOS_BUILD_TYPES.SIMULATOR) {
|
||||
await simulator_1.default(ctx, job);
|
||||
}
|
||||
else {
|
||||
throw new Error(`Unsupported iOS build type: ${buildType}`);
|
||||
}
|
||||
const artifactUrl = await uploader_1.uploadBuildToS3(ctx);
|
||||
return { artifactUrl };
|
||||
}
|
||||
catch (err) {
|
||||
common_1.logErrorOnce(err);
|
||||
throw err;
|
||||
}
|
||||
finally {
|
||||
await cleanup(ctx);
|
||||
}
|
||||
}
|
||||
exports.default = iosBuilder;
|
||||
async function initBuilder(ctx) {
|
||||
for (const dir of getTemporaryDirs(ctx)) {
|
||||
await fs_extra_1.default.ensureDir(dir);
|
||||
await fs_extra_1.default.chmod(dir, 0o755);
|
||||
}
|
||||
}
|
||||
async function cleanup(ctx) {
|
||||
if (config_1.default.builder.skipCleanup) {
|
||||
return;
|
||||
}
|
||||
await Promise.all(getTemporaryDirs(ctx).map((dir) => fs_extra_1.default.remove(dir)));
|
||||
}
|
||||
const getTemporaryDirs = (ctx) => Object.values(pick_1.default(ctx, ['appDir', 'provisioningProfileDir']));
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/builders/ios/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA0B;AAC1B,uDAA+B;AAE/B,wDAAuD;AACvD,uCAA6E;AAC7E,4DAA2D;AAC3D,4CAA4D;AAC5D,yEAAgF;AAChF,gDAAiE;AACjE,8CAAyE;AACzE,0DAAmC;AACnC,+CAAmD;AAGpC,KAAK,UAAU,UAAU,CAAC,GAAS;IAChD,IAAI,GAAG,CAA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,CAAC;AAED,KAAK,UAAU,OAAO,CAAC,GAAa;IAClC,IAAI,gBAAM,CAAC,OAAO,CAAC,WAAW,EAAE;QAC9B,OAAO;KACR;IACD,MAAM,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAW,EAAE,EAAE,CAAC,kBAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC;AAED,MAAM,gBAAgB,GAAG,CAAC,GAAa,EAAE,EAAE,CACzC,MAAM,CAAC,MAAM,CAAC,cAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,wBAAwB,CAAC,CAAC,CAAa,CAAC","sourcesContent":["import fs from 'fs-extra';\nimport pick from 'lodash/pick';\n\nimport buildArchive from 'turtle/builders/ios/archive';\nimport { createBuilderContext, IContext } from 'turtle/builders/ios/context';\nimport buildSimulator from 'turtle/builders/ios/simulator';\nimport { logErrorOnce } from 'turtle/builders/utils/common';\nimport prepareAdHocBuildCredentials from 'turtle/builders/utils/ios/adhocBuild';\nimport { uploadBuildToS3 } from 'turtle/builders/utils/uploader';\nimport { ensureCanBuildSdkVersion } from 'turtle/builders/utils/version';\nimport config from 'turtle/config';\nimport { IOS_BUILD_TYPES } from 'turtle/constants';\nimport { IJob, IJobResult } from 'turtle/job';\n\nexport default async function iosBuilder(job: IJob): Promise<IJobResult> {\n if (job.config.buildType !== IOS_BUILD_TYPES.CLIENT) {\n await ensureCanBuildSdkVersion(job);\n }\n\n const ctx = createBuilderContext(job);\n\n try {\n await initBuilder(ctx);\n\n const { buildType } = job.config;\n\n if (buildType === IOS_BUILD_TYPES.CLIENT) {\n await prepareAdHocBuildCredentials(job);\n }\n\n if ([IOS_BUILD_TYPES.ARCHIVE, IOS_BUILD_TYPES.CLIENT].includes(buildType!)) {\n await buildArchive(ctx, job);\n } else if (buildType === IOS_BUILD_TYPES.SIMULATOR) {\n await buildSimulator(ctx, job);\n } else {\n throw new Error(`Unsupported iOS build type: ${buildType}`);\n }\n\n const artifactUrl = await uploadBuildToS3(ctx);\n return { artifactUrl };\n } catch (err) {\n logErrorOnce(err);\n throw err;\n } finally {\n await cleanup(ctx);\n }\n}\n\nasync function initBuilder(ctx: IContext) {\n for (const dir of getTemporaryDirs(ctx)) {\n await fs.ensureDir(dir);\n await fs.chmod(dir, 0o755);\n }\n}\n\nasync function cleanup(ctx: IContext) {\n if (config.builder.skipCleanup) {\n return;\n }\n await Promise.all(getTemporaryDirs(ctx).map((dir: string) => fs.remove(dir)));\n}\n\nconst getTemporaryDirs = (ctx: IContext) =>\n Object.values(pick(ctx, ['appDir', 'provisioningProfileDir'])) as string[];\n"]}
|
||||
@@ -1,15 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const shellAppBuilder_1 = __importDefault(require("../utils/ios/shellAppBuilder"));
|
||||
const logger_1 = __importDefault(require("../../logger"));
|
||||
async function buildSimulator(ctx, job) {
|
||||
const l = logger_1.default.child({ buildPhase: 'running simulator builder' });
|
||||
l.info('running simulator build');
|
||||
await shellAppBuilder_1.default(ctx, job);
|
||||
l.info('build complete');
|
||||
}
|
||||
exports.default = buildSimulator;
|
||||
//# sourceMappingURL=simulator.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"simulator.js","sourceRoot":"","sources":["../../../src/builders/ios/simulator.ts"],"names":[],"mappings":";;;;;AACA,mFAA2E;AAE3E,0DAAmC;AAEpB,KAAK,UAAU,cAAc,CAAC,GAAa,EAAE,GAAS;IACnE,MAAM,CAAC,GAAG,gBAAM,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,2BAA2B,EAAE,CAAC,CAAC;IACpE,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAClC,MAAM,yBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACnC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;AAC3B,CAAC;AALD,iCAKC","sourcesContent":["import { IContext } from 'turtle/builders/ios/context';\nimport runShellAppBuilder from 'turtle/builders/utils/ios/shellAppBuilder';\nimport { IJob } from 'turtle/job';\nimport logger from 'turtle/logger';\n\nexport default async function buildSimulator(ctx: IContext, job: IJob) {\n const l = logger.child({ buildPhase: 'running simulator builder' });\n l.info('running simulator build');\n await runShellAppBuilder(ctx, job);\n l.info('build complete');\n}\n"]}
|
||||
@@ -1,65 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const xdl_1 = require("@expo/xdl");
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const get_1 = __importDefault(require("lodash/get"));
|
||||
const v4_1 = __importDefault(require("uuid/v4"));
|
||||
const sqs = __importStar(require("../../../aws/sqs"));
|
||||
const build_1 = require("../../../constants/build");
|
||||
const logger_1 = __importDefault(require("../../../logger"));
|
||||
const turtleContext_1 = require("../../../turtleContext");
|
||||
async function getOrCreateCredentials(jobData) {
|
||||
if (!jobData.credentials) {
|
||||
const l = logger_1.default.child({ buildPhase: 'generating keystore' });
|
||||
const credentials = {};
|
||||
l.info('Creating keystore');
|
||||
const keystoreFilename = `/tmp/keystore-${jobData.id}.tmp.jks`;
|
||||
credentials.keystorePassword = v4_1.default().replace(/-/g, '');
|
||||
credentials.keyPassword = v4_1.default().replace(/-/g, '');
|
||||
credentials.keystoreAlias = Buffer.from(jobData.experienceName).toString('base64');
|
||||
const androidPackage = get_1.default(jobData, 'manifest.android.package')
|
||||
|| get_1.default(jobData, 'config.androidPackage');
|
||||
if (!androidPackage) {
|
||||
throw new Error('Android package name is not set in the app manifest (please update app.json if you\'re using turtle-cli).');
|
||||
}
|
||||
await xdl_1.AndroidCredentials.createKeystore({
|
||||
keystorePath: keystoreFilename,
|
||||
keystorePassword: credentials.keystorePassword,
|
||||
keyPassword: credentials.keyPassword,
|
||||
keyAlias: credentials.keystoreAlias,
|
||||
}, androidPackage);
|
||||
credentials.keystore = (await fs_extra_1.default.readFile(keystoreFilename)).toString('base64');
|
||||
l.info('Keystore created successfully');
|
||||
if (turtleContext_1.isOffline()) {
|
||||
const projectKeystorePath = path_1.default.join(jobData.projectDir, `${jobData.experienceName}.jks`);
|
||||
await fs_extra_1.default.copy(keystoreFilename, projectKeystorePath);
|
||||
l.info(`Saved created keystore to ${projectKeystorePath}`);
|
||||
l.info(`Keystore password: ${credentials.keystorePassword}`);
|
||||
l.info(`Keystore alias: ${credentials.keystoreAlias}`);
|
||||
l.info(`Key password: ${credentials.keyPassword}`);
|
||||
l.info(`Please keep these credentials safe`);
|
||||
}
|
||||
else {
|
||||
await sqs.sendMessage(jobData.id, build_1.UPDATE_CREDENTIALS, {
|
||||
...credentials,
|
||||
});
|
||||
l.info('Keystore sent to storage successfully');
|
||||
}
|
||||
await fs_extra_1.default.unlink(keystoreFilename);
|
||||
return credentials;
|
||||
}
|
||||
return jobData.credentials;
|
||||
}
|
||||
exports.default = getOrCreateCredentials;
|
||||
//# sourceMappingURL=credentials.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../../../src/builders/utils/android/credentials.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAAwB;AAExB,mCAA+C;AAC/C,wDAA0B;AAC1B,qDAA6B;AAC7B,iDAA6B;AAE7B,sDAAsC;AACtC,oDAA4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+BAA+B,CAAC,CAAC;QACxC,IAAI,yBAAS,EAAE,EAAE;YACf,MAAM,mBAAmB,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,OAAO,CAAC,cAAc,MAAM,CAAC,CAAC;YAC3F,MAAM,kBAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,CAAC;YACrD,CAAC,CAAC,IAAI,CAAC,6BAA6B,mBAAmB,EAAE,CAAC,CAAC;YAC3D,CAAC,CAAC,IAAI,CAAC,sBAAsB,WAAW,CAAC,gBAAgB,EAAE,CAAC,CAAC;YAC7D,CAAC,CAAC,IAAI,CAAC,mBAAmB,WAAW,CAAC,aAAa,EAAE,CAAC,CAAC;YACvD,CAAC,CAAC,IAAI,CAAC,iBAAiB,WAAW,CAAC,WAAW,EAAE,CAAC,CAAC;YACnD,CAAC,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;SAC9C;aAAM;YACL,MAAM,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,EAAE,0BAAkB,EAAE;gBACpD,GAAG,WAAW;aACf,CAAC,CAAC;YACH,CAAC,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;SACjD;QACD,MAAM,kBAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAClC,OAAO,WAAW,CAAC;KACpB;IAED,OAAO,OAAO,CAAC,WAAkC,CAAC;AACpD,CAAC;AAED,kBAAe,sBAAsB,CAAC","sourcesContent":["import path from 'path';\n\nimport { AndroidCredentials } from '@expo/xdl';\nimport fs from 'fs-extra';\nimport get from 'lodash/get';\nimport uuidv4 from 'uuid/v4';\n\nimport * as sqs from 'turtle/aws/sqs';\nimport { UPDATE_CREDENTIALS } from 'turtle/constants/build';\nimport { IAndroidCredentials, IJob } from 'turtle/job';\nimport logger from 'turtle/logger';\nimport { isOffline } from 'turtle/turtleContext';\n\nasync function getOrCreateCredentials(jobData: IJob): Promise<IAndroidCredentials> {\n if (!jobData.credentials) {\n const l = logger.child({ buildPhase: 'generating keystore' });\n const credentials: any = {};\n l.info('Creating keystore');\n const keystoreFilename = `/tmp/keystore-${jobData.id}.tmp.jks`;\n credentials.keystorePassword = uuidv4().replace(/-/g, '');\n credentials.keyPassword = uuidv4().replace(/-/g, '');\n credentials.keystoreAlias = Buffer.from(jobData.experienceName).toString('base64');\n const androidPackage =\n get(jobData, 'manifest.android.package')\n || get(jobData, 'config.androidPackage');\n if (!androidPackage) {\n throw new Error(\n 'Android package name is not set in the app manifest (please update app.json if you\\'re using turtle-cli).',\n );\n }\n\n await AndroidCredentials.createKeystore(\n {\n keystorePath: keystoreFilename,\n keystorePassword: credentials.keystorePassword,\n keyPassword: credentials.keyPassword,\n keyAlias: credentials.keystoreAlias,\n },\n androidPackage,\n );\n\n credentials.keystore = (await fs.readFile(keystoreFilename)).toString('base64');\n l.info('Keystore created successfully');\n if (isOffline()) {\n const projectKeystorePath = path.join(jobData.projectDir, `${jobData.experienceName}.jks`);\n await fs.copy(keystoreFilename, projectKeystorePath);\n l.info(`Saved created keystore to ${projectKeystorePath}`);\n l.info(`Keystore password: ${credentials.keystorePassword}`);\n l.info(`Keystore alias: ${credentials.keystoreAlias}`);\n l.info(`Key password: ${credentials.keyPassword}`);\n l.info(`Please keep these credentials safe`);\n } else {\n await sqs.sendMessage(jobData.id, UPDATE_CREDENTIALS, {\n ...credentials,\n });\n l.info('Keystore sent to storage successfully');\n }\n await fs.unlink(keystoreFilename);\n return credentials;\n }\n\n return jobData.credentials as IAndroidCredentials;\n}\n\nexport default getOrCreateCredentials;\n"]}
|
||||
@@ -1,17 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const xdl_1 = require("@expo/xdl");
|
||||
const config_1 = __importDefault(require("../../../config"));
|
||||
const constants_1 = require("../../../constants");
|
||||
function formatShellAppDirectory({ sdkVersion }) {
|
||||
const majorSdkVersion = xdl_1.ExponentTools.parseSdkMajorVersion(sdkVersion);
|
||||
return config_1.default.builder.useLocalWorkingDir
|
||||
? path_1.default.join(config_1.default.directories.workingDir, 'local')
|
||||
: path_1.default.join(config_1.default.directories.workingDir, constants_1.PLATFORMS.ANDROID, `sdk${majorSdkVersion}`);
|
||||
}
|
||||
exports.formatShellAppDirectory = formatShellAppDirectory;
|
||||
//# sourceMappingURL=workingdir.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"workingdir.js","sourceRoot":"","sources":["../../../../src/builders/utils/android/workingdir.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AAExB,mCAA0C;AAG1C,6DAAmC;AACnC,kDAA6C;AAE7C,SAAgB,uBAAuB,CAAC,EAAE,UAAU,EAA4B;IAC9E,MAAM,eAAe,GAAG,mBAAa,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;IACvE,OAAO,gBAAM,CAAC,OAAO,CAAC,kBAAkB;QACtC,CAAC,CAAC,cAAI,CAAC,IAAI,CAAC,gBAAM,CAAC,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC;QACnD,CAAC,CAAC,cAAI,CAAC,IAAI,CAAC,gBAAM,CAAC,WAAW,CAAC,UAAU,EAAE,qBAAS,CAAC,OAAO,EAAE,MAAM,eAAe,EAAE,CAAC,CAAC;AAC3F,CAAC;AALD,0DAKC","sourcesContent":["import path from 'path';\n\nimport { ExponentTools } from '@expo/xdl';\n\nimport { IShellAppDirectoryConfig } from 'turtle/builders/utils/workingdir';\nimport config from 'turtle/config';\nimport { PLATFORMS } from 'turtle/constants';\n\nexport function formatShellAppDirectory({ sdkVersion }: IShellAppDirectoryConfig) {\n const majorSdkVersion = ExponentTools.parseSdkMajorVersion(sdkVersion);\n return config.builder.useLocalWorkingDir\n ? path.join(config.directories.workingDir, 'local')\n : path.join(config.directories.workingDir, PLATFORMS.ANDROID, `sdk${majorSdkVersion}`);\n}\n"]}
|
||||
@@ -1,33 +0,0 @@
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const url = __importStar(require("url"));
|
||||
const config_1 = __importDefault(require("../../config"));
|
||||
const logger_1 = __importDefault(require("../../logger"));
|
||||
function getExperienceUrl(experienceName, publicUrl) {
|
||||
// publicUrl is passed in if user wants to build an externally hosted app
|
||||
if (publicUrl) {
|
||||
return publicUrl;
|
||||
}
|
||||
const { protocol, hostname, port } = config_1.default.api;
|
||||
return url.format({ protocol, hostname, port, pathname: `/${experienceName}` });
|
||||
}
|
||||
exports.getExperienceUrl = getExperienceUrl;
|
||||
const alreadyLoggedError = Symbol('alreadyLoggedError');
|
||||
function logErrorOnce(err) {
|
||||
if (!err[alreadyLoggedError]) {
|
||||
logger_1.default.error(err.stack);
|
||||
err[alreadyLoggedError] = true;
|
||||
}
|
||||
}
|
||||
exports.logErrorOnce = logErrorOnce;
|
||||
//# sourceMappingURL=common.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/builders/utils/common.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAA2B;AAE3B,0DAAmC;AACnC,0DAAmC;AAEnC,SAAgB,gBAAgB,CAAC,cAAsB,EAAE,SAAkB;IACzE,yEAAyE;IACzE,IAAI,SAAS,EAAE;QACb,OAAO,SAAS,CAAC;KAClB;IACD,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,gBAAM,CAAC,GAAG,CAAC;IAChD,OAAO,GAAG,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,cAAc,EAAE,EAAE,CAAC,CAAC;AAClF,CAAC;AAPD,4CAOC;AAED,MAAM,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAExD,SAAgB,YAAY,CAAC,GAAQ;IACnC,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,EAAE;QAC5B,gBAAM,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACxB,GAAG,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC;KAChC;AACH,CAAC;AALD,oCAKC","sourcesContent":["import * as url from 'url';\n\nimport config from 'turtle/config';\nimport logger from 'turtle/logger';\n\nexport function getExperienceUrl(experienceName: string, publicUrl?: string) {\n // publicUrl is passed in if user wants to build an externally hosted app\n if (publicUrl) {\n return publicUrl;\n }\n const { protocol, hostname, port } = config.api;\n return url.format({ protocol, hostname, port, pathname: `/${experienceName}` });\n}\n\nconst alreadyLoggedError = Symbol('alreadyLoggedError');\n\nexport function logErrorOnce(err: any) {\n if (!err[alreadyLoggedError]) {\n logger.error(err.stack);\n err[alreadyLoggedError] = true;\n }\n}\n"]}
|
||||
@@ -1,12 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
async function writeBase64ToBinaryFile(filename, base64) {
|
||||
const buffer = Buffer.from(base64, 'base64');
|
||||
await fs_extra_1.default.writeFile(filename, buffer);
|
||||
}
|
||||
exports.writeBase64ToBinaryFile = writeBase64ToBinaryFile;
|
||||
//# sourceMappingURL=file.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src/builders/utils/file.ts"],"names":[],"mappings":";;;;;AAAA,wDAA0B;AAEnB,KAAK,UAAU,uBAAuB,CAAC,QAAgB,EAAE,MAAc;IAC5E,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC7C,MAAM,kBAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AACvC,CAAC;AAHD,0DAGC","sourcesContent":["import fs from 'fs-extra';\n\nexport async function writeBase64ToBinaryFile(filename: string, base64: string) {\n const buffer = Buffer.from(base64, 'base64');\n await fs.writeFile(filename, buffer);\n}\n"]}
|
||||
@@ -1,34 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const sharp_1 = __importDefault(require("sharp"));
|
||||
async function resizeIconWithSharpAsync(iconSizePx, iconFilename, destinationIconPath) {
|
||||
const filename = path_1.default.join(destinationIconPath, iconFilename);
|
||||
// PLEASE DON'T REMOVE THE FOLLOWING LINE (sharp caches files taking path as the cache key)
|
||||
sharp_1.default.cache(false);
|
||||
// sharp can't have same input and output filename, so load to buffer then
|
||||
// write to disk after resize is complete
|
||||
const buffer = await sharp_1.default(filename)
|
||||
.resize(iconSizePx, iconSizePx)
|
||||
.toBuffer();
|
||||
await fs_extra_1.default.writeFile(filename, buffer);
|
||||
}
|
||||
exports.resizeIconWithSharpAsync = resizeIconWithSharpAsync;
|
||||
async function getImageDimensionsWithSharpAsync(dirname, filename) {
|
||||
const filepath = path_1.default.join(dirname, filename);
|
||||
// PLEASE DON'T REMOVE THE FOLLOWING LINE (sharp caches files taking path as the cache key)
|
||||
sharp_1.default.cache(false);
|
||||
try {
|
||||
const { width, height } = await sharp_1.default(filepath).metadata();
|
||||
return { width, height };
|
||||
}
|
||||
catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
exports.getImageDimensionsWithSharpAsync = getImageDimensionsWithSharpAsync;
|
||||
//# sourceMappingURL=image.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../src/builders/utils/image.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AAExB,wDAA0B;AAC1B,kDAA0B;AAEnB,KAAK,UAAU,wBAAwB,CAAC,UAAkB,EAAE,YAAoB,EAAE,mBAA2B;IAClH,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC;IAE9D,2FAA2F;IAC3F,eAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAEnB,0EAA0E;IAC1E,yCAAyC;IACzC,MAAM,MAAM,GAAG,MAAM,eAAK,CAAC,QAAQ,CAAC;SACjC,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC;SAC9B,QAAQ,EAAE,CAAC;IAEd,MAAM,kBAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AACvC,CAAC;AAbD,4DAaC;AAEM,KAAK,UAAU,gCAAgC,CAAC,OAAe,EAAE,QAAgB;IACtF,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAE9C,2FAA2F;IAC3F,eAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAEnB,IAAI;QACF,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,eAAK,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;KAC1B;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AAZD,4EAYC","sourcesContent":["import path from 'path';\n\nimport fs from 'fs-extra';\nimport sharp from 'sharp';\n\nexport async function resizeIconWithSharpAsync(iconSizePx: number, iconFilename: string, destinationIconPath: string) {\n const filename = path.join(destinationIconPath, iconFilename);\n\n // PLEASE DON'T REMOVE THE FOLLOWING LINE (sharp caches files taking path as the cache key)\n sharp.cache(false);\n\n // sharp can't have same input and output filename, so load to buffer then\n // write to disk after resize is complete\n const buffer = await sharp(filename)\n .resize(iconSizePx, iconSizePx)\n .toBuffer();\n\n await fs.writeFile(filename, buffer);\n}\n\nexport async function getImageDimensionsWithSharpAsync(dirname: string, filename: string) {\n const filepath = path.join(dirname, filename);\n\n // PLEASE DON'T REMOVE THE FOLLOWING LINE (sharp caches files taking path as the cache key)\n sharp.cache(false);\n\n try {\n const { width, height } = await sharp(filepath).metadata();\n return { width, height };\n } catch (e) {\n return null;\n }\n}\n"]}
|
||||
@@ -1,93 +0,0 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const spawn_async_1 = __importDefault(require("@expo/spawn-async"));
|
||||
const xdl_1 = require("@expo/xdl");
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const sqs = __importStar(require("../../../aws/sqs"));
|
||||
const BuildError_1 = __importStar(require("../../BuildError"));
|
||||
const build_1 = require("../../../constants/build");
|
||||
const logger_1 = __importDefault(require("../../../logger"));
|
||||
const turtleContext_1 = require("../../../turtleContext");
|
||||
// tslint:disable-next-line:no-var-requires
|
||||
const travelingFastlane = process.platform === 'darwin' ? require('@expo/traveling-fastlane-darwin')() : null;
|
||||
async function prepareAdHocBuildCredentials(job) {
|
||||
if (process.platform !== 'darwin') {
|
||||
throw new Error('This function should be called only on macOS!');
|
||||
}
|
||||
const { bundleIdentifier } = job.config;
|
||||
const { certP12, certPassword, teamId, appleSession, udids, provisioningProfileId, } = job.credentials;
|
||||
const certSerialNumber = xdl_1.IosCodeSigning.findP12CertSerialNumber(certP12, certPassword);
|
||||
const args = [
|
||||
...(provisioningProfileId ? ['--profile-id', provisioningProfileId] : []),
|
||||
teamId,
|
||||
udids.join(','),
|
||||
bundleIdentifier,
|
||||
certSerialNumber || '__last__',
|
||||
];
|
||||
try {
|
||||
if (provisioningProfileId) {
|
||||
logger_1.default.info(`Using ad hoc provisioning profile id: ${provisioningProfileId}`);
|
||||
}
|
||||
const credentials = await runFastlaneAction(travelingFastlane.manageAdHocProvisioningProfile, args, { env: { FASTLANE_SESSION: appleSession } });
|
||||
logger_1.default.info('New ad hoc provisioning profile successfully created');
|
||||
job.credentials.provisioningProfile = credentials.provisioningProfile;
|
||||
if (!credentials.provisioningProfileUpdateTimestamp) {
|
||||
// dont need to persist profile because nothing changed
|
||||
return;
|
||||
}
|
||||
if (turtleContext_1.isOffline()) {
|
||||
const provisioningProfilePath = path_1.default.join(job.projectDir, `adhoc.mobileprovision`);
|
||||
await fs_extra_1.default.writeFile(provisioningProfilePath, Buffer.from(credentials.provisioningProfile, 'base64'));
|
||||
logger_1.default.info(`Saved provisioning profile to ${provisioningProfilePath}`);
|
||||
}
|
||||
else {
|
||||
await sqs.sendMessage(job.id, build_1.UPDATE_CREDENTIALS, {
|
||||
provisioningProfileId: credentials.provisioningProfileId,
|
||||
provisioningProfile: credentials.provisioningProfile,
|
||||
});
|
||||
logger_1.default.info('Ad Hoc provisioning profile sent to storage successfully');
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof BuildError_1.default) {
|
||||
logger_1.default.error('Apple Session expired! Please authenticate again using expo-cli.');
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
async function runFastlaneAction(action, args, { env }) {
|
||||
const { stderr } = await spawn_async_1.default(action, args, {
|
||||
stdio: ['inherit', 'pipe', 'pipe'],
|
||||
env: { ...process.env, ...env },
|
||||
});
|
||||
const { result, ...rest } = JSON.parse(stderr.trim());
|
||||
if (result === 'failure') {
|
||||
const { reason, rawDump, type } = rest;
|
||||
let errorMsg = `Reason: ${reason}`;
|
||||
if (rawDump) {
|
||||
errorMsg += `, raw: ${JSON.stringify(rawDump)}`;
|
||||
}
|
||||
if (type === 'session-expired') {
|
||||
throw new BuildError_1.default(BuildError_1.BuildErrorReason.SESSION_EXPIRED, errorMsg);
|
||||
}
|
||||
else {
|
||||
throw new Error(errorMsg);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return rest;
|
||||
}
|
||||
}
|
||||
exports.default = prepareAdHocBuildCredentials;
|
||||
//# sourceMappingURL=adhocBuild.js.map
|
||||
Loaded 100 of 271 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user