Exemplo n.º 1
0
    public override void UpdateBootConfig(BuildTarget target, BootConfigData config, BuildOptions options)
    {
        base.UpdateBootConfig(target, config, options);

        if (PlayerSettings.forceSingleInstance)
        {
            config.AddKey("single-instance");
        }
        if (!PlayerSettings.useFlipModelSwapchain)
        {
            config.AddKey("force-d3d11-bltblt-mode");
        }
        if (IL2CPPUtils.UseIl2CppCodegenWithMonoBackend(BuildPipeline.GetBuildTargetGroup(target)))
        {
            config.Set("mono-codegen", "il2cpp");
        }
        if ((options & BuildOptions.EnableHeadlessMode) != 0)
        {
            config.AddKey("headless");
        }
        if ((options & BuildOptions.EnableCodeCoverage) != 0)
        {
            config.Set("enableCodeCoverage", "1");
        }
        if (!PlayerSettings.usePlayerLog)
        {
            config.AddKey("nolog");
        }
    }
Exemplo n.º 2
0
    public override void UpdateBootConfig(BuildTarget target, BootConfigData config, BuildOptions options)
    {
        base.UpdateBootConfig(target, config, options);

        if (PlayerSettings.forceSingleInstance)
        {
            config.AddKey("single-instance");
        }
        if (IL2CPPUtils.UseIl2CppCodegenWithMonoBackend(BuildPipeline.GetBuildTargetGroup(target)))
        {
            config.Set("mono-codegen", "il2cpp");
        }
    }
Exemplo n.º 3
0
    protected virtual string GetVariationName(BuildPostProcessArgs args)
    {
        var platformString      = PlatformStringFor(args.target);
        var configurationString = GetDevelopment(args) ? "development" : "nondevelopment";

        var scriptingBackend = "mono";

        if (UseIl2Cpp && !IL2CPPUtils.UseIl2CppCodegenWithMonoBackend(BuildTargetGroup.Standalone))
        {
            scriptingBackend = "il2cpp";
        }

        return($"{platformString}_{configurationString}_{scriptingBackend}");
    }
Exemplo n.º 4
0
    private void ProcessIl2CppOutputForBinary(BuildPostProcessArgs args)
    {
        // Move GameAssembly next to game executable
        var il2cppOutputNativeDirectory = Path.Combine(args.stagingAreaData, "Native");
        var gameAssemblyDirectory       = GetDirectoryForGameAssembly(args);

        foreach (var file in Directory.GetFiles(il2cppOutputNativeDirectory))
        {
            var fileName = Path.GetFileName(file);
            if (fileName.StartsWith("."))
            {
                continue; // Skip files starting with ., as they weren't output by our tools and potentially belong to the OS (like .DS_Store on macOS)
            }
            FileUtil.MoveFileOrDirectory(file, Path.Combine(gameAssemblyDirectory, fileName));
        }

        if (PlaceIL2CPPSymbolMapNextToExecutable())
        {
            // Move symbol map to be next to game executable
            FileUtil.MoveFileOrDirectory(Paths.Combine(il2cppOutputNativeDirectory, "Data", "SymbolMap"), Path.Combine(args.stagingArea, "SymbolMap"));
        }

        // Move il2cpp data directory one directory up
        FileUtil.MoveFileOrDirectory(Path.Combine(il2cppOutputNativeDirectory, "Data"), Path.Combine(args.stagingAreaData, "il2cpp_data"));

        // Native directory is supposed to be empty at this point
        FileUtil.DeleteFileOrDirectory(il2cppOutputNativeDirectory);

        var dataBackupFolder = Path.Combine(args.stagingArea, GetIl2CppDataBackupFolderName(args));

        FileUtil.CreateOrCleanDirectory(dataBackupFolder);

        // Move generated C++ code out of Data directory
        FileUtil.MoveFileOrDirectory(Path.Combine(args.stagingAreaData, "il2cppOutput"), Path.Combine(dataBackupFolder, "il2cppOutput"));

        if (IL2CPPUtils.UseIl2CppCodegenWithMonoBackend(BuildPipeline.GetBuildTargetGroup(args.target)))
        {
            // Are we using IL2CPP code generation with the Mono runtime? If so, strip the assemblies so we can use them for metadata.
            StripAssembliesToLeaveOnlyMetadata(args.target, args.stagingAreaDataManaged);
        }
        else
        {
            // Otherwise, move them to temp data directory as il2cpp does not need managed assemblies to run
            FileUtil.MoveFileOrDirectory(args.stagingAreaDataManaged, Path.Combine(dataBackupFolder, "Managed"));
        }

        ProcessPlatformSpecificIL2CPPOutput(args);
    }
Exemplo n.º 5
0
    protected void DeleteUnusedMono(string dataFolder, BuildReport report)
    {
        bool flag = IL2CPPUtils.UseIl2CppCodegenWithMonoBackend(BuildTargetGroup.Standalone);

        if (flag || EditorApplication.scriptingRuntimeVersion == ScriptingRuntimeVersion.Latest)
        {
            string text = Path.Combine(dataFolder, DesktopStandalonePostProcessor.GetMonoFolderName(ScriptingRuntimeVersion.Legacy));
            FileUtil.DeleteFileOrDirectory(text);
            report.RecordFilesDeletedRecursive(text);
        }
        if (flag || EditorApplication.scriptingRuntimeVersion == ScriptingRuntimeVersion.Legacy)
        {
            string text2 = Path.Combine(dataFolder, DesktopStandalonePostProcessor.GetMonoFolderName(ScriptingRuntimeVersion.Latest));
            FileUtil.DeleteFileOrDirectory(text2);
            report.RecordFilesDeletedRecursive(text2);
        }
    }
    protected void DeleteUnusedMono(string dataFolder, BuildReport report)
    {
        // Mono is built by the il2cpp builder, so we dont need the libs copied
        bool deleteBoth = IL2CPPUtils.UseIl2CppCodegenWithMonoBackend(BuildTargetGroup.Standalone);

        if (deleteBoth || EditorApplication.scriptingRuntimeVersion == ScriptingRuntimeVersion.Latest)
        {
            var monoPath = Path.Combine(dataFolder, GetMonoFolderName(ScriptingRuntimeVersion.Legacy));
            FileUtil.DeleteFileOrDirectory(monoPath);
            report.RecordFilesDeletedRecursive(monoPath);
        }
        if (deleteBoth || EditorApplication.scriptingRuntimeVersion == ScriptingRuntimeVersion.Legacy)
        {
            var monoPath = Path.Combine(dataFolder, GetMonoFolderName(ScriptingRuntimeVersion.Latest));
            FileUtil.DeleteFileOrDirectory(monoPath);
            report.RecordFilesDeletedRecursive(monoPath);
        }
    }
    private void SetupStagingArea(BuildPostProcessArgs args)
    {
        if (UseIl2Cpp && GetCreateSolution())
        {
            throw new Exception("CreateSolution is not supported with IL2CPP build");
        }

        Directory.CreateDirectory(args.stagingAreaData);

        List <string> cppPlugins;

        CopyNativePlugins(args, out cppPlugins);

        if (args.target == BuildTarget.StandaloneWindows ||
            args.target == BuildTarget.StandaloneWindows64)
        {
            CreateApplicationData(args);
        }

        PostprocessBuildPlayer.InstallStreamingAssets(args.stagingAreaData, args.report);

        if (UseIl2Cpp)
        {
            CopyVariationFolderIntoStagingArea(args);
            IL2CPPUtils.RunIl2Cpp(args.stagingAreaData, GetPlatformProvider(args), (cppOutputDir) => CopyCppPlugins(cppOutputDir, cppPlugins), args.usedClassRegistry);

            // Move GameAssembly next to game executable
            var il2cppOutputNativeDirectory = Path.Combine(args.stagingAreaData, "Native");
            var gameAssemblyDirectory       = GetDirectoryForGameAssembly(args);
            foreach (var file in Directory.GetFiles(il2cppOutputNativeDirectory))
            {
                var fileName = Path.GetFileName(file);
                if (fileName.StartsWith("."))
                {
                    continue; // Skip files starting with ., as they weren't output by our tools and potentially belong to the OS (like .DS_Store on macOS)
                }
                FileUtil.MoveFileOrDirectory(file, Path.Combine(gameAssemblyDirectory, fileName));
            }

            if (PlaceIL2CPPSymbolMapNextToExecutable())
            {
                // Move symbol map to be next to game executable
                FileUtil.MoveFileOrDirectory(Paths.Combine(il2cppOutputNativeDirectory, "Data", "SymbolMap"), Path.Combine(args.stagingArea, "SymbolMap"));
            }

            // Move il2cpp data directory one directory up
            FileUtil.MoveFileOrDirectory(Path.Combine(il2cppOutputNativeDirectory, "Data"), Path.Combine(args.stagingAreaData, "il2cpp_data"));

            // Native directory is supposed to be empty at this point
            FileUtil.DeleteFileOrDirectory(il2cppOutputNativeDirectory);

            var dataBackupFolder = Path.Combine(args.stagingArea, GetIl2CppDataBackupFolderName(args));
            FileUtil.CreateOrCleanDirectory(dataBackupFolder);

            // Move generated C++ code out of Data directory
            FileUtil.MoveFileOrDirectory(Path.Combine(args.stagingAreaData, "il2cppOutput"), Path.Combine(dataBackupFolder, "il2cppOutput"));

            if (IL2CPPUtils.UseIl2CppCodegenWithMonoBackend(BuildPipeline.GetBuildTargetGroup(args.target)))
            {
                // Are we using IL2CPP code generation with the Mono runtime? If so, strip the assemblies so we can use them for metadata.
                StripAssembliesToLeaveOnlyMetadata(args.target, args.stagingAreaDataManaged);
            }
            else
            {
                // Otherwise, move them to temp data directory as il2cpp does not need managed assemblies to run
                FileUtil.MoveFileOrDirectory(args.stagingAreaDataManaged, Path.Combine(dataBackupFolder, "Managed"));
            }

            ProcessPlatformSpecificIL2CPPOutput(args);
        }

        if (GetInstallingIntoBuildsFolder(args))
        {
            CopyDataForBuildsFolder(args);
        }
        else
        {
            if (!UseIl2Cpp)
            {
                CopyVariationFolderIntoStagingArea(args);
            }

            if (GetCreateSolution())
            {
                CopyPlayerSolutionIntoStagingArea(args);
            }
            RenameFilesInStagingArea(args);
        }
    }
Exemplo n.º 8
0
 private void SetupStagingArea(BuildPostProcessArgs args)
 {
     if (this.UseIl2Cpp && this.GetCreateSolution())
     {
         throw new Exception("CreateSolution is not supported with IL2CPP build");
     }
     Directory.CreateDirectory(args.stagingAreaData);
     this.CopyNativePlugins(args);
     if (args.target == BuildTarget.StandaloneWindows || args.target == BuildTarget.StandaloneWindows64)
     {
         this.CreateApplicationData(args);
     }
     PostprocessBuildPlayer.InstallStreamingAssets(args.stagingAreaData, args.report);
     if (this.UseIl2Cpp)
     {
         this.CopyVariationFolderIntoStagingArea(args);
         IL2CPPUtils.RunIl2Cpp(args.stagingAreaData, this.GetPlatformProvider(args), null, args.usedClassRegistry);
         string   text = Path.Combine(args.stagingAreaData, "Native");
         string   directoryForGameAssembly = this.GetDirectoryForGameAssembly(args);
         string[] files = Directory.GetFiles(text);
         for (int i = 0; i < files.Length; i++)
         {
             string text2    = files[i];
             string fileName = Path.GetFileName(text2);
             if (!fileName.StartsWith("."))
             {
                 FileUtil.MoveFileOrDirectory(text2, Path.Combine(directoryForGameAssembly, fileName));
             }
         }
         if (this.PlaceIL2CPPSymbolMapNextToExecutable())
         {
             FileUtil.MoveFileOrDirectory(Paths.Combine(new string[]
             {
                 text,
                 "Data",
                 "SymbolMap"
             }), Path.Combine(args.stagingArea, "SymbolMap"));
         }
         FileUtil.MoveFileOrDirectory(Path.Combine(text, "Data"), Path.Combine(args.stagingAreaData, "il2cpp_data"));
         FileUtil.DeleteFileOrDirectory(text);
         string text3 = Path.Combine(args.stagingArea, this.GetIl2CppDataBackupFolderName(args));
         FileUtil.CreateOrCleanDirectory(text3);
         FileUtil.MoveFileOrDirectory(Path.Combine(args.stagingAreaData, "il2cppOutput"), Path.Combine(text3, "il2cppOutput"));
         if (IL2CPPUtils.UseIl2CppCodegenWithMonoBackend(BuildPipeline.GetBuildTargetGroup(args.target)))
         {
             DesktopStandalonePostProcessor.StripAssembliesToLeaveOnlyMetadata(args.target, args.stagingAreaDataManaged);
         }
         else
         {
             FileUtil.MoveFileOrDirectory(args.stagingAreaDataManaged, Path.Combine(text3, "Managed"));
         }
         this.ProcessPlatformSpecificIL2CPPOutput(args);
     }
     if (this.GetInstallingIntoBuildsFolder(args))
     {
         this.CopyDataForBuildsFolder(args);
     }
     else
     {
         if (!this.UseIl2Cpp)
         {
             this.CopyVariationFolderIntoStagingArea(args);
         }
         if (this.GetCreateSolution())
         {
             this.CopyPlayerSolutionIntoStagingArea(args);
         }
         this.RenameFilesInStagingArea(args);
     }
 }