Пример #1
0
        public static BeeDriver Make(RunnableProgram buildProgram, string dagName,
                                     string dagDirectory, bool useScriptUpdater, string projectDirectory, ProgressAPI progressAPI = null, RunnableProgram beeBackendProgram = null)
        {
            var sourceFileUpdaters = useScriptUpdater
                ? new[] { new UnityScriptUpdater(projectDirectory) }
            : Array.Empty <SourceFileUpdaterBase>();

            var processSourceFileUpdatersResult = new UnitySourceFileUpdatersResultHandler();

            NPath dagDir = dagDirectory ?? "Library/Bee";

            RecreateDagDirectoryIfNeeded(dagDir);
            NPath profilerOutputFile = UnityBeeDriverProfilerSession.GetTraceEventsOutputForNewBeeDriver() ?? $"{dagDir}/fullprofile.json";
            var   result             = new BeeDriver(buildProgram, beeBackendProgram ?? UnityBeeBackendProgram(), projectDirectory, dagName, dagDir.ToString(), sourceFileUpdaters, processSourceFileUpdatersResult, progressAPI ?? new UnityProgressAPI("Script Compilation"), profilerOutputFile: profilerOutputFile.ToString());

            result.DataForBuildProgram.Add(new ConfigurationData
            {
                Il2CppDir           = IL2CPPUtils.GetIl2CppFolder(),
                Il2CppPath          = IL2CPPUtils.GetExePath("il2cpp"),
                UnityLinkerPath     = IL2CPPUtils.GetExePath("UnityLinker"),
                NetCoreRunPath      = NetCoreRunProgram.NetCoreRunPath,
                EditorContentsPath  = EditorApplication.applicationContentsPath,
                Packages            = GetPackageInfos(NPath.CurrentDirectory.ToString()),
                UnityVersion        = Application.unityVersion,
                UnityVersionNumeric = new BeeBuildProgramCommon.Data.Version(Application.unityVersionVer, Application.unityVersionMaj, Application.unityVersionMin),
                UnitySourceCodePath = Unsupported.IsSourceBuild(false) ? Unsupported.GetBaseUnityDeveloperFolder() : null,
                AdvancedLicense     = PlayerSettings.advancedLicense,
                Batchmode           = InternalEditorUtility.inBatchMode,
                EmitDataForBeeWhy   = (Debug.GetDiagnosticSwitch("EmitDataForBeeWhy").value as bool?) ?? false,
            });
            return(result);
        }
    private void CopyStagingAreaIntoDestination(BuildPostProcessArgs args)
    {
        if (GetInstallingIntoBuildsFolder(args))
        {
            string dst = Unsupported.GetBaseUnityDeveloperFolder() + "/" + GetDestinationFolderForInstallingIntoBuildsFolder(args);

            if (!Directory.Exists(Path.GetDirectoryName(dst)))
            {
                throw new Exception("Installing in builds folder failed because the player has not been built (You most likely want to enable 'Development build').");
            }

            FileUtil.CopyDirectoryFiltered(args.stagingAreaData, dst, true, f => true, recursive: true);
        }
        else
        {
            if (GetCreateSolution())
            {
                // TODO: smart overwrite
            }
            else
            {
                DeleteDestination(args);
            }

            // Copy entire stagingarea over
            FileUtil.CopyDirectoryFiltered(args.stagingArea, GetDestinationFolder(args), true, f => true, recursive: true);
            args.report.RecordFilesMoved(args.stagingArea, GetDestinationFolder(args));
        }
    }
        internal static void LoadEditorResourcesIntoProject()
        {
            // Set default editor resources project.
            var editorResourcesPath = Path.Combine(Unsupported.GetBaseUnityDeveloperFolder(), "External/Resources/editor_resources");

            if (!Directory.Exists(editorResourcesPath))
            {
                editorResourcesPath = Directory.GetCurrentDirectory();
            }

            // Ask the user to select the editor resources package folder.
            editorResourcesPath = EditorUtility.OpenFolderPanel("Select editor resources folder", editorResourcesPath, "");
            if (String.IsNullOrEmpty(editorResourcesPath))
            {
                return;
            }

            // Make sure the editor_resources project does not contain any Library/ folder which could make the asset database crash if imported.
            var editorResourcesLibraryPath = Path.Combine(editorResourcesPath, "Library");

            if (Directory.Exists(editorResourcesLibraryPath))
            {
                Debug.LogError($"Please dispose of the Library folder under {editorResourcesPath} as it might fail to be imported.");
                return;
            }

            if (LoadEditorResourcesPackage(editorResourcesPath))
            {
                EditorApplication.OpenProject(Path.Combine(Application.dataPath, ".."), Environment.GetCommandLineArgs());
            }
        }
Пример #4
0
        protected override void CopyDataForBuildsFolder()
        {
            string[] components = new string[] { Unsupported.GetBaseUnityDeveloperFolder(), "build/WindowsStandaloneSupport/Variations", this.GetVariationName(), "Data" };
            string   source     = Paths.Combine(components);

            string[] textArray2 = new string[] { Unsupported.GetBaseUnityDeveloperFolder(), this.DestinationFolderForInstallingIntoBuildsFolder };
            string   target     = Paths.Combine(textArray2);

            FileUtil.CopyDirectoryRecursiveForPostprocess(source, target, true);
        }
 protected void CopyStagingAreaIntoDestination()
 {
     if (this.InstallingIntoBuildsFolder)
     {
         string path = Unsupported.GetBaseUnityDeveloperFolder() + "/" + this.DestinationFolderForInstallingIntoBuildsFolder;
         if (!Directory.Exists(Path.GetDirectoryName(path)))
         {
             throw new Exception("Installing in builds folder failed because the player has not been built (You most likely want to enable 'Development build').");
         }
         if (< > f__am$cache1 == null)
         {
Пример #6
0
        private static CompilerMessage[] ParseResults(string text)
        {
            Console.Write(text);
            var lines  = text.Split(kNewlineChars, StringSplitOptions.RemoveEmptyEntries);
            var prefix = Unsupported.GetBaseUnityDeveloperFolder();

            var msgs = new MicrosoftCSharpCompilerOutputParser().Parse(lines, false).ToList();

            for (var index = 0; index < msgs.Count; index++)
            {
                var msg = msgs[index];
                msg.file    = Path.Combine(prefix, msg.file);
                msgs[index] = msg;
            }
            return(msgs.ToArray());
        }
    protected void CopyStagingAreaIntoDestination()
    {
        if (!this.InstallingIntoBuildsFolder)
        {
            this.DeleteDestination();
            FileUtil.CopyDirectoryFiltered(this.StagingArea, this.DestinationFolder, true, (string f) => true, true);
            return;
        }
        string text = Unsupported.GetBaseUnityDeveloperFolder() + "/" + this.DestinationFolderForInstallingIntoBuildsFolder;

        if (!Directory.Exists(Path.GetDirectoryName(text)))
        {
            throw new Exception("Installing in builds folder failed because the player has not been built (You most likely want to enable 'Development build').");
        }
        FileUtil.CopyDirectoryFiltered(this.DataFolder, text, true, (string f) => true, true);
    }
Пример #8
0
        public static BuildRequest BuildRequestFor(RunnableProgram buildProgram, string dagName, string dagDirectory, bool useScriptUpdater, string projectDirectory, ILPostProcessingProgram ilpp, StdOutMode stdoutMode, RunnableProgram beeBackendProgram = null)
        {
            NPath dagDir = dagDirectory ?? "Library/Bee";

            RecreateDagDirectoryIfNeeded(dagDir);
            var   performingPlayerBuild = UnityBeeDriverProfilerSession.PerformingPlayerBuild;
            NPath profilerOutputFile    = performingPlayerBuild ? UnityBeeDriverProfilerSession.GetTraceEventsOutputForPlayerBuild() : $"{dagDir}/fullprofile.json";

            return(new BuildRequest()
            {
                BuildProgram = buildProgram,
                BackendProgram = beeBackendProgram ?? UnityBeeBackendProgram(stdoutMode),
                ProjectRoot = projectDirectory,
                DagName = dagName,
                BuildStateDirectory = dagDir.EnsureDirectoryExists().ToString(),
                ProfilerOutputFile = profilerOutputFile.ToString(),
                // Use a null process name during a player build to avoid writing process metadata.  The player profiler will take care of writing the process metadata
                ProfilerProcessName = performingPlayerBuild ? null : "BeeDriver",
                SourceFileUpdaters = useScriptUpdater
                    ? new[] { new UnityScriptUpdater(projectDirectory) }
                    : Array.Empty <SourceFileUpdaterBase>(),
                ProcessSourceFileUpdatersResult = new UnitySourceFileUpdatersResultHandler(),

                DataForBuildProgram =
                {
                    () => new ConfigurationData
                    {
                        Il2CppDir = IL2CPPUtils.GetIl2CppFolder(),
                        Il2CppPath = IL2CPPUtils.GetExePath("il2cpp"),
                        UnityLinkerPath = IL2CPPUtils.GetExePath("UnityLinker"),
                        NetCoreRunPath = NetCoreRunProgram.NetCoreRunPath,
                        EditorContentsPath = EditorApplication.applicationContentsPath,
                        Packages = GetPackageInfos(NPath.CurrentDirectory.ToString()),
                        UnityVersion = Application.unityVersion,
                        UnityVersionNumeric = new BeeBuildProgramCommon.Data.Version(Application.unityVersionVer, Application.unityVersionMaj, Application.unityVersionMin),
                        UnitySourceCodePath = Unsupported.IsSourceBuild(false) ? Unsupported.GetBaseUnityDeveloperFolder() : null,
                        AdvancedLicense = PlayerSettings.advancedLicense,
                        Batchmode = InternalEditorUtility.inBatchMode,
                        EmitDataForBeeWhy = (Debug.GetDiagnosticSwitch("EmitDataForBeeWhy").value as bool?) ?? false,
                        NamedPipeOrUnixSocket = ilpp.NamedPipeOrUnixSocket,
                    }
                }
            });
        }
Пример #9
0
 private void CopyStagingAreaIntoDestination(BuildPostProcessArgs args)
 {
     if (this.GetInstallingIntoBuildsFolder(args))
     {
         string text = Unsupported.GetBaseUnityDeveloperFolder() + "/" + this.GetDestinationFolderForInstallingIntoBuildsFolder(args);
         if (!Directory.Exists(Path.GetDirectoryName(text)))
         {
             throw new Exception("Installing in builds folder failed because the player has not been built (You most likely want to enable 'Development build').");
         }
         FileUtil.CopyDirectoryFiltered(args.stagingAreaData, text, true, (string f) => true, true);
     }
     else
     {
         if (!this.GetCreateSolution())
         {
             this.DeleteDestination(args);
         }
         FileUtil.CopyDirectoryFiltered(args.stagingArea, this.GetDestinationFolder(args), true, (string f) => true, true);
         args.report.RecordFilesMoved(args.stagingArea, this.GetDestinationFolder(args));
     }
 }
Пример #10
0
        private static ProcessStartInfo GetJamStartInfo(bool includeModules)
        {
            StringBuilder moduleArgs = new StringBuilder();

            moduleArgs.Append("jam.pl LiveReloadableEditorAssemblies " + InternalEditorUtility.GetBuildSystemVariationArgs());
            if (includeModules)
            {
                foreach (string target in ModuleManager.GetJamTargets())
                {
                    moduleArgs.Append(" ").Append(target);
                }
            }

            var psi = new ProcessStartInfo
            {
                WorkingDirectory       = Unsupported.GetBaseUnityDeveloperFolder(),
                RedirectStandardOutput = true,
                RedirectStandardError  = false,
                //The only reason jam.pl exists is that I cannot figure out how to call jam.bat, or jam.exe directly. magic.
                Arguments = moduleArgs.ToString(),
                FileName  = "perl",
            };

            var path = Environment.GetEnvironmentVariable("PATH") ?? "";

            // on macOS the typical mercurial path might not be in our environment variable, so add it for executing jam
            if (Application.platform == RuntimePlatform.OSXEditor)
            {
                var localBin = "/usr/local/bin";
                if (!path.Contains(localBin))
                {
                    path = $"{path}:{localBin}";
                }
            }
            psi.EnvironmentVariables["PATH"] = path;

            return(psi);
        }