@@ -31,7 +31,7 @@ public function __construct(
3131
3232 public function download (SystemInfo $ systemInfo ): void
3333 {
34- $ asset = $ this ->getAsset ($ systemInfo-> platform , $ systemInfo -> arch );
34+ $ asset = $ this ->getAsset ($ systemInfo );
3535 $ assetUrl = $ asset ['browser_download_url ' ];
3636 $ pathToExtractedAsset = $ this ->downloadAsset ($ assetUrl );
3737
@@ -46,19 +46,33 @@ public function check(string $filename): bool
4646 return $ this ->filesystem ->exists ($ filename );
4747 }
4848
49- private function findAsset (array $ assets , string $ systemPlatform , string $ systemArch ): array
49+ private function findAsset (array $ assets , SystemInfo $ systemInfo ): array
5050 {
51+ $ assetsMacOs = null ;
52+
5153 foreach ($ assets as $ asset ) {
5254 \preg_match ('/^temporal-test-server_[^_]+_([^_]+)_([^.]+)\.(?:zip|tar.gz)$/ ' , $ asset ['name ' ], $ match );
5355 [, $ assetPlatform , $ assetArch ] = $ match ;
5456
55- if ($ assetPlatform === $ systemPlatform ) {
56- // TODO: assetArch === systemArch (no arm builds for test server yet)
57+
58+ // save compatibility
59+ if ($ assetPlatform == 'macOS ' ) {
60+ $ assetsMacOs = $ asset ;
61+ }
62+
63+
64+ if ($ assetPlatform == $ systemInfo ->platform && $ systemInfo ->os == $ assetArch ) {
5765 return $ asset ;
5866 }
5967 }
6068
61- throw new \RuntimeException ("Asset for $ systemPlatform not found " );
69+ // save compatibility
70+ if ($ systemInfo ->platform == 'macOS ' && $ assetsMacOs != null ) {
71+ return $ assetsMacOs ;
72+ }
73+
74+
75+ throw new \RuntimeException ("Asset for $ systemInfo ->platform not found " );
6276 }
6377
6478 private function downloadAsset (string $ assetUrl ): string
@@ -82,11 +96,11 @@ private function downloadAsset(string $assetUrl): string
8296 return $ extractedPath ;
8397 }
8498
85- private function getAsset (string $ systemPlatform , string $ systemArch ): array
99+ private function getAsset (SystemInfo $ systemInfo ): array
86100 {
87101 $ response = $ this ->httpClient ->request ('GET ' , $ this ->javaSdkUrl );
88102 $ assets = $ response ->toArray ()['assets ' ];
89103
90- return $ this ->findAsset ($ assets , $ systemPlatform , $ systemArch );
104+ return $ this ->findAsset ($ assets , $ systemInfo );
91105 }
92106}
0 commit comments