File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed 
src/main/java/org/moe/gradle Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,14 @@ public URI getSdkDir() {
9999        return  Require .nonNull (sdkDir );
100100    }
101101
102+     @ Nullable 
103+     private  Boolean  remoteAARCH64 ;
104+ 
105+     @ NotNull 
106+     public  boolean  isRemoteAARCH64 () {
107+         return  Require .nonNull (remoteAARCH64 );
108+     }
109+ 
102110    @ Nullable 
103111    private  Task  moeRemoteServerSetupTask ;
104112
@@ -202,13 +210,19 @@ public void connect() {
202210                    throw  new  GradleException (e .getMessage (), e );
203211                }
204212
213+                 fetchArchitecture ();
205214                setupUserHome ();
206215                setupBuildDir ();
207216                prepareServerMOE ();
208217            });
209218        });
210219    }
211220
221+     private  void  fetchArchitecture () {
222+         String  arch  = exec ("get arch" , "arch" );
223+         remoteAARCH64  = arch .equals ("arm64" );
224+     }
225+ 
212226    private  void  prepareServerMOE () {
213227        final  MoeSDK  sdk  = plugin .getSDK ();
214228
Original file line number Diff line number Diff line change @@ -249,7 +249,12 @@ protected void run() {
249249                    "mkdir -p `dirname "  + remoteDestArt  + "` && "  +
250250                    "mkdir -p `dirname "  + remoteDestOat  + "`" );
251251
252-             remoteServer .exec ("dex2oat" , dex2oatExec  + " "  +
252+             String  optionalRosetta  = "" ;
253+             if  (remoteServer .isRemoteAARCH64 () && !Arch .FAMILY_ARM64 .equalsIgnoreCase (getArchFamily ())) {
254+                 optionalRosetta  = "arch --x86_64 " ;
255+             }
256+ 
257+             remoteServer .exec ("dex2oat" , optionalRosetta  + dex2oatExec  + " "  +
253258                    "--instruction-set="  + Arch .validateArchFamily (getArchFamily ()) + " "  +
254259                    "--base=0x"  + Long .toHexString (getBase ()) + " "  +
255260                    "--compiler-backend="  + validateBackend (getCompilerBackend ()) + " "  +
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments