예제 #1
0
        public void Run()
        {
            var outputDirectory = GetCppOutputDirectoryInStagingArea();
            var managedDir      = Path.GetFullPath(Path.Combine(m_StagingAreaData, "Managed"));

            // Make all assemblies in Staging/Managed writable for stripping.
            foreach (var file in Directory.GetFiles(managedDir))
            {
                var fileInfo = new FileInfo(file);
                fileInfo.IsReadOnly = false;
            }

            var buildTargetGroup = BuildPipeline.GetBuildTargetGroup(m_PlatformProvider.target);

            var managedStrippingLevel = PlayerSettings.GetManagedStrippingLevel(buildTargetGroup);

            // IL2CPP does not support a managed stripping level of disabled. If the player settings
            // do try this (which should not be possible from the editor), use Low instead.
            if (managedStrippingLevel == ManagedStrippingLevel.Disabled)
            {
                managedStrippingLevel = ManagedStrippingLevel.Low;
            }
            AssemblyStripper.StripAssemblies(managedDir, m_PlatformProvider.CreateUnityLinkerPlatformProvider(), m_PlatformProvider, m_RuntimeClassRegistry, managedStrippingLevel);

            // The IL2CPP editor integration here is responsible to give il2cpp.exe an empty directory to use.
            FileUtil.CreateOrCleanDirectory(outputDirectory);

            if (m_ModifyOutputBeforeCompile != null)
            {
                m_ModifyOutputBeforeCompile(outputDirectory);
            }

            var pipelineData = new Il2CppBuildPipelineData(m_PlatformProvider.target, managedDir);

            ConvertPlayerDlltoCpp(pipelineData, outputDirectory, managedDir, m_PlatformProvider.supportsManagedDebugging);

            var compiler = m_PlatformProvider.CreateNativeCompiler();

            if (compiler != null && m_PlatformProvider.CreateIl2CppNativeCodeBuilder() == null)
            {
                var nativeLibPath = OutputFileRelativePath();

                var includePaths = new List <string>(m_PlatformProvider.includePaths);
                includePaths.Add(outputDirectory);

                m_PlatformProvider.CreateNativeCompiler().CompileDynamicLibrary(
                    nativeLibPath,
                    NativeCompiler.AllSourceFilesIn(outputDirectory),
                    includePaths,
                    m_PlatformProvider.libraryPaths,
                    new string[0]);
            }
        }
예제 #2
0
        public void Run()
        {
            var outputDirectory = GetCppOutputDirectoryInStagingArea();
            var managedDir      = Path.GetFullPath(Path.Combine(m_StagingAreaData, "Managed"));

            // Make all assemblies in Staging/Managed writable for stripping.
            foreach (var file in Directory.GetFiles(managedDir))
            {
                var fileInfo = new FileInfo(file);
                fileInfo.IsReadOnly = false;
            }

            AssemblyStripper.StripAssemblies(managedDir, m_PlatformProvider, m_RuntimeClassRegistry);

            // The IL2CPP editor integration here is responsible to give il2cpp.exe an empty directory to use.
            FileUtil.CreateOrCleanDirectory(outputDirectory);

            if (m_ModifyOutputBeforeCompile != null)
            {
                m_ModifyOutputBeforeCompile(outputDirectory);
            }

            ConvertPlayerDlltoCpp(GetUserAssembliesToConvert(managedDir), outputDirectory, managedDir, m_PlatformProvider.supportsManagedDebugging);

            var compiler = m_PlatformProvider.CreateNativeCompiler();

            if (compiler != null && m_PlatformProvider.CreateIl2CppNativeCodeBuilder() == null)
            {
                var nativeLibPath = OutputFileRelativePath();

                var includePaths = new List <string>(m_PlatformProvider.includePaths);
                includePaths.Add(outputDirectory);

                m_PlatformProvider.CreateNativeCompiler().CompileDynamicLibrary(
                    nativeLibPath,
                    NativeCompiler.AllSourceFilesIn(outputDirectory),
                    includePaths,
                    m_PlatformProvider.libraryPaths,
                    new string[0]);
            }
        }
예제 #3
0
        public void Run()
        {
            string cppOutputDirectoryInStagingArea = this.GetCppOutputDirectoryInStagingArea();
            string fullPath = Path.GetFullPath(Path.Combine(this.m_StagingAreaData, "Managed"));

            string[] files = Directory.GetFiles(fullPath);
            for (int i = 0; i < files.Length; i++)
            {
                string   fileName = files[i];
                FileInfo fileInfo = new FileInfo(fileName);
                fileInfo.IsReadOnly = false;
            }
            AssemblyStripper.StripAssemblies(this.m_StagingAreaData, this.m_PlatformProvider, this.m_RuntimeClassRegistry);
            FileUtil.CreateOrCleanDirectory(cppOutputDirectoryInStagingArea);
            if (this.m_ModifyOutputBeforeCompile != null)
            {
                this.m_ModifyOutputBeforeCompile(cppOutputDirectoryInStagingArea);
            }
            this.ConvertPlayerDlltoCpp(this.GetUserAssembliesToConvert(fullPath), cppOutputDirectoryInStagingArea, fullPath);
            INativeCompiler nativeCompiler = this.m_PlatformProvider.CreateNativeCompiler();

            if (nativeCompiler != null && this.m_PlatformProvider.CreateIl2CppNativeCodeBuilder() == null)
            {
                string        outFile = this.OutputFileRelativePath();
                List <string> list    = new List <string>(this.m_PlatformProvider.includePaths);
                list.Add(cppOutputDirectoryInStagingArea);
                this.m_PlatformProvider.CreateNativeCompiler().CompileDynamicLibrary(outFile, NativeCompiler.AllSourceFilesIn(cppOutputDirectoryInStagingArea), list, this.m_PlatformProvider.libraryPaths, new string[0]);
            }
        }
예제 #4
0
        public void Run()
        {
            string cppOutputDirectoryInStagingArea = this.GetCppOutputDirectoryInStagingArea();
            string fullPath = Path.GetFullPath(Path.Combine(this.m_StagingAreaData, "Managed"));

            string[] files = Directory.GetFiles(fullPath);
            for (int i = 0; i < files.Length; i++)
            {
                string   fileName = files[i];
                FileInfo fileInfo = new FileInfo(fileName);
                fileInfo.IsReadOnly = false;
            }
            this.PatchAssemblies();
            this.StripAssemblies(this.GetUserAssemblies(fullPath), fullPath);
            this.ConvertPlayerDlltoCpp(this.GetUserAssembliesOrUnityEngine(fullPath), cppOutputDirectoryInStagingArea, fullPath);
            if (this.m_ModifyOutputBeforeCompile != null)
            {
                this.m_ModifyOutputBeforeCompile(cppOutputDirectoryInStagingArea);
            }
            INativeCompiler nativeCompiler = this.m_PlatformProvider.CreateNativeCompiler();

            if (nativeCompiler != null)
            {
                string text = Path.Combine(this.m_StagingAreaData, "Native");
                Directory.CreateDirectory(text);
                text = Path.Combine(text, this.m_PlatformProvider.nativeLibraryFileName);
                List <string> list = new List <string>(this.m_PlatformProvider.includePaths);
                list.Add(cppOutputDirectoryInStagingArea);
                this.m_PlatformProvider.CreateNativeCompiler().CompileDynamicLibrary(text, NativeCompiler.AllSourceFilesIn(cppOutputDirectoryInStagingArea), list, this.m_PlatformProvider.libraryPaths, new string[0]);
            }
        }
예제 #5
0
        public void Run()
        {
            string directoryInStagingArea = this.GetCppOutputDirectoryInStagingArea();
            string fullPath = Path.GetFullPath(Path.Combine(this.m_StagingAreaData, "Managed"));

            foreach (string file in Directory.GetFiles(fullPath))
            {
                new FileInfo(file).IsReadOnly = false;
            }
            AssemblyStripper.StripAssemblies(this.m_StagingAreaData, this.m_PlatformProvider, this.m_RuntimeClassRegistry, this.m_DevelopmentBuild);
            this.ConvertPlayerDlltoCpp((ICollection <string>) this.GetUserAssembliesToConvert(fullPath), directoryInStagingArea, fullPath);
            if (this.m_ModifyOutputBeforeCompile != null)
            {
                this.m_ModifyOutputBeforeCompile(directoryInStagingArea);
            }
            if (this.m_PlatformProvider.CreateNativeCompiler() == null)
            {
                return;
            }
            string str = Path.Combine(this.m_StagingAreaData, "Native");

            Directory.CreateDirectory(str);
            this.m_PlatformProvider.CreateNativeCompiler().CompileDynamicLibrary(Path.Combine(str, this.m_PlatformProvider.nativeLibraryFileName), NativeCompiler.AllSourceFilesIn(directoryInStagingArea), (IEnumerable <string>) new List <string>((IEnumerable <string>) this.m_PlatformProvider.includePaths)
            {
                directoryInStagingArea
            }, (IEnumerable <string>) this.m_PlatformProvider.libraryPaths, (IEnumerable <string>) new string[0]);
        }