@@ -53,9 +53,11 @@ def from_string(path: str) -> "JREResolvedPath":
5353
5454
5555class JREProvisioner :
56- def __init__ (self , api : SonarQubeApi , cache : Cache ):
56+ def __init__ (self , api : SonarQubeApi , cache : Cache , sonar_scanner_os : str , sonar_scanner_arch : str ):
5757 self .api = api
5858 self .cache = cache
59+ self .sonar_scanner_os = sonar_scanner_os
60+ self .sonar_scanner_arch = sonar_scanner_arch
5961
6062 def provision (self ) -> JREResolvedPath :
6163 jre , resolved_path = self .__attempt_provisioning_jre_with_retry ()
@@ -67,7 +69,7 @@ def __attempt_provisioning_jre_with_retry(self) -> tuple[JRE, pathlib.Path]:
6769 jre_and_resolved_path = self .__attempt_provisioning_jre ()
6870 if jre_and_resolved_path is None :
6971 raise ChecksumException (
70- f"Failed to download and verify JRE for { utils . get_os (). value } and { utils . get_arch (). value } "
72+ f"Failed to download and verify JRE for { self . sonar_scanner_os } and { self . sonar_scanner_arch } "
7173 )
7274
7375 return jre_and_resolved_path
@@ -83,10 +85,10 @@ def __attempt_provisioning_jre(self) -> Optional[tuple[JRE, pathlib.Path]]:
8385 return (jre , jre_path ) if jre_path is not None else None
8486
8587 def __get_available_jre (self ) -> JRE :
86- jres = self .api .get_analysis_jres (os = utils . get_os () , arch = utils . get_arch () )
88+ jres = self .api .get_analysis_jres (os = self . sonar_scanner_os , arch = self . sonar_scanner_arch )
8789 if len (jres ) == 0 :
8890 raise NoJreAvailableException (
89- f"No JREs are available for { utils . get_os (). value } and { utils . get_arch (). value } "
91+ f"No JREs are available for { self . sonar_scanner_os } and { self . sonar_scanner_arch } "
9092 )
9193 return jres [0 ]
9294
0 commit comments