@@ -285,7 +285,12 @@ func buildInDocker(targetOS string, vmArguments []string) {
285
285
if runtime .GOOS != "windows" {
286
286
chownStr = fmt .Sprintf (" && chown %s:%s ./ -R" , u .Uid , u .Gid )
287
287
}
288
- args = append (args , "bash" , "-c" , fmt .Sprintf ("%s%s" , strings .Join (buildCommand (targetOS , vmArguments , "build/outputs/" + targetOS + "/" + build .OutputBinaryName (pubspec .GetPubSpec ().Name , targetOS )), " " ), chownStr ))
288
+ stripStr := ""
289
+ if targetOS == "linux" {
290
+ outputEngineFile := filepath .Join ("/app" , build .BuildPath , "build" , "outputs" , targetOS , build .EngineFile (targetOS ))
291
+ stripStr = fmt .Sprintf ("strip -s %s && " , outputEngineFile )
292
+ }
293
+ args = append (args , "bash" , "-c" , fmt .Sprintf ("%s%s%s" , stripStr , strings .Join (buildCommand (targetOS , vmArguments , "build/outputs/" + targetOS + "/" + build .OutputBinaryName (pubspec .GetPubSpec ().Name , targetOS )), " " ), chownStr ))
289
294
dockerRunCmd := exec .Command (build .DockerBin , args ... )
290
295
dockerRunCmd .Stderr = os .Stderr
291
296
dockerRunCmd .Stdout = os .Stdout
@@ -383,32 +388,15 @@ func buildNormal(targetOS string, vmArguments []string) {
383
388
}
384
389
}
385
390
386
- var engineFile string
387
- switch targetOS {
388
- case "darwin" :
389
- engineFile = "FlutterEmbedder.framework"
390
- case "linux" :
391
- engineFile = "libflutter_engine.so"
392
- case "windows" :
393
- engineFile = "flutter_engine.dll"
394
- }
395
-
396
- outputEngineFile := filepath .Join (build .OutputDirectoryPath (targetOS ), engineFile )
391
+ outputEngineFile := filepath .Join (build .OutputDirectoryPath (targetOS ), build .EngineFile (targetOS ))
397
392
err = copy .Copy (
398
- filepath .Join (engineCachePath , engineFile ),
393
+ filepath .Join (engineCachePath , build . EngineFile ( targetOS ) ),
399
394
outputEngineFile ,
400
395
)
401
396
if err != nil {
402
- log .Errorf ("Failed to copy %s: %v" , engineFile , err )
397
+ log .Errorf ("Failed to copy %s: %v" , build . EngineFile ( targetOS ) , err )
403
398
os .Exit (1 )
404
399
}
405
- if ! buildDebug && targetOS == "linux" {
406
- err = exec .Command ("strip" , "-s" , outputEngineFile ).Run ()
407
- if err != nil {
408
- log .Errorf ("Failed to strip %s: %v" , outputEngineFile , err )
409
- os .Exit (1 )
410
- }
411
- }
412
400
413
401
err = copy .Copy (
414
402
filepath .Join (engineCachePath , "artifacts" , "icudtl.dat" ),
@@ -489,6 +477,14 @@ func buildNormal(targetOS string, vmArguments []string) {
489
477
return
490
478
}
491
479
480
+ if ! buildDebug && targetOS == "linux" {
481
+ err = exec .Command ("strip" , "-s" , outputEngineFile ).Run ()
482
+ if err != nil {
483
+ log .Errorf ("Failed to strip %s: %v" , outputEngineFile , err )
484
+ os .Exit (1 )
485
+ }
486
+ }
487
+
492
488
buildCommandString := buildCommand (targetOS , vmArguments , build .OutputBinaryPath (pubspec .GetPubSpec ().Name , targetOS ))
493
489
cmdGoBuild := exec .Command (buildCommandString [0 ], buildCommandString [1 :]... )
494
490
cmdGoBuild .Dir = filepath .Join (wd , build .BuildPath )
0 commit comments