private static void St2() { var hasLibCSharpFileMakeCompileSlow = false; foreach (var p in RoFile.Ls(EditorScript.Ro.EditorEnv.assetsPath)) { var isLibDir = RoFile.IsDir(p) && !RoFile.Basename(p) .IsMatch(@"^(Script|PostProcessing|Scripts|Editor|EditorScript|Draft|Test|Plugins|Standard Assets)$"); if (isLibDir) { foreach (var p2 in RoFile.FF(p)) { if (p2.IsMatch("\\.cs$")) { hasLibCSharpFileMakeCompileSlow = true; var rootDir = RoFile.Rel(p2, EditorEnv.assetsPath).Match("[^/]+").ToString(); Shell.NotifyWarn( $"In *Assets/{rootDir}*, it has lib c# file in Assets not *Assets/Standard Assets* to make compile slow, run *mad compile time optimizer* or maunally moving all lib c# files to *Assets/Standard Assets* to improve it"); break; } } } if (hasLibCSharpFileMakeCompileSlow) { break; } } }
private static void St2() { var shouldBeIgnoredInBuildScripts = new List <string>(); foreach (var path in RoFile.Ls(EditorEnv.assetsPath)) { if (RoFile.IsDir(path)) { if (RoFile.Basename(path).IsMatch("(Editor|Script|Standard Assets)")) { continue; } var fs = RoFile.FF(path); fs.Each((path2) => { if (path2.IsMatch("\\.cs$") && !RoFile.Read(path2).IsMatch("#if UNITY_EDITOR")) { shouldBeIgnoredInBuildScripts.Add(path2); } }); } } if (shouldBeIgnoredInBuildScripts.Count > 0) { throw new SystemException( "following code should be marked #if UNITY_EDITOR to only run in unity editor not unity build" + "\n" + shouldBeIgnoredInBuildScripts.Join("\n")); } }
public static void St() { Thr(() => { var editorScriptsDir = RoFile.Join(EditorEnv.assetsPath, "EditorScript/Ro"); if (RoFile.IsDir(editorScriptsDir)) { var shouldMarkIf_UNITY_EDITOR_scripts = new List <string>(); RoFile.FF(editorScriptsDir).Each((path) => { if (path.IsMatch("\\.cs$") && !RoFile.Read(path).IsMatch("#if\\s+UNITY_EDITOR")) { Notify($"wrap with #if UNITY_EDITOR, script: {path}"); RoFile.Write(path, $"#if UNITY_EDITOR\n{RoFile.Read(path)}\n#endif"); } }); } // var shouldMarkStr = shouldMarkIf_UNITY_EDITOR_scripts.Map((script) => { return $" {script}"; }) // .Join("\n"); // throw new SystemException( // $"following scripts should mark #if UNITY_EDITOR\n{shouldMarkStr}"); }); }