99using System . Linq ;
1010using System . Text ;
1111using System . Runtime . InteropServices ;
12- using Unity . IL2CPP . BeeSettings ;
1312using UnityEditor ;
1413using UnityEditor . Build ;
1514using UnityEditor . Build . Player ;
@@ -459,6 +458,9 @@ internal static string[] GetBuildingIL2CPPArguments(IIl2CppPlatformProvider il2c
459458
460459 arguments . Add ( "--avoid-dynamic-library-copy" ) ;
461460
461+ //make il2cpp not deploy baselib, as we already copy it in ourselves
462+ arguments . Add ( "--dont-deploy-baselib" ) ;
463+
462464 arguments . Add ( "--profiler-report" ) ;
463465
464466 return arguments . ToArray ( ) ;
@@ -479,11 +481,6 @@ internal static string GetIl2CppFolder()
479481 "il2cpp" ) ) ;
480482 }
481483
482- internal static string GetIl2CppBeeSettingsFolder ( )
483- {
484- return $ "{ GetIl2CppFolder ( ) } /build/BeeSettings/offline";
485- }
486-
487484 internal static string GetTundraFolder ( )
488485 {
489486 return $ "{ GetIl2CppFolder ( ) } /external/bee/tundra";
@@ -577,11 +574,7 @@ public void Run()
577574 var managedDir = Path . GetFullPath ( Path . Combine ( m_StagingAreaData , "Managed" ) ) ;
578575
579576 // Make all assemblies in Staging/Managed writable for stripping.
580- foreach ( var file in Directory . GetFiles ( managedDir ) )
581- {
582- var fileInfo = new FileInfo ( file ) ;
583- fileInfo . IsReadOnly = false ;
584- }
577+ ClearReadOnlyFlagOnAllFilesNonRecursively ( managedDir ) ;
585578
586579 var buildTargetGroup = BuildPipeline . GetBuildTargetGroup ( m_PlatformProvider . target ) ;
587580
@@ -595,12 +588,17 @@ public void Run()
595588
596589 Directory . CreateDirectory ( m_TempFolder ) ;
597590 Directory . CreateDirectory ( generatedCppDir ) ;
591+ ClearReadOnlyFlagOnAllFilesNonRecursively ( generatedCppDir ) ;
598592
599593 // Need to clean out the AdditionalCppFiles directory because a platform could do pretty much anything
600594 // in a "modifyOutputBeforeCompile" callback method, and so we need to provide a fresh directory. Bee will
601595 // still check the hash of these files before doing a build, so writing them again won't cause a recompile.
602596 if ( Directory . Exists ( additionalCppFilesDirectory ) )
597+ {
598+ ClearReadOnlyFlagOnAllFilesNonRecursively ( additionalCppFilesDirectory ) ;
603599 Directory . Delete ( additionalCppFilesDirectory , true ) ;
600+ }
601+
604602 Directory . CreateDirectory ( additionalCppFilesDirectory ) ;
605603
606604 if ( m_ModifyOutputBeforeCompile != null )
@@ -611,6 +609,15 @@ public void Run()
611609 ConvertPlayerDlltoCpp ( pipelineData ) ;
612610 }
613611
612+ private static void ClearReadOnlyFlagOnAllFilesNonRecursively ( string managedDir )
613+ {
614+ foreach ( var file in Directory . GetFiles ( managedDir ) )
615+ {
616+ var fileInfo = new FileInfo ( file ) ;
617+ fileInfo . IsReadOnly = false ;
618+ }
619+ }
620+
614621 public void RunCompileAndLink ( string il2cppBuildCacheSource )
615622 {
616623 if ( string . Equals ( Path . GetFullPath ( il2cppBuildCacheSource ) , Path . GetFullPath ( m_PlatformProvider . il2cppBuildCacheDirectory ) , StringComparison . OrdinalIgnoreCase ) )
@@ -709,6 +716,10 @@ private void ConvertPlayerDlltoCpp(Il2CppBuildPipelineData data)
709716 Il2CppNativeCodeBuilderUtils . ClearAndPrepareCacheDirectory ( il2CppNativeCodeBuilder ) ;
710717 arguments . AddRange ( Il2CppNativeCodeBuilderUtils . AddBuilderArguments ( il2CppNativeCodeBuilder , buildCacheNativeOutputFile , m_PlatformProvider . includePaths , m_PlatformProvider . libraryPaths , compilerConfiguration ) ) ;
711718 }
719+ else
720+ {
721+ arguments . Add ( $ "--cachedirectory={ CommandLineFormatter . PrepareFileName ( GetShortPathName ( Path . GetFullPath ( m_PlatformProvider . il2cppBuildCacheDirectory ) ) ) } ") ;
722+ }
712723
713724 // Additional files can take any form, depending on platform, so pass anything in the additional files directory
714725 foreach ( var additionalCppFile in Directory . GetFiles ( GetAdditionalCppFilesDirectory ( m_PlatformProvider . il2cppBuildCacheDirectory ) ) )
@@ -727,7 +738,6 @@ private void ConvertPlayerDlltoCpp(Il2CppBuildPipelineData data)
727738 arguments . Add ( additionalArgs ) ;
728739
729740 arguments . Add ( $ "--directory={ CommandLineFormatter . PrepareFileName ( GetShortPathName ( Path . GetFullPath ( data . inputDirectory ) ) ) } ") ;
730-
731741 arguments . Add ( $ "--generatedcppdir={ CommandLineFormatter . PrepareFileName ( GetCppOutputDirectory ( m_PlatformProvider . il2cppBuildCacheDirectory ) ) } ") ;
732742
733743 // NOTE: any arguments added here that affect how generated code is built need
@@ -771,29 +781,13 @@ private void RunIl2CppWithArguments(List<string> arguments, Action<ProcessStartI
771781 var nativeOutputDirectoryInBuildCache = GetNativeOutputRelativeDirectory ( m_PlatformProvider . il2cppBuildCacheDirectory ) ;
772782 var nativeOutputDirectoryInStagingArea = GetNativeOutputRelativeDirectory ( m_StagingAreaData ) ;
773783
774- BeeSettingsIl2Cpp beeSettings = new BeeSettingsIl2Cpp ( ) ;
775784 var il2cppOutputParser = new Il2CppOutputParser ( Path . Combine ( cppOutputDirectoryInBuildCache , "Il2CppToEditorData.json" ) ) ;
776785
777- beeSettings . ToolPath = $ "{ EscapeSpacesInPath ( GetIl2CppExe ( ) ) } ";
778- beeSettings . Arguments . AddRange ( arguments ) ;
779- beeSettings . Serialize ( m_PlatformProvider . il2cppBuildCacheDirectory ) ;
780-
781- void SetupTundraAndStartInfo ( ProcessStartInfo startInfo )
782- {
783- if ( setupStartInfo != null )
784- setupStartInfo ( startInfo ) ;
785-
786- // For some reason, TUNDRA_EXECUTABLE needs to be unescaped in order to be found on OSX,
787- // but MONO_EXECUTABLE needs to be escaped in order to be found on OSX
788- startInfo . EnvironmentVariables . Add ( "TUNDRA_EXECUTABLE" , GetIl2CppTundraExe ( ) ) ;
789- startInfo . EnvironmentVariables . Add ( "REAPI_CACHE_CLIENT" , GetIl2CppReapiCacheClientExe ( ) ) ;
790- startInfo . EnvironmentVariables . Add ( "MONO_EXECUTABLE" , EscapeSpacesInPath ( GetMonoBleedingEdgeExe ( ) ) ) ;
791- }
786+ arguments . Add ( "--convert-in-graph" ) ;
792787
793788 var args = arguments . Aggregate ( String . Empty , ( current , arg ) => current + arg + " " ) ;
794- var beeArgs = $ "--no-colors --prebuiltbuildprogram={ EscapeSpacesInPath ( GetIl2CppBeeBuildProgramExe ( ) ) } ";
795- Console . WriteLine ( "Invoking il2cpp (via bee.exe) with arguments: " + args ) ;
796- Runner . RunManagedProgram ( GetIl2CppBeeExe ( ) , beeArgs , m_PlatformProvider . il2cppBuildCacheDirectory , il2cppOutputParser , SetupTundraAndStartInfo ) ;
789+ Console . WriteLine ( "Invoking il2cpp with arguments: " + args ) ;
790+ Runner . RunNetCoreProgram ( GetIl2CppExe ( ) , args , m_PlatformProvider . il2cppBuildCacheDirectory , il2cppOutputParser , setupStartInfo ) ;
797791
798792 // Copy IL2CPP outputs to StagingArea
799793 if ( Directory . Exists ( nativeOutputDirectoryInBuildCache ) )
@@ -820,21 +814,6 @@ private string GetIl2CppExe()
820814 return $ "{ IL2CPPUtils . GetIl2CppFolder ( ) } /build/deploy/netcoreapp3.1/il2cpp{ ( Application . platform == RuntimePlatform . WindowsEditor ? ".exe" : "" ) } ";
821815 }
822816
823- private string GetIl2CppBeeExe ( )
824- {
825- return $ "{ IL2CPPUtils . GetIl2CppBeeSettingsFolder ( ) } /bee.exe";
826- }
827-
828- private string GetIl2CppBeeArtifactsDirectory ( )
829- {
830- return $ "{ IL2CPPUtils . GetIl2CppBeeSettingsFolder ( ) } /artifacts";
831- }
832-
833- private string GetIl2CppBeeBuildProgramExe ( )
834- {
835- return $ "{ GetIl2CppBeeArtifactsDirectory ( ) } /buildprogram/buildprogram.exe";
836- }
837-
838817 private string GetIl2CppTundraExe ( )
839818 {
840819 if ( Application . platform == RuntimePlatform . OSXEditor )
0 commit comments