@expo/build-tools 20.5.1 → 21.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/android/gradle.d.ts +5 -0
  2. package/dist/android/gradle.js +13 -33
  3. package/dist/common/installDependencies.js +21 -18
  4. package/dist/context.js +31 -1
  5. package/dist/steps/easFunctions.js +18 -0
  6. package/dist/steps/functions/capturePosthogEvent.d.ts +2 -0
  7. package/dist/steps/functions/capturePosthogEvent.js +79 -0
  8. package/dist/steps/functions/createPosthogAnnotation.d.ts +2 -0
  9. package/dist/steps/functions/createPosthogAnnotation.js +75 -0
  10. package/dist/steps/functions/finishIosSimulatorRecordings.d.ts +2 -0
  11. package/dist/steps/functions/finishIosSimulatorRecordings.js +24 -0
  12. package/dist/steps/functions/rolloutPosthogFlag.d.ts +2 -0
  13. package/dist/steps/functions/rolloutPosthogFlag.js +208 -0
  14. package/dist/steps/functions/startAgentDeviceRemoteSession.js +21 -8
  15. package/dist/steps/functions/startArgentRemoteSession.d.ts +14 -0
  16. package/dist/steps/functions/startArgentRemoteSession.js +105 -44
  17. package/dist/steps/functions/startIosSimulatorRecordings.d.ts +2 -0
  18. package/dist/steps/functions/startIosSimulatorRecordings.js +20 -0
  19. package/dist/steps/functions/startServeSimRemoteSession.js +7 -5
  20. package/dist/steps/functions/uploadDeviceRunSessionScreenRecordings.d.ts +3 -0
  21. package/dist/steps/functions/uploadDeviceRunSessionScreenRecordings.js +91 -0
  22. package/dist/steps/functions/uploadPosthogSourcemaps.d.ts +2 -0
  23. package/dist/steps/functions/uploadPosthogSourcemaps.js +83 -0
  24. package/dist/steps/functions/waitForPosthogMetric.d.ts +2 -0
  25. package/dist/steps/functions/waitForPosthogMetric.js +135 -0
  26. package/dist/steps/functions/waitForPosthogQuery.d.ts +2 -0
  27. package/dist/steps/functions/waitForPosthogQuery.js +95 -0
  28. package/dist/steps/utils/IosSimulatorRecordingUtils.d.ts +17 -0
  29. package/dist/steps/utils/IosSimulatorRecordingUtils.js +218 -0
  30. package/dist/steps/utils/PosthogClient.d.ts +46 -0
  31. package/dist/steps/utils/PosthogClient.js +156 -0
  32. package/dist/steps/utils/PosthogUtils.d.ts +41 -0
  33. package/dist/steps/utils/PosthogUtils.js +65 -0
  34. package/dist/steps/utils/agentDeviceArtifacts.d.ts +27 -0
  35. package/dist/steps/utils/agentDeviceArtifacts.js +133 -0
  36. package/dist/steps/utils/android/gradle.d.ts +5 -0
  37. package/dist/steps/utils/android/gradle.js +13 -62
  38. package/dist/steps/utils/argentArtifacts.d.ts +5 -3
  39. package/dist/steps/utils/argentArtifacts.js +95 -23
  40. package/dist/steps/utils/deviceRunSessionArtifacts.d.ts +3 -1
  41. package/dist/steps/utils/deviceRunSessionArtifacts.js +6 -2
  42. package/dist/steps/utils/remoteDeviceRunSession.d.ts +8 -0
  43. package/dist/steps/utils/remoteDeviceRunSession.js +62 -1
  44. package/dist/utils/AndroidEmulatorUtils.js +3 -0
  45. package/dist/utils/IosSimulatorUtils.d.ts +1 -0
  46. package/dist/utils/IosSimulatorUtils.js +41 -2
  47. package/dist/utils/expoUpdatesEmbedded.js +4 -0
  48. package/dist/utils/processes.d.ts +1 -0
  49. package/dist/utils/processes.js +23 -0
  50. package/package.json +9 -8
  51. package/resources/record-sim/Package.swift +28 -0
  52. package/resources/record-sim/README.md +79 -0
  53. package/resources/record-sim/Sources/RecordSim/FramebufferDisplaySource.swift +192 -0
  54. package/resources/record-sim/Sources/RecordSim/PrivateSimulatorServices.swift +96 -0
  55. package/resources/record-sim/Sources/RecordSim/RecordingModels.swift +70 -0
  56. package/resources/record-sim/Sources/RecordSim/RecordingOutputWriter.swift +136 -0
  57. package/resources/record-sim/Sources/RecordSim/SimulatorRecorder.swift +632 -0
  58. package/resources/record-sim/Sources/RecordSim/Utilities.swift +60 -0
  59. package/resources/record-sim/Sources/record-sim/main.swift +143 -0
@@ -0,0 +1,143 @@
1
+ import Foundation
2
+ import RecordSim
3
+
4
+ struct CLIOptions {
5
+ var udid: String?
6
+ var output: String?
7
+ var segmentDuration: TimeInterval = 120
8
+ var fps = 30
9
+ var bitrate = 30_000_000
10
+ var codec: RecorderCodec = .h264
11
+ }
12
+
13
+ private var stopRequested: CInt = 0
14
+ private var simulatorStopped: CInt = 0
15
+
16
+ private func handleStopSignal(_: CInt) {
17
+ stopRequested = 1
18
+ }
19
+
20
+ private func isStopRequested() -> Bool {
21
+ stopRequested != 0 || simulatorStopped != 0
22
+ }
23
+
24
+ func usage() -> String {
25
+ """
26
+ Usage:
27
+ record-sim --udid <UDID> --output <session-dir> [options]
28
+
29
+ Options:
30
+ --segment-duration <seconds> Target fMP4 media segment duration. Use 0 for one MP4. Default: 120
31
+ --fps <fps> Expected source frame rate. Default: 30
32
+ --bitrate <bits/sec> AVAssetWriter average bitrate. Default: 30000000
33
+ --codec <h264|hevc> Video codec. Default: h264
34
+ -h, --help Show this help
35
+ """
36
+ }
37
+
38
+ func parseOptions(_ args: [String]) throws -> CLIOptions {
39
+ var options = CLIOptions()
40
+ var i = 0
41
+
42
+ func next(_ flag: String) throws -> String {
43
+ i += 1
44
+ guard i < args.count else {
45
+ throw NSError(domain: "record-sim", code: 2, userInfo: [NSLocalizedDescriptionKey: "Missing value for \(flag)"])
46
+ }
47
+ return args[i]
48
+ }
49
+
50
+ while i < args.count {
51
+ let arg = args[i]
52
+ switch arg {
53
+ case "--udid", "-u":
54
+ options.udid = try next(arg)
55
+ case "--output", "--output-dir", "--out", "-o":
56
+ options.output = try next(arg)
57
+ case "--segment-duration":
58
+ options.segmentDuration = Double(try next(arg)) ?? -1
59
+ case "--fps":
60
+ options.fps = Int(try next(arg)) ?? 0
61
+ case "--bitrate":
62
+ options.bitrate = Int(try next(arg)) ?? 0
63
+ case "--codec":
64
+ let raw = try next(arg)
65
+ guard let codec = RecorderCodec(rawValue: raw) else {
66
+ throw NSError(domain: "record-sim", code: 2, userInfo: [NSLocalizedDescriptionKey: "--codec must be h264 or hevc"])
67
+ }
68
+ options.codec = codec
69
+ case "--help", "-h":
70
+ print(usage())
71
+ exit(0)
72
+ default:
73
+ throw NSError(domain: "record-sim", code: 2, userInfo: [NSLocalizedDescriptionKey: "Unknown argument: \(arg)"])
74
+ }
75
+ i += 1
76
+ }
77
+
78
+ guard options.udid != nil else {
79
+ throw NSError(domain: "record-sim", code: 2, userInfo: [NSLocalizedDescriptionKey: "Missing required --udid"])
80
+ }
81
+ guard options.output != nil else {
82
+ throw NSError(domain: "record-sim", code: 2, userInfo: [NSLocalizedDescriptionKey: "Missing required --output"])
83
+ }
84
+ guard options.segmentDuration >= 0 else {
85
+ throw NSError(domain: "record-sim", code: 2, userInfo: [NSLocalizedDescriptionKey: "--segment-duration must be non-negative"])
86
+ }
87
+ guard options.fps > 0, options.fps <= 120 else {
88
+ throw NSError(domain: "record-sim", code: 2, userInfo: [NSLocalizedDescriptionKey: "--fps must be between 1 and 120"])
89
+ }
90
+ guard options.bitrate > 0 else {
91
+ throw NSError(domain: "record-sim", code: 2, userInfo: [NSLocalizedDescriptionKey: "--bitrate must be positive"])
92
+ }
93
+ return options
94
+ }
95
+
96
+ do {
97
+ signal(SIGINT, handleStopSignal)
98
+ signal(SIGTERM, handleStopSignal)
99
+
100
+ let options = try parseOptions(Array(CommandLine.arguments.dropFirst()))
101
+ let configuration = SimulatorRecordingConfiguration(
102
+ deviceUDID: options.udid!,
103
+ outputDirectory: URL(fileURLWithPath: options.output!),
104
+ fps: options.fps,
105
+ bitrate: options.bitrate,
106
+ codec: options.codec,
107
+ segmentDuration: options.segmentDuration
108
+ )
109
+
110
+ let recorder = SimulatorRecorder(configuration: configuration)
111
+ recorder.onSimulatorStopped = { state in
112
+ simulatorStopped = 1
113
+ fputs("[record-sim] simulator stopped state=\(state); finalizing recording\n", stderr)
114
+ }
115
+ recorder.onSegment = { segment in
116
+ switch segment.kind {
117
+ case .initialization:
118
+ fputs("[record-sim] init \(segment.relativePath) bytes=\(segment.byteCount)\n", stderr)
119
+ case .media:
120
+ let duration = segment.durationSeconds ?? 0
121
+ fputs(String(format: "[record-sim] segment %@ duration=%.3fs bytes=%d\n", segment.relativePath, duration, segment.byteCount), stderr)
122
+ }
123
+ }
124
+
125
+ try recorder.start()
126
+ try recorder.waitUntilFirstFrame()
127
+ fputs("[record-sim] recording -> \(options.output!)\n", stderr)
128
+
129
+ while !isStopRequested() {
130
+ Thread.sleep(forTimeInterval: 0.1)
131
+ }
132
+
133
+ let manifest = try recorder.stop()
134
+ if let recording = manifest.recording {
135
+ fputs("[record-sim] done recording=\(recording)\n", stderr)
136
+ } else {
137
+ fputs("[record-sim] done segments=\(manifest.segments.count)\n", stderr)
138
+ }
139
+ fputs("[record-sim] manifest \(URL(fileURLWithPath: options.output!).appendingPathComponent("session.json").path)\n", stderr)
140
+ } catch {
141
+ fputs("error: \(error.localizedDescription)\n", stderr)
142
+ exit(1)
143
+ }